Skip to content

Commit

Permalink
fix(app): fix users not directed to "run preview" when starting a run (
Browse files Browse the repository at this point in the history
…#16116)

Closes RQA-3092

We want users to be directed to the run preview panel (from any tab, not just the setup tab) when a run has started. We still want to ensure that users can still navigate to all tabs (which is why the dependency array is the way it is). See the code comment above the useEffect for the intended behavior.
  • Loading branch information
mjhuff authored Aug 27, 2024
1 parent e746300 commit 88f46db
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions app/src/pages/Devices/ProtocolRunDetails/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -322,12 +322,13 @@ const SetupTab = (props: SetupTabProps): JSX.Element | null => {
'not_available_for_a_completed_run'
)}`

// On the initial render only, navigate to "run preview" if the run has started.
// On the initial render or when a run first begins, navigate to "run preview" if the run has started.
// If "run again" is clicked, the user should NOT be directed back to the "setup" tab.
React.useEffect(() => {
if (runHasStarted && protocolRunDetailsTab === 'setup') {
if (runHasStarted && protocolRunDetailsTab !== 'run-preview') {
navigate(`/devices/${robotName}/protocol-runs/${runId}/run-preview`)
}
}, [])
}, [runHasStarted])

return (
<RoundTab
Expand Down

0 comments on commit 88f46db

Please sign in to comment.