From df6eff6855781dcbe6975f2752b07d03e607e4ca Mon Sep 17 00:00:00 2001 From: Jorge Costa Date: Tue, 26 Nov 2024 18:51:51 +0000 Subject: [PATCH] Fix: Duplicate template part refers to original name instead of duplicated name --- .../src/dataviews/actions/duplicate-template-part.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/editor/src/dataviews/actions/duplicate-template-part.tsx b/packages/editor/src/dataviews/actions/duplicate-template-part.tsx index 95e7e6bb672fc..5f576ecdb5863 100644 --- a/packages/editor/src/dataviews/actions/duplicate-template-part.tsx +++ b/packages/editor/src/dataviews/actions/duplicate-template-part.tsx @@ -15,7 +15,7 @@ import type { Action } from '@wordpress/dataviews'; import { TEMPLATE_PART_POST_TYPE } from '../../store/constants'; import { CreateTemplatePartModalContents } from '../../components/create-template-part-modal'; import { getItemTitle } from './utils'; -import type { TemplatePart } from '../types'; +import type { Post, TemplatePart } from '../types'; const duplicateTemplatePart: Action< TemplatePart > = { id: 'duplicate-template-part', @@ -38,12 +38,12 @@ const duplicateTemplatePart: Action< TemplatePart > = { ); }, [ item.content, item.blocks ] ); const { createSuccessNotice } = useDispatch( noticesStore ); - function onTemplatePartSuccess() { + function onTemplatePartSuccess( templatePart: Post ) { createSuccessNotice( sprintf( // translators: %s: The new template part's title e.g. 'Call to action (copy)'. _x( '"%s" duplicated.', 'template part' ), - getItemTitle( item ) + getItemTitle( templatePart ) ), { type: 'snackbar', id: 'edit-site-patterns-success' } );