From 877d5a56b662f6663c6cef90b28e6af5508dde1f Mon Sep 17 00:00:00 2001 From: Jamey Huffnagle Date: Mon, 9 Sep 2024 10:29:21 -0400 Subject: [PATCH] fix(app): fix undismissable calibration modals after e-stop event (#16216) Closes RQA-3155 If you throw an estop event during pipette or gripper calibration flows, the "exit" button in the modal header does not properly fire the onClose event, making it impossible to exit the modal. Currently, onClose requires the home command to succeed in order to close the modal. Instead, let's just make the modal close regardless of whether the home command succeeds or fails. Note that module calibration flows already have this logic, it's just these two flows that don't. --- app/src/organisms/GripperWizardFlows/index.tsx | 18 ++++++++++-------- app/src/organisms/PipetteWizardFlows/index.tsx | 13 +++++++------ 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/app/src/organisms/GripperWizardFlows/index.tsx b/app/src/organisms/GripperWizardFlows/index.tsx index 219fd687771..95d7e6f3500 100644 --- a/app/src/organisms/GripperWizardFlows/index.tsx +++ b/app/src/organisms/GripperWizardFlows/index.tsx @@ -120,12 +120,13 @@ export function GripperWizardFlows( const [errorMessage, setErrorMessage] = React.useState(null) const handleClose = (): void => { - if (props?.onComplete != null) props.onComplete() + if (props?.onComplete != null) { + props.onComplete() + } if (maintenanceRunData != null) { deleteMaintenanceRun(maintenanceRunData?.data.id) - } else { - closeFlow() } + closeFlow() } const { @@ -141,20 +142,21 @@ export function GripperWizardFlows( }) const handleCleanUpAndClose = (): void => { - if (maintenanceRunData?.data.id == null) handleClose() - else { + if (maintenanceRunData?.data.id == null) { + handleClose() + } else { chainRunCommands( maintenanceRunData?.data.id, [{ commandType: 'home' as const, params: {} }], false ) - .then(() => { - handleClose() - }) .catch(error => { setIsExiting(true) setErrorMessage(error.message as string) }) + .finally(() => { + handleClose() + }) } } diff --git a/app/src/organisms/PipetteWizardFlows/index.tsx b/app/src/organisms/PipetteWizardFlows/index.tsx index ad483b6ce5b..05e49c77eb9 100644 --- a/app/src/organisms/PipetteWizardFlows/index.tsx +++ b/app/src/organisms/PipetteWizardFlows/index.tsx @@ -182,12 +182,13 @@ export const PipetteWizardFlows = ( } } const handleClose = (): void => { - if (onComplete != null) onComplete() + if (onComplete != null) { + onComplete() + } if (maintenanceRunData != null) { deleteMaintenanceRun(maintenanceRunData?.data.id) - } else { - closeFlow() } + closeFlow() } const { @@ -210,13 +211,13 @@ export const PipetteWizardFlows = ( [{ commandType: 'home' as const, params: {} }], false ) - .then(() => { - handleClose() - }) .catch(error => { setIsExiting(true) setShowErrorMessage(error.message as string) }) + .finally(() => { + handleClose() + }) } } const {