Skip to content

Commit 891b840

Browse files
authored
fix(protocol-designer,shared-data): remove blowout placeholder (#18913)
This PR fixes blowout flow rate behavior to not show an inaccurate placeholder value when the field is empty. It also correctly transforms the liquid class's retract blowout location value to its corresponding value in the PD UI blowout location dropdown (`'source'` -> `'source_well'`, `'destination'` -> `'dest_well'`) Closes RQA-4372
1 parent 5da5aaf commit 891b840

File tree

3 files changed

+27
-22
lines changed

3 files changed

+27
-22
lines changed

protocol-designer/src/pages/Designer/ProtocolSteps/StepForm/PipetteFields/FlowRateField.tsx

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -171,17 +171,18 @@ export function FlowRateField(props: FlowRateFieldProps): JSX.Element {
171171
const isFlowRateOutOfBounds =
172172
(maxFlowRate != null && flowRateNum > maxFlowRate) || flowRateNum < 0
173173

174-
let errorMessage: string | null = null
175-
if (
176-
(!isPristine && passThruProps.value !== undefined && flowRateNum === 0) ||
174+
const errorMessage =
175+
(passThruProps.value &&
176+
!isPristine &&
177+
passThruProps.value !== undefined &&
178+
flowRateNum === 0) ||
177179
isFlowRateOutOfBounds ||
178180
(isPristine && flowRateNum === 0)
179-
) {
180-
errorMessage = i18n.format(
181-
t('step_edit_form.field.flow_rate.error_out_of_bounds'),
182-
'capitalize'
183-
)
184-
}
181+
? i18n.format(
182+
t('step_edit_form.field.flow_rate.error_out_of_bounds'),
183+
'capitalize'
184+
)
185+
: passThruProps.errorToShow ?? null
185186

186187
useEffect(() => {
187188
if (isPristine && passThruProps.value == null) {
@@ -195,7 +196,7 @@ export function FlowRateField(props: FlowRateFieldProps): JSX.Element {
195196
padding={padding}
196197
type="number"
197198
setIsPristine={setIsPristine}
198-
errorToShow={maxFlowRate != null ? errorMessage : null}
199+
errorToShow={errorMessage}
199200
key={`${flowRateType}_FlowRateInput`}
200201
title={title}
201202
showTooltip={false}
@@ -209,7 +210,6 @@ export function FlowRateField(props: FlowRateFieldProps): JSX.Element {
209210
})
210211
: null
211212
}
212-
placeholder={String(defaultFlowRate)}
213213
/>
214214
)
215215
}

protocol-designer/src/steplist/formLevel/handleFormChange/utils.ts

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
WATER_LIQUID_CLASS_NAME,
1414
} from '@opentrons/shared-data'
1515
import {
16+
DEST_WELL_BLOWOUT_DESTINATION,
1617
getTransferPlanAndReferenceVolumes,
1718
SOURCE_WELL_BLOWOUT_DESTINATION,
1819
} from '@opentrons/step-generation'
@@ -382,13 +383,20 @@ const getBlowoutFields = (args: {
382383
hardwareMaximumFlowRate = null,
383384
} = args
384385
const { enable, params } = blowout
385-
// transform location to additional equipment entity ID
386-
const transformedLocation =
387-
(params?.location === 'trash'
388-
? Object.values(additionalEquipmentEntities).find(
389-
({ name }) => name === 'trashBin' || name === 'wasteChute'
390-
)?.id
391-
: params?.location) ?? null
386+
387+
// transform location
388+
let transformedLocation: string | null = null
389+
if (params?.location === 'trash') {
390+
transformedLocation =
391+
Object.values(additionalEquipmentEntities).find(
392+
({ name }) => name === 'trashBin' || name === 'wasteChute'
393+
)?.id ?? null
394+
} else if (params?.location === 'source') {
395+
transformedLocation = SOURCE_WELL_BLOWOUT_DESTINATION
396+
} else if (params?.location === 'destination') {
397+
transformedLocation = DEST_WELL_BLOWOUT_DESTINATION
398+
}
399+
392400
const checkedFlowRate =
393401
params != null
394402
? min([

shared-data/js/helpers/linearInterpolate.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,8 @@ export const linearInterpolate = (
1717
left: number | null = null,
1818
right: number | null = null
1919
): number | null => {
20-
console.assert(
21-
interpolationPoints.length > 0,
22-
'At least one point required for interpolation'
23-
)
2420
if (interpolationPoints.length === 0) {
21+
console.warn('At least one point required for interpolation')
2522
return null
2623
}
2724
const sortedInterpolationPoints = interpolationPoints.sort((a, b) => {

0 commit comments

Comments
 (0)