Skip to content

Commit 2418775

Browse files
authored
fix(app): fix unhandled undefined selectedLabware when exiting LPC (#18384)
Fixes a whitescreen when exiting LPC on the desktop app from the "labware list" view. #18300 accounts for some specific gantry movement when exiting on the desktop app, but we should not type assert selectedLabware or offsetLocationDetails here: these can very much be undefined if the user clicks the exit button on the "labware list view". I don't know why I decided we needed to type assert here to begin with, whoops.
1 parent 3a109d5 commit 2418775

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

app/src/organisms/LabwarePositionCheck/steps/DetachProbe.tsx

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@ import {
1515
import { DescriptionContent, TwoColumn } from '/app/molecules/InterventionModal'
1616

1717
import type { LoadedPipette } from '@opentrons/shared-data'
18-
import type {
19-
OffsetLocationDetails,
20-
SelectedLwOverview,
21-
} from '/app/redux/protocol-runs'
2218
import type { LPCWizardContentProps } from '/app/organisms/LabwarePositionCheck/types'
2319

2420
import detachProbe1 from '/app/assets/videos/pipette-wizard-flows/Pipette_Detach_Probe_1.webm'
@@ -37,20 +33,21 @@ export function DetachProbe(props: LPCWizardContentProps): JSX.Element {
3733
const currentSubstep = useSelector(selectCurrentSubstep(runId))
3834
const pipette = useSelector(selectActivePipette(runId)) as LoadedPipette
3935
const pipetteId = pipette.id
40-
const selectedLwInfo = useSelector(
41-
selectSelectedLwOverview(runId)
42-
) as SelectedLwOverview
36+
const selectedLwInfo = useSelector(selectSelectedLwOverview(runId))
4337
const mostRecentVectorOffset = useSelector(
4438
selectSelectedLwWithOffsetDetailsMostRecentVectorOffset(runId)
4539
)
46-
const offsetLocationDetails = selectedLwInfo.offsetLocationDetails as OffsetLocationDetails
40+
const offsetLocationDetails = selectedLwInfo?.offsetLocationDetails
4741

4842
const handleGoBack = (): void => {
4943
void toggleRobotMoving(true)
5044
.then(() => {
5145
// On the desktop app, ensure the robot returns to the initial offset position instead of the home position
5246
// when actively calibrating an offset.
53-
if (currentSubstep === 'handle-lw/edit-offset/check-labware') {
47+
if (
48+
currentSubstep === 'handle-lw/edit-offset/check-labware' &&
49+
offsetLocationDetails != null
50+
) {
5451
return home()
5552
.then(() =>
5653
handleMoveToInitialOffsetPosition(

0 commit comments

Comments
 (0)