Sp-dev-docs: pageContext does not refresh in app customizers on inline navigation

Created on 9 Sep 2020  路  7Comments  路  Source: SharePoint/sp-dev-docs

Category

[x ] Question

Question

We assume that based on inline navigation between modern pages and lists/libs, that there is a possible issue with refreshing the page context. This is likely not only a problem with SPFX, perhaps more a general logic bug in SPO itself ?!

This has been tested using the following app customizer template from github:
https://github.com/estruyf/appcustomizer-navigation-issues-spfx

We extended the information the app customizer delivers within the header section with additional properties like "pageItemId, listTitle..."

image

When a user does an inline navigation between a modern UI page and e.g. the SitePages library, the header displays empty properties, even if you use the standard refresh events in SPFX like:

this.context.application.navigatedEvent

This is the default output if you directly load a doc lib.
image

This is the output if you do an inline navigation from a page to the lib
image
As you can see, also the url of the lib is incorrect.

We also figured out that inline navigation to doc libs/lists causes some additional issues which may be related to this behavior, like:

  • Header placeholder element in DOM is contained twice (one from the page you navigated from, the other from the lib). Perhaps the Modern Page Header is simply outdated?

image

  • If you navigate inline from a modern page to SitePages lib, you are not able to open a modern news link in edit mode anymore (an url parameter is not set correctly - ?stay=true) > Fully reload SitePage lib (F5) and it works as expected.

Any help or tipps on how to address this issues to the right people? We allready opened support tickets for these issues on our tenant, still at first level support, and it is not easy to explain the direct user impact because the app customizer is somehow "custom development".

Thanks
Bjoern

Environment details

  • Your Developer Environment:Windows 10
  • Target Environment: SharePoint Online
  • Framework: Node.js v8
  • Browser(s): any
  • Tooling: VS Code | SPFx 1.10

Tags

spfx-tooling #spfx

Possible related issues

6237

spfx-extensions question

All 7 comments

Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.

We have noticed this too. Could this be a general problem with url-query parameters when using inline navigation?

There are indeed issues with partial page transitions, check the following posts for a couple of techniques to overcome this: https://www.eliostruyf.com/things-to-check-in-your-spfx-application-customizer-after-page-transitions/

@estruyf - Thanks for your answer..

Actually we are allready using the same techniques you mentioned in your blog post to workaround this issues (like navigatedEvents, navigation history).

If nothing works, pageContext somehow did not refresh, the only thing we can do (like in your code) is to trigger a full page reload. (not based on a language check, in our case, listId, listTitle and a lot more are empty)

image

The big difference is, that this actually happens if a user navigates between a modern page and a doc lib and not like in your code, only when the user navigates between different hubs or site collections. Means: the overall inline navigation concept between pages and libs can not be used and always needs a full page reload in order to provide the correct pageContext.

BTW, the double placeholders #4945 was already reported a long time ago. Issue is still open.

Can confirm that we are also experiencing this issue.

We are making use of an ApplicationExtension to run some code on all pages, which is now only running on full page loads/reloads.

@estruyf Will explore the options in your article, thanks for that.

We are experiencing this as well.
It happens with the simplest test:
Scaffold a new extension and deploy it as-is.
Navigate between pages using the SharePoint navigation and the dialog only appears when the same navigation link is clicked twice.

Thank you @estruyf for pointing out this link that has provided a good work around for me: https://blog.velingeorgiev.com/page-hit-when-SPA-page-transitioning-modern-sharepoint-sites

Was this page helpful?
0 / 5 - 0 ratings