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

Library: Incorrect snackbar text and sidebar menu when removing template/template part #51969

Closed
t-hamano opened this issue Jun 27, 2023 · 3 comments
Labels
[Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") [Type] Bug An existing feature does not function as intended

Comments

@t-hamano
Copy link
Contributor

Description

I believe the following behavior that occurs when a template part is deleted is not what was intended.

  • Displayed as "undefined" deleted. on snackbar.
  • Nothing appears in the side menu.

Step-by-step reproduction instructions

  • Access the Site Editor > Library.
  • Click "Create pattern" button > Select "Create template part"
  • Create template part.
  • Click the document title bar.
  • Select "Delete template part".
  • A snackbar with the text "undefined" deleted. should appear. Also, nothing will appear in the sidebar menu.

Screenshots, screen recording, code snippet

27cbe95fc24791a2bdf325d7097a05a4.mp4

Environment info

No response

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

@t-hamano t-hamano 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 27, 2023
@t-hamano t-hamano changed the title Library: Incorrect snackbar text and sidebar menu when removing template parts Library: Incorrect snackbar text and sidebar menu when removing template/template part Jun 28, 2023
@t-hamano
Copy link
Contributor Author

I have confirmed that this problem occurs with template as well as template part.

7be1728d8ee8385e5d29ee0d172e81c8.mp4

@aaronrobertshaw
Copy link
Contributor

It appears that the entity record received when deleting via the List page vs the command palette is slightly different.

On the List page, the record contains a template.title.rendered property which is what the removeTemplate action expects, hence the correct snackbar notice there. The record passed on from the command palette only contains a simple string for the template.title property.

I haven't put my finger on why there's a difference just yet but will keep digging.

@aaronrobertshaw
Copy link
Contributor

This was fixed in #52034.

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") [Type] Bug An existing feature does not function as intended
Projects
Development

No branches or pull requests

2 participants