Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(protocol-designer): add dependent fields when tiprack changes #16790

Merged
merged 3 commits into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,30 @@ const updatePatchOnPipetteChannelChange = (

const updatePatchOnPipetteChange = (
patch: FormPatch,
rawForm: FormData,
pipetteEntities: PipetteEntities
rawForm: FormData
): FormPatch => {
// when pipette ID is changed (to another ID, or to null),
// set any flow rates to null
if (fieldHasChanged(rawForm, patch, 'pipette')) {
return {
...patch,
...getDefaultFields(
'aspirate_flowRate',
'dispense_flowRate',
'tipRack',
'nozzles'
Comment on lines +144 to +145
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added tiprack and nozzles as well in here because if the user changes the pipette, we probably want both of these fields to be reset as well.

),
}
}

return patch
}

const updatePatchOnTiprackChange = (
patch: FormPatch,
rawForm: FormData
): FormPatch => {
if (fieldHasChanged(rawForm, patch, 'tipRack')) {
return {
...patch,
...getDefaultFields('aspirate_flowRate', 'dispense_flowRate'),
Expand Down Expand Up @@ -168,7 +186,7 @@ export function dependentFieldsUpdateMix(
labwareEntities,
pipetteEntities
),
chainPatch =>
updatePatchOnPipetteChange(chainPatch, rawForm, pipetteEntities),
chainPatch => updatePatchOnPipetteChange(chainPatch, rawForm),
chainPatch => updatePatchOnTiprackChange(chainPatch, rawForm),
])
}
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,40 @@ const updatePatchOnPipetteChange = (
'dispense_mix_volume',
'disposalVolume_volume',
'aspirate_mmFromBottom',
'dispense_mmFromBottom'
'dispense_mmFromBottom',
'nozzles',
'tipRack'
),
aspirate_airGap_volume: airGapVolume,
dispense_airGap_volume: airGapVolume,
}
}

return patch
}

const updatePatchOnTiprackChange = (
patch: FormPatch,
rawForm: FormData,
pipetteEntities: PipetteEntities
): FormPatch => {
if (fieldHasChanged(rawForm, patch, 'tipRack')) {
const pipette = patch.pipette
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit
const { pipette } = patch

let airGapVolume: string | null = null

if (typeof pipette === 'string' && pipette in pipetteEntities) {
const minVolume = getMinPipetteVolume(pipetteEntities[pipette])
airGapVolume = minVolume.toString()
}

return {
...patch,
...getDefaultFields(
'aspirate_flowRate',
'dispense_flowRate',
'aspirate_mix_volume',
'dispense_mix_volume',
'disposalVolume_volume'
),
aspirate_airGap_volume: airGapVolume,
dispense_airGap_volume: airGapVolume,
Expand Down Expand Up @@ -662,5 +695,7 @@ export function dependentFieldsUpdateMoveLiquid(
chainPatch => updatePatchBlowoutFields(chainPatch, rawForm),
chainPatch =>
clampDispenseAirGapVolume(chainPatch, rawForm, pipetteEntities),
chainPatch =>
updatePatchOnTiprackChange(chainPatch, rawForm, pipetteEntities),
])
}
Loading