Skip to content

Commit 3ded26c

Browse files
fix(frontend): add truncation indicator for drill-down node limit
Show "Showing X of Y nodes" when the drill-down fetches 200 nodes but the total exceeds that, so users know results are truncated. Co-Authored-By: Paperclip <noreply@paperclip.ing>
1 parent 482ca24 commit 3ded26c

3 files changed

Lines changed: 59 additions & 53 deletions

File tree

src/main/frontend/src/components/CodeGraphView.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ export default function CodeGraphView() {
228228
const [dimensions, setDimensions] = useState({ width: 0, height: 0 });
229229
const [selectedKind, setSelectedKind] = useState<string | null>(null);
230230
const [drillNodes, setDrillNodes] = useState<NodeResponse[]>([]);
231+
const [drillTotal, setDrillTotal] = useState(0);
231232
const [drillLoading, setDrillLoading] = useState(false);
232233

233234
const { data: kindsData, loading: kindsLoading } = useApi(() => api.getKinds(), []);
@@ -258,12 +259,14 @@ export default function CodeGraphView() {
258259
setSelectedKind(kind);
259260
setDrillLoading(true);
260261
setDrillNodes([]);
262+
setDrillTotal(0);
261263
try {
262-
// Fetch up to 200 nodes for the drill-down view
263264
const result: NodesListResponse = await api.getNodesByKind(kind, 200, 0);
264265
setDrillNodes(result.nodes ?? []);
266+
setDrillTotal(result.total ?? result.count ?? (result.nodes ?? []).length);
265267
} catch {
266268
setDrillNodes([]);
269+
setDrillTotal(0);
267270
} finally {
268271
setDrillLoading(false);
269272
}
@@ -272,6 +275,7 @@ export default function CodeGraphView() {
272275
const handleDrillUp = useCallback(() => {
273276
setSelectedKind(null);
274277
setDrillNodes([]);
278+
setDrillTotal(0);
275279
}, []);
276280

277281
const kinds: KindEntry[] = kindsData?.kinds ?? [];
@@ -284,7 +288,9 @@ export default function CodeGraphView() {
284288
<h1 className="text-2xl font-bold gradient-text">Code Graph</h1>
285289
<p className="text-sm text-surface-400 mt-0.5">
286290
{selectedKind
287-
? `${drillNodes.length} nodes of kind "${selectedKind}"`
291+
? drillTotal > drillNodes.length
292+
? `Showing ${drillNodes.length} of ${drillTotal} "${selectedKind}" nodes`
293+
: `${drillNodes.length} nodes of kind "${selectedKind}"`
288294
: `${kinds.length} node kinds — click a tile to explore`}
289295
</p>
290296
</div>

0 commit comments

Comments
 (0)