diff --git a/protocol-designer/src/steplist/formLevel/handleFormChange/dependentFieldsUpdateMix.ts b/protocol-designer/src/steplist/formLevel/handleFormChange/dependentFieldsUpdateMix.ts index c564b185ed9..de8a28df5c3 100644 --- a/protocol-designer/src/steplist/formLevel/handleFormChange/dependentFieldsUpdateMix.ts +++ b/protocol-designer/src/steplist/formLevel/handleFormChange/dependentFieldsUpdateMix.ts @@ -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' + ), + } + } + + return patch +} + +const updatePatchOnTiprackChange = ( + patch: FormPatch, + rawForm: FormData +): FormPatch => { + if (fieldHasChanged(rawForm, patch, 'tipRack')) { return { ...patch, ...getDefaultFields('aspirate_flowRate', 'dispense_flowRate'), @@ -168,7 +186,7 @@ export function dependentFieldsUpdateMix( labwareEntities, pipetteEntities ), - chainPatch => - updatePatchOnPipetteChange(chainPatch, rawForm, pipetteEntities), + chainPatch => updatePatchOnPipetteChange(chainPatch, rawForm), + chainPatch => updatePatchOnTiprackChange(chainPatch, rawForm), ]) } diff --git a/protocol-designer/src/steplist/formLevel/handleFormChange/dependentFieldsUpdateMoveLiquid.ts b/protocol-designer/src/steplist/formLevel/handleFormChange/dependentFieldsUpdateMoveLiquid.ts index a0385305a55..e40486135dc 100644 --- a/protocol-designer/src/steplist/formLevel/handleFormChange/dependentFieldsUpdateMoveLiquid.ts +++ b/protocol-designer/src/steplist/formLevel/handleFormChange/dependentFieldsUpdateMoveLiquid.ts @@ -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 + 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, @@ -662,5 +695,7 @@ export function dependentFieldsUpdateMoveLiquid( chainPatch => updatePatchBlowoutFields(chainPatch, rawForm), chainPatch => clampDispenseAirGapVolume(chainPatch, rawForm, pipetteEntities), + chainPatch => + updatePatchOnTiprackChange(chainPatch, rawForm, pipetteEntities), ]) } diff --git a/protocol-designer/src/steplist/formLevel/handleFormChange/test/mix.test.ts b/protocol-designer/src/steplist/formLevel/handleFormChange/test/mix.test.ts index 7c8f9ff97d5..5ae4f4d6897 100644 --- a/protocol-designer/src/steplist/formLevel/handleFormChange/test/mix.test.ts +++ b/protocol-designer/src/steplist/formLevel/handleFormChange/test/mix.test.ts @@ -94,6 +94,8 @@ describe('well selection should update', () => { wells: [], aspirate_flowRate: null, dispense_flowRate: null, + nozzles: null, + tipRack: null, }) }) it('pipette single -> multi', () => { @@ -105,6 +107,8 @@ describe('well selection should update', () => { wells: [], aspirate_flowRate: null, dispense_flowRate: null, + nozzles: null, + tipRack: null, }) }) it('pipette multi -> single', () => { @@ -117,6 +121,8 @@ describe('well selection should update', () => { wells: ['A10', 'B10', 'C10', 'D10', 'E10', 'F10', 'G10', 'H10'], aspirate_flowRate: null, dispense_flowRate: null, + nozzles: null, + tipRack: null, }) }) it('select single-well labware', () => {