-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Block Editor: Preload together with Post Editor section #45934
Conversation
Here is how your PR affects size of JS and CSS bundles shipped to the user's browser: App Entrypoints (~25 bytes added 📈 [gzipped])
Common code that is always downloaded and parsed every time the app is loaded, no matter which route is used. Sections (~100 bytes removed 📉 [gzipped])
Sections contain code specific for a given set of routes. Is downloaded and parsed only when a particular route is navigated to. Async-loaded Components (~63 bytes removed 📉 [gzipped])
React components that are loaded lazily, when a certain part of UI is displayed for the first time. Legend What is parsed and gzip size?Parsed Size: Uncompressed size of the JS and CSS files. This much code needs to be parsed and stored in memory. Generated by performance advisor bot at iscalypsofastyet.com. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
export function preloadEditor() { | ||
preload( 'gutenberg-editor' ); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this function also include preload( 'post-editor' )
?
export function preloadEditor() { | |
preload( 'gutenberg-editor' ); | |
} | |
export function preloadEditor() { | |
preload( 'gutenberg-editor' ); | |
preload( 'post-editor' ); | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uh, sorry @saramarcondes - this is expected behavior.
It was changed because of this review request: #45934 (comment) but I forgot to update the PR description.
Could you take another look?
I forgot to update PR description and testing instructions, so Sara was following old ones.
Oh gosh sorry @tyxla I should have read the existing discussion but my mind glossed right over it. I'll dismiss my review and this LGTM and is behaving as expected. The refactor into a single function for preloading the editor is a great idea too, glad you were able to make that improvement. |
Currently, at multiple places, when the user intends to click on a link to open the post editor, we preload the post editor section. That helps with perceived performance, because the section starts loading immediately, and when the user navigates to the post editor, it loads faster because it had already loaded.
However, for many of the users, we use the block editor, and this introduces a couple of problems:
This PR introduces a common preloader helper that preloads both sections, and updates all the locations that were previously preloading the post editor to preload both sections. That resolves both of the abovementioned problems.
Ideally, we would know which section to preload and would preload only that section, but at this point, I expect the positive impact of preloading both sections to be higher than the negative one.
Changes proposed in this Pull Request
Testing instructions
/posts/:site
gutenberg-editor
section chunk gets preloaded.