diff --git a/app/src/organisms/DropTipWizardFlows/hooks/__tests__/useDropTipRouting.test.tsx b/app/src/organisms/DropTipWizardFlows/hooks/__tests__/useDropTipRouting.test.tsx index c6cf823784c..f5622960244 100644 --- a/app/src/organisms/DropTipWizardFlows/hooks/__tests__/useDropTipRouting.test.tsx +++ b/app/src/organisms/DropTipWizardFlows/hooks/__tests__/useDropTipRouting.test.tsx @@ -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]) + }) }) diff --git a/app/src/organisms/DropTipWizardFlows/hooks/useDropTipRouting.tsx b/app/src/organisms/DropTipWizardFlows/hooks/useDropTipRouting.tsx index b0928eca3c2..4c3e8e01064 100644 --- a/app/src/organisms/DropTipWizardFlows/hooks/useDropTipRouting.tsx +++ b/app/src/organisms/DropTipWizardFlows/hooks/useDropTipRouting.tsx @@ -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] } diff --git a/app/src/organisms/ErrorRecoveryFlows/RecoveryError.tsx b/app/src/organisms/ErrorRecoveryFlows/RecoveryError.tsx index dd680ed24f6..d2fe92438a4 100644 --- a/app/src/organisms/ErrorRecoveryFlows/RecoveryError.tsx +++ b/app/src/organisms/ErrorRecoveryFlows/RecoveryError.tsx @@ -92,6 +92,7 @@ export function RecoveryDropTipFlowErrors({ routeUpdateActions, getRecoveryOptionCopy, errorKind, + subMapUtils, }: RecoveryContentProps): JSX.Element { const { t } = useTranslation('error_recovery') const { step } = recoveryMap @@ -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: diff --git a/app/src/organisms/ErrorRecoveryFlows/__tests__/RecoveryError.test.tsx b/app/src/organisms/ErrorRecoveryFlows/__tests__/RecoveryError.test.tsx index 1394993746b..f46f3f949ba 100644 --- a/app/src/organisms/ErrorRecoveryFlows/__tests__/RecoveryError.test.tsx +++ b/app/src/organisms/ErrorRecoveryFlows/__tests__/RecoveryError.test.tsx @@ -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, @@ -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') @@ -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) @@ -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}`, () => {