Skip to content

Commit 894bd9e

Browse files
authored
fix(protocol-designer): ensure module does not disappear when clearing labware (#19101)
This PR fixes the logic in clearing a zoomed in slot when adding and clearing labware such that the module does not disappear. Closes AUTH-2171
1 parent 7fc8623 commit 894bd9e

File tree

1 file changed

+8
-14
lines changed
  • protocol-designer/src/components/organisms/LabwareCardOverflowMenu

1 file changed

+8
-14
lines changed

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

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -103,21 +103,15 @@ export function LabwareCardOverflowMenu(
103103
labwareIds.forEach(labwareId => {
104104
dispatch(deleteContainer({ labwareId }))
105105
})
106-
if (isAdapter) {
107-
dispatch(
108-
editSlotInfo({
109-
adapterDefURI: null,
110-
})
111-
)
112-
} else {
113-
dispatch(
114-
editSlotInfo({
115-
labwareDefURI: null,
116-
lidDefURI: null,
117-
amount: 1,
118-
})
119-
)
106+
const module = moduleId != null ? deckSetupModules[moduleId] : null
107+
const moduleModel = module?.model ?? null
108+
const newSlotInfo = {
109+
...(moduleModel != null ? { moduleModel } : {}),
110+
...(isAdapter === true
111+
? { adapterDefURI: null }
112+
: { labwareDefURI: null, lidDefURI: null, amount: 1 }),
120113
}
114+
dispatch(editSlotInfo(newSlotInfo))
121115
}
122116
const handleConfirmDeleteEntityInUseModal = (): void => {
123117
labwareIds.forEach(labwareId => {

0 commit comments

Comments
 (0)