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

Performance: Split Classic block and Meta Boxes to their own package #32665

Open
gziolo opened this issue Jun 14, 2021 · 3 comments
Open

Performance: Split Classic block and Meta Boxes to their own package #32665

gziolo opened this issue Jun 14, 2021 · 3 comments
Labels
[Block] Classic Affects the Classic Editor Block [Feature] Meta Boxes A draggable box shown on the post editing screen [Package] Edit Post /packages/edit-post [Type] Performance Related to performance efforts

Comments

@gziolo
Copy link
Member

gziolo commented Jun 14, 2021

What problem does this address?

We still have some legacy dependencies present in the block editor that were added to bridge the Classic Editor:

  • Classic Block
  • Meta Boxes

They are always present in the post editor even when they are never used on the website having a huge impact on the size of assets that every user has to download to edit content, example:

https://github.com/WordPress/wordpress-develop/blob/611d953e1509e20bf6a7d40f5710c0ce24b88b89/src/wp-includes/script-loader.php#L242-L247

  1. The Classic block requires the editor script dependency and several TinyMCE scripts and stylesheets to make them work. It impacts not only the post editor but also other screens like the new widgets editor screen.
  2. Meta Boxes require at least the postbox script dependency to operate properly, but in many cases, they depend on TinyMCE and all its assets.

What is your proposed solution?

I discussed with @youknowriad that it'd a good idea to split Classic block and Meta Boxes handling to their own package, e.g., edit-post-compat and tweak the condition to load that package iteratively (to deprecate it over time). The first step could be to make the Classic block and Meta Boxes opt-out on the site.

The ideal scenario would be that the Classic block is available from the Block Directory and everyone can consume it from there when necessary.

Related work

There is a related issue #29681 created by @sarayourfriend for the Classic block that tried to load this block asynchronously which is still unresolved. I believe that both issues still make sense as they address a similar problem but different use cases. Related PRs: #21684, #29681.

There is also a WordPress Trac ticket: https://core.trac.wordpress.org/ticket/48654 which considers a solution/endpoint to lazy-load scripts and styles. It has also a work in progress PR in Gutenberg: #21244.

The Classic block gets removed for the list of blocks in the widgets editor as of #32800.

@gziolo gziolo added [Type] Performance Related to performance efforts [Feature] Meta Boxes A draggable box shown on the post editing screen [Block] Classic Affects the Classic Editor Block [Package] Edit Post /packages/edit-post labels Jun 14, 2021
@gziolo
Copy link
Member Author

gziolo commented Jul 19, 2021

There is a related issue #33422 reported by @johngodley about the undefined support for core/freeform block when oldEditor variable is not set. It's going to be the same case with the changes proposed in this issue when the Classic Box is not present on the page.

@tyxla
Copy link
Member

tyxla commented Aug 7, 2023

I'd say it will be interesting how this plays out with the experiment to deprecate TinyMCE. It might be easier if we have fewer use cases when we actually load the Classic block.

@gziolo
Copy link
Member Author

gziolo commented Aug 9, 2023

I'd say it will be interesting how this plays out with the experiment to deprecate TinyMCE. It might be easier if we have fewer use cases when we actually load the Classic block.

It would be great to replicate the same experiment for Meta Boxes and add a similar JavaScript proxy for the postbox global.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Classic Affects the Classic Editor Block [Feature] Meta Boxes A draggable box shown on the post editing screen [Package] Edit Post /packages/edit-post [Type] Performance Related to performance efforts
Projects
None yet
Development

No branches or pull requests

2 participants