Skip to content

Commit d86ae7a

Browse files
authored
fix(app): Intervention modal map rendering stacker and labware incorrectly (#19164)
fix RQA-4427, RABR-815
1 parent 9f8d1b0 commit d86ae7a

File tree

5 files changed

+45
-74
lines changed

5 files changed

+45
-74
lines changed

app/src/organisms/ErrorRecoveryFlows/hooks/useDeckMapUtils.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@ import { useMemo } from 'react'
33
import { getLabwareLocation } from '@opentrons/components'
44
import {
55
FLEX_ROBOT_TYPE,
6+
FLEX_STACKER_MODULE_TYPE,
67
getDeckDefFromRobotType,
78
getFixedTrashLabwareDefinition,
89
getModuleDef,
10+
getModuleType,
911
getPositionFromSlotId,
1012
getSimplestDeckConfigForProtocol,
1113
OT2_ROBOT_TYPE,
@@ -495,9 +497,13 @@ export function updateLabwareInModules({
495497
} {
496498
const usedSlots = new Set<string>()
497499

500+
// a flex stackers module location will be in slot 3, but labware in that slot
501+
// is not nested on the stacker so we shouldn't match those up
498502
const updatedModules = runCurrentModules.map(moduleInfo => {
499503
const labwareInSameLoc = currentLabwareInfo.find(
500-
lw => moduleInfo.moduleLocation.slotName === lw.slotName
504+
lw =>
505+
moduleInfo.moduleLocation.slotName === lw.slotName &&
506+
getModuleType(moduleInfo.moduleModel) !== FLEX_STACKER_MODULE_TYPE
501507
)
502508

503509
if (labwareInSameLoc != null) {

app/src/organisms/ErrorRecoveryFlows/shared/TwoColLwInfoAndDeck.tsx

Lines changed: 13 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,8 @@ import {
44
COLORS,
55
Flex,
66
LabwareRender,
7-
Module,
87
MoveLabwareOnDeck,
98
} from '@opentrons/components'
10-
import { inferModuleOrientationFromXCoordinate } from '@opentrons/shared-data'
119

1210
import { DeckMapContent, TwoColumn } from '/app/molecules/InterventionModal'
1311

@@ -133,6 +131,18 @@ export function TwoColLwInfoAndDeck(
133131
const isValidDeck =
134132
currentLoc != null && newLoc != null && movedLabwareDef != null
135133

134+
const modulesOnDeck = moduleRenderInfo
135+
?.filter(module => module.targetSlotId != null)
136+
.map(module => {
137+
return {
138+
moduleModel: module.moduleDef.model,
139+
moduleLocation: { slotName: module.targetSlotId ?? '' },
140+
nestedLabwareDef:
141+
module.nestedLabwareId !== failedLwId
142+
? module.nestedLabwareDef
143+
: null,
144+
}
145+
})
136146
return isValidDeck ? (
137147
<MoveLabwareOnDeck
138148
deckFill={isOnDevice ? COLORS.grey35 : '#e6e6e6'}
@@ -141,39 +151,9 @@ export function TwoColLwInfoAndDeck(
141151
movedLabwareDef={movedLabwareDef}
142152
labwareDefinitions={allRunDefs}
143153
{...restUtils}
154+
modulesOnDeck={modulesOnDeck}
144155
backgroundItems={
145156
<>
146-
{moduleRenderInfo.map(
147-
({
148-
x,
149-
y,
150-
moduleId,
151-
moduleDef,
152-
nestedLabwareDef,
153-
nestedLabwareId,
154-
targetDeckId,
155-
targetSlotId,
156-
}) => (
157-
<Module
158-
key={moduleId}
159-
def={moduleDef}
160-
x={x}
161-
y={y}
162-
orientation={inferModuleOrientationFromXCoordinate(x)}
163-
targetDeckId={targetDeckId}
164-
targetSlotId={targetSlotId}
165-
childrenPositioningMode="offsetToSlot"
166-
>
167-
{nestedLabwareDef != null &&
168-
nestedLabwareId !== failedLwId ? (
169-
<LabwareRender
170-
definition={nestedLabwareDef}
171-
positioningMode="offsetInSlot"
172-
/>
173-
) : null}
174-
</Module>
175-
)
176-
)}
177157
{labwareRenderInfo
178158
.filter(l => l.labwareId !== failedLwId)
179159
.map(({ labwareOrigin, labwareDef, labwareId }) => (

app/src/organisms/ErrorRecoveryFlows/shared/__tests__/TwoColLwInfoAndDeck.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,8 @@ describe('TwoColLwInfoAndDeck', () => {
202202
props.currentRecoveryOptionUtils.selectedRecoveryOption =
203203
RECOVERY_MAP.MANUAL_MOVE_AND_SKIP.ROUTE
204204
props.deckMapUtils = {
205-
movedLabwareDef: null,
206-
moduleRenderInfo: null,
205+
currentLoc: null,
206+
newLoc: null,
207207
labwareRenderInfo: null,
208208
} as any
209209

app/src/organisms/InterventionModal/MoveLabwareInterventionContent.tsx

Lines changed: 19 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import {
1515
Icon,
1616
LabwareRender,
1717
LegacyStyledText,
18-
Module,
1918
MoveLabwareOnDeck,
2019
RESPONSIVENESS,
2120
SPACING,
@@ -27,7 +26,6 @@ import {
2726
getLoadedLabwareDefinitionsByUri,
2827
getModuleType,
2928
GRIPPER_WASTE_CHUTE_ADDRESSABLE_AREA,
30-
inferModuleOrientationFromXCoordinate,
3129
OT2_ROBOT_TYPE,
3230
TC_MODULE_LOCATION_OT2,
3331
TC_MODULE_LOCATION_OT3,
@@ -124,16 +122,29 @@ export function MoveLabwareInterventionContent({
124122
const deckDef = getDeckDefFromRobotType(robotType)
125123
const deckConfig = useNotifyDeckConfigurationQuery().data ?? []
126124

127-
const moduleRenderInfo = getRunModuleRenderInfo(
128-
run,
129-
deckDef,
130-
labwareDefsByUri
131-
)
132125
const labwareRenderInfo = getRunLabwareRenderInfo(
133126
run,
134127
labwareDefsByUri,
135128
deckDef
136129
)
130+
const moduleRenderInfo = getRunModuleRenderInfo(
131+
run,
132+
deckDef,
133+
labwareDefsByUri
134+
)
135+
const modulesOnDeck = moduleRenderInfo
136+
?.filter(module => module.targetSlotId != null)
137+
.map(module => {
138+
return {
139+
moduleModel: module.moduleDef.model,
140+
moduleLocation: { slotName: module.targetSlotId ?? '' },
141+
nestedLabwareDef:
142+
module.nestedLabwareId !== command.params.labwareId
143+
? module.nestedLabwareDef
144+
: null,
145+
}
146+
})
147+
137148
const oldLabwareLocation =
138149
getLoadedLabware(run.labware, command.params.labwareId)?.location ?? null
139150

@@ -202,39 +213,9 @@ export function MoveLabwareInterventionContent({
202213
loadedModules={run.modules}
203214
loadedLabware={run.labware}
204215
deckConfig={deckConfig}
216+
modulesOnDeck={modulesOnDeck}
205217
backgroundItems={
206218
<>
207-
{moduleRenderInfo.map(
208-
({
209-
x,
210-
y,
211-
moduleId,
212-
moduleDef,
213-
nestedLabwareDef,
214-
nestedLabwareId,
215-
targetDeckId,
216-
targetSlotId,
217-
}) => (
218-
<Module
219-
key={moduleId}
220-
def={moduleDef}
221-
x={x}
222-
y={y}
223-
orientation={inferModuleOrientationFromXCoordinate(x)}
224-
targetDeckId={targetDeckId}
225-
targetSlotId={targetSlotId}
226-
childrenPositioningMode="offsetToSlot"
227-
>
228-
{nestedLabwareDef != null &&
229-
nestedLabwareId !== command.params.labwareId ? (
230-
<LabwareRender
231-
definition={nestedLabwareDef}
232-
positioningMode="offsetInSlot"
233-
/>
234-
) : null}
235-
</Module>
236-
)
237-
)}
238219
{labwareRenderInfo
239220
.filter(l => l.labwareId !== command.params.labwareId)
240221
.map(({ labwareOrigin, labwareDef, labwareId }) => (

components/src/hardware-sim/Deck/MoveLabwareOnDeck.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import type {
2424
RobotType,
2525
Vector3D,
2626
} from '@opentrons/shared-data'
27+
import type { ModuleOnDeck } from '../../hardware-sim/BaseDeck'
2728
import type { StyleProps } from '../../primitives'
2829

2930
const SPLASH_Y_BUFFER_MM = 10
@@ -35,6 +36,7 @@ interface MoveLabwareOnDeckProps extends StyleProps {
3536
finalLabwareLocation: LabwareLocation
3637
loadedModules: LoadedModule[]
3738
loadedLabware: LoadedLabware[]
39+
modulesOnDeck?: ModuleOnDeck[]
3840
labwareDefinitions: LabwareDefinition[]
3941
deckConfig: DeckConfiguration
4042
backgroundItems?: ReactNode
@@ -47,6 +49,7 @@ export function MoveLabwareOnDeck(
4749
robotType,
4850
movedLabwareDef,
4951
loadedLabware,
52+
modulesOnDeck,
5053
labwareDefinitions,
5154
initialLabwareLocation,
5255
finalLabwareLocation,
@@ -137,6 +140,7 @@ export function MoveLabwareOnDeck(
137140
<BaseDeck
138141
deckConfig={deckConfig}
139142
robotType={robotType}
143+
modulesOnDeck={modulesOnDeck}
140144
svgProps={{
141145
style: { opacity: springProps.deckOpacity },
142146
...styleProps,

0 commit comments

Comments
 (0)