From 7a3be496dfabe2e2925911935c342bb98ffd0b99 Mon Sep 17 00:00:00 2001 From: Jethary Rader <66035149+jerader@users.noreply.github.com> Date: Mon, 3 Jun 2024 11:31:25 -0400 Subject: [PATCH] fix(protocol-designer): duplicate labware thunk refinement for offdeck (#15312) closes RQA-2792 --- .../src/labware-ingred/actions/thunks.ts | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/protocol-designer/src/labware-ingred/actions/thunks.ts b/protocol-designer/src/labware-ingred/actions/thunks.ts index dbda17a9974..33d054f930e 100644 --- a/protocol-designer/src/labware-ingred/actions/thunks.ts +++ b/protocol-designer/src/labware-ingred/actions/thunks.ts @@ -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) @@ -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, }, }) }