mirror of
https://github.com/Egonex-AI/Understand-Anything.git
synced 2026-06-22 10:58:03 +08:00
Fixes #14 — dashboard becomes unusable with large knowledge graphs (2,700+ nodes). - Web Worker for dagre layout: graphs above 200 nodes compute layout off the main thread via a dedicated Web Worker, keeping the UI responsive - Request ID correlation: concurrent layout calls are routed by incrementing request ID, preventing race conditions where results cross-wire - Worker error handling: onerror rejects pending promises; GraphView catches errors and clears the loading spinner - Cancellation cleanup: effect cleanup clears layouting state to prevent stuck spinners when the graph switches below the async threshold - Topology/visual split: dagre only re-runs when graph structure changes; node selection, tour highlights, and search results are applied as a cheap O(n) overlay without triggering relayout - React.memo on CustomNode: prevents O(n) re-renders when selecting individual nodes in large graphs - Zero overhead for small graphs: below 200 nodes, the original synchronous layout path is used unchanged Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>