Skip to content

Commit

Permalink
fix(protocol-designer): duplicate labware thunk refinement for offdeck (
Browse files Browse the repository at this point in the history
  • Loading branch information
jerader authored Jun 3, 2024
1 parent 203c1e4 commit 7a3be49
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions protocol-designer/src/labware-ingred/actions/thunks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export const duplicateLabware: (
robotType,
labwareDef
)
if (duplicateSlot == null) {
if (duplicateSlot == null && !templateLabwareIdIsOffDeck) {
console.error('no slots available, cannot duplicate labware')
}
const allNicknamesById = uiLabwareSelectors.getLabwareNicknamesById(state)
Expand All @@ -140,15 +140,29 @@ export const duplicateLabware: (
Object.keys(allNicknamesById).map((id: string) => allNicknamesById[id]), // NOTE: flow won't do Object.values here >:(
templateNickname
)
const duplicateLabwareId = uuid() + ':' + templateLabwareDefURI

if (templateLabwareDefURI && duplicateSlot != null) {
if (templateLabwareDefURI) {
if (templateLabwareIdIsOffDeck) {
dispatch({
type: 'DUPLICATE_LABWARE',
payload: {
duplicateLabwareNickname,
templateLabwareId,
duplicateLabwareId,
slot: 'offDeck',
},
})
}
}
if (duplicateSlot != null && !templateLabwareIdIsOffDeck) {
dispatch({
type: 'DUPLICATE_LABWARE',
payload: {
duplicateLabwareNickname,
templateLabwareId,
duplicateLabwareId: uuid() + ':' + templateLabwareDefURI,
slot: templateLabwareIdIsOffDeck ? 'offDeck' : duplicateSlot,
duplicateLabwareId,
slot: duplicateSlot,
},
})
}
Expand Down

0 comments on commit 7a3be49

Please sign in to comment.