-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Section Styles: Prevent flash of variation style updates #6959
Section Styles: Prevent flash of variation style updates #6959
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 Core Committers: Use this line as a base for the props when committing in SVN:
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
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.
LGTM.
I do still see a much briefer flash, but I assume that because a package update is needed to bring the JS changes from WordPress/gutenberg#63071. It's still better than in trunk
.
As mentioned in the gutenberg PR, this brings consistency for the post and site editor in terms of theme/global styles preloading, so I think it's a good idea 👍
That would be correct. Without the JS update, the global styles ID is loaded after another API request which isn't required when the ID is in the URL already. The demo videos in the description illustrate the degree to which this is an improvement even without the JS update. |
Would love to see this merged prior to RC3 release. Think it is possible? |
98d3e22
to
244c37e
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.
LGTM, too!
@@ -72,6 +72,9 @@ static function ( $classes ) { | |||
sprintf( '%s/autosaves?context=edit', $rest_path ), | |||
'/wp/v2/settings', | |||
array( '/wp/v2/settings', 'OPTIONS' ), | |||
'/wp/v2/global-styles/themes/' . get_stylesheet(), | |||
'/wp/v2/themes?context=edit&status=active', | |||
'/wp/v2/global-styles/' . WP_Theme_JSON_Resolver::get_user_global_styles_post_id() . '?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.
Looks like this can be null
?
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 guess the worst thing that can happen is that the path is invalid, it wouldn't cause a warning.
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.
It might be a couple of days due to other priorities but I could tighten this up in a follow-up if needed.
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 am still seeing a pretty significant flash right now, even with the code that was back-ported to RC3.
This PR backports the changes from WordPress/gutenberg#63071
These changes include preloading the global styles REST API paths required to collect the global styles data for use in the block editor. This has two benefits:
Test Instructions
Trac ticket: https://core.trac.wordpress.org/ticket/61553
Screen.Recording.2024-07-03.at.3.08.06.PM.mp4
Screen.Recording.2024-07-03.at.3.09.09.PM.mp4
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.