The trace detail view re-downloads the entire trace twice unnecessarily: once when the live stream signals completion (invalidateQueries), and again on window-focus (React Query default staleTime/refetchOnWindowFocus). For a large trace this means repeatedly pulling tens of MB — the user-visible "slow to refresh." A completed trace is immutable, and final spans already arrive via the live stream merge.
Tasks
- In
frontend/ui/src/features/traces/hooks/use-trace-stream.ts, remove the invalidateQueries on trace_complete; rely on the merged streamed spans.
- For the trace-detail query (
features/traces/hooks/index.ts / TraceViewerPanel.tsx), set refetchOnWindowFocus: false and a long/Infinity staleTime.
- Keep live-streaming merge intact for in-progress traces.
Acceptance
- Opening a completed trace and switching tabs back triggers no new
GET …/traces/{id} request.
- In-progress traces still stream and complete correctly.
Files: frontend/ui/src/features/traces/hooks/use-trace-stream.ts, frontend/ui/src/features/traces/hooks/index.ts, TraceViewerPanel.tsx, cross-check app/providers.tsx
Part of #1040.
The trace detail view re-downloads the entire trace twice unnecessarily: once when the live stream signals completion (
invalidateQueries), and again on window-focus (React Query defaultstaleTime/refetchOnWindowFocus). For a large trace this means repeatedly pulling tens of MB — the user-visible "slow to refresh." A completed trace is immutable, and final spans already arrive via the live stream merge.Tasks
frontend/ui/src/features/traces/hooks/use-trace-stream.ts, remove theinvalidateQueriesontrace_complete; rely on the merged streamed spans.features/traces/hooks/index.ts/TraceViewerPanel.tsx), setrefetchOnWindowFocus: falseand a long/InfinitystaleTime.Acceptance
GET …/traces/{id}request.Files:
frontend/ui/src/features/traces/hooks/use-trace-stream.ts,frontend/ui/src/features/traces/hooks/index.ts,TraceViewerPanel.tsx, cross-checkapp/providers.tsxPart of #1040.