Skip to content

Commit 40dd787

Browse files
fix(app): Fix module positioning in certain deck maps (#18871)
## Overview Closes EXEC-1645. ## Details The `<Module>` component knows how to offset itself so it's positioned correctly relative to the deck, but in order do that, we need to remember to pass it the `targetDeckId` and `targetSlotId` props, which are optional. A util feeding a couple of deck maps was forgetting to do that, so `<Module>` fell back using default, slot-nonspecific positioning. This was too subtle of an error to be noticeable for most modules, but it is noticeable for at least the Thermocycler.
1 parent bcd8a81 commit 40dd787

File tree

4 files changed

+17
-1
lines changed

4 files changed

+17
-1
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,13 +149,17 @@ export function TwoColLwInfoAndDeck(
149149
moduleDef,
150150
nestedLabwareDef,
151151
nestedLabwareId,
152+
targetDeckId,
153+
targetSlotId,
152154
}) => (
153155
<Module
154156
key={moduleId}
155157
def={moduleDef}
156158
x={x}
157159
y={y}
158160
orientation={inferModuleOrientationFromXCoordinate(x)}
161+
targetDeckId={targetDeckId}
162+
targetSlotId={targetSlotId}
159163
>
160164
{nestedLabwareDef != null &&
161165
nestedLabwareId !== failedLwId ? (

app/src/organisms/InterventionModal/MoveLabwareInterventionContent.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,13 +210,17 @@ export function MoveLabwareInterventionContent({
210210
moduleDef,
211211
nestedLabwareDef,
212212
nestedLabwareId,
213+
targetDeckId,
214+
targetSlotId,
213215
}) => (
214216
<Module
215217
key={moduleId}
216218
def={moduleDef}
217219
x={x}
218220
y={y}
219221
orientation={inferModuleOrientationFromXCoordinate(x)}
222+
targetDeckId={targetDeckId}
223+
targetSlotId={targetSlotId}
220224
>
221225
{nestedLabwareDef != null &&
222226
nestedLabwareId !== command.params.labwareId ? (

app/src/organisms/InterventionModal/__tests__/utils.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ describe('getRunLabwareRenderInfo', () => {
200200
})
201201
})
202202

203-
describe('getCurrentRunModuleRenderInfo', () => {
203+
describe('getRunModuleRenderInfo', () => {
204204
it('returns an empty array if there is no loaded module for the run', () => {
205205
const res = getRunModuleRenderInfo({ modules: [] } as any, {} as any, {})
206206
expect(res).toBeInstanceOf(Array)
@@ -219,6 +219,8 @@ describe('getCurrentRunModuleRenderInfo', () => {
219219
expect(moduleInfo.y).toEqual(0)
220220
expect(moduleInfo.moduleDef.moduleType).toEqual('heaterShakerModuleType')
221221
expect(moduleInfo.moduleId).toEqual('mockModuleID')
222+
expect(moduleInfo.targetDeckId).toEqual(ot2DeckDefV5.otId)
223+
expect(moduleInfo.targetSlotId).toEqual('3') // taken from mockRunData
222224
expect(moduleInfo.nestedLabwareDef).not.toEqual(null)
223225
expect(moduleInfo.nestedLabwareId).toEqual('mockLabwareID')
224226
})

app/src/organisms/InterventionModal/utils/getRunModuleRenderInfo.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ import {
44
SPAN7_8_10_11_SLOT,
55
} from '@opentrons/shared-data'
66

7+
import type { ComponentProps } from 'react'
78
import type { RunData } from '@opentrons/api-client'
9+
import type { Module } from '@opentrons/components'
810
import type {
911
DeckDefinition,
1012
LabwareDefinition,
@@ -19,6 +21,8 @@ export interface RunModuleInfo {
1921
moduleDef: ModuleDefinition
2022
nestedLabwareDef: LabwareDefinition | null
2123
nestedLabwareId: string | null
24+
targetDeckId: ComponentProps<typeof Module>['targetDeckId']
25+
targetSlotId: ComponentProps<typeof Module>['targetSlotId']
2226
}
2327

2428
export function getRunModuleRenderInfo(
@@ -52,6 +56,8 @@ export function getRunModuleRenderInfo(
5256
moduleDef,
5357
nestedLabwareDef,
5458
nestedLabwareId: nestedLabware?.id ?? null,
59+
targetDeckId: deckDef.otId,
60+
targetSlotId: slotName,
5561
},
5662
]
5763
}, [])

0 commit comments

Comments
 (0)