Skip to content

SharePoint Web Parts do not recover correctly when using browser back button #10927

Description

@bcameron1231

Target SharePoint environment

SharePoint Online

What SharePoint development model, framework, SDK or API is this about?

💥 SharePoint Framework

Developer environment

Windows

What browser(s) / client(s) have you tested

  • 💥 Internet Explorer
  • 💥 Microsoft Edge
  • 💥 Google Chrome
  • 💥 FireFox
  • 💥 Safari
  • mobile (iOS/iPadOS)
  • mobile (Android)
  • not applicable
  • other (enter in the "Additional environment details" area below)

Additional environment details

SPFx 1.21.1 (Though it affects all versions of SPFX and first-party SharePoint Web Parts)

Describe the bug / error

When a user clicks a link from Page1.aspx to Page2.aspx and presses the Browser back button mid-navigation event, the SharePoint page lifecycle is not recovering correctly. The Browser URL accurately shows Page1.aspx, but the Web Parts are still trying to load from Page2.aspx

This is causing an issue with our custom web parts which utilize URL parameters. As we load a page such as Page2.aspx?k="" and the Web Parts are loading data based on that... however pressing back changes the URL, but doesn't change the loaded Web Parts. However, to demonstrate, this behavior also exists in first party scenarios using out of the box components.

See below. I click a link from News Web Part, and while it's loading the News page, I press back in the browser. The URL correctly updates, but the page is still loading the previous news page web parts.

SharePoint.navigation.issue.mp4

We can mitigate this issue in custom code by disabling data-interception, however, we cannot control the out of the box experience. Also, disabling data-interception to off is not a great experience due to the performance impact.

This behavior has manifested itself in the past in various ways, but I believe them to all be related:
#8913
#5604

Steps to reproduce

  1. Create a News Page
  2. On the home page, add a News Part that loads the News
  3. Click on the News Article
  4. Press back in the browser before the page full loads

Expected behavior

When pressing back in the browser mid navigation event, the SharePoint page should correctly recover the proper Web Parts for the loaded page... whether using first-party web parts or custom SPFx web parts.

Metadata

Metadata

Assignees

Labels

area:spfxCategory: SharePoint Framework (not extensions related)sharepoint-developer-supportsharepoint-developer-supporttype:bug-suspectedSuspected bug (not working as designed/expected). See “type:bug-confirmed” for confirmed bugs.

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions