-
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
Preload the edited template to avoid the white page effect before the screen loads #21214
Conversation
Nice! |
Size Change: +3 B (0%) Total Size: 857 kB
ℹ️ View Unchanged
|
ce3ec83
to
ab333ba
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.
This works well! Very nice.
I see from the comment the preload paths are taken from edit-forms-blocks.php.
Do all of these items in the path make sense to have preloaded for the site editor? By the looks of it most of them seem appropriate, but Im not certain.
Anyways, testing this change I do see a noticeable difference!
lib/edit-site-page.php
Outdated
'/wp/v2/taxonomies?per_page=-1&context=edit', | ||
'/wp/v2/themes?status=active', | ||
sprintf( '/wp/v2/templates/%s?context=edit', $_wp_current_template_id ), | ||
'/wp/v2/users/me?post_type=templates&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.
does having post_type=templates
make sense here? For the site editor isn't our post type undefined
?
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 think our post type is wp_template actually, so yeah that might be the only unused entry here, I'll test it.
f2a7f99
to
00628bd
Compare
00628bd
to
04e454a
Compare
@@ -139,6 +139,9 @@ const ColorPanel = ( { colorSettings, clientId } ) => { | |||
|
|||
useEffect( () => { | |||
const colorsDetectionElement = getBlockDOMNode( clientId ); | |||
if ( ! colorsDetectionElement ) { |
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.
This is a small unrelated bug fix that was causing some blocks (template part) to fail in the edit site page.
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 & looks good from my end!
Right now the screen loads as a white page before the API fetching the template finishes. This PR fixes that by preloading the template.