// @ts-nocheck - Temporary fix for HF Spaces TypeScript resolution issues import React, { useEffect, useCallback } from "react"; import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; import { Skeleton } from "@/components/ui/skeleton"; import { FileText } from "lucide-react"; import { useAgentGraph } from "@/context/AgentGraphContext"; import { TraceItem } from "./TraceItem"; import { EmptyState } from "@/components/shared/EmptyState"; import { api } from "@/lib/api"; export function TracesSection() { const { state, actions } = useAgentGraph(); const { traces, isLoading } = state; const loadTraces = useCallback(async () => { actions.setLoading(true); try { const tracesData = await api.traces.list(); actions.setTraces(Array.isArray(tracesData) ? tracesData : []); } catch (error) { actions.setError( error instanceof Error ? error.message : "Failed to load traces" ); actions.setTraces([]); } finally { actions.setLoading(false); } }, [actions]); useEffect(() => { loadTraces(); }, [loadTraces]); // NOTE: Auto-refresh disabled to avoid 429 errors in HF Spaces // TracesView component handles auto-refresh to prevent duplicate requests // useEffect(() => { // const interval = setInterval(() => { // if (!isLoading) { // loadTraces(); // } // }, 60000); // 60 seconds (increased from 12s) // return () => clearInterval(interval); // }, [loadTraces, isLoading]); const handleUploadTrace = () => { actions.setActiveView("upload"); }; return (
Traces {!isLoading && traces.length > 0 && ( {traces.length} )}
{isLoading ? (
{[...Array(3)].map((_, i) => (
))}
) : !Array.isArray(traces) || traces.length === 0 ? (
) : (
{traces.map((trace) => ( ))}
)}
); }