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) <noreply@anthropic.com>
This commit is contained in:
Lum1104
2026-03-17 11:53:08 +08:00
co-authored by Claude Opus 4.6
parent da8509e2b1
commit 4161d3eba3
@@ -89,10 +89,10 @@ export default function GraphView() {
};
});
const diffNodeIds = new Set([...changedNodeIds, ...affectedNodeIds]);
const diffNodeIds = diffMode ? new Set([...changedNodeIds, ...affectedNodeIds]) : new Set<string>();
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 {