Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Missing items parameter and or missing onActionPerformed calls. #60753

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading