From 741382dbb1ecfb16065d4556b0f5234e7187e008 Mon Sep 17 00:00:00 2001 From: Jamey Huffnagle Date: Thu, 6 Feb 2025 15:57:50 -0500 Subject: [PATCH] fix(app): fix multi-location tip selection during error recovery (#17454) Closes RQA-3927 --- .../ErrorRecoveryFlows/shared/TipSelection.tsx | 1 + .../shared/__tests__/TipSelection.test.tsx | 1 + app/src/organisms/WellSelection/index.tsx | 17 +++++++++++++---- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/app/src/organisms/ErrorRecoveryFlows/shared/TipSelection.tsx b/app/src/organisms/ErrorRecoveryFlows/shared/TipSelection.tsx index f22c7fb268b..ba2b7ec35a5 100644 --- a/app/src/organisms/ErrorRecoveryFlows/shared/TipSelection.tsx +++ b/app/src/organisms/ErrorRecoveryFlows/shared/TipSelection.tsx @@ -37,6 +37,7 @@ export function TipSelection(props: TipSelectionProps): JSX.Element { relevantActiveNozzleLayout )} allowSelect={allowTipSelection} + allowMultiDrag={false} /> ) } diff --git a/app/src/organisms/ErrorRecoveryFlows/shared/__tests__/TipSelection.test.tsx b/app/src/organisms/ErrorRecoveryFlows/shared/__tests__/TipSelection.test.tsx index c6bee4f8d55..36f81c3ca35 100644 --- a/app/src/organisms/ErrorRecoveryFlows/shared/__tests__/TipSelection.test.tsx +++ b/app/src/organisms/ErrorRecoveryFlows/shared/__tests__/TipSelection.test.tsx @@ -42,6 +42,7 @@ describe('TipSelection', () => { channels: props.failedPipetteUtils.failedPipetteInfo?.data.channels ?? 1, allowSelect: props.allowTipSelection, + allowMultiDrag: false, pipetteNozzleDetails: undefined, }), {} diff --git a/app/src/organisms/WellSelection/index.tsx b/app/src/organisms/WellSelection/index.tsx index 06daf9536a5..27949aa14e6 100644 --- a/app/src/organisms/WellSelection/index.tsx +++ b/app/src/organisms/WellSelection/index.tsx @@ -1,5 +1,6 @@ import { useState } from 'react' import reduce from 'lodash/reduce' +import pick from 'lodash/pick' import { COLORS, Labware, RobotCoordinateSpace } from '@opentrons/components' import { @@ -29,6 +30,8 @@ interface WellSelectionProps { pipetteNozzleDetails?: NozzleLayoutDetails /* Whether highlighting and selectWells() updates are permitted. */ allowSelect?: boolean + /* Whether selecting more than the channel count of well locations is permitted. */ + allowMultiDrag?: boolean } export function WellSelection(props: WellSelectionProps): JSX.Element { @@ -40,6 +43,7 @@ export function WellSelection(props: WellSelectionProps): JSX.Element { channels, pipetteNozzleDetails, allowSelect = true, + allowMultiDrag = true, } = props const [highlightedWells, setHighlightedWells] = useState({}) @@ -61,16 +65,21 @@ export function WellSelection(props: WellSelectionProps): JSX.Element { }) if (!wellSet) { return acc + } else if (allowMultiDrag) { + return { ...acc, [wellSet[0]]: null } + } else { + return { [wellSet[0]]: null } } - return { ...acc, [wellSet[0]]: null } }, {} ) return primaryWells + } else { + // single-channel or ingred selection mode + return allowMultiDrag + ? selectedWells + : pick(selectedWells, Object.keys(selectedWells)[0]) } - - // single-channel or ingred selection mode - return selectedWells } const _getWellsFromRect: (rect: GenericRect) => WellGroup = rect => {