Skip to content

Commit

Permalink
Redirect to robot dashboard after cancelling quick transfer from desktop
Browse files Browse the repository at this point in the history
  • Loading branch information
smb2268 committed Aug 7, 2024
1 parent 604993f commit ecba646
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
25 changes: 22 additions & 3 deletions app/src/organisms/Devices/ProtocolRun/ProtocolRunHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ export function ProtocolRunHeader({
displayName,
protocolKey,
isProtocolAnalyzing,
isQuickTransfer,
} = useProtocolDetailsForRun(runId)
const { reportRecoveredRunResult } = useRecoveryAnalytics()

Expand Down Expand Up @@ -266,7 +267,13 @@ export function ProtocolRunHeader({
...robotAnalyticsData,
},
})
closeCurrentRun()
closeCurrentRun({
onSuccess: () => {
if (isQuickTransfer) {
navigate(`/devices/${robotName}`)
}
},
})
}
}, [runStatus, isRunCurrent, runId, closeCurrentRun])

Expand Down Expand Up @@ -314,7 +321,13 @@ export function ProtocolRunHeader({
name: ANALYTICS_PROTOCOL_RUN_ACTION.FINISH,
properties: robotAnalyticsData ?? undefined,
})
closeCurrentRun()
closeCurrentRun({
onSuccess: () => {
if (isQuickTransfer) {
navigate(`/devices/${robotName}`)
}
},
})
}

return (
Expand Down Expand Up @@ -416,7 +429,13 @@ export function ProtocolRunHeader({
onCloseClick={() => {
resetTipStatus()
setShowDropTipBanner(false)
closeCurrentRun()
closeCurrentRun({
onSuccess: () => {
if (isQuickTransfer) {
navigate(`/devices/${robotName}`)
}
},
})
}}
/>
) : null}
Expand Down
2 changes: 2 additions & 0 deletions app/src/organisms/Devices/hooks/useProtocolDetailsForRun.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export interface ProtocolDetails {
protocolKey: string | null
isProtocolAnalyzing?: boolean
robotType: RobotType
isQuickTransfer: boolean
}

export function useProtocolDetailsForRun(
Expand Down Expand Up @@ -67,5 +68,6 @@ export function useProtocolDetailsForRun(
(mostRecentAnalysis?.status === 'completed'
? mostRecentAnalysis?.robotType ?? FLEX_ROBOT_TYPE
: FLEX_ROBOT_TYPE),
isQuickTransfer: protocolRecord?.data.protocolKind === 'quick-transfer',
}
}

0 comments on commit ecba646

Please sign in to comment.