Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(app): Bubble pipette command errors during drop tip wizard #16793

Merged
merged 2 commits into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions app/src/organisms/DropTipWizardFlows/DropTipWizard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,13 @@ export const DropTipWizardContent = (

function buildModalContent(): JSX.Element {
// Don't render the spinner screen for 1 render cycle on fixit commands.
if (currentStep === BEFORE_BEGINNING && issuedCommandsType === 'fixit') {

if (errorDetails != null) {
return buildErrorScreen()
} else if (
currentStep === BEFORE_BEGINNING &&
issuedCommandsType === 'fixit'
) {
return buildBeforeBeginning()
} else if (
activeMaintenanceRunId == null &&
Expand All @@ -259,8 +265,6 @@ export const DropTipWizardContent = (
return buildRobotInMotion()
} else if (showConfirmExit) {
return buildShowExitConfirmation()
} else if (errorDetails != null) {
return buildErrorScreen()
} else if (currentStep === BEFORE_BEGINNING) {
return buildBeforeBeginning()
} else if (currentStep === CHOOSE_LOCATION_OPTION) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,4 +144,15 @@ describe('getInitialRouteAndStep', () => {
expect(initialRoute).toBe(DT_ROUTES.DROP_TIP)
expect(initialStep).toBe(DT_ROUTES.DROP_TIP[2])
})

it('should return the overridden route and first step when fixitUtils.routeOverride.route is provided but routeOverride.step is not provided', () => {
const fixitUtils = {
routeOverride: { route: DT_ROUTES.DROP_TIP, step: null },
} as any

const [initialRoute, initialStep] = getInitialRouteAndStep(fixitUtils)

expect(initialRoute).toBe(DT_ROUTES.DROP_TIP)
expect(initialStep).toBe(DT_ROUTES.DROP_TIP[0])
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,10 @@ export function getInitialRouteAndStep(
): [DropTipFlowsRoute, DropTipFlowsStep] {
const routeOverride = fixitUtils?.routeOverride
const initialRoute = routeOverride?.route ?? DT_ROUTES.BEFORE_BEGINNING
const initialStep = routeOverride?.step ?? BEFORE_BEGINNING_STEPS[0]
const initialStep =
routeOverride?.step ??
routeOverride?.route?.[0] ??
BEFORE_BEGINNING_STEPS[0]

return [initialRoute, initialStep]
}
4 changes: 4 additions & 0 deletions app/src/organisms/ErrorRecoveryFlows/RecoveryError.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ export function RecoveryDropTipFlowErrors({
routeUpdateActions,
getRecoveryOptionCopy,
errorKind,
subMapUtils,
}: RecoveryContentProps): JSX.Element {
const { t } = useTranslation('error_recovery')
const { step } = recoveryMap
Expand All @@ -108,6 +109,9 @@ export function RecoveryDropTipFlowErrors({
errorKind
)

// Whenever there is an error during drop tip wizard, reset the submap so properly re-entry routing occurs.
subMapUtils.updateSubMap(null)

const buildTitle = (): string => {
switch (step) {
case ERROR_WHILE_RECOVERING.STEPS.DROP_TIP_GENERAL_ERROR:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,14 @@ describe('RecoveryError', () => {
let getRecoverOptionCopyMock: Mock
let handleMotionRoutingMock: Mock
let homePipetteZAxesMock: Mock
let updateSubMapMock: Mock

beforeEach(() => {
proceedToRouteAndStepMock = vi.fn()
getRecoverOptionCopyMock = vi.fn()
handleMotionRoutingMock = vi.fn().mockResolvedValue(undefined)
homePipetteZAxesMock = vi.fn().mockResolvedValue(undefined)
updateSubMapMock = vi.fn()

props = {
...mockRecoveryContentProps,
Expand All @@ -48,6 +50,7 @@ describe('RecoveryError', () => {
route: ERROR_WHILE_RECOVERING.ROUTE,
step: ERROR_WHILE_RECOVERING.STEPS.RECOVERY_ACTION_FAILED,
},
subMapUtils: { subMap: null, updateSubMap: updateSubMapMock },
}

getRecoverOptionCopyMock.mockReturnValue('Retry step')
Expand Down Expand Up @@ -95,7 +98,7 @@ describe('RecoveryError', () => {
expect(screen.queryAllByText('Continue to drop tip')[0]).toBeInTheDocument()
})

it(`renders RecoveryDropTipFlowErrors when step is ${ERROR_WHILE_RECOVERING.STEPS.DROP_TIP_TIP_DROP_FAILED}`, () => {
it(`renders RecoveryDropTipFlowErrors when step is ${ERROR_WHILE_RECOVERING.STEPS.DROP_TIP_TIP_DROP_FAILED} and resets the submap`, () => {
props.recoveryMap.step =
RECOVERY_MAP.ERROR_WHILE_RECOVERING.STEPS.DROP_TIP_TIP_DROP_FAILED
render(props)
Expand All @@ -107,6 +110,7 @@ describe('RecoveryError', () => {
)[0]
).toBeInTheDocument()
expect(screen.queryAllByText('Return to menu')[0]).toBeInTheDocument()
expect(updateSubMapMock).toHaveBeenCalledWith(null)
})

it(`calls proceedToRouteAndStep with ${RECOVERY_MAP.OPTION_SELECTION.ROUTE} when the "Return to menu" button is clicked in RecoveryDropTipFlowErrors with step ${ERROR_WHILE_RECOVERING.STEPS.DROP_TIP_GENERAL_ERROR}`, () => {
Expand Down
Loading