diff --git a/src/components/sectionList/listActions/DeleteAction.tsx b/src/components/sectionList/listActions/DeleteAction.tsx index fe60dbf9..d3af827b 100644 --- a/src/components/sectionList/listActions/DeleteAction.tsx +++ b/src/components/sectionList/listActions/DeleteAction.tsx @@ -78,7 +78,12 @@ function ConfirmationDialog({ onDeleteSuccess: () => void }) { const schema = useSchemaFromHandle() - const deleteModelMutation = useDeleteModelMutation(schema) + const deleteModelMutation = useDeleteModelMutation(schema, { + onSuccess: () => { + showDeletionSuccess() + onDeleteSuccess() + }, + }) const deleteModel = async () => { await deleteModelMutation.mutateAsync({ id: modelId, @@ -96,16 +101,6 @@ function ConfirmationDialog({ { success: true } ) - const deleteAndClose = () => - deleteModel() - .then(() => { - showDeletionSuccess() - onDeleteSuccess() - }) - // We don't need to do anything on error except for catching it, - // we have all the information on the deleteModelMutation value - .catch(() => null) - // eslint-disable-next-line @typescript-eslint/no-explicit-any const errorReports = (deleteModelMutation.error as any)?.details?.response ?.errorReports @@ -155,7 +150,7 @@ function ConfirmationDialog({