Skip to content

Commit

Permalink
fix(app): fix undismissable calibration modals after e-stop event (#1…
Browse files Browse the repository at this point in the history
…6216)

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.
  • Loading branch information
mjhuff authored Sep 9, 2024
1 parent 904b1ef commit 877d5a5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 14 deletions.
18 changes: 10 additions & 8 deletions app/src/organisms/GripperWizardFlows/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,13 @@ export function GripperWizardFlows(
const [errorMessage, setErrorMessage] = React.useState<null | string>(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 {
Expand All @@ -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()
})
}
}

Expand Down
13 changes: 7 additions & 6 deletions app/src/organisms/PipetteWizardFlows/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down

0 comments on commit 877d5a5

Please sign in to comment.