-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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: speed up load by preloading home and front-page templates #66579
Conversation
Size Change: -181 B (-0.01%) Total Size: 1.81 MB
ℹ️ View Unchanged
|
Flaky tests detected in db599cc. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/11599710943
|
3885404
to
7498e46
Compare
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. |
if ( !! frontPageTemplateId ) { | ||
return frontPageTemplateId; | ||
} | ||
return frontPageTemplateId; |
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 previous frontPageTemplateId
seems to only find the actual front-page template instead of going through the hierarchy and return wherever is the fallback when it does not exist.
We introduced server-side resolution for similar cases a while back, but it was later reverted in favor of client-side resolutions. See #38817. |
@Mamaduka I'm not sure if it's quite the same. That PR seems to be about a different use case? What was the revert PR and reason, I didn't see it linked. |
I don't recall exactly. It was part of the larger refactors Riad did for the site editor. In any case, it shouldn't be a blocker here. |
f208185
to
d366821
Compare
09d02da
to
db599cc
Compare
if ( !! frontPageTemplateId ) { | ||
return frontPageTemplateId; | ||
} | ||
return getDefaultTemplateId( { slug: 'front-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.
Should we leave previous logic/step related comments? They should still apply, right?
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 don't think so? This returns the resolving selector right away so it will either return undefined or the ID. Worth noting it's already the same below for postsPageId
which already returned a resolving selector before.
packages/edit-site/src/components/sync-state-with-url/use-init-edited-entity-from-url.js
Show resolved
Hide resolved
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!
This test really well for me ✅
87a698f
to
111a7f4
Compare
111a7f4
to
3a52f7c
Compare
@ellatrix, this breaks the Site Editor when no query arguments are provided: edit: only on Safari (macOS) The notice reads "You attempted to edit an item that doesn't exist. Perhaps it was deleted?". |
Odd, I'm pretty sure I tested various scenarios accessing the Site Editor and should've been picked up by e2e tests as well. |
Talked to Ella and we can both repro using Safari on macOS, but not elsewhere. |
This introduced a change in behavior for me when |
#66687 is also an issue I've stumbled upon |
WordPress#66579) Co-authored-by: ellatrix <[email protected]> Co-authored-by: Mamaduka <[email protected]>
What?
Depends on #66581.
The
front-page
andhome
template IDs (or their fallbacks) should be preloaded for the Site Editor. This avoids a request to figure out which template is used.Why?
Avoid a blocking request (
?_wp-find-template=true
) that slows down Site Editor loading.How?
We remove the resolver that triggers the request entirely and use
/wp/v2/templates/lookup
instead to preload the info.Testing Instructions
Testing Instructions for Keyboard
Screenshots or screencast