Multiple WebPart initializations when partial navigation occurs. #2023
Labels
area:spfx
Category: SharePoint Framework (not extensions related)
Needs: Attention 👋
Original poster responded to request for feedback, awaiting attention from Microsoft / community.
type:bug-suspected
Suspected bug (not working as designed/expected). See “type:bug-confirmed” for confirmed bugs.
Category
Expected or Desired Behavior
Observed Behavior
Steps to Reproduce
Create a Blank Communication site at /sites/bug-reproduction1
Create another Blank Communication site at /sites/bug-reproduction2
In /sites/bug-reproduction1, add the test-onepointfive app to the site. This SPFX app contains one WebPart.
Add the Bug Reproduction WebPart to the page. This is a freshly yeoman generated 1.5.0 WebPart that only adds console.log() to track when webpart lifecycle event occur.
Add a Link WebPart to the page, pointing to the home page of /sites/bug-reproduction2. Key here is it being cross site collection.
With browser dev tools open, from the home page of /sites/bug-reproduction1, refresh the page. In the console, observe the webpart reporting its different phases (onInit, render). OnInit() is called one time, and render() is called one time.
Click the link to navigate to /sites/bug-reproduction2. Observe an empty site with no webparts.
Click the back button in the browser. Observe multiple onInit() and render() calls for the dev webpart.
When you navigate around the SharePoint site between site collections, the framework doesn’t dispose the instances of the webparts properly, and loads them multiple times. Each webpart that contains async logic makes its networks calls multiple times as well. In IE11, the memory starts to add up after only a few page loads and eventually crashes.
The text was updated successfully, but these errors were encountered: