From 28261dcc5a3c0c5554fbfea57238fc22fc0f1e5a Mon Sep 17 00:00:00 2001 From: syao1226 <146495172+syao1226@users.noreply.github.com> Date: Wed, 13 Nov 2024 15:21:12 -0500 Subject: [PATCH] fix(protocol-designer): fix multi-channel to single-channel switch issue with trash bin destination (#16789) fix RQA-3543 # Overview Fixing a TypeError when switching from a multi-channel to a single-channel pipette with the trash bin or waste chute as the destination labware, caused by an inability to get the labware definition for these destinations. ## Test Plan and Hands on Testing ## Changelog - Added a condition to differentiate trash bin/waste chute from other labware when updating `dispense_wells` with a multi-channel pipette. Used `getDefaultWells` for the trash bin/waste chute, as they lack well locations and labware definitions. ## Review requests ## Risk assessment --------- Co-authored-by: shiyaochen --- .../dependentFieldsUpdateMoveLiquid.ts | 25 +++++++++++++------ 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/protocol-designer/src/steplist/formLevel/handleFormChange/dependentFieldsUpdateMoveLiquid.ts b/protocol-designer/src/steplist/formLevel/handleFormChange/dependentFieldsUpdateMoveLiquid.ts index e40486135dc..752a6629386 100644 --- a/protocol-designer/src/steplist/formLevel/handleFormChange/dependentFieldsUpdateMoveLiquid.ts +++ b/protocol-designer/src/steplist/formLevel/handleFormChange/dependentFieldsUpdateMoveLiquid.ts @@ -514,10 +514,10 @@ const updatePatchOnPipetteChannelChange = ( const multiToSingle = (prevChannels === 8 || prevChannels === 96) && nextChannels === 1 + const pipetteId: string = appliedPatch.pipette as string + if (patch.pipette === null || singleToMulti) { // reset all well selection - // @ts-expect-error(sa, 2021-6-14): appliedPatch.pipette does not exist. Address in #3161 - const pipetteId: string = appliedPatch.pipette update = { aspirate_wells: getDefaultWells({ // @ts-expect-error(sa, 2021-6-14): appliedPatch.aspirate_labware does not exist. Address in #3161 @@ -545,18 +545,27 @@ const updatePatchOnPipetteChannelChange = ( const sourceLabware = labwareEntities[sourceLabwareId] const sourceLabwareDef = sourceLabware.def const destLabware = labwareEntities[destLabwareId] - const destLabwareDef = destLabware.def + update = { aspirate_wells: getAllWellsFromPrimaryWells( appliedPatch.aspirate_wells as string[], sourceLabwareDef, channels as 8 | 96 ), - dispense_wells: getAllWellsFromPrimaryWells( - appliedPatch.dispense_wells as string[], - destLabwareDef, - channels as 8 | 96 - ), + dispense_wells: + destLabwareId.includes('trashBin') || + destLabwareId.includes('wasteChute') + ? getDefaultWells({ + labwareId: destLabwareId, + pipetteId, + labwareEntities, + pipetteEntities, + }) + : getAllWellsFromPrimaryWells( + appliedPatch.dispense_wells as string[], + destLabware.def, + channels as 8 | 96 + ), } }