Skip to content

Commit

Permalink
let's include the null check in the promise chain
Browse files Browse the repository at this point in the history
  • Loading branch information
mjhuff committed Nov 7, 2024
1 parent 96619a3 commit 5b40f90
Showing 1 changed file with 31 additions and 28 deletions.
59 changes: 31 additions & 28 deletions app/src/organisms/DropTipWizardFlows/hooks/useDropTipCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,35 +109,38 @@ export function useDropTipCommands({
isPredefinedLocation: boolean
): Promise<void> => {
return new Promise((resolve, reject) => {
const addressableAreaFromConfig = getAddressableAreaFromConfig(
addressableArea,
deckConfig,
instrumentModelSpecs.channels,
robotType
)

if (addressableAreaFromConfig == null) {
throw new Error('invalid addressable area.')
}

const moveToAACommand = buildMoveToAACommand(
addressableAreaFromConfig,
pipetteId,
isPredefinedLocation,
issuedCommandsType
)
Promise.resolve()
.then(() => {
const addressableAreaFromConfig = getAddressableAreaFromConfig(
addressableArea,
deckConfig,
instrumentModelSpecs.channels,
robotType
)

if (addressableAreaFromConfig == null) {
throw new Error('invalid addressable area.')
}

return chainRunCommands(
isFlex
? [
ENGAGE_AXES,
UPDATE_ESTIMATORS_EXCEPT_PLUNGERS,
Z_HOME,
moveToAACommand,
]
: [Z_HOME, moveToAACommand],
false
)
const moveToAACommand = buildMoveToAACommand(
addressableAreaFromConfig,
pipetteId,
isPredefinedLocation,
issuedCommandsType
)

return chainRunCommands(
isFlex
? [
ENGAGE_AXES,
UPDATE_ESTIMATORS_EXCEPT_PLUNGERS,
Z_HOME,
moveToAACommand,
]
: [Z_HOME, moveToAACommand],
false
)
})
.then((commandData: CommandData[]) => {
const error = commandData[0].data.error
if (error != null) {
Expand Down

0 comments on commit 5b40f90

Please sign in to comment.