(traceId: string | undefined)
| 73 | * in that case Axum's SPA fallback returns the index.html, and we surface |
| 74 | * that as a query error instead of letting the UI crash on `string.find`. */ |
| 75 | export function useTraceFiles(traceId: string | undefined) { |
| 76 | return useQuery<StepFile[]>({ |
| 77 | queryKey: traceKeys.traceFiles(traceId ?? ''), |
| 78 | queryFn: async () => { |
| 79 | const data = await apiClient.get<unknown>(`/api/traces/${traceId}/files`) |
| 80 | if (!Array.isArray(data)) { |
| 81 | throw new Error( |
| 82 | 'Trace files endpoint returned a non-array. Your `trace serve` ' + |
| 83 | 'binary may be older than this frontend — rebuild and restart it.', |
| 84 | ) |
| 85 | } |
| 86 | return data as StepFile[] |
| 87 | }, |
| 88 | enabled: !!traceId, |
| 89 | staleTime: 60_000, |
| 90 | retry: false, |
| 91 | }) |
| 92 | } |
| 93 | |
| 94 | export function useStepFileContent(path: string | undefined) { |
| 95 | return useQuery<string>({ |
no outgoing calls
no test coverage detected
searching dependent graphs…