-
Notifications
You must be signed in to change notification settings - Fork 4.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
Site Editor: preload settings requests #66488
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Size Change: 0 B Total Size: 1.81 MB ℹ️ View Unchanged
|
Flaky tests detected in 5d50bac. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/11523009291
|
5be281b
to
fef278c
Compare
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.
Thank you, @ellatrix!
fef278c
to
d692645
Compare
Co-authored-by: ellatrix <ellatrix@git.wordpress.org> Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
$paths[] = '/?_fields=' . implode( | ||
',', | ||
// @see packages/core-data/src/entities.js | ||
array( | ||
'description', | ||
'gmt_offset', | ||
'home', | ||
'name', | ||
'site_icon', | ||
'site_icon_url', | ||
'site_logo', | ||
'timezone_string', | ||
'url', | ||
) | ||
); |
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.
@ellatrix, should we also preload this path for the post editor?
What?
There's currently 3 settings requests that are not preloaded in the Site Editor (one GET and two OPTIONS). They are blocking requests (canvas loader), so we should preload them.
They are already preloaded in the Post Editor in core, so no need to add them there.
https://github.com/WordPress/wordpress-develop/blob/695476ea5e51d1c92f389ac236b138ceeaee8a99/src/wp-admin/edit-form-blocks.php#L68-L69
Missing in the site editor:
https://github.com/WordPress/wordpress-develop/blob/695476ea5e51d1c92f389ac236b138ceeaee8a99/src/wp-admin/site-editor.php#L90-L119
You'll notice that this PR only eliminates one GET and one OPTIONS request. That's because the preload cache only works for one API fetch call, and one of the instances uses a separate API fetch call instead of the store. This should be fixed at some point, separately. The same problem happens in the post editor. It's not too dissimilar to #65871, but it will require a different fix, sharing the OPTIONS state with
canUser
.gutenberg/packages/core-data/src/entities.js
Lines 420 to 423 in 0466f7d
Why?
How?
These requests block loading the site editor content.
Testing Instructions
Check the network tab (search for "settings"). In trunk there's 3 requests. With this PR one.
Testing Instructions for Keyboard
Screenshots or screencast