react-command-singlepartapppage not showing custom action after deployment
tyh77 opened this issue · 6 comments
Sample
react-command-singlepartapppage
Author(s)
What happened?
Unable to see Single Part Page option in the options panel.
Steps to reproduce
- Git clone repo
- npm i
- gulp serve
Expected behavior
I expect to see the option to turn the SitePage into a Single Part Page, but do not see that option in the menu after I've deployed the extension locally via gulp serve
.
Target SharePoint environment
SharePoint Online
Developer environment
No response
Browsers
- Internet Explorer
- Microsoft Edge
- Google Chrome
- FireFox
- Safari
- mobile (iOS/iPadOS)
- mobile (Android)
- not applicable
- other (enter in the "Additional environment details" area below)
Node.js version
v10.23.2
Additional environment details
No response
Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.
Hi @tyh77
this sample is pretty old. However, is still working for me.
I´ve used NVM to install node v8.17.0 as it was the node version required by spfx v.1.7.1. However, if you´re able to build the code using your node v10, it shouldn´t be the reason of your issue.
When loading the SP URL, are you appending the query to load the spfx extension? when running the gulp serve the full url to use is printed:
Let me know if it helps.
@luismanez thanks for looking into this.
I was able to get localhost up and running. However, once I compile: gulp bundle --ship && gulp package-solution --ship
, the extension is not loaded on my SharePoint Site Pages library - still unable to get past this issue unfortunately
I'm beginning to wonder if it's tenant related.
I see. As this is just a sample, I didn´t test the deployment. I think the reason is that the extension is thought to be used in the SitePages library. This is a document library. However, the ./sharepoint/assets/elements.xml file, is pointing to just Lists (please, see here: https://docs.microsoft.com/en-us/sharepoint/dev/spfx/extensions/get-started/building-simple-cmdset-with-dialog-api#add-a-listview-command-set-to-a-solution-package-for-deployment)
While running from localhost the custom action will work on both lists and document libraries, but will not once deployed unless the elements.xml is updated. RegistrationId=100 will only associate the custom action with lists and NOT document libraries.
In order to associate the custom action with document libraries, the RegistrationId must be set to 101.
RegistrationId="100"
Try to set it to 101.
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<CustomAction
Title="MakeSinglePartAppPage"
RegistrationId="101"
RegistrationType="List"
Location="ClientSideExtension.ListViewCommandSet.CommandBar"
ClientSideComponentId="f376321d-95fe-4796-bf5d-ca4b8f64529d"
ClientSideComponentProperties="{"sampleTextOne":"One item is selected in the list.", "sampleTextTwo":"This command is always visible."}">
</CustomAction>
</Elements>
Let me know if it works.
I´ve updated my sample to fix this "issue". Now if you deploy the sample, the button should be present in the SitePages library. My previous comment was right, but actually, the RegistrationId to use should be 116, which is the proper value for the SitePages library
However, something I´ve noted is that setting a page as an AppPartPage, seems is not working as expected anymore, and once the AppPartPage layout is set, you will get an error when loading the page saying
The value for "_componentId" must not be undefined
This seems an internal issue in SPFx or SharePoint, as the PnP Powershell command that should do the same function, is not working either. I mean, the official doc here https://docs.microsoft.com/en-us/sharepoint/dev/spfx/web-parts/single-part-app-pages?tabs=pnpposh#how-to-provision-single-part-app-page-in-your-tenant is not working anymore
I´ll try to dig a bit more, but seems is not in our side...
/cc @hugoabernier
BTW, the issue happens only when the page contains some "artifacts". For instance, I´ve created a Blank page, removed all the sections and webparts, added only a People webpart, converted the page using my sample, and then the page is loaded fine as a Single AppPart page...