Skip to content

Commit c154e04

Browse files
committed
Merge remote-tracking branch 'origin/chore_release-pd-8.8.0' into temp-880-into-900
2 parents f7404dc + 32c59d3 commit c154e04

File tree

6 files changed

+48
-18
lines changed

6 files changed

+48
-18
lines changed

protocol-designer/src/pages/Designer/DeckSetup/DeckSetupToolbox.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,17 @@ export function DeckSetupToolbox(
138138
(createdAdapterForSlot == null && createdStackForSlot.length === 0) ||
139139
(createdStackForSlot.length === 0 && deckSetup.labware[slot] != null)
140140
const handleClear = (): void => {
141-
if (slot !== 'offDeck' && offDeckLabware == null) {
141+
if (isHopperSlot) {
142+
const labwareIdsToDelete = (labwareInHopper ?? []).reduce<string[]>(
143+
(acc, group) => {
144+
return [...acc, ...Object.values(group).filter(id => id != null)]
145+
},
146+
[]
147+
)
148+
labwareIdsToDelete.forEach(labwareId => {
149+
dispatch(deleteContainer({ labwareId: labwareId }))
150+
})
151+
} else if (slot !== 'offDeck' && offDeckLabware == null) {
142152
if (createdAdapterForSlot != null) {
143153
dispatch(deleteContainer({ labwareId: createdAdapterForSlot.id }))
144154
}

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ import { useTranslation } from 'react-i18next'
33
import { useSelector } from 'react-redux'
44

55
import { DropdownMenu, Flex, SPACING } from '@opentrons/components'
6-
import { ALL, COLUMN, SINGLE } from '@opentrons/shared-data'
6+
import { ALL, COLUMN, getIsTiprack, SINGLE } from '@opentrons/shared-data'
77

8-
import { getInitialDeckSetup } from '/protocol-designer/step-forms/selectors'
8+
import { getDeckSetupForActiveItem } from '/protocol-designer/top-selectors/labware-locations'
99

1010
import type { DropdownOption } from '@opentrons/components'
1111
import type { PipetteV2Specs } from '@opentrons/shared-data'
@@ -24,12 +24,10 @@ export function PartialTipField(props: PartialTipFieldProps): JSX.Element {
2424
pipetteSpecs,
2525
} = props
2626
const { t } = useTranslation('protocol_steps')
27-
const deckSetup = useSelector(getInitialDeckSetup)
27+
const { labware } = useSelector(getDeckSetupForActiveItem)
2828
const { channels } = pipetteSpecs
2929

30-
const tipracks = Object.values(deckSetup.labware).filter(
31-
labware => labware.def.parameters.isTiprack
32-
)
30+
const tipracks = Object.values(labware).filter(({ def }) => getIsTiprack(def))
3331
const tipracksNotOnAdapter = tipracks.filter(
3432
tiprack => tiprack.stack.length === 2
3533
)

protocol-designer/src/utils/index.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -436,13 +436,15 @@ export const getFullStackFromLabwaresOnDeck = (
436436
const slotInStack = onHopper
437437
? FAKE_HOPPER_LOCATION_MAP[slot as HopperLocationMapKey]
438438
: slot
439-
return labwareOnDeck
440-
.filter(
441-
({ stack }) =>
442-
stack.includes(slotInStack as string) &&
443-
onHopper === stack.includes(HOPPER_STACKER_LOCATION)
444-
)
445-
.sort((a, b) => b.stack.length - a.stack.length)[0]?.stack
439+
return (
440+
labwareOnDeck
441+
.filter(
442+
({ stack }) =>
443+
stack.includes(slotInStack as string) &&
444+
onHopper === stack.includes(HOPPER_STACKER_LOCATION)
445+
)
446+
.sort((a, b) => b.stack.length - a.stack.length)[0]?.stack ?? []
447+
)
446448
}
447449

448450
export const getModuleIdFromStack = (

step-generation/src/getNextRobotStateAndWarnings/__tests__/stackerUpdates.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,6 @@ describe('flex stacker state updates forFlexStackerStore', () => {
257257
'tiprack4Id',
258258
HOPPER_STACKER_LOCATION,
259259
FLEX_STACKER_ID,
260-
'1',
261260
])
262261
})
263262
})

step-generation/src/getNextRobotStateAndWarnings/forMoveLabware.ts

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,26 @@ export function forMoveLabware(
5151
return type === FLEX_STACKER_MODULE_TYPE && slot === initialDeckSlot
5252
}) ?? null
5353

54+
const movedStackFromShuttle =
55+
initialShuttleParentStackerState != null &&
56+
initialShuttleParentStackerState[1].moduleState.type ===
57+
FLEX_STACKER_MODULE_TYPE
58+
? BOTTOM_UP_LABWARE_POOL_KEYS.map(
59+
key =>
60+
(
61+
initialShuttleParentStackerState[1]
62+
.moduleState as FlexStackerModuleState
63+
).labwareOnShuttle?.[key]
64+
).filter((id): id is string => id != null)
65+
: []
66+
67+
const movedStackUpToTarget = movedStackFromShuttle.includes(labwareId)
68+
? movedStackFromShuttle.slice(
69+
0,
70+
movedStackFromShuttle.indexOf(labwareId) + 1
71+
)
72+
: []
73+
5474
if (
5575
initialShuttleParentStackerState != null &&
5676
initialShuttleParentStackerState[1].moduleState.type ===
@@ -90,7 +110,10 @@ export function forMoveLabware(
90110
}) ?? null
91111
const [newModuleId, newStackerOnDeck] = newShuttleParentStackerState ?? []
92112
if (newModuleId != null && newStackerOnDeck != null) {
93-
const fullStack = getLargestStackInSlot(labware, initialDeckSlot)
113+
const fullStack =
114+
movedStackUpToTarget.length > 0
115+
? movedStackUpToTarget
116+
: getLargestStackInSlot(labware, initialDeckSlot)
94117
const stackIndexOfTarget = fullStack.indexOf(labwareId)
95118
const moduleState = newStackerOnDeck.moduleState as FlexStackerModuleState
96119
if (stackIndexOfTarget !== -1) {

step-generation/src/getNextRobotStateAndWarnings/stackerUpdates.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,6 @@ export const forFlexStackerStore = (
580580
): void => {
581581
const { robotState } = robotStateAndWarnings
582582
const { moduleId } = params
583-
const moduleSlot = robotState.modules[moduleId].slot
584583
const moduleState = flexStackerStateGetter(robotState, moduleId)
585584
if (moduleState != null) {
586585
const { labwareOnShuttle } = moduleState
@@ -603,7 +602,6 @@ export const forFlexStackerStore = (
603602
labwareId,
604603
HOPPER_STACKER_LOCATION,
605604
moduleId,
606-
moduleSlot,
607605
]
608606
}
609607
}

0 commit comments

Comments
 (0)