Skip to content

Commit

Permalink
fix(app): fix "rerun protocol now" redirection delay (#16199)
Browse files Browse the repository at this point in the history
Closes RQA-3152
  • Loading branch information
mjhuff authored Sep 5, 2024
1 parent 8713caa commit 2878ab3
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 9 deletions.
18 changes: 16 additions & 2 deletions app/src/organisms/Devices/HistoricalProtocolRunOverflowMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,10 @@ function MenuDropdown(props: MenuDropdownProps): JSX.Element {
}
const trackEvent = useTrackEvent()
const { trackProtocolRunEvent } = useTrackProtocolRunEvent(runId, robotName)
const { reset, isRunControlLoading } = useRunControls(runId, onResetSuccess)
const { reset, isResetRunLoading, isRunControlLoading } = useRunControls(
runId,
onResetSuccess
)
const { deleteRun } = useDeleteRunMutation()
const robot = useRobot(robotName)
const robotSerialNumber =
Expand Down Expand Up @@ -189,7 +192,18 @@ function MenuDropdown(props: MenuDropdownProps): JSX.Element {
}
data-testid="RecentProtocolRun_OverflowMenu_rerunNow"
>
{t('rerun_now')}
<Flex alignItems={ALIGN_CENTER} gridGap={SPACING.spacing8}>
{t('rerun_now')}
{isResetRunLoading ? (
<Icon
name="ot-spinner"
size={SIZE_1}
color={COLORS.grey50}
aria-label="spinner"
spin
/>
) : null}
</Flex>
</MenuItem>
{isRobotOnWrongVersionOfSoftware && (
<Tooltip tooltipProps={tooltipProps}>
Expand Down
13 changes: 6 additions & 7 deletions app/src/organisms/ProtocolUpload/hooks/useCloneRun.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,12 @@ export function useCloneRun(
'protocols',
protocolKey,
])
Promise.all([invalidateRuns, invalidateProtocols])
.then(() => {
onSuccessCallback?.(response)
})
.catch((e: Error) => {
console.error(`error invalidating runs query: ${e.message}`)
})
Promise.all([invalidateRuns, invalidateProtocols]).catch((e: Error) => {
console.error(`error invalidating runs query: ${e.message}`)
})
// The onSuccess callback is not awaited until query invalidation, because currently, in every instance this
// onSuccessCallback is utilized, we only use it for navigating. We may need to revisit this.
onSuccessCallback?.(response)
},
})
const { createProtocolAnalysis } = useCreateProtocolAnalysisMutation(
Expand Down

0 comments on commit 2878ab3

Please sign in to comment.