Skip to content

Site editor crashes when opening styles Typography or Colors and theme variations aren't fully loaded yet #59509

@afercia

Description

@afercia

Description

The editor may crash when quickly opening the Styles > Typography or Styles > Color panel.

This is about timing so it's more evident on a local development environment, which is much slower than the built production release. Still, it appears threre's something to fix as at some point the underlying code attemps to get the length property of an object that is (I guess) null.

Error messages when opening Typography or Colors panel:

TypeError: Cannot read properties of undefined (reading 'length')
    at ScreenTypography 
...


TypeError: Cannot read properties of undefined (reading 'length')
    at ScreenColors 
    ...

See also this animated GIF to better illustrate:

crash

Step-by-step reproduction instructions

  • Set Twenty Twenty-Four as active theme: it adds 7 theme global styles 'variations'.
  • Go to the Site editor > edit mode.
  • Refresh the page.
  • As soon as the 'Styles' button in the top bar appears, click on it.
  • The quicly click either Typography or Colors.
  • Observe the editor crashes.

Screenshots, screen recording, code snippet

No response

Environment info

No response

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

Metadata

Metadata

Assignees

Labels

[Package] Edit Site/packages/edit-site[Status] In ProgressTracking issues with work in progress[Type] BugAn existing feature does not function as intended

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions