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

Placeholders not appearing on page intermittently

Open CloudDesignBox opened this issue 8 years ago • 17 comments

This is happening in one out of several tenancies and doesn't seem to be an issue across the board yet.

Our application customizers are not loading each time because the placeholders do not exist.

The following code: console.log('Available placeholders: '+ this.context.placeholderProvider.placeholderNames.map(name => PlaceholderName[name]).join(', '));

Returns nothing after a page refresh. However it does work again after a hard refresh (sometimes). Usually the returns the Top and Bottom placeholders every time.

Category

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

CloudDesignBox avatar Oct 16 '18 13:10 CloudDesignBox

Now getting this for more tenants this afternoon....maybe a bug has been introduced??

This is happening with a Tenant Wide Deployment of SharePoint Framework Extensions.

CloudDesignBox avatar Oct 16 '18 16:10 CloudDesignBox

Also seeing this on multiple tenants. A resize event causes the placeholders to come back.

dgusoff avatar Oct 16 '18 20:10 dgusoff

I noticed this first around 11:30am PST today. Hopefully my workaround can get people going while a real fix is done :)

MaartenSundman avatar Oct 16 '18 21:10 MaartenSundman

Great, Thank you for the dirty timeout function as a workaround! I'll certainly give that a go. I found it worked fine if the extension was deployed per site but not globally across the tenant. Hopefully they can fix before it spreads to all tenancies! @patmill is this your area?

CloudDesignBox avatar Oct 16 '18 21:10 CloudDesignBox

This is definitely spreading, taking down tons of tenants for me. The promise of Placeholders being a place where you could always rely on being there is not true. Between stuff like this and buggy in place navigation you are better off injecting your own div. Really disappointing to have to have fire drills like this and explain to clients that SPFX can break underneath you at any time.

tdwhite0 avatar Oct 16 '18 21:10 tdwhite0

Sorry - catching up on this.

First off - if you are encountering issue on live sites, please open a support ticket. Now, to help diagnose - can you shed some more light on what / where this is happening? Is it on modern pages? list pages? SharePoint Home? Does it happen on every page refresh, or only once in a while? Does it happen on an in-place navigation, or even on a fresh view (F5)? Lastly, can you let us know what file path you see when you look at a network tab under something like spoprod-a.akamaihd.net/sp-client-prod_2018-**********/0.sp-pages-panels_hashkeyhere.js ?

patmill avatar Oct 16 '18 22:10 patmill

Chatting with some folks internally - There is some code rolling out that can cause things to behave slightly different order in some cases. The correct / best-practice in dealing with the PlaceHolders is code that looks like this:

this.context.placeholderProvider.changedEvent.add(this, this._renderPlaceHolders);

And then in your renderPlaceHolders, you'll want to check for the existence: if (!this._topPlaceholder) { this._topPlaceholder = this.context.placeholderProvider.tryCreateContent( PlaceholderName.Top, { onDispose: this._onDispose } ); By doing this, you will get notified when the placeholders have been created and are ready to be used.

You might be doing the tryCreateContent() call directly in your onInit() method. That's not particularly safe.

patmill avatar Oct 16 '18 22:10 patmill

This issue for us anyway is present for modern pages, strange thing is that the add in works on the Contents page of the sites. started at around 10:00 NZDT

AronHowarth avatar Oct 16 '18 22:10 AronHowarth

@patmill thank you for the update and your quick feedback. I guess we have all been basing our code using the samples on the SPFx documentation site which has since changed to include event code. I'll give that a go tomorrow. Thanks again!

CloudDesignBox avatar Oct 16 '18 22:10 CloudDesignBox

This should also set you up for future improvements in app customizers, where we can start executing code earlier (like before the page has rendered).

patmill avatar Oct 16 '18 23:10 patmill

Great, looking forward to all the new stuff we can do in the new versions in 1.6 and 1.7! I'll close this issue now and reopen if the fix doesn't resolve.

CloudDesignBox avatar Oct 16 '18 23:10 CloudDesignBox

We observed this same problem with a number of clients at start of business today (~3 hours ago). We raised a couple of support tickets (one per customer), and the issue is now no longer coming up.

We're now looking at changing code for active customers to use the new changedEvent pattern for app customizers, but to do this retrospectively for all customers is a bit of a stretch support-wise.

We also noticed, with some customers using SPFx web parts on classic pages, web parts using specific react related libraries were failing load on classic pages - the fix there was to update to newer versions of the libraries. But, I reckon something's been rolled back on the platform because those web parts have fixed themselves with no code changes on our part.

mpowney avatar Oct 17 '18 00:10 mpowney

@mpowney : We're now looking at changing code for active customers to use the new changedEvent pattern for app customizers, but to do this retrospectively for all customers is a bit of a stretch support-wise.

Well stated and I agree completely. That said I also see functionality restored. Looks like somebody scrambled to roll back an update.

dgusoff avatar Oct 17 '18 01:10 dgusoff

Hey Marc - is it possible to share what react libraries you are using in classic, and how they are getting loaded? We are trying to roll out support for react 16, and found some strange errors in some classic scenarios. It looks like people are using a weird mix of react 15 and 16 that we can't repro. For now we are including some react 15 functionality in the 16 code, which "fixes" the errors, but seems wrong.


