Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple WebPart initializations when partial navigation occurs. #2023

Closed
1 of 4 tasks
tdwhite0 opened this issue Jun 12, 2018 · 4 comments
Closed
1 of 4 tasks

Multiple WebPart initializations when partial navigation occurs. #2023

tdwhite0 opened this issue Jun 12, 2018 · 4 comments
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.

Comments

@tdwhite0
Copy link

Category

  • Question
  • Typo
  • Bug
  • Additional article idea

Expected or Desired Behavior

WebParts should consistently go through their lifecycle only once per instance of the WebPart.

Observed Behavior

When navigating across site collections, webparts are not being disposed properly and initialize multiple times. Partial navigation seems to be the culprit. These instances can sometimes stack up multiple times, so browser memory increases needlessly and in some cases (IE11) crashes completely.

Steps to Reproduce

Clone this webpart: https://github.com/tdwhite0/spfx-partialnavigation-bug, build it, and add to App Catalog.

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.

@VesaJuvonen VesaJuvonen added type:bug-suspected Suspected bug (not working as designed/expected). See “type:bug-confirmed” for confirmed bugs. area:spfx Category: SharePoint Framework (not extensions related) labels Jun 13, 2018
@andrewconnell
Copy link
Collaborator

Have you reviewed the recently published supported browsers docs here: https://support.office.com/en-us/article/Which-Browsers-Work-With-Office-Online-AD1303E0-A318-47AA-B409-D3A5EB44E452

Pay special attention to the IE11 node for the modern experience (as com sites are modern) & IE's document mode.

If you continue to have the issue, please comment back with some additional context. Thanks!

@andrewconnell andrewconnell added the Needs: Author Feedback Awaiting response from the original poster of the issue. Marked as stale if no activity for 7 days. label Aug 9, 2019
@msft-github-bot msft-github-bot added the no-recent-activity Stale issue due to lack of activity. Closed after 7 days with no activity by OP. label Aug 16, 2019
@msft-github-bot
Copy link
Collaborator

This issue has been automatically marked as stale because it has marked as requiring author feedback but has not had any activity for 7 days. It will be closed if no further activity occurs within next 7 days of this comment. Thank you for your contributions to SharePoint Developer activities.

@tdwhite0
Copy link
Author

This can be closed. I no longer experience problems with multiple WebPart initializations.

@msft-github-bot msft-github-bot added Needs: Attention 👋 Original poster responded to request for feedback, awaiting attention from Microsoft / community. and removed no-recent-activity Stale issue due to lack of activity. Closed after 7 days with no activity by OP. Needs: Author Feedback Awaiting response from the original poster of the issue. Marked as stale if no activity for 7 days. labels Aug 18, 2019
@msft-github-bot
Copy link
Collaborator

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

@SharePoint SharePoint locked as resolved and limited conversation to collaborators Jan 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
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.
Projects
None yet
Development

No branches or pull requests

4 participants