MCPcopy Create free account
hub / github.com/AIScientists-Dev/Flowtrace / useTraceFiles

Function useTraceFiles

frontend/src/features/trace/api/trace-core.ts:75–92  ·  view source on GitHub ↗
(traceId: string | undefined)

Source from the content-addressed store, hash-verified

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`. */
75export 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
94export function useStepFileContent(path: string | undefined) {
95 return useQuery<string>({

Callers 2

TraceDocsDrawerFunction · 0.90
TraceDetailViewFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…