From ee773ce1bdee16b2f1a544efb3d4abc82dd17403 Mon Sep 17 00:00:00 2001 From: Jorge Costa Date: Mon, 15 Apr 2024 19:04:10 +0200 Subject: [PATCH] Fix: Missing items parameter and or missing onActionPerformed calls. (#60753) Co-authored-by: jorgefilipecosta --- packages/editor/src/components/post-actions/actions.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/editor/src/components/post-actions/actions.js b/packages/editor/src/components/post-actions/actions.js index 8dded54a6a756..a6ff1f77486c9 100644 --- a/packages/editor/src/components/post-actions/actions.js +++ b/packages/editor/src/components/post-actions/actions.js @@ -428,7 +428,7 @@ const renamePostAction = { isEligible( post ) { return post.status !== 'trash'; }, - RenderModal: ( { items, closeModal } ) => { + RenderModal: ( { items, closeModal, onActionPerformed } ) => { const [ item ] = items; const originalTitle = decodeEntities( typeof item.title === 'string' ? item.title : item.title.rendered @@ -455,6 +455,7 @@ const renamePostAction = { createSuccessNotice( __( 'Name updated' ), { type: 'snackbar', } ); + onActionPerformed?.( items ); } catch ( error ) { const errorMessage = error.message && error.code !== 'unknown_error' @@ -582,7 +583,7 @@ const resetTemplateAction = { variant="primary" onClick={ async () => { await onConfirm( items ); - onActionPerformed?.(); + onActionPerformed?.( items ); closeModal(); } } > @@ -650,7 +651,7 @@ const deleteTemplateAction = { await removeTemplates( templates, { allowUndo: false, } ); - onActionPerformed?.(); + onActionPerformed?.( templates ); closeModal(); } } > @@ -676,7 +677,7 @@ const renameTemplateAction = { } return true; }, - RenderModal: ( { items: templates, closeModal } ) => { + RenderModal: ( { items: templates, closeModal, onActionPerformed } ) => { const template = templates[ 0 ]; const title = decodeEntities( template.title.rendered ); const [ editedTitle, setEditedTitle ] = useState( title ); @@ -718,6 +719,7 @@ const renameTemplateAction = { type: 'snackbar', } ); + onActionPerformed?.( templates ); } catch ( error ) { const fallbackErrorMessage = template.type === TEMPLATE_POST_TYPE