Skip to content

Theme changed event calls render before onInit #10414

@SharePickle

Description

@SharePickle

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

  • Chrome 140.0.7339.81 (Official Build) (64-bit)
  • 1.21.1
  • 18.18.1

Describe the bug / error

When refreshing the page in Edit mode, render is called before onInit and theme changed event is being called multiple times. I think these issues are linked #10413

eval	@	VM2488:1
render	@	CustomWebPart.ts:93
i._internalHandleThemeChangedEvent	@	sp-pages-assembly_en…0cc25137d4d7.js:299
(anonymous)	@	sp-pages-assembly_en…00cc25137d4d7.js:23
e._raiseEventInternal	@	sp-pages-assembly_en…00cc25137d4d7.js:23
e.raiseEvent	@	sp-pages-assembly_en…00cc25137d4d7.js:23
e._raiseEvent	@	sp-pages-assembly_en…0cc25137d4d7.js:275
e._setTheme	@	sp-pages-assembly_en…0cc25137d4d7.js:275 // <------ this triggers theme changed event
Image

Steps to reproduce

  1. Open page in Edit mode
  2. Refresh the page
  3. render method is called before onInit completes

Expected behavior

render is not called before onInit.

Metadata

Metadata

Assignees

Labels

area:spfxCategory: SharePoint Framework (not extensions related)sharepoint-developer-supportsharepoint-developer-supporttype:bug-confirmedConfirmed bug, not working as designed / expected.type: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