From: Mark Powney [email protected] Sent: Tuesday, October 16, 2018 5:45:09 PM To: SharePoint/sp-dev-docs Cc: Pat Miller (SHAREPOINT); Mention Subject: Re: [SharePoint/sp-dev-docs] Placeholders not appearing on page intermittently (#2773)

We observed this same problem with a number of clients at start of business today (~3 hours ago). We raised a couple of support tickets (one per customer), and the issue is now no longer coming up.

We're now looking at changing code for active customers to use the new changedEvent pattern for app customizers, but to do this retrospectively for all customers is a bit of a stretch support-wise.

We also noticed, with some customers using SPFx web parts on classic pages, web parts using specific react related libraries were failing load on classic pages - the fix there was to update to newer versions of the libraries. But, I reckon something's been rolled back on the platform because those web parts have fixed themselves with no code changes on our part.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FSharePoint%2Fsp-dev-docs%2Fissues%2F2773%23issuecomment-430449988&data=02%7C01%7CPat.Miller%40microsoft.com%7Cbf2d88622677463e404708d633c9ca94%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636753339108678003&sdata=PeMUG58%2BWmdDQCtGVletg%2B0H2fbvI6Q8wJTq%2BtTNh6c%3D&reserved=0, or mute the threadhttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FADl-SUgL0RTdCVuYA4mcivq6LlfNPoavks5uln2VgaJpZM4XeV13&data=02%7C01%7CPat.Miller%40microsoft.com%7Cbf2d88622677463e404708d633c9ca94%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636753339108678003&sdata=mzIP0eO%2FUS9%2F2q1dLd3U0QWDGLdm2wwMR1a9iPRunWA%3D&reserved=0.

patmill avatar Oct 17 '18 02:10 patmill

The library was react-slick - it was loaded in a .tsx React.Component with var Slider: any = require('react-slick');

We found a fix prior to the platform fixes involved three things:

  • upgrading to the latest react-slick library (0.14.5 > 0.23.1)
  • upgrading the dependency library slick-carousel (1.6.0 > 1.8.1)
  • changing from require to import in the .tsx component: import Slider from 'react-slick';

Not sure if its relevant, but the same component has a reference to office-ui-fabric: import { MessageBar, MessageBarType } from 'office-ui-fabric-react/lib/MessageBar';

This particular project deployed to the classic site is quite old - SPFx 1.1

package.json dependencies:

    "@microsoft/sp-core-library": "~1.1.0",
    "@microsoft/sp-webpart-base": "~1.1.1",
    "@types/react": "0.14.46",
    "@types/react-addons-shallow-compare": "0.14.17",
    "@types/react-addons-test-utils": "0.14.15",
    "@types/react-addons-update": "0.14.14",
    "@types/react-dom": "0.14.18",
    "@types/webpack-env": ">=1.12.1 <1.14.0",
    "axios": "^0.16.1",
    "crypto-js": "^3.1.9-1",
    "es6-map": "^0.1.5",
    "es6-promise": "^4.0.5",
    "es6-set": "^0.1.5",
    "font-awesome": "^4.7.0",
    "jquery": "^3.2.1",
    "jqueryui": "^1.11.1",
    "mobx": "^3.2.2",
    "mobx-react": "^4.2.2",
    "office-ui-fabric": "^2.6.2",
    "office-ui-fabric-core": "^5.1.0",
    "office-ui-fabric-react": "^1.14.3",
    "react": "15.4.2",
    "react-ace": "^5.10.0",
    "react-dom": "15.4.2",
    "react-slick": "^0.23.1",
    "slick-carousel": "^1.8.1",
    "sp-pnp-js": "^3.0.4"

package.json devDependencies:

    "@microsoft/sp-build-web": "~1.1.0",
    "@microsoft/sp-module-interfaces": "~1.1.0",
    "@microsoft/sp-webpart-workbench": "~1.1.0",
    "@types/chai": ">=3.4.34 <3.6.0",
    "@types/jquery": "^2.0.34",
    "@types/mocha": ">=2.2.33 <2.6.0",
    "@types/sharepoint": "^2013.1.6",
    "gulp": "^3.9.1"

mpowney avatar Oct 17 '18 03:10 mpowney

Chatting with some folks internally - There is some code rolling out that can cause things to behave slightly different order in some cases. The correct / best-practice in dealing with the PlaceHolders is code that looks like this:

this.context.placeholderProvider.changedEvent.add(this, this._renderPlaceHolders);

And then in your renderPlaceHolders, you'll want to check for the existence: if (!this._topPlaceholder) { this._topPlaceholder = this.context.placeholderProvider.tryCreateContent( PlaceholderName.Top, { onDispose: this._onDispose } ); By doing this, you will get notified when the placeholders have been created and are ready to be used.

You might be doing the tryCreateContent() call directly in your onInit() method. That's not particularly safe. @patmill Thanks for the workaround, you saved my day ! Is there any channel where that kind of information is released to devs in order to discover things like that before it is released into production ? Our entire navigation system is based on extensions so this broke everythink for all users... Maybe we do not monitor the right channels of information so if they are some, which are they ?

BraunJonathan avatar Oct 19 '18 11:10 BraunJonathan

Issues that have been closed & had no follow-up activity for at least 7 days are automatically locked. Please refer to our wiki for more details, including how to remediate this action if you feel this was done prematurely or in error: Issue List: Our approach to locked issues

msft-github-bot avatar Jan 26 '20 06:01 msft-github-bot