Skip to content

Commit a2bb2e0

Browse files
aksOpsclaude
andauthored
perf(ui): cap initial file-tree fetch at depth 8 on dashboard (#119)
Dashboard.tsx called `api.getFileTree()` with no depth, so the backend returned the full tree (capped only by the 10 K maxFiles limit). On a 200 K-node graph that's ~2-4 MB of JSON shipped to the browser on every cold load, even though ECharts treemap only renders one level at a time and drilling is client-side. Cap initial fetch at depth 8 — enough for a fully-qualified Java path (`src/main/java/io/github/<org>/<pkg>/<sub>/File.java` = 8 segments) and the typical TS/Python/Go layouts. Past depth 8 the directory renders as a leaf with its aggregate node count; on-demand subtree fetching for deeper drilling is a follow-up if real workloads need it. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 4b7cb45 commit a2bb2e0

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

src/main/frontend/src/pages/Dashboard.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,13 @@ export default function Dashboard() {
208208
// breadcrumb(38) + gaps(24)
209209
const treemapHeight = useViewportHeight(56 + 32 + 110 + 38 + 24);
210210

211-
// Treemap
212-
const { data: treeData, loading: treeLoading } = useApi<FileTreeResponse>(() => api.getFileTree(), []);
211+
// Treemap. Cap initial fetch at depth 8 — enough for a fully-qualified Java
212+
// path (src/main/java/io/github/<org>/<pkg>/<sub>/File.java = 8 segments)
213+
// and most other languages, but spares the 200 K-node case from shipping
214+
// the full tree for paths the user will never drill into. Past depth 8
215+
// the directory renders as a leaf with its aggregate node count; on-demand
216+
// subtree fetching is a follow-up (Phase 2).
217+
const { data: treeData, loading: treeLoading } = useApi<FileTreeResponse>(() => api.getFileTree(8), []);
213218
const { treemapRoot, pathMap } = useMemo(() => {
214219
const map = new WeakMap<TreemapNode, string>();
215220
const children = buildTreemapTree(collapseTree(treeData?.tree ?? []), '', map);

0 commit comments

Comments
 (0)