-
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: Avoid previous content flash when a new template is created #40841
Conversation
Size Change: +17 B (0%) Total Size: 1.23 MB
ℹ️ View Unchanged
|
374f664
to
906f12d
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.
Working as advertised :)
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 fix!
setTemplate
always feels a bit weird to me in this context though. We have both history
and setTemplate
/setPage
/setTemplatePart
, but I think we should only have one of them at a time. I guess it might be too big of a change to refactor it now so this fix makes sense to me 👍
@kevin940726, do you remember why we never swapped |
Unfortunately, I don't remember 😅. Agree it might be a good start though. |
I cherry-picked this PR for WordPress 6.0 RC2 release with 025ae02. |
…ted (#40841) * Site Editor: Avoid previous content flash when a new template is created * Pass slug
What?
Resolves #40286.
PR fixes previous template content flash when creating a new template from the Template list view.
Why?
The site editor store retains the edited template even after navigating to the Template list view. This template is visible for a second before
URLQueryController
updates the store with the new one.P.S. In the future, we might want to reset the currently edited template state when the Template list view is rendered. But for now, I decided to keep the fix simple if it's cherry-picked for WP 6.0 RC.
How?
I update the template creation handler to dispatch
setTemplate
before updating the history and navigating to the editor.Testing Instructions
Screenshots or screencast
Before
CleanShot.2022-05-05.at.12.36.48.mp4
After
CleanShot.2022-05-05.at.12.34.20.mp4