@@ -5,13 +5,7 @@ import { useTranslation } from 'react-i18next'
5
5
import NiceModal , { useModal } from '@ebay/nice-modal-react'
6
6
7
7
import { useConditionalConfirm , COLORS } from '@opentrons/components'
8
- import {
9
- LEFT ,
10
- NINETY_SIX_CHANNEL ,
11
- RIGHT ,
12
- LoadedPipette ,
13
- CreateCommand ,
14
- } from '@opentrons/shared-data'
8
+ import { LEFT , NINETY_SIX_CHANNEL , RIGHT } from '@opentrons/shared-data'
15
9
import {
16
10
useHost ,
17
11
useDeleteMaintenanceRunMutation ,
@@ -28,6 +22,7 @@ import { getTopPortalEl } from '../../App/portal'
28
22
import { WizardHeader } from '../../molecules/WizardHeader'
29
23
import { FirmwareUpdateModal } from '../FirmwareUpdateModal'
30
24
import { getIsOnDevice } from '../../redux/config'
25
+ import { SimpleWizardBody } from '../../molecules/SimpleWizardBody'
31
26
import { useAttachedPipettesFromInstrumentsQuery } from '../Devices/hooks'
32
27
import { usePipetteFlowWizardHeaderText } from './hooks'
33
28
import { getPipetteWizardSteps } from './getPipetteWizardSteps'
@@ -44,10 +39,13 @@ import { Carriage } from './Carriage'
44
39
import { MountingPlate } from './MountingPlate'
45
40
import { UnskippableModal } from './UnskippableModal'
46
41
47
- import type { PipetteMount } from '@opentrons/shared-data'
42
+ import type {
43
+ LoadedPipette ,
44
+ CreateCommand ,
45
+ PipetteMount ,
46
+ } from '@opentrons/shared-data'
48
47
import type { CommandData , HostConfig } from '@opentrons/api-client'
49
48
import type { PipetteWizardFlow , SelectablePipettes } from './types'
50
- import { SimpleWizardBody } from '../../molecules/SimpleWizardBody'
51
49
52
50
const RUN_REFETCH_INTERVAL = 5000
53
51
@@ -185,11 +183,18 @@ export const PipetteWizardFlows = (
185
183
if ( onComplete != null ) onComplete ( )
186
184
if ( maintenanceRunData != null ) {
187
185
deleteMaintenanceRun ( maintenanceRunData ?. data . id )
186
+ } else {
187
+ closeFlow ( )
188
188
}
189
- closeFlow ( )
190
189
}
191
190
192
- const { deleteMaintenanceRun } = useDeleteMaintenanceRunMutation ( { } )
191
+ const {
192
+ deleteMaintenanceRun,
193
+ isLoading : isDeleteLoading ,
194
+ } = useDeleteMaintenanceRunMutation ( {
195
+ onSuccess : ( ) => closeFlow ( ) ,
196
+ onError : ( ) => closeFlow ( ) ,
197
+ } )
193
198
194
199
const handleCleanUpAndClose = ( ) : void => {
195
200
if ( maintenanceRunData ?. data . id == null ) handleClose ( )
@@ -234,7 +239,7 @@ export const PipetteWizardFlows = (
234
239
: undefined
235
240
const calibrateBaseProps = {
236
241
chainRunCommands : chainMaintenanceRunCommands ,
237
- isRobotMoving : isCommandMutationLoading ,
242
+ isRobotMoving : isCommandMutationLoading || isDeleteLoading ,
238
243
proceed,
239
244
maintenanceRunId,
240
245
goBack,
@@ -255,11 +260,11 @@ export const PipetteWizardFlows = (
255
260
proceed = { handleCleanUpAndClose }
256
261
goBack = { cancelExit }
257
262
isOnDevice = { isOnDevice }
258
- isRobotMoving = { isCommandMutationLoading }
263
+ isRobotMoving = { isCommandMutationLoading || isDeleteLoading }
259
264
/>
260
265
) : (
261
266
< ExitModal
262
- isRobotMoving = { isCommandMutationLoading }
267
+ isRobotMoving = { isCommandMutationLoading || isDeleteLoading }
263
268
goBack = { cancelExit }
264
269
proceed = { handleCleanUpAndClose }
265
270
flowType = { flowType }
@@ -383,7 +388,7 @@ export const PipetteWizardFlows = (
383
388
}
384
389
385
390
let exitWizardButton = onExit
386
- if ( isCommandMutationLoading ) {
391
+ if ( isCommandMutationLoading || isDeleteLoading ) {
387
392
exitWizardButton = undefined
388
393
} else if ( errorMessage != null && isExiting ) {
389
394
exitWizardButton = handleClose
0 commit comments