Skip to content

Commit 0145d00

Browse files
committed
address more feedback
1 parent 5fa1a97 commit 0145d00

File tree

7 files changed

+64
-34
lines changed

7 files changed

+64
-34
lines changed

protocol-designer/src/components/organisms/SlotDetailsContainer/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import {
66
FAKE_HOPPER_LOCATION_MAP,
77
getIsSlotAHopper,
88
getTopLocationInStack,
9-
HopperLocationMapKey,
109
} from '@opentrons/step-generation'
1110

1211
import { getLiquidEntities } from '/protocol-designer/step-forms/selectors'
@@ -18,6 +17,7 @@ import { getFullStackFromLabwaresOnDeck } from '/protocol-designer/utils'
1817
import { SlotInformation } from '../SlotInformation'
1918

2019
import type { DeckSlotId, RobotType } from '@opentrons/shared-data'
20+
import type { HopperLocationMapKey } from '@opentrons/step-generation'
2121
import type { ContentsByWell } from '/protocol-designer/labware-ingred/types'
2222

2323
interface SlotDetailContainerProps {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ export function DeckSetupContainer(
167167
const zoomInSlotPosition = getPositionFromSlotId(
168168
slot ?? '',
169169
deckDef,
170-
isOnHopper ? HOPPER_ZOOM_OFFSET_POSTITION : undefined
170+
...(isOnHopper ? [HOPPER_ZOOM_OFFSET_POSTITION] : [])
171171
)
172172
if (zoomInSlotPosition != null) {
173173
const zoomedInViewBox = zoomInOnCoordinate({

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ export function HighlightItems(props: HighlightItemsProps): JSX.Element | null {
6363
)
6464
const hoveredItem = useSelector(getHoveredDropdownItem)
6565
const selectedDropdownItems = useSelector(getSelectedDropdownItem)
66+
6667
if (
6768
hoveredItem == null &&
6869
(selectedDropdownItems == null || selectedDropdownItems.length === 0)

protocol-designer/src/pages/Designer/utils.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,11 @@ export const getSlotInformation = (
107107
: slot
108108
const slotPosition =
109109
deckDef != null && offDeckLabware == null
110-
? (getPositionFromSlotId(
110+
? getPositionFromSlotId(
111111
adjustedSlot,
112112
deckDef,
113-
isSlotAHopper ? HOPPER_LABWARE_X_OFFSET : undefined
114-
) ?? null)
113+
...(isSlotAHopper ? [HOPPER_LABWARE_X_OFFSET] : [])
114+
)
115115
: null
116116
const createdModuleForSlot = Object.values(deckSetupModules).find(
117117
module => module.slot === adjustedSlot

protocol-designer/src/step-forms/actions/thunks.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export const createContainerAboveModule: (
3636
const state = getState()
3737
const deckSetup = getDeckSetupForActiveItem(state)
3838
const modules = deckSetup.modules
39+
3940
const moduleId = Object.values(modules).find(
4041
module => module.slot === slot
4142
)?.id

protocol-designer/src/utils/index.ts

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -369,25 +369,25 @@ export function getLocationStackTopToBottom(
369369
moduleEntities: ModuleEntities
370370
): string[] {
371371
const stack: string[] = []
372-
let current = labwareId
373-
374-
while (true) {
372+
const visited = new Set<string>()
373+
let current: string | undefined = labwareId
374+
while (current != null) {
375+
// Cycle detection: if we've seen this node before, break to prevent infinite loop
376+
if (visited.has(current)) {
377+
break
378+
}
379+
visited.add(current)
375380
stack.push(current)
376-
377-
const slot = labwareLocationUpdate[current]
378-
const parent = slot ?? moduleLocationUpdate[current]
381+
const slot: string | undefined = labwareLocationUpdate[current]
382+
const parent: string | undefined = slot ?? moduleLocationUpdate[current]
379383
const isOnHopper =
380384
moduleEntities[slot] != null &&
381385
moduleEntities[slot].type === FLEX_STACKER_MODULE_TYPE
382-
383386
if (isOnHopper) {
384387
// Hopper stack shape: [labware, hopper, moduleId, slot]
385388
// So when the node is on the hopper, insert the hopper marker once
386389
stack.push(HOPPER_STACKER_LOCATION)
387390
}
388-
389-
if (!parent) break
390-
391391
current = parent
392392
}
393393
return stack
@@ -403,8 +403,8 @@ export const getLabwaresOnModuleFromStack = (
403403
} => {
404404
// all stacks involving this module and not on the hopper if its a flex stacker
405405
const allStacks = labware.filter(
406-
lw =>
407-
lw.stack.includes(moduleId) && !lw.stack.includes(HOPPER_STACKER_LOCATION)
406+
({ stack }) =>
407+
stack.includes(moduleId) && !stack.includes(HOPPER_STACKER_LOCATION)
408408
)
409409
const largestStack = allStacks.sort(
410410
(a, b) => b.stack.length - a.stack.length
@@ -415,8 +415,8 @@ export const getLabwaresOnModuleFromStack = (
415415
)
416416
// all stacks involving the hopper if there is one
417417
const allStacksOnHopper = labware.filter(
418-
lw =>
419-
lw.stack.includes(moduleId) && lw.stack.includes(HOPPER_STACKER_LOCATION)
418+
({ stack }) =>
419+
stack.includes(moduleId) && stack.includes(HOPPER_STACKER_LOCATION)
420420
)
421421
const largestStackOnHopper = allStacksOnHopper.sort(
422422
(a, b) => b.stack.length - a.stack.length
@@ -438,11 +438,9 @@ export const getFullStackFromLabwaresOnDeck = (
438438
: slot
439439
return labwareOnDeck
440440
.filter(
441-
lw =>
442-
lw.stack.includes(slotInStack) &&
443-
(onHopper
444-
? lw.stack.includes(HOPPER_STACKER_LOCATION)
445-
: !lw.stack.includes(HOPPER_STACKER_LOCATION))
441+
({ stack }) =>
442+
stack.includes(slotInStack) &&
443+
onHopper === stack.includes(HOPPER_STACKER_LOCATION)
446444
)
447445
.sort((a, b) => b.stack.length - a.stack.length)[0]?.stack
448446
}

step-generation/src/types.ts

Lines changed: 40 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -634,26 +634,56 @@ export interface CaptureImageArgs extends CommonArgs {
634634
saturation: number
635635
}
636636

637+
export interface FlexStackerStore extends CommonArgs {
638+
moduleId: string
639+
commandCreatorFnName: 'flexStackerStore'
640+
}
641+
642+
export interface FlexStackerRetrieve extends CommonArgs {
643+
moduleId: string
644+
commandCreatorFnName: 'flexStackerRetrieve'
645+
}
646+
647+
export interface FlexStackerEmpty extends CommonArgs {
648+
moduleId: string
649+
commandCreatorFnName: 'flexStackerEmpty'
650+
interventionMessage: string | null
651+
}
652+
653+
export interface FlexStackerFillItems extends CommonArgs {
654+
moduleId: string
655+
commandCreatorFnName: 'flexStackerFillItems'
656+
fillLabwareUri: string | null
657+
fillQuantity: number | null
658+
}
659+
660+
export type FlexStackerArgs =
661+
| FlexStackerStore
662+
| FlexStackerRetrieve
663+
| FlexStackerEmpty
664+
| FlexStackerFillItems
665+
637666
export type CommandCreatorArgs =
638667
| AbsorbanceReaderInitializeArgs
639-
| AbsorbanceReaderReadArgs
640668
| AbsorbanceReaderLidArgs
641-
| ConsolidateArgs
669+
| AbsorbanceReaderReadArgs
642670
| CaptureImageArgs
671+
| CommentArgs
672+
| ConsolidateArgs
673+
| DeactivateTemperatureArgs
674+
| DisengageMagnetArgs
643675
| DistributeArgs
676+
| EngageMagnetArgs
677+
| FlexStackerArgs
678+
| HeaterShakerArgs
644679
| MixArgs
680+
| MoveLabwareArgs
645681
| PauseArgs
646-
| TransferArgs
647-
| EngageMagnetArgs
648-
| DisengageMagnetArgs
649682
| SetTemperatureArgs
650-
| WaitForTemperatureArgs
651-
| DeactivateTemperatureArgs
652683
| ThermocyclerProfileStepArgs
653684
| ThermocyclerStateStepArgs
654-
| HeaterShakerArgs
655-
| MoveLabwareArgs
656-
| CommentArgs
685+
| TransferArgs
686+
| WaitForTemperatureArgs
657687

658688
export interface LocationLiquidState {
659689
[ingredGroup: string]: { volume: number }

0 commit comments

Comments
 (0)