Skip to content

React Lazy Loading Causes Intermittent Crash in SPFx Web Part #10507

@BJS1209

Description

@BJS1209

Target SharePoint environment

SharePoint Online

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

💥 SharePoint Framework

Developer environment

None

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

  • browser version: Chrome (142.0.7444.176)
  • SPFx version: 1.2.1
  • Node.js version: 22.16.0

Describe the bug / error

Description:

I created a SharePoint Framework (SPFx) web part where I am using React lazy loading for components. During the initial loading of the SharePoint page containing the web part, the page crashes intermittently (approximately 4 out of 10 times). After refreshing the page, the web part loads and works perfectly fine.

Investigation:

While debugging using React DevTools, I observed that one of the SharePoint page components has a Suspense fallback set to null. This is causing the entire page to suspend and results in a crash during the first load.
There is no error in console.

Image

Steps to reproduce

  1. Load the SharePoint page with the SPFx web part containing lazy loaded React components.
  2. The page crashes randomly on initial load.
  3. Refresh the page, and the web part loads successfully without errors.

Expected behavior

The SPFx web part should load reliably on the first attempt without crashing, even if React lazy loading is used.

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

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions