Skip to content

fix(app): allow stacker setup with no pipette #19160

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

Merged
merged 10 commits into from
Aug 11, 2025
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
54 changes: 40 additions & 14 deletions app/src/App/hooks.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useCallback, useContext, useEffect, useRef } from 'react'
import { useCallback, useContext, useEffect, useRef, useState } from 'react'
import { useTranslation } from 'react-i18next'
import { useQueryClient } from 'react-query'
import { useDispatch } from 'react-redux'
Expand All @@ -15,6 +15,10 @@ import {
useCreateLiveCommandMutation,
useHost,
} from '@opentrons/react-api-client'
import {
ABSORBANCE_READER_TYPE,
FLEX_STACKER_MODULE_TYPE,
} from '@opentrons/shared-data'

import { useToaster } from '/app/organisms/ToasterOven'
import { checkShellUpdate } from '/app/redux/shell'
Expand All @@ -26,7 +30,10 @@ import { useCurrentRunId } from '../resources/runs'
import { SharedScrollRefContext } from './ODDProviders/ScrollRefProvider'

import type { AttachedModule } from '@opentrons/api-client'
import type { SetStatusBarCreateCommand } from '@opentrons/shared-data'
import type {
ModuleType,
SetStatusBarCreateCommand,
} from '@opentrons/shared-data'
import type { Dispatch } from '/app/redux/types'

const UPDATE_RECHECK_INTERVAL_MS = 60000
Expand Down Expand Up @@ -128,7 +135,14 @@ export function useProtocolReceiptToast(): void {
}, [protocolIds])
}

export function useGetNewModules(): AttachedModule[] {
const MODULES_NOT_REQUIRING_PIPETTE_FOR_SETUP: ModuleType[] = [
ABSORBANCE_READER_TYPE,
FLEX_STACKER_MODULE_TYPE,
]

const MODULES_NOT_REQUIRING_CALIBRATION = MODULES_NOT_REQUIRING_PIPETTE_FOR_SETUP

export function useGetModulesNeedingSetup(): AttachedModule[] {
const attachedModules =
useAttachedModules({
refetchInterval: ATTACHED_MODULE_POLL_MS,
Expand All @@ -141,33 +155,44 @@ export function useGetNewModules(): AttachedModule[] {
const modulesInDeckConfig = deckConfig
?.filter(c => c.opentronsModuleSerialNumber)
.map(m => m.opentronsModuleSerialNumber)
const newModules = attachedModules.filter(
return attachedModules.filter(
m =>
m.moduleOffset === undefined &&
!modulesInDeckConfig.includes(m.serialNumber)
!modulesInDeckConfig.includes(m.serialNumber) ||
(!MODULES_NOT_REQUIRING_CALIBRATION.includes(m.moduleType) &&
m.moduleOffset === undefined)
)
return newModules
}
return []
}

export function useGetModulesNeedingSetupThatCanCurrentlyBeSetUp(): AttachedModule[] {
const modulesRequiringSetup = useGetModulesNeedingSetup()
const attachedPipettes = useAttachedPipettes(modulesRequiringSetup.length > 0)
return modulesRequiringSetup.filter(
m =>
MODULES_NOT_REQUIRING_PIPETTE_FOR_SETUP.includes(m.moduleType) ||
attachedPipettes.left != null ||
attachedPipettes.right != null
)
}

export function useModuleAttachedToast(
launchModuleSetupCallback: () => void
): void {
const newModules = useGetNewModules()
const currentlySetuppableModules = useGetModulesNeedingSetupThatCanCurrentlyBeSetUp()

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

“setuppable” 😅

const currentRunId = useCurrentRunId({ refetchInterval: CURRENT_RUN_POLL })
const attachedPipettes = useAttachedPipettes(newModules.length > 0)
const { t, i18n } = useTranslation(['module_wizard_flows', 'shared'])
const { makeToast } = useToaster()
const moduleSerials = newModules.map(m => m.serialNumber)
const moduleSerials = currentlySetuppableModules.map(m => m.serialNumber)
const moduleSerialsRef = useRef(moduleSerials)
const runInProgress = currentRunId != null

const [firstRun, setFirstRun] = useState<boolean>(true)

useEffect(() => {
const newModuleSerials = difference(moduleSerials, moduleSerialsRef.current)
const hasPipette =
attachedPipettes.left != null || attachedPipettes.right != null
if (!runInProgress && hasPipette && newModuleSerials.length > 0) {
if (!runInProgress && newModuleSerials.length > 0) {
makeToast(t('module_added') as string, 'info', {
buttonText: i18n.format(t('shared:close'), 'capitalize'),
linkText: t('module_added_link'),
Expand All @@ -177,9 +202,10 @@ export function useModuleAttachedToast(
})
}
moduleSerialsRef.current = moduleSerials
setFirstRun(false)
// dont want this hook to rerun when other deps change
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [moduleSerials, runInProgress])
}, [moduleSerials, runInProgress, firstRun])
}

export function useScrollRef(): {
Expand Down
1 change: 1 addition & 0 deletions app/src/assets/localization/en/module_wizard_flows.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"close_doors_description": "The robot needs to safely move to its home location before you can set the labware shuttle onto the track.",
"close_stacker_doors": "Close robot door and all stacker doors",
"complete_calibration": "Complete calibration",
"connect_a_pipette_to_set_up_more_modules": "Connect a pipette to set up more modules.",
"confirm_location": "Confirm location",
"confirm_placement": "Confirm placement",
"door_circuit_error": "Robot is open",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ export interface ModalContentOneColSimpleButtonsProps {
buttons: ButtonProps[]
onSelect?: ChangeEventHandler<HTMLInputElement>
initialSelected?: string
subText?: string
scroll?: boolean
}

export function ModalContentOneColSimpleButtons(
Expand All @@ -33,16 +35,26 @@ export function ModalContentOneColSimpleButtons(
props.initialSelected ?? null
)
return (
<OneColumn>
<Flex flexDirection={DIRECTION_COLUMN} gap={SPACING.spacing16}>
<LegacyStyledText
fontSize={TYPOGRAPHY.fontSize28}
fontWeight={TYPOGRAPHY.fontWeightSemiBold}
lineHeight={TYPOGRAPHY.lineHeight36}
<OneColumn height="100%">
<Flex
flexDirection={DIRECTION_COLUMN}
gap={SPACING.spacing16}
height="100%"
>
<Flex>
<LegacyStyledText
fontSize={TYPOGRAPHY.fontSize28}
fontWeight={TYPOGRAPHY.fontWeightSemiBold}
lineHeight={TYPOGRAPHY.lineHeight36}
>
{props.headline}
</LegacyStyledText>
</Flex>
<Flex
flexDirection={DIRECTION_COLUMN}
gap={SPACING.spacing4}
overflowY={props.scroll === true ? 'auto' : null}
>
{props.headline}
</LegacyStyledText>
<Flex flexDirection={DIRECTION_COLUMN} gap={SPACING.spacing4}>
{props.buttons.map((buttonProps, idx) => (
<RadioButton
key={`button${idx}-${buttonProps.value}`}
Expand All @@ -56,6 +68,15 @@ export function ModalContentOneColSimpleButtons(
}}
/>
))}
{props.subText != null ? (
<LegacyStyledText
fontSize={TYPOGRAPHY.fontSize22}
fontWeight={TYPOGRAPHY.fontWeightRegular}
lineHeight={TYPOGRAPHY.lineHeight28}
>
{props.subText}
</LegacyStyledText>
) : null}
</Flex>
</Flex>
</OneColumn>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ describe('Module Update Banner', () => {
expect(screen.queryByText('Setup module')).not.toBeInTheDocument()
})

it('should not render module setup banner if pipette calibration is required', () => {
it('should render module setup banner even if pipette calibration is required', () => {
props = {
...props,
updateType: 'setup',
Expand All @@ -135,7 +135,7 @@ describe('Module Update Banner', () => {
'ModuleCard_calibration_update_banner_test_number'
)
).not.toBeInTheDocument()
expect(screen.queryByText('Setup module')).not.toBeInTheDocument()
screen.getByText('Setup module')
})

it('should not render a module setup link if pipette firmware update is required', () => {
Expand Down
19 changes: 11 additions & 8 deletions app/src/molecules/UpdateBanner/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,17 @@ export const UpdateBanner = ({
return t('module_calibration_required')
}

const canProceed =
updateType === 'firmware'
? true
: !isEstopNotDisengaged &&
!isTooHot &&
!attachPipetteRequired &&
!calibratePipetteRequired &&
!updatePipetteFWRequired
const proceedChecks = {
firmware: () => true,
calibration: () =>
!isEstopNotDisengaged &&
!isTooHot &&
!attachPipetteRequired &&
!calibratePipetteRequired &&
!updatePipetteFWRequired,
setup: () => true,
}
const canProceed = proceedChecks[updateType]()

const getMessage = (): string => {
switch (updateType) {
Expand Down
4 changes: 2 additions & 2 deletions app/src/organisms/ModuleWizardFlows/AttachProbe.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ import { SimpleWizardInProgressBody } from '/app/molecules/SimpleWizardBody'
import { getFixtureIdByCutoutId } from './getFixtureIdByCutoutId'

import type { CreateCommand, DeckConfiguration } from '@opentrons/shared-data'
import type { ModuleSetupWizardStepProps } from './types'
import type { ModuleSetupWizardRequiresPipetteStepProps } from './types'

interface AttachProbeProps extends ModuleSetupWizardStepProps {
interface AttachProbeProps extends ModuleSetupWizardRequiresPipetteStepProps {
adapterId: string | null
deckConfig: DeckConfiguration
}
Expand Down
4 changes: 2 additions & 2 deletions app/src/organisms/ModuleWizardFlows/BeforeBeginning.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ import { GenericWizardTile } from '/app/molecules/GenericWizardTile'
import { WizardRequiredEquipmentList } from '/app/molecules/WizardRequiredEquipmentList'

import type { AttachedModule } from '@opentrons/api-client'
import type { ModuleSetupWizardStepProps } from './types'
import type { ModuleSetupWizardMaybePipetteStepProps } from './types'

interface EqipmentItem {
loadName: string
displayName: string
subtitle?: string
}

interface BeforeBeginningProps extends ModuleSetupWizardStepProps {}
interface BeforeBeginningProps extends ModuleSetupWizardMaybePipetteStepProps {}

export function BeforeBeginning(props: BeforeBeginningProps): JSX.Element {
const { proceed, attachedModule, setErrorMessage } = props
Expand Down
5 changes: 3 additions & 2 deletions app/src/organisms/ModuleWizardFlows/CheckStackerInstall.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ import { useSendIdentifyStacker } from './hooks'

import type { AttachedModule } from '@opentrons/api-client'
import type { DeckConfiguration } from '@opentrons/shared-data'
import type { ModuleSetupWizardStepProps } from './types'
import type { ModuleSetupWizardMaybePipetteStepProps } from './types'

interface CheckStackerInstallProps extends ModuleSetupWizardStepProps {
interface CheckStackerInstallProps
extends ModuleSetupWizardMaybePipetteStepProps {
deckConfig: DeckConfiguration
attachedModules: AttachedModule[]
doorOpenStatus: boolean
Expand Down
4 changes: 2 additions & 2 deletions app/src/organisms/ModuleWizardFlows/CloseStackerDoor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import {
} from '/app/molecules/SimpleWizardBody'

import type { CreateCommand, DeckConfiguration } from '@opentrons/shared-data'
import type { ModuleSetupWizardStepProps } from './types'
import type { ModuleSetupWizardMaybePipetteStepProps } from './types'

interface CloseDoorProps extends ModuleSetupWizardStepProps {
interface CloseDoorProps extends ModuleSetupWizardMaybePipetteStepProps {
deckConfig: DeckConfiguration
}

Expand Down
6 changes: 4 additions & 2 deletions app/src/organisms/ModuleWizardFlows/DetachProbe.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import detachProbe8 from '/app/assets/videos/pipette-wizard-flows/Pipette_Detach
import detachProbe96 from '/app/assets/videos/pipette-wizard-flows/Pipette_Detach_Probe_96.webm'
import { GenericWizardTile } from '/app/molecules/GenericWizardTile'

import type { ModuleSetupWizardStepProps } from './types'
import type { ModuleSetupWizardRequiresPipetteStepProps } from './types'

const BODY_STYLE = css`
${TYPOGRAPHY.pRegular};
Expand All @@ -26,7 +26,9 @@ const BODY_STYLE = css`
}
`

export function DetachProbe(props: ModuleSetupWizardStepProps): JSX.Element {
export function DetachProbe(
props: ModuleSetupWizardRequiresPipetteStepProps
): JSX.Element {
const { attachedPipette, proceed, goBack } = props
const { t, i18n } = useTranslation('module_wizard_flows')

Expand Down
4 changes: 2 additions & 2 deletions app/src/organisms/ModuleWizardFlows/InstallShuttle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ import { SimpleWizardBody } from '/app/molecules/SimpleWizardBody'

import type { AttachedModule } from '@opentrons/api-client'
import type { DeckConfiguration } from '@opentrons/shared-data'
import type { ModuleSetupWizardStepProps } from './types'
import type { ModuleSetupWizardMaybePipetteStepProps } from './types'

interface InstallShuttleProps extends ModuleSetupWizardStepProps {
interface InstallShuttleProps extends ModuleSetupWizardMaybePipetteStepProps {
deckConfig: DeckConfiguration
attachedModules: AttachedModule[]
}
Expand Down
4 changes: 2 additions & 2 deletions app/src/organisms/ModuleWizardFlows/PlaceAdapter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ import { SimpleWizardInProgressBody } from '/app/molecules/SimpleWizardBody'
import { LEFT_SLOTS } from './constants'

import type { CreateCommand, DeckConfiguration } from '@opentrons/shared-data'
import type { ModuleSetupWizardStepProps } from './types'
import type { ModuleSetupWizardRequiresPipetteStepProps } from './types'

interface PlaceAdapterProps extends ModuleSetupWizardStepProps {
interface PlaceAdapterProps extends ModuleSetupWizardRequiresPipetteStepProps {
deckConfig: DeckConfiguration
setCreatedAdapterId: (adapterId: string) => void
}
Expand Down
5 changes: 3 additions & 2 deletions app/src/organisms/ModuleWizardFlows/SelectLocation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import type {
CutoutId,
DeckConfiguration,
} from '@opentrons/shared-data'
import type { ModuleSetupWizardStepProps } from './types'
import type { ModuleSetupWizardMaybePipetteStepProps } from './types'

export const BODY_STYLE = css`
${TYPOGRAPHY.pRegular};
Expand All @@ -52,7 +52,8 @@ export const BODY_STYLE = css`
line-height: 1.75rem;
}
`
export interface SelectLocationProps extends ModuleSetupWizardStepProps {
export interface SelectLocationProps
extends ModuleSetupWizardMaybePipetteStepProps {
deckConfig: DeckConfiguration
createMaintenanceRun: CreateMaintenanceRunType
isLoadedInRun: boolean
Expand Down
Loading
Loading