Skip to content
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

Resetting template part causes snackbar notification saying it's been deleted #62458

Closed
annezazu opened this issue Jun 10, 2024 · 2 comments · Fixed by #62521
Closed

Resetting template part causes snackbar notification saying it's been deleted #62458

annezazu opened this issue Jun 10, 2024 · 2 comments · Fixed by #62521
Assignees
Labels
[Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended

Comments

@annezazu
Copy link
Contributor

Using 6.6 beta 1, if you make a change to a theme provided template part and then reset those changes from data views, you will see a snackbar notice that says the template part has been deleted rather than reset:

sidebar.deleted.beta.1.mov

I can replicate this with 6.6 beta 1 with and without GB 18.5 installed.

@annezazu annezazu added [Type] Bug An existing feature does not function as intended [Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") labels Jun 10, 2024
@ramonjd
Copy link
Member

ramonjd commented Jun 11, 2024

It's triggered by this line:

Introduced here:

https://github.com/WordPress/gutenberg/pull/61612/files#diff-f6d2ea7cd82485550ff502f466f05c286fe0cb0c444921ba001394a06280fe55R724

Wondering if it should be calling revertTemplate instead? 🤔 @jorgefilipecosta

Or is Gutenberg just trashing the post and reverting to the static theme file source? In that case we should somehow be able to discern the intention and display a different message I think.

@jorgefilipecosta
Copy link
Member

Good catch, it was not introduced in #61612 as the reset action already called removeTemplate before https://github.com/WordPress/gutenberg/pull/61612/files#diff-112c6ef76fe2ea3012ca3ea57f5e53a413364e9aa63dda2360b7f24ea1213177L249. Calling removeTemplate seems correct as we want to trash the post and revert to the static theme file source. @youknowriad previously suggested doing that also for templates and not just template parts.
I guess the action should try to be aware if it is a remove or reset and throw a message matching that, I will have a look into this fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended
3 participants