diff --git a/app/src/organisms/Devices/ProtocolRun/ProtocolRunHeader.tsx b/app/src/organisms/Devices/ProtocolRun/ProtocolRunHeader.tsx index b14dd37c5b5d..5c11ccbc0a7b 100644 --- a/app/src/organisms/Devices/ProtocolRun/ProtocolRunHeader.tsx +++ b/app/src/organisms/Devices/ProtocolRun/ProtocolRunHeader.tsx @@ -21,6 +21,7 @@ import { import { useModulesQuery, useDoorQuery, + useDeleteRunMutation, useHost, useRunCommandErrors, } from '@opentrons/react-api-client' @@ -165,6 +166,7 @@ export function ProtocolRunHeader({ const robotAnalyticsData = useRobotAnalyticsData(robotName) const isRobotViewable = useIsRobotViewable(robotName) const runStatus = useRunStatus(runId) + const { deleteRun } = useDeleteRunMutation() const { analysisErrors } = useProtocolAnalysisErrors(runId) const isRunCurrent = Boolean( useNotifyRunQuery(runId, { refetchInterval: CURRENT_RUN_POLL_MS })?.data @@ -291,6 +293,7 @@ export function ProtocolRunHeader({ closeCurrentRun({ onSuccess: () => { if (isQuickTransfer) { + deleteRun(runId) navigate(`/devices/${robotName}`) } }, @@ -345,6 +348,7 @@ export function ProtocolRunHeader({ closeCurrentRun({ onSuccess: () => { if (isQuickTransfer) { + deleteRun(runId) navigate(`/devices/${robotName}`) } }, @@ -457,6 +461,7 @@ export function ProtocolRunHeader({ closeCurrentRun({ onSuccess: () => { if (isQuickTransfer) { + deleteRun(runId) navigate(`/devices/${robotName}`) } }, diff --git a/app/src/pages/RunSummary/index.tsx b/app/src/pages/RunSummary/index.tsx index 4b8e9dba2574..705fe918ed98 100644 --- a/app/src/pages/RunSummary/index.tsx +++ b/app/src/pages/RunSummary/index.tsx @@ -134,6 +134,11 @@ export function RunSummary(): JSX.Element { reportRecoveredRunResult(runStatus, enteredER) } }, [isRunCurrent, enteredER]) + React.useEffect(() => { + if (runRecord == null) { + navigate('/') + } + }) const { reset, isResetRunLoading } = useRunControls(runId, onCloneRunSuccess) const trackEvent = useTrackEvent()