Skip to content

Performance: Explore a lazy-editor package to lazy load editor assets and settings in the site editor. #72982

@youknowriad

Description

@youknowriad

What problem does this address?

Currently, edit-site pages load all block editor assets and settings upfront, even when they don't render an editor. This impacts performance for navigation flows that don't require the editor. (e.g., styles page, post list...).

What is your proposed solution?

Create a @wordpress/lazy-editor package that loads the block editor asynchronously on-demand. This would allow edit-site to defer loading editor resources until actually needed.

Proposed architecture:

  1. Editor Settings Endpoint - REST API endpoint to fetch block editor settings dynamically
  2. Editor Assets Endpoint - REST API endpoint to return required block editor assets (scripts/styles)
  3. @wordpress/load-assets Package - Utility for dynamically loading scripts and styles into the DOM
  4. @wordpress/lazy-editor Package - Higher-level component that accepts postType and postId props and handles async loading of settings, assets, and rendering

Benefits:

  • Improved initial load performance for edit-site pages
  • Reduced bundle size for navigation-only flows
  • Better code splitting and resource management

Backwards compatibility

A lot of third-party plugins that are not using the right hooks to enqueue assets might have conflicts with this, so we'd need a fallback/opt-in/opt-out at some point.

cc @WordPress/gutenberg-core WDYT?

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions