-
Notifications
You must be signed in to change notification settings - Fork 2
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
Issue-91 [FEATURE] Removes preloading of blocks on edit post screen #92
Conversation
$paths, | ||
function ( $v ) { | ||
// Remove the blocks preload path for performance reasons. | ||
return ! is_string( $v ) || ! str_starts_with( $v, '/wp/v2/blocks?context=edit' ); |
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.
Is it best to wipe out preloading synced patterns on all sites? Is it ever beneficial for sites with fewer synced patterns?
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.
I wish I could find a discussion about the possible benefit as I certainly don't want to cause any issues with this change. I'll ask around.
I do know that if only some blocks are pre-loaded (like only 10) that there are issues with searching for reusable blocks. So it seems that it has to be either an all or nothing approach.
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.
Yeah, the all-or-nothing part doesn't seem like a big deal to me, rather, should this logic kick in only after a site gets more than 20 (or whatever) synced patterns? And that number could be filterable, etc.
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.
I like how you're thinking @dlh01, but how about for MVP we launch it as is and put in an Enhancement issue to add a filterable threshold?
Sites can always turn off this feature with a filter.
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.
imo it's a sensible default to turn it off completely as long as it doesn't cause any issues with synced patterns/reusable blocks, and if individual sites want to preload, they can turn off the feature with the filter as @mogmarsh said.
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.
In addition to testing this on a very large traditional site, I also tested it on a block theme and had no issue using synced patterns.
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.
🌳 Some thoughts about how this feature could be tightened up, but no blocking feedback.
src/alley/wp/alleyvate/features/class-disable-block-editor-rest-api-preload-paths.php
Show resolved
Hide resolved
src/alley/wp/alleyvate/features/class-disable-block-editor-rest-api-preload-paths.php
Outdated
Show resolved
Hide resolved
tests/alley/wp/alleyvate/features/test-disable-block-editor-rest-api-preload-paths.php
Show resolved
Hide resolved
tests/alley/wp/alleyvate/features/test-disable-block-editor-rest-api-preload-paths.php
Show resolved
Hide resolved
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.
🌳
Summary
WordPress pre-loads all Reusable Blocks (Synced Patterns) on the edit post screen, site editor, and widget screen. For sites with hundreds of blocks, this is a lot of processing overhead, as the_content and all other filters run on these blocks. Disabling this behavior make the editing experience faster and less fragile for sites with a large number of blocks.
Notes for reviewers
None.
Other Information
README.md
file for any new/updated features.CHANGELOG.md
file for any new/updated features.Changelog entries
Added
Changed
Deprecated
Removed
Fixed
Security