@@ -14,6 +14,7 @@ import {
1414 StyledText ,
1515} from '@opentrons/components'
1616import {
17+ FLEX_SINGLE_SLOT_BY_CUTOUT_ID ,
1718 getTipTypeFromTipRackDefinition ,
1819 LOW_VOLUME_PIPETTES ,
1920 TRASH_BIN_ADAPTER_FIXTURE ,
@@ -65,41 +66,62 @@ export function DisposalVolume(props: DisposalVolumeProps): JSX.Element {
6566 if ( typeof blowOut . location === 'string' ) {
6667 return blowOut . location
6768 }
68- return `trashBin:${ blowOut . location . cutoutId } `
69+ if (
70+ 'cutoutFixtureId' in blowOut . location &&
71+ typeof blowOut . location . cutoutFixtureId === 'string' &&
72+ WASTE_CHUTE_FIXTURES . includes ( blowOut . location . cutoutFixtureId )
73+ ) {
74+ return `wasteChute:${ blowOut . location . cutoutId } `
75+ }
76+ if ( 'cutoutId' in blowOut . location ) {
77+ return `trashBin:${ blowOut . location . cutoutId } `
78+ }
79+ return ''
6980 }
7081
7182 const [ selectedBlowoutLocation , setSelectedBlowoutLocation ] =
7283 useState < string > ( getInitialBlowoutLocation ( state . blowOutDispense ) )
7384 const [ flowRate , setFlowRate ] = useState < number | null > ( null )
7485 const deckConfig = useNotifyDeckConfigurationQuery ( ) . data ?? [ ]
75- const fixtureLocationOptions = deckConfig . filter (
76- cutoutConfig =>
77- WASTE_CHUTE_FIXTURES . includes ( cutoutConfig . cutoutFixtureId ) ||
78- TRASH_BIN_ADAPTER_FIXTURE === cutoutConfig . cutoutFixtureId
79- )
80-
81- const trashBinCutoutId = fixtureLocationOptions . find (
82- option => option . cutoutFixtureId === TRASH_BIN_ADAPTER_FIXTURE
83- ) ?. cutoutId
8486
87+ const trashBinCutoutConfig = deckConfig . find (
88+ cutoutConfig => cutoutConfig . cutoutFixtureId === TRASH_BIN_ADAPTER_FIXTURE
89+ )
8590 const trashBinOption : BlowOutLocation | undefined =
86- trashBinCutoutId != null
91+ trashBinCutoutConfig != null
8792 ? {
88- cutoutId : trashBinCutoutId ,
93+ cutoutId : trashBinCutoutConfig . cutoutId ,
8994 cutoutFixtureId : TRASH_BIN_ADAPTER_FIXTURE ,
9095 }
9196 : undefined
9297
98+ const wasteChuteOptions = deckConfig
99+ . filter (
100+ option =>
101+ typeof option . cutoutFixtureId === 'string' &&
102+ WASTE_CHUTE_FIXTURES . includes ( option . cutoutFixtureId )
103+ )
104+ . map ( option => ( {
105+ option,
106+ value : `wasteChute:${ option . cutoutId } ` ,
107+ description : t ( 'wasteChute_location' , {
108+ slotName : FLEX_SINGLE_SLOT_BY_CUTOUT_ID [ option . cutoutId ] ,
109+ } ) ,
110+ } ) )
111+
93112 const blowoutLocationOptions = [
94113 ...( trashBinOption != null
95114 ? [
96115 {
97116 option : trashBinOption ,
98117 value : `trashBin:${ trashBinOption . cutoutId } ` ,
99- description : t ( 'trashBin' ) ,
118+ description : t ( 'trashBin_location' , {
119+ slotName : FLEX_SINGLE_SLOT_BY_CUTOUT_ID [ trashBinOption . cutoutId ] ,
120+ } ) ,
100121 } ,
101122 ]
102123 : [ ] ) ,
124+ ...wasteChuteOptions ,
103125 {
104126 option : SOURCE_WELL_BLOWOUT_DESTINATION ,
105127 value : SOURCE_WELL_BLOWOUT_DESTINATION ,
@@ -113,11 +135,14 @@ export function DisposalVolume(props: DisposalVolumeProps): JSX.Element {
113135 const flowRatesForSupportedTip : SupportedTip | undefined =
114136 state . volume < 5 &&
115137 `lowVolumeDefault` in liquidSpecs &&
138+ typeof pipetteName === 'string' &&
116139 LOW_VOLUME_PIPETTES . includes ( pipetteName )
117140 ? liquidSpecs . lowVolumeDefault . supportedTips [ tipType ]
118141 : liquidSpecs . default . supportedTips [ tipType ]
119142 const minFlowRate = 0.1
120- const maxFlowRate = Math . floor ( flowRatesForSupportedTip ?. uiMaxFlowRate ?? 0 )
143+ const maxFlowRate = Math . floor (
144+ ( flowRatesForSupportedTip ?. uiMaxFlowRate ?? 0 ) as number
145+ )
121146
122147 const flowRateError =
123148 flowRate != null && ( flowRate < minFlowRate || flowRate > maxFlowRate )
@@ -145,11 +170,17 @@ export function DisposalVolume(props: DisposalVolumeProps): JSX.Element {
145170 return
146171 }
147172
173+ const selectedOption = blowoutLocationOptions . find (
174+ opt => opt . value === selectedBlowoutLocation
175+ )
176+ const blowOutLocation : BlowOutLocation =
177+ selectedOption ?. option ?? ( selectedBlowoutLocation as BlowOutLocation )
178+
148179 dispatch ( {
149180 type : ACTIONS . SET_DISPOSAL_VOLUME_DISPENSE ,
150181 disposalVolumeDispenseSettings : {
151182 volume,
152- blowOutLocation : selectedBlowoutLocation as BlowOutLocation ,
183+ blowOutLocation,
153184 flowRate,
154185 } ,
155186 } )
@@ -257,7 +288,8 @@ export function DisposalVolume(props: DisposalVolumeProps): JSX.Element {
257288 key = { option . value }
258289 isSelected = { selectedBlowoutLocation === option . value }
259290 onChange = { ( ) => {
260- setSelectedBlowoutLocation ( option . value )
291+ const value = String ( option . value )
292+ setSelectedBlowoutLocation ( value )
261293 } }
262294 buttonValue = { option . value }
263295 buttonLabel = { option . description }
0 commit comments