Skip to content

Commit 2da4c80

Browse files
refactor(app): Improve RunModuleInfo typing (#19175)
1 parent e5b41f7 commit 2da4c80

File tree

3 files changed

+22
-26
lines changed

3 files changed

+22
-26
lines changed

app/src/organisms/ErrorRecoveryFlows/shared/TwoColLwInfoAndDeck.tsx

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -131,18 +131,16 @@ export function TwoColLwInfoAndDeck(
131131
const isValidDeck =
132132
currentLoc != null && newLoc != null && movedLabwareDef != null
133133

134-
const modulesOnDeck = moduleRenderInfo
135-
?.filter(module => module.targetSlotId != null)
136-
.map(module => {
137-
return {
138-
moduleModel: module.moduleDef.model,
139-
moduleLocation: { slotName: module.targetSlotId ?? '' },
140-
nestedLabwareDef:
141-
module.nestedLabwareId !== failedLwId
142-
? module.nestedLabwareDef
143-
: null,
144-
}
145-
})
134+
const modulesOnDeck = moduleRenderInfo?.map(module => {
135+
return {
136+
moduleModel: module.moduleDef.model,
137+
moduleLocation: { slotName: module.targetSlotId },
138+
nestedLabwareDef:
139+
module.nestedLabwareId !== failedLwId
140+
? module.nestedLabwareDef
141+
: null,
142+
}
143+
})
146144
return isValidDeck ? (
147145
<MoveLabwareOnDeck
148146
deckFill={isOnDevice ? COLORS.grey35 : '#e6e6e6'}

app/src/organisms/InterventionModal/MoveLabwareInterventionContent.tsx

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -132,18 +132,16 @@ export function MoveLabwareInterventionContent({
132132
deckDef,
133133
labwareDefsByUri
134134
)
135-
const modulesOnDeck = moduleRenderInfo
136-
?.filter(module => module.targetSlotId != null)
137-
.map(module => {
138-
return {
139-
moduleModel: module.moduleDef.model,
140-
moduleLocation: { slotName: module.targetSlotId ?? '' },
141-
nestedLabwareDef:
142-
module.nestedLabwareId !== command.params.labwareId
143-
? module.nestedLabwareDef
144-
: null,
145-
}
146-
})
135+
const modulesOnDeck = moduleRenderInfo?.map(module => {
136+
return {
137+
moduleModel: module.moduleDef.model,
138+
moduleLocation: { slotName: module.targetSlotId },
139+
nestedLabwareDef:
140+
module.nestedLabwareId !== command.params.labwareId
141+
? module.nestedLabwareDef
142+
: null,
143+
}
144+
})
147145

148146
const oldLabwareLocation =
149147
getLoadedLabware(run.labware, command.params.labwareId)?.location ?? null

app/src/organisms/InterventionModal/utils/getRunModuleRenderInfo.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ export interface RunModuleInfo {
2121
moduleDef: ModuleDefinition
2222
nestedLabwareDef: LabwareDefinition | null
2323
nestedLabwareId: string | null
24-
targetDeckId: ComponentProps<typeof Module>['targetDeckId']
25-
targetSlotId: ComponentProps<typeof Module>['targetSlotId']
24+
targetDeckId: NonNullable<ComponentProps<typeof Module>['targetDeckId']>
25+
targetSlotId: NonNullable<ComponentProps<typeof Module>['targetSlotId']>
2626
}
2727

2828
export function getRunModuleRenderInfo(

0 commit comments

Comments
 (0)