Skip to content

Commit

Permalink
removeTemplate: consider title type
Browse files Browse the repository at this point in the history
  • Loading branch information
t-hamano committed Jun 29, 2023
1 parent 4d99fb4 commit 5b30f82
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/edit-site/src/store/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,18 @@ export const removeTemplate =
throw lastError;
}

// Depending on how the entity was retrieved it's title might be
// an object or simple string.
const templateTitle =
typeof template.title === 'string'
? template.title
: template.title?.rendered;

registry.dispatch( noticesStore ).createSuccessNotice(
sprintf(
/* translators: The template/part's name. */
__( '"%s" deleted.' ),
decodeEntities( template.title.rendered )
decodeEntities( templateTitle )
),
{ type: 'snackbar', id: 'site-editor-template-deleted-success' }
);
Expand Down

0 comments on commit 5b30f82

Please sign in to comment.