-
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: Pages: Preload template lookup #66654
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. |
lib/compat/wordpress-6.8/preload.php
Outdated
@@ -10,11 +10,23 @@ | |||
*/ | |||
function gutenberg_block_editor_preload_paths_6_8( $paths, $context ) { | |||
if ( 'core/edit-site' === $context->name ) { | |||
if ( ! empty( $_GET['postId'] ) ) { | |||
if ( ! empty( $_GET['postId'] ) && ! empty( $_GET['postType'] ) ) { |
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.
The $context
has a post
property, only populated in the post editor. I think we should do the same for the core/edit-site
, but when it makes sense. Currently, that would be a page post type.
See: https://developer.wordpress.org/reference/classes/wp_block_editor_context/
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.
@Mamaduka yes, that's a good idea. We can't do it here correctly, but I did it in the backport: WordPress/wordpress-develop#7695
6289abd
to
65d6922
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.
Works well for me and I feel the editor shows the preview faster.
f09ccf8
to
c631dde
Compare
What?
Preload the page's template when the page in the site editor is loaded directly.
Why?
The lookup request blocks the loading of the whole editor (a loading indicator is shown).
How?
Preload.
Testing Instructions
Go to the Sited Editor > Pages > edit a page. Check the network tab. Reload an observe no lookup request.
Testing Instructions for Keyboard
Screenshots or screencast