From fcbd0bb310ea6d96de06ee02bf234cbb75132729 Mon Sep 17 00:00:00 2001 From: Jamey Huffnagle Date: Tue, 19 Mar 2024 15:23:58 -0400 Subject: [PATCH] fix(app): fix ODD "run again" routing Clicking "run again" repeatedly causes multiple cloneRun hooks to fire, resulting in sometimes bizzare routing scenarios. If a cloneRun is in progress, do not let another cloneRun occur. --- app/src/pages/RunSummary/index.tsx | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/app/src/pages/RunSummary/index.tsx b/app/src/pages/RunSummary/index.tsx index f147acab1cf..e76a73ce1b9 100644 --- a/app/src/pages/RunSummary/index.tsx +++ b/app/src/pages/RunSummary/index.tsx @@ -110,7 +110,7 @@ export function RunSummary(): JSX.Element { const localRobot = useSelector(getLocalRobot) const robotName = localRobot?.name ?? 'no name' const { trackProtocolRunEvent } = useTrackProtocolRunEvent(runId, robotName) - const { reset } = useRunControls(runId) + const { reset, isResetRunLoading } = useRunControls(runId) const trackEvent = useTrackEvent() const { closeCurrentRun, isClosingCurrentRun } = useCloseCurrentRun() const robotAnalyticsData = useRobotAnalyticsData(robotName) @@ -163,13 +163,15 @@ export function RunSummary(): JSX.Element { setPipettesWithTip ).catch(e => console.log(`Error launching Tip Attachment Modal: ${e}`)) } else { - setShowRunAgainSpinner(true) - reset() - trackEvent({ - name: 'proceedToRun', - properties: { sourceLocation: 'RunSummary' }, - }) - trackProtocolRunEvent({ name: ANALYTICS_PROTOCOL_RUN_AGAIN }) + if (!isResetRunLoading) { + setShowRunAgainSpinner(true) + reset() + trackEvent({ + name: 'proceedToRun', + properties: { sourceLocation: 'RunSummary' }, + }) + trackProtocolRunEvent({ name: ANALYTICS_PROTOCOL_RUN_AGAIN }) + } } }