-
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: fix multiple regressions around global styles #66468
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. |
Flaky tests detected in ece965d. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/11517897274
|
cdd9d9e
to
12efb60
Compare
Size Change: +14 B (0%) Total Size: 1.81 MB
ℹ️ View Unchanged
|
Thanks for looking at this. It was something @aaronrobertshaw and I wanted to come back to but we got desperately sidetracked. LGTM Site and post editor (admin role)Before
After
Post editor (editor role)Before
After
|
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.
Here's a ✅ for what it's worth.
Happy to help out with backport too.
@ramonjd What's in the table? Are these preloaded requests? Or requests the editor is making still? |
Are there some specific test instructions I can follow here? On trunk, I can see the problematic requests noted in the PR description within the dev tools network log. After checking out this PR, I no longer see them. I might just be confused as to what's expected in light of Ramon's results above. So far I've checked using:
The behaviour at least appears consistent for me though. |
Sorry, that's embarrassing. I was looking at the network requests in the browser between branches, but now I think my env was kaputt, and so was my brain. 😅 Anyway I nuked and updated my env, and ran the tests again. I am now seeing that the global styles requests in question are being preloaded through string(35) "/wp/v2/global-styles/5?context=edit"
string(57) "/wp/v2/global-styles/themes/twentytwentyfive?context=view"
string(68) "/wp/v2/global-styles/themes/twentytwentyfive/variations?context=view"
string(22) "/wp/v2/global-styles/5" The corresponding clientside network requests are no longer being fired as Aaron notes. ✅ |
I think the E2E fails are real. This PR breaks the patterns view for hybrid themes. For example, activate a hybrid theme and visit |
// We want the global styles ID request to finish before triggering | ||
// the OPTIONS request for user capabilities, otherwise it will | ||
// fetch `/wp/v2/global-styles` instead of | ||
// `/wp/v2/global-styles/{id}`! |
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.
// We want the global styles ID request to finish before triggering | |
// the OPTIONS request for user capabilities, otherwise it will | |
// fetch `/wp/v2/global-styles` instead of | |
// `/wp/v2/global-styles/{id}`! | |
/* | |
* We want the global styles ID request to finish before triggering | |
* the OPTIONS request for user capabilities, otherwise it will | |
* fetch `/wp/v2/global-styles` instead of `/wp/v2/global-styles/{id}`. | |
*/ |
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.
Why?
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.
Thanks for the reviews! |
Great stuff! Thanks for fixing it 🙇🏻 |
Since this fixes a regression, let's have a crack at getting it into 6.7. I can migrate the compat layer to 6.7 if it makes it. |
There was a conflict while trying to cherry-pick the commit to the wp/6.7 branch. Please resolve the conflict manually and create a PR to the wp/6.7 branch. PRs to wp/6.7 are similar to PRs to trunk, but you should base your PR on the wp/6.7 branch instead of trunk.
|
Co-authored-by: ellatrix <[email protected]> Co-authored-by: ramonjd <[email protected]> Co-authored-by: aaronrobertshaw <[email protected]>
Cherry picked here: #66542 |
…tyles (#66468) (#66542) * Sync with #66543 * Move backport log to 6.7 --------- Co-authored-by: ellatrix <[email protected]> Co-authored-by: ramonjd <[email protected]> Co-authored-by: aaronrobertshaw <[email protected]> Co-authored-by: andrewserong <[email protected]>
I cherry picked this PR to wp/6.7 in #66542 |
Co-authored-by: ellatrix <[email protected]> Co-authored-by: ramonjd <[email protected]> Co-authored-by: aaronrobertshaw <[email protected]>
What?
Avoids 5 blocking requests for Site Editor loading:
There are multiple things going wrong after #65071 (cc @ramonjd):
/wp/v2/global-styles
and one at/wp/v2/global-styles/{id}
.edit
andview
context. This shouldn't be happening.edit
context and (2) WITHOUT any context, even though Global Styles: allow read access to users withedit_posts
capabilities #65071 changed the request from no context at all toview
.view
.edit_posts
capabilities #65071, but global styles variations are not preloaded.To fix all the issues we should:
view
oredit
context. If we neededit
for example, we shouldn't be fetching `view unnecessarily.view
context to the theme global styles path for preloading and remove the old path.Why?
Optimise site editor loading.
How?
Testing Instructions
Check the network tab for these requests.
Testing Instructions for Keyboard
Screenshots or screencast