From 34221b633b0ca9b46471797aa20e6da95203886c Mon Sep 17 00:00:00 2001 From: Albrecht Degering Date: Tue, 28 Jul 2026 21:32:28 +0200 Subject: [PATCH] Guard View surface tree traversal --- webui/src/features/views/ViewsAdminPanel.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/webui/src/features/views/ViewsAdminPanel.tsx b/webui/src/features/views/ViewsAdminPanel.tsx index 4f88f71..55412d0 100644 --- a/webui/src/features/views/ViewsAdminPanel.tsx +++ b/webui/src/features/views/ViewsAdminPanel.tsx @@ -1054,10 +1054,12 @@ function SurfaceSelector({ function descendants(surfaceId: string): string[] { const result: string[] = []; + const visited = new Set([surfaceId]); const pending = [...(childrenByParent.get(surfaceId) ?? [])]; while (pending.length) { const child = pending.shift(); - if (!child) continue; + if (!child || visited.has(child.id)) continue; + visited.add(child.id); result.push(child.id); pending.push(...(childrenByParent.get(child.id) ?? [])); } @@ -1065,8 +1067,11 @@ function SurfaceSelector({ } function withAncestors(next: Set, surfaceId: string) { + const visited = new Set([surfaceId]); let current = byId.get(surfaceId); while (current?.parentId) { + if (visited.has(current.parentId)) break; + visited.add(current.parentId); next.add(current.parentId); current = byId.get(current.parentId); }