From 4a6ad9b414fcabea636309d0ed8c6ac043c5d913 Mon Sep 17 00:00:00 2001 From: sahil-mangla Date: Wed, 24 Jun 2026 10:49:56 +0530 Subject: [PATCH] fix(ui): handle indexing errors in frontend and ignore local npm cache Signed-off-by: sahil-mangla --- .gitignore | 3 ++ graph-ui/src/components/StatsTab.tsx | 46 +++++++++++++++++++++++++--- 2 files changed, 44 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 5860fb1b6..2edd00383 100644 --- a/.gitignore +++ b/.gitignore @@ -59,3 +59,6 @@ soak-results/ # LSP originality-check reference cache (scripts/check-lsp-originality.sh) .lsp-refs/ + +# Local npm cache +graph-ui/.npm-cache-local/ diff --git a/graph-ui/src/components/StatsTab.tsx b/graph-ui/src/components/StatsTab.tsx index 988902714..b8304b939 100644 --- a/graph-ui/src/components/StatsTab.tsx +++ b/graph-ui/src/components/StatsTab.tsx @@ -274,19 +274,35 @@ function CreateIndexModal({ onClose, onCreated }: { onClose: () => void; onCreat /* ── Index Progress ─────────────────────────────────────── */ function IndexProgress({ onDone }: { onDone: () => void }) { - const [jobs, setJobs] = useState<{ slot: number; status: string; path: string }[]>([]); + const [jobs, setJobs] = useState<{ slot: number; status: string; path: string; error?: string }[]>([]); + const [hasActive, setHasActive] = useState(true); + useEffect(() => { + if (!hasActive) return; const poll = setInterval(async () => { try { const data = await (await fetch("/api/index-status")).json(); setJobs(data); - if (data.length > 0 && data.every((j: { status: string }) => j.status !== "indexing")) onDone(); - } catch { /* */ } + const stillIndexing = data.some((j: { status: string }) => j.status === "indexing"); + if (!stillIndexing) { + setHasActive(false); + const hasErrors = data.some((j: { status: string }) => j.status === "error"); + if (!hasErrors) { + onDone(); + } + } + } catch (error) { + console.error("[IndexProgress] Poll failed:", error); + } }, 2000); return () => clearInterval(poll); - }, [onDone]); + }, [onDone, hasActive]); + const active = jobs.filter((j) => j.status === "indexing"); - if (active.length === 0) return null; + const errors = jobs.filter((j) => j.status === "error"); + + if (active.length === 0 && errors.length === 0) return null; + return (
{active.map((j) => ( @@ -298,6 +314,26 @@ function IndexProgress({ onDone }: { onDone: () => void }) {
))} + {errors.map((j) => ( +
+ ⚠️ +
+

Indexing Failed

+

{j.path}

+ {j.error &&

{j.error}

} +
+
+ ))} + {errors.length > 0 && ( +
+ +
+ )} ); }