sp-dev-docs icon indicating copy to clipboard operation
sp-dev-docs copied to clipboard

Placeholders not found on Site Pages while using SPFx Application Customizer

Open Ash11282 opened this issue 8 years ago • 27 comments

Category

  • [ ] Question
  • [ ] Typo
  • [x] Bug
  • [ ] Additional article idea

Expected or Desired Behavior

I am creating a global top level menu using Application Customizer, which will be tied to Top Placeholder of the page.

Observed Behavior

Application Customizer is unable to render Top Placeholder on any of the Site Pages. It works fine on all _layouts pages and all lists/document library items pages. It fails on Site Pages, even on the plain out of box site page. This holds true for both Communication and Team site template. image

Steps to Reproduce

TS file : https://gist.github.com/ashishshukla1183/da28d1aafd38e5929d9ac8c7538f044b

Package.json enteries: "dependencies": { "@microsoft/sp-core-library": "~1.4.1", "@microsoft/decorators": "~1.4.1", "@types/webpack-env": "1.13.1", "@types/es6-promise": "0.0.33", "@microsoft/sp-dialog": "~1.4.1", "@microsoft/sp-application-base": "~1.4.1", "@microsoft/sp-webpart-base": "~1.4.1", "@microsoft/sp-listview-extensibility": "~1.4.1", "@microsoft/sp-http": "~1.4.1", "@microsoft/microsoft-graph-client": "1.2.0" }, "devDependencies": { "@microsoft/sp-build-web": "~1.4.1", "@microsoft/sp-module-interfaces": "~1.4.1", "@microsoft/sp-webpart-workbench": "~1.4.1", "gulp": "~3.9.1", "@types/chai": "3.4.34", "@types/mocha": "2.2.38", "ajv": "~5.2.2" }

I have seen similar reported issues which were told to be fixed. However, I am still facing this issue. Any suggestions or help will be appreciated.

Ash11282 avatar Oct 19 '18 06:10 Ash11282

I have an application customizer that have been running without any issues for months. Today it stopped working with the same issue. Needs to be fixed asap as this is running in multiple environments. @VesaJuvonen

Error message: image

Code snippet:

let placeholder: PlaceholderContent;
placeholder = this.context.placeholderProvider.tryCreateContent(PlaceholderName.Top);

ReactDom.render(element, placeholder.domElement);

frnk01 avatar Oct 19 '18 07:10 frnk01

I have an application customizer that have been running without any issues for months. Today it stopped working with the same issue. Needs to be fixed asap as this is running in multiple environments. @VesaJuvonen

Error message: image

Code snippet:

let placeholder: PlaceholderContent;
placeholder = this.context.placeholderProvider.tryCreateContent(PlaceholderName.Top);

ReactDom.render(element, placeholder.domElement);

Same with me. It was running all fine until yesterday. I noticed that it disappears, only on pages with search box in header. Not sure if there is any relation with it, but i came to know that there was some major search outage/fixes going on in last few days. May be the old search issue with application customizer has cropped up again.

Ash11282 avatar Oct 19 '18 07:10 Ash11282

Seems related to layout changes on site pages due to missing dom element for top placeholder. I've tried to reach out to Vesa on Twitter to get som quicker response on the issue.

frnk01 avatar Oct 19 '18 07:10 frnk01

Same here, extensions for header and footer stopped working suddenly... Fortunately, it only happens when the tenant is set to first realease. EDIT : i was wrong, we also have the problem on standard release in production !!!

BraunJonathan avatar Oct 19 '18 08:10 BraunJonathan

Same for me !

PooLP avatar Oct 19 '18 08:10 PooLP

Also confirming the same behavior.

koltyakov avatar Oct 19 '18 08:10 koltyakov

Might be a duplicate of https://github.com/SharePoint/sp-dev-docs/issues/2773. patmil described a fix that might help you: https://github.com/SharePoint/sp-dev-docs/issues/2773#issuecomment-430424273

MortenGuldbaek avatar Oct 19 '18 08:10 MortenGuldbaek

Same for us. Fix did't have an effect...

BigEaseGueldi avatar Oct 19 '18 11:10 BigEaseGueldi

We have two extensions : one working with the top placeholder, one with the bottom placeholder. With the fix by @patmill in place, the extension with top placeholder works well but the one with the bottom placeholder disapears when we navigate from one site to another... (both extensions work roughlythe same way and we did not notice any problem before today...)

BraunJonathan avatar Oct 19 '18 12:10 BraunJonathan

Looking into this. In the meantime, any further information would be helpful: Is this happening only for first-release tenants? Is it the header, footer, or both, that are not appearing? Does it happen on all site templates? Is it only happening on modern pages (and not happening on modern lists) Does it only happen on pages that show search in the suite nav?

Thanks for any help.

patmill avatar Oct 19 '18 14:10 patmill

For me, it's happening ...

  • ... on 4 first-release tenants - unfortunately I currently don't have quick access to a non-first-release tenant.
  • ... on communication sites and team sites
  • ... on site pages (application pages are fine, list views fine as well)

BigEaseGueldi avatar Oct 19 '18 14:10 BigEaseGueldi

@frnk01 - You should try and follow a pattern in code to look more like this (this isn't the reason you aren't seeing the placeholder, but I noticed it in your code) :

let placeholder: PlaceholderContent; placeholder = this.context.placeholderProvider.tryCreateContent(PlaceholderName.Top); if ( placeholder ) { ReactDom.render(element, placeholder.domElement); }

You want to ensure that the placeholder exists before accessing the domElement of it.

patmill avatar Oct 19 '18 14:10 patmill

@BigEaseGueldi - Do you happen to notice if the search box is in the suite nav (very top navigation bar)? Does the placement of the search box differ from the list page to the site page?

patmill avatar Oct 19 '18 14:10 patmill

Looking into this. In the meantime, any further information would be helpful: Is this happening only for first-release tenants? Does it happen on all site templates? Is it only happening on modern pages (and not happening on modern lists) etc.

Thanks for any help. For me its happening for:

  1. All first release tenants
  2. Communication and team site.
  3. Site Pages only

Ash11282 avatar Oct 19 '18 15:10 Ash11282

OK, one more question for people that are helping out here (thank you for your help). If you look at the sources tab in the developer tools, you should see some files coming from a URL like: spoprod-a.akamaihd.net\files\sp-client-prod_2018-*********\sp-pages-assembly_en-us....

What is the full version # in the 2018-********* showing?

Thanks again for helping.

patmill avatar Oct 19 '18 15:10 patmill

OK, one more question for people that are helping out here (thank you for your help). If you look at the sources tab in the developer tools, you should see some files coming from a URL like: spoprod-a.akamaihd.net\files\sp-client-prod_2018-*********\sp-pages-assembly_en-us....

What is the full version # in the 2018-********* showing?

Thanks again for helping. Not sure if this is what you were asking. Sharing some screenshots. image

image

Ash11282 avatar Oct 19 '18 15:10 Ash11282

Thanks @ashishshukla1183 - that helps. The version # is 2018-09-28.13

patmill avatar Oct 19 '18 15:10 patmill

@BigEaseGueldi - Do you happen to notice if the search box is in the suite nav (very top navigation bar)? Does the placement of the search box differ from the list page to the site page?

The search box is where it used to be (not in the suite nav): for list views/ application pages, the search box is in the command bar (on the right), for site pages, it's in the composite header.

BigEaseGueldi avatar Oct 19 '18 16:10 BigEaseGueldi

OK, this is frustrating. I have a tenant w/ the same build ID, but am not having the same issue. We have rolled back the build for now while we continue to investigate.

If anyone happens to feel OK sharing their source code (or at least their onInit function, where the code hooks up to the PlaceholdersChanged event, and the code where they tryCreateContent) that would help as well.

patmill avatar Oct 19 '18 16:10 patmill

OK, this is frustrating. I have a tenant w/ the same build ID, but am not having the same issue. We have rolled back the build for now while we continue to investigate.

If anyone happens to feel OK sharing their source code (or at least their onInit function and the code where they tryCreateContent) that would help as well.

You can refer mine at https://gist.github.com/ashishshukla1183/da28d1aafd38e5929d9ac8c7538f044b Let me know if you need any more details.

Ash11282 avatar Oct 19 '18 16:10 Ash11282