Skip to content

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

Closed

Description

@t-hamano

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

Activity

  1. added
    [Type] Bug
    [Feature] Site Editor
    on Jun 27, 2023
  2. 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[/+] on Jun 28, 2023
  3. t-hamano commented on Jun 28, 2023

    @t-hamano
    ContributorAuthor

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

    7be1728d8ee8385e5d29ee0d172e81c8.mp4
  4. aaronrobertshaw commented on Jun 29, 2023

    @aaronrobertshaw
    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.

  5. aaronrobertshaw commented on Jun 30, 2023

    @aaronrobertshaw
    Contributor

    This was fixed in #52034.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    [Feature] Site Editor[Type] Bug

    Type

    No type

    Projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions