Skip to content

Commit

Permalink
Fix: Missing items parameter and or missing onActionPerformed calls. (#…
Browse files Browse the repository at this point in the history
…60753)

Co-authored-by: jorgefilipecosta <jorgefilipecosta@git.wordpress.org>
  • Loading branch information
jorgefilipecosta and jorgefilipecosta authored Apr 15, 2024
1 parent a5882a2 commit ee773ce
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions packages/editor/src/components/post-actions/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -455,6 +455,7 @@ const renamePostAction = {
createSuccessNotice( __( 'Name updated' ), {
type: 'snackbar',
} );
onActionPerformed?.( items );
} catch ( error ) {
const errorMessage =
error.message && error.code !== 'unknown_error'
Expand Down Expand Up @@ -582,7 +583,7 @@ const resetTemplateAction = {
variant="primary"
onClick={ async () => {
await onConfirm( items );
onActionPerformed?.();
onActionPerformed?.( items );
closeModal();
} }
>
Expand Down Expand Up @@ -650,7 +651,7 @@ const deleteTemplateAction = {
await removeTemplates( templates, {
allowUndo: false,
} );
onActionPerformed?.();
onActionPerformed?.( templates );
closeModal();
} }
>
Expand All @@ -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 );
Expand Down Expand Up @@ -718,6 +719,7 @@ const renameTemplateAction = {
type: 'snackbar',
}
);
onActionPerformed?.( templates );
} catch ( error ) {
const fallbackErrorMessage =
template.type === TEMPLATE_POST_TYPE
Expand Down

0 comments on commit ee773ce

Please sign in to comment.