diff --git a/app/src/organisms/Desktop/Devices/ProtocolRun/SetupLabwarePositionCheck/__tests__/SetupLabwarePositionCheck.test.tsx b/app/src/organisms/Desktop/Devices/ProtocolRun/SetupLabwarePositionCheck/__tests__/SetupLabwarePositionCheck.test.tsx index 6b0b3d5ad20..e3f396c5ed5 100644 --- a/app/src/organisms/Desktop/Devices/ProtocolRun/SetupLabwarePositionCheck/__tests__/SetupLabwarePositionCheck.test.tsx +++ b/app/src/organisms/Desktop/Devices/ProtocolRun/SetupLabwarePositionCheck/__tests__/SetupLabwarePositionCheck.test.tsx @@ -24,6 +24,7 @@ import { useUnmatchedModulesForProtocol, } from '/app/resources/runs' import { useRobotType } from '/app/redux-resources/robots' +import { useLPCFlows } from '/app/organisms/LabwarePositionCheck' import type { Mock } from 'vitest' @@ -34,6 +35,7 @@ vi.mock('/app/redux/config') vi.mock('../../../hooks/useLPCSuccessToast') vi.mock('@opentrons/react-api-client') vi.mock('/app/resources/runs') +vi.mock('/app/organisms/LabwarePositionCheck') const DISABLED_REASON = 'MOCK_DISABLED_REASON' const ROBOT_NAME = 'otie' @@ -106,6 +108,7 @@ describe('SetupLabwarePositionCheck', () => { vi.mocked(useProtocolAnalysisAsDocumentQuery).mockReturnValue({ data: null, } as any) + vi.mocked(useLPCFlows).mockReturnValue({ launchLPC: mockLaunchLPC } as any) }) afterEach(() => { diff --git a/app/src/organisms/LabwarePositionCheck/hooks/useLPCCommands/useHandlePrepModules.ts b/app/src/organisms/LabwarePositionCheck/hooks/useLPCCommands/useHandlePrepModules.ts index 71303abbf48..3d68e457845 100644 --- a/app/src/organisms/LabwarePositionCheck/hooks/useLPCCommands/useHandlePrepModules.ts +++ b/app/src/organisms/LabwarePositionCheck/hooks/useLPCCommands/useHandlePrepModules.ts @@ -35,11 +35,13 @@ export function useHandlePrepModules({ prepCommands.length > 0 ) { return chainLPCCommands(prepCommands, false) + } else { + return Promise.resolve([]) } } return Promise.reject( - new Error('Cannot prep modules during unsupported step.') + new Error(`Cannot prep modules during unsupported step: ${step?.section}`) ) } diff --git a/app/src/organisms/LabwarePositionCheck/hooks/useLPCCommands/useHandleValidMoveToMaintenancePosition.ts b/app/src/organisms/LabwarePositionCheck/hooks/useLPCCommands/useHandleValidMoveToMaintenancePosition.ts index e0f8a2c93d3..05a9ec13f5f 100644 --- a/app/src/organisms/LabwarePositionCheck/hooks/useLPCCommands/useHandleValidMoveToMaintenancePosition.ts +++ b/app/src/organisms/LabwarePositionCheck/hooks/useLPCCommands/useHandleValidMoveToMaintenancePosition.ts @@ -28,7 +28,7 @@ export function useHandleValidMoveToMaintenancePosition({ } else { return Promise.reject( new Error( - 'Does not move to maintenance position if step is not a probe step.' + `Does not move to maintenance position if step is not a probe step. Step: ${step?.section}` ) ) } diff --git a/app/src/organisms/LabwarePositionCheck/steps/CheckItem/index.tsx b/app/src/organisms/LabwarePositionCheck/steps/CheckItem/index.tsx index 960c2e9387d..cede9664579 100644 --- a/app/src/organisms/LabwarePositionCheck/steps/CheckItem/index.tsx +++ b/app/src/organisms/LabwarePositionCheck/steps/CheckItem/index.tsx @@ -2,6 +2,7 @@ import { Trans, useTranslation } from 'react-i18next' import { DIRECTION_COLUMN, Flex, LegacyStyledText } from '@opentrons/components' +import { NAV_STEPS } from '/app/organisms/LabwarePositionCheck/constants' import { FLEX_ROBOT_TYPE } from '@opentrons/shared-data' import { getLabwareDisplayLocation } from '/app/local-resources/labware' import { UnorderedList } from '/app/molecules/UnorderedList' @@ -101,8 +102,13 @@ export function CheckItem( }) ) }) - .then(() => handleCheckItemsPrepModules(steps.next)) - .then(() => handleValidMoveToMaintenancePosition(steps.next)) + .then(() => { + if (state.steps.next?.section === NAV_STEPS.CHECK_POSITIONS) { + return handleCheckItemsPrepModules(steps.next) + } else { + return handleValidMoveToMaintenancePosition(steps.next) + } + }) .finally(() => toggleRobotMoving(false)) } diff --git a/app/src/organisms/LegacyLabwarePositionCheck/index.tsx b/app/src/organisms/LegacyLabwarePositionCheck/index.tsx index 777fead7780..52a87f9b687 100644 --- a/app/src/organisms/LegacyLabwarePositionCheck/index.tsx +++ b/app/src/organisms/LegacyLabwarePositionCheck/index.tsx @@ -31,6 +31,8 @@ interface LabwarePositionCheckModalProps { // the component's dependencies (like useLabwarePositionCheck). If we wrapped the contents of LabwarePositionCheckComponent // in an ErrorBoundary as part of its return value (render), an error could occur before this point, meaning the error boundary // would never get invoked + +// LegacyFlows are utilized by the OT-2, and should never actually be utilized by the Flex despite offering Flex support. export const LegacyLabwarePositionCheck = ( props: LabwarePositionCheckModalProps ): JSX.Element => { diff --git a/app/src/pages/ODD/ProtocolSetup/__tests__/ProtocolSetup.test.tsx b/app/src/pages/ODD/ProtocolSetup/__tests__/ProtocolSetup.test.tsx index 5863d70ba93..d87bad08d52 100644 --- a/app/src/pages/ODD/ProtocolSetup/__tests__/ProtocolSetup.test.tsx +++ b/app/src/pages/ODD/ProtocolSetup/__tests__/ProtocolSetup.test.tsx @@ -65,6 +65,7 @@ import { import { mockConnectableRobot } from '/app/redux/discovery/__fixtures__' import { mockRunTimeParameterData } from '/app/organisms/ODD/ProtocolSetup/__fixtures__' import { useScrollPosition } from '/app/local-resources/dom-utils' +import { useLPCFlows } from '/app/organisms/LabwarePositionCheck' import type { UseQueryResult } from 'react-query' import type * as SharedData from '@opentrons/shared-data' @@ -115,6 +116,7 @@ vi.mock('/app/redux-resources/analytics') vi.mock('/app/redux-resources/robots') vi.mock('/app/resources/modules') vi.mock('/app/local-resources/dom-utils') +vi.mock('/app/organisms/LabwarePositionCheck') const render = (path = '/') => { return renderWithProviders( @@ -328,6 +330,7 @@ describe('ProtocolSetup', () => { isScrolled: false, scrollRef: {} as any, }) + vi.mocked(useLPCFlows).mockReturnValue({ launchLPC: mockLaunchLPC } as any) }) it('should render text, image, and buttons', () => {