Skip to content

Commit

Permalink
fix(protocol-designer): default to correct tiprack uri (#15224)
Browse files Browse the repository at this point in the history
closes RQA-2709
  • Loading branch information
jerader authored May 20, 2024
1 parent ab34746 commit bf6bbd7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ export function TiprackField(props: TiprackFieldProps): JSX.Element {
defaultTiprackUris.includes(option.value)
)

React.useEffect(() => {
// if default value is not included in the pipette's tiprack uris then
// change it so it is
if (!defaultTiprackUris.includes(value as string)) {
updateValue(defaultTiprackUris[0])
}
}, [defaultTiprackUris, value, updateValue])
const hasMissingTiprack = defaultTiprackUris.length > tiprackOptions.length
return (
<Box {...targetProps}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ describe('createPresavedStepForm', () => {
pipette: 'leftPipetteId',
nozzles: null,
stepType: 'moveLiquid',
tipRack: 'defaultTipRack',
tipRack: null,
// default fields
dropTip_location: 'mockTrash',
aspirate_airGap_checkbox: false,
Expand Down Expand Up @@ -228,7 +228,7 @@ describe('createPresavedStepForm', () => {
volume: undefined,
aspirate_flowRate: null,
dispense_flowRate: null,
tipRack: 'defaultTipRack',
tipRack: null,
blowout_flowRate: null,
})
})
Expand Down
48 changes: 0 additions & 48 deletions protocol-designer/src/step-forms/utils/createPresavedStepForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,45 +118,6 @@ const _patchDefaultDropTipLocation = (args: {
return null
}

const _patchDefaultTiprack = (args: {
initialDeckSetup: InitialDeckSetup
labwareEntities: LabwareEntities
pipetteEntities: PipetteEntities
savedStepForms: SavedStepFormState
orderedStepIds: OrderedStepIdsState
}): FormUpdater => formData => {
const {
initialDeckSetup,
labwareEntities,
pipetteEntities,
savedStepForms,
orderedStepIds,
} = args
const defaultPipetteId = getNextDefaultPipetteId(
savedStepForms,
orderedStepIds,
initialDeckSetup.pipettes
)

const pipetteFirstTiprackDefUri =
pipetteEntities[defaultPipetteId].tiprackDefURI[0]
const formHasTipRackField = formData && 'tipRack' in formData

if (formHasTipRackField) {
const updatedFields = handleFormChange(
{
tipRack: pipetteFirstTiprackDefUri,
},
formData,
pipetteEntities,
labwareEntities
)
return updatedFields
}

return null
}

const _patchDefaultMagnetFields = (args: {
initialDeckSetup: InitialDeckSetup
orderedStepIds: OrderedStepIdsState
Expand Down Expand Up @@ -312,14 +273,6 @@ export const createPresavedStepForm = ({
additionalEquipmentEntities,
})

const updateDefaultTipRack = _patchDefaultTiprack({
initialDeckSetup,
labwareEntities,
orderedStepIds,
pipetteEntities,
savedStepForms,
})

const updateDefaultPipette = _patchDefaultPipette({
initialDeckSetup,
labwareEntities,
Expand Down Expand Up @@ -360,7 +313,6 @@ export const createPresavedStepForm = ({
return [
updateDefaultPipette,
updateDefaultDropTip,
updateDefaultTipRack,
updateTemperatureModuleId,
updateThermocyclerFields,
updateHeaterShakerModuleId,
Expand Down

0 comments on commit bf6bbd7

Please sign in to comment.