diff --git a/app/src/organisms/ErrorRecoveryFlows/hooks/__tests__/useFailedLabwareUtils.test.tsx b/app/src/organisms/ErrorRecoveryFlows/hooks/__tests__/useFailedLabwareUtils.test.tsx index ab12a0e7280..a1541fe0c77 100644 --- a/app/src/organisms/ErrorRecoveryFlows/hooks/__tests__/useFailedLabwareUtils.test.tsx +++ b/app/src/organisms/ErrorRecoveryFlows/hooks/__tests__/useFailedLabwareUtils.test.tsx @@ -168,8 +168,8 @@ const TestWrapper = (props: GetRelevantLwLocationsParams) => { const displayLocation = useRelevantFailedLwLocations(props) return ( <> -
{`Current Loc: ${displayLocation.currentLoc}`}
-
{`New Loc: ${displayLocation.newLoc}`}
+
{`Current Loc: ${displayLocation.displayNameCurrentLoc}`}
+
{`New Loc: ${displayLocation.displayNameNewLoc}`}
) } diff --git a/app/src/organisms/ErrorRecoveryFlows/hooks/useFailedLabwareUtils.ts b/app/src/organisms/ErrorRecoveryFlows/hooks/useFailedLabwareUtils.ts index 239cb6f9e3d..795df443665 100644 --- a/app/src/organisms/ErrorRecoveryFlows/hooks/useFailedLabwareUtils.ts +++ b/app/src/organisms/ErrorRecoveryFlows/hooks/useFailedLabwareUtils.ts @@ -26,6 +26,7 @@ import type { DispenseRunTimeCommand, LiquidProbeRunTimeCommand, MoveLabwareRunTimeCommand, + LabwareLocation, } from '@opentrons/shared-data' import type { LabwareDisplayLocationSlotOnly } from '/app/local-resources/labware' import type { ErrorRecoveryFlowsProps } from '..' @@ -40,8 +41,10 @@ interface UseFailedLabwareUtilsProps { } interface RelevantFailedLabwareLocations { - currentLoc: string - newLoc: string | null + displayNameCurrentLoc: string + displayNameNewLoc: string | null + currentLoc: LabwareLocation | null + newLoc: LabwareLocation | null } export type UseFailedLabwareUtilsResult = UseTipSelectionUtilsResult & { @@ -53,6 +56,7 @@ export type UseFailedLabwareUtilsResult = UseTipSelectionUtilsResult & { relevantWellName: string | null /* The user-content nickname of the failed labware, if any */ failedLabwareNickname: string | null + /* Details relating to the labware location. */ failedLabwareLocations: RelevantFailedLabwareLocations } @@ -360,25 +364,35 @@ export function useRelevantFailedLwLocations({ isOnDevice: false, // Always return the "slot XYZ" copy, which is the desktop copy. } - const currentLocation = getLabwareDisplayLocation({ + const displayNameCurrentLoc = getLabwareDisplayLocation({ ...BASE_DISPLAY_PARAMS, location: failedLabware?.location ?? null, }) - const getNewLocation = (): string | null => { + const getNewLocation = (): Pick< + RelevantFailedLabwareLocations, + 'displayNameNewLoc' | 'newLoc' + > => { switch (failedCommandByRunRecord?.commandType) { case 'moveLabware': - return getLabwareDisplayLocation({ - ...BASE_DISPLAY_PARAMS, - location: failedCommandByRunRecord.params.newLocation, - }) + return { + displayNameNewLoc: getLabwareDisplayLocation({ + ...BASE_DISPLAY_PARAMS, + location: failedCommandByRunRecord.params.newLocation, + }), + newLoc: failedCommandByRunRecord.params.newLocation, + } default: - return null + return { + displayNameNewLoc: null, + newLoc: null, + } } } return { - currentLoc: currentLocation, - newLoc: getNewLocation(), + displayNameCurrentLoc, + currentLoc: failedLabware?.location ?? null, + ...getNewLocation(), } } diff --git a/app/src/organisms/ErrorRecoveryFlows/shared/LeftColumnLabwareInfo.tsx b/app/src/organisms/ErrorRecoveryFlows/shared/LeftColumnLabwareInfo.tsx index ad1e7b0bc4a..87cdac57255 100644 --- a/app/src/organisms/ErrorRecoveryFlows/shared/LeftColumnLabwareInfo.tsx +++ b/app/src/organisms/ErrorRecoveryFlows/shared/LeftColumnLabwareInfo.tsx @@ -22,12 +22,14 @@ export function LeftColumnLabwareInfo({ failedLabwareNickname, failedLabwareLocations, } = failedLabwareUtils - const { newLoc, currentLoc } = failedLabwareLocations + const { displayNameNewLoc, displayNameCurrentLoc } = failedLabwareLocations const buildNewLocation = (): React.ComponentProps< typeof InterventionContent >['infoProps']['newLocationProps'] => - newLoc != null ? { deckLabel: newLoc.toUpperCase() } : undefined + displayNameNewLoc != null + ? { deckLabel: displayNameNewLoc.toUpperCase() } + : undefined return ( { }) it('does not include newLocationProps when newLoc is not provided', () => { - props.failedLabwareUtils.failedLabwareLocations.newLoc = null + props.failedLabwareUtils.failedLabwareLocations.displayNameNewLoc = null render(props) expect(vi.mocked(InterventionContent)).toHaveBeenCalledWith( @@ -91,8 +91,8 @@ describe('LeftColumnLabwareInfo', () => { it('converts location labels to uppercase', () => { props.failedLabwareUtils.failedLabwareLocations = { - currentLoc: 'slot A1', - newLoc: 'slot B2', + displayNameCurrentLoc: 'slot A1', + displayNameNewLoc: 'slot B2', } render(props)