From 4161d3eba31b965900c3fbaa8b16dd16531b663e Mon Sep 17 00:00:00 2001 From: Lum1104 Date: Tue, 17 Mar 2026 11:53:08 +0800 Subject: [PATCH] perf(dashboard): skip diff overlay computation when diffMode is off Guard diffNodeIds construction and per-edge lookups behind diffMode check to avoid unnecessary Set spreads and has() calls on every graph recompute when diff mode is inactive. Co-Authored-By: Claude Opus 4.6 (1M context) --- .../packages/dashboard/src/components/GraphView.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/understand-anything-plugin/packages/dashboard/src/components/GraphView.tsx b/understand-anything-plugin/packages/dashboard/src/components/GraphView.tsx index 375a231..1a57793 100644 --- a/understand-anything-plugin/packages/dashboard/src/components/GraphView.tsx +++ b/understand-anything-plugin/packages/dashboard/src/components/GraphView.tsx @@ -89,10 +89,10 @@ export default function GraphView() { }; }); - const diffNodeIds = new Set([...changedNodeIds, ...affectedNodeIds]); + const diffNodeIds = diffMode ? new Set([...changedNodeIds, ...affectedNodeIds]) : new Set(); const flowEdges: Edge[] = filteredGraphEdges.map((edge, i) => { - const sourceInDiff = diffNodeIds.has(edge.source); - const targetInDiff = diffNodeIds.has(edge.target); + const sourceInDiff = diffMode && diffNodeIds.has(edge.source); + const targetInDiff = diffMode && diffNodeIds.has(edge.target); const isImpacted = diffMode && (sourceInDiff || targetInDiff); return {