Skip to content

Commit

Permalink
fallback to analysis commands if commandsAsPreSerializedList endpoint…
Browse files Browse the repository at this point in the history
… comes back empty
  • Loading branch information
ncdiehl committed Apr 29, 2024
1 parent 4598c85 commit e5099b6
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions app/src/organisms/RunPreview/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,19 +54,19 @@ export const RunPreviewComponent = (
? (RUN_STATUSES_TERMINAL as RunStatus[]).includes(runStatus)
: false
// we only ever want one request done for terminal runs because this is a heavy request
const commandsFromQuery =
useAllCommandsAsPreSerializedList(
runId,
{ cursor: 0, pageLength: MAX_COMMANDS },
{
staleTime: Infinity,
cacheTime: Infinity,
enabled: isRunTerminal,
}
).data?.data ?? []
const parsedCommandsFromQuery = commandsFromQuery.map(command =>
JSON.parse(command)
)
const commandsFromQuery = useAllCommandsAsPreSerializedList(
runId,
{ cursor: 0, pageLength: MAX_COMMANDS },
{
staleTime: Infinity,
cacheTime: Infinity,
enabled: isRunTerminal,
}
).data?.data
const parsedCommandsFromQuery =
commandsFromQuery == null
? robotSideAnalysis?.commands
: commandsFromQuery.map(command => JSON.parse(command))
const viewPortRef = React.useRef<HTMLDivElement | null>(null)
const currentRunCommandKey = useNotifyLastRunCommandKey(runId, {
refetchInterval: LIVE_RUN_COMMANDS_POLL_MS,
Expand Down

0 comments on commit e5099b6

Please sign in to comment.