Skip to content

Commit

Permalink
fix(app): load natural pipetteId during error recovery
Browse files Browse the repository at this point in the history
  • Loading branch information
mjhuff committed Aug 12, 2024
1 parent 1201666 commit 5625b9c
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -334,12 +334,13 @@ const buildMoveToAACommand = (

export const buildLoadPipetteCommand = (
pipetteName: PipetteModelSpecs['name'],
mount: PipetteData['mount']
mount: PipetteData['mount'],
pipetteId?: string | null
): CreateCommand => {
return {
commandType: 'loadPipette',
params: {
pipetteId: MANAGED_PIPETTE_ID,
pipetteId: pipetteId ?? MANAGED_PIPETTE_ID,
mount,
pipetteName,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,15 @@ function useRegisterPipetteFixitType({
instrumentModelSpecs,
issuedCommandsType,
chainRunCommands,
fixitCommandTypeUtils,
}: UseRegisterPipetteFixitType): void {
React.useEffect(() => {
if (issuedCommandsType === 'fixit') {
const command = buildLoadPipetteCommand(instrumentModelSpecs.name, mount)
const command = buildLoadPipetteCommand(
instrumentModelSpecs.name,
mount,
fixitCommandTypeUtils?.pipetteId
)
void chainRunCommands([command], true)
}
}, [])
Expand Down
1 change: 1 addition & 0 deletions app/src/organisms/DropTipWizardFlows/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export interface DropTipWizardRouteOverride {
export interface FixitCommandTypeUtils {
runId: string
failedCommandId: string
pipetteId: string | null
copyOverrides: CopyOverrides
errorOverrides: ErrorOverrides
buttonOverrides: ButtonOverrides
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { DropTipWizardFlows } from '../../DropTipWizardFlows'
import { DT_ROUTES } from '../../DropTipWizardFlows/constants'
import { SelectRecoveryOption } from './SelectRecoveryOption'

import type { PipettingRunTimeCommand } from '@opentrons/shared-data'

Check failure on line 27 in app/src/organisms/ErrorRecoveryFlows/RecoveryOptions/ManageTips.tsx

View workflow job for this annotation

GitHub Actions / js checks

'PipettingRunTimeCommand' is defined but never used

Check failure on line 27 in app/src/organisms/ErrorRecoveryFlows/RecoveryOptions/ManageTips.tsx

View workflow job for this annotation

GitHub Actions / js checks

'PipettingRunTimeCommand' is defined but never used
import type { PipetteWithTip } from '../../DropTipWizardFlows'
import type { RecoveryContentProps, RecoveryRoute, RouteStep } from '../types'
import type { FixitCommandTypeUtils } from '../../DropTipWizardFlows/types'
Expand Down Expand Up @@ -200,6 +201,7 @@ export function useDropTipFlowUtils({
subMapUtils,
routeUpdateActions,
recoveryMap,
failedPipetteInfo,
}: RecoveryContentProps): FixitCommandTypeUtils {
const { t } = useTranslation('error_recovery')
const {
Expand Down Expand Up @@ -301,9 +303,17 @@ export function useDropTipFlowUtils({
}
}

const pipetteId =
failedCommand != null &&
'params' in failedCommand.byRunRecord &&
'pipetteId' in failedCommand.byRunRecord.params
? failedCommand.byRunRecord.params.pipetteId
: null

return {
runId,
failedCommandId,
pipetteId,
copyOverrides: buildCopyOverrides(),
errorOverrides: buildErrorOverrides(),
buttonOverrides: buildButtonOverrides(),
Expand Down

0 comments on commit 5625b9c

Please sign in to comment.