Skip to content

Commit 6ede00e

Browse files
committed
Merge back 'chore_release-pd-8.5.0' into 'edge' (#19128)
Resolved conflicts: - protocol-designer/src/components/organisms/LabwareCardOverflowMenu/index.tsx
2 parents 82f33e0 + 894bd9e commit 6ede00e

File tree

2 files changed

+30
-25
lines changed
  • protocol-designer/src/components/organisms/LabwareCardOverflowMenu
  • step-generation/src/commandCreators/atomic

2 files changed

+30
-25
lines changed

protocol-designer/src/components/organisms/LabwareCardOverflowMenu/index.tsx

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -106,21 +106,15 @@ export function LabwareCardOverflowMenu(
106106
if (lidId != null) {
107107
dispatch(deleteContainer({ labwareId: lidId }))
108108
}
109-
if (isAdapter) {
110-
dispatch(
111-
editSlotInfo({
112-
adapterDefURI: null,
113-
})
114-
)
115-
} else {
116-
dispatch(
117-
editSlotInfo({
118-
labwareDefURI: null,
119-
lidDefURI: null,
120-
amount: 1,
121-
})
122-
)
109+
const module = moduleId != null ? deckSetupModules[moduleId] : null
110+
const moduleModel = module?.model ?? null
111+
const newSlotInfo = {
112+
...(moduleModel != null ? { moduleModel } : {}),
113+
...(isAdapter === true
114+
? { adapterDefURI: null }
115+
: { labwareDefURI: null, lidDefURI: null, amount: 1 }),
123116
}
117+
dispatch(editSlotInfo(newSlotInfo))
124118
}
125119
const handleConfirmDeleteEntityInUseModal = (): void => {
126120
labwareIds.forEach(labwareId => {

step-generation/src/commandCreators/atomic/moveLabware.ts

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import type {
3636
CommandCreator,
3737
CommandCreatorError,
3838
CommandCreatorWarning,
39+
ModuleState,
3940
} from '../../types'
4041

4142
/** Move labware from one location to another, manually or via a gripper. */
@@ -125,10 +126,25 @@ export const moveLabware: CommandCreator<MoveLabwareParams> = (
125126
const initialSlot =
126127
initialAdapterSlot != null ? initialAdapterSlot : initialLabwareSlot
127128

128-
const initialModuleState =
129-
initialSlot != null
130-
? prevRobotState.modules[initialSlot]?.moduleState
131-
: null
129+
const getModuleStateFromSlotOrId = (
130+
identifier: string | null
131+
): ModuleState | null => {
132+
if (identifier == null) {
133+
return null
134+
} else if (identifier in prevRobotState.modules) {
135+
// identifier is a module id
136+
return prevRobotState.modules[identifier].moduleState
137+
} else {
138+
// identifier is a slot name
139+
return (
140+
Object.values(prevRobotState.modules).find(
141+
({ slot }) => slot === identifier
142+
)?.moduleState ?? null
143+
)
144+
}
145+
}
146+
147+
const initialModuleState = getModuleStateFromSlotOrId(initialSlot)
132148
if (initialModuleState != null) {
133149
if (
134150
initialModuleState.type === THERMOCYCLER_MODULE_TYPE &&
@@ -181,13 +197,8 @@ export const moveLabware: CommandCreator<MoveLabwareParams> = (
181197
warnings.push(warningCreators.labwareInWasteChuteHasLiquid())
182198
}
183199

184-
if (
185-
destinationModuleIdOrSlot != null &&
186-
prevRobotState.modules[destinationModuleIdOrSlot] != null
187-
) {
188-
const destModuleState =
189-
prevRobotState.modules[destinationModuleIdOrSlot].moduleState
190-
200+
const destModuleState = getModuleStateFromSlotOrId(destinationModuleIdOrSlot)
201+
if (destModuleState != null) {
191202
if (
192203
destModuleState.type === THERMOCYCLER_MODULE_TYPE &&
193204
destModuleState.lidOpen !== true

0 commit comments

Comments
 (0)