feat(graph): live force simulation with node dragging - #980
Conversation
Replace the one-shot ForceAtlas2 pre-layout with a continuously running simulation so the graph organises itself on open, settles, and reacts when a node is dragged. - add dependency-free GraphPhysics (link springs, grid-cutoff repulsion, centering, collision, alpha decay/reheat, fx/fy pinning) - drive it one tick per animation frame; park when settled, wake on grab - add node dragging with a 3px threshold so a drag never opens a tab - stop baking a static layout in graph-builder; seed at simulation scale - animateLayout now means "live motion", defaults on, and is exposed in the control panel
|
React Doctor found 1 new issue in 1 file · 1 warning · score 92 / 100 (Great) · 0 fixed · vs 1 warning
Reviewed by React Doctor for commit |
| } | ||
| } | ||
|
|
||
| frame = requestAnimationFrame(step) |
There was a problem hiding this comment.
React Doctor · react-doctor/effect-raf-loop-needs-cancel (warning)
This requestAnimationFrame loop can schedule another frame but is never cancelled, so pending work may continue after unmount; store every frame id in one handle and cancel that handle from the returned effect cleanup.
Fix → Store the frame id and return a cleanup that calls cancelAnimationFrame(id) so self-scheduling work cannot continue after unmount.
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
What
GraphPhysics(link springs, grid-cutoff repulsion, centering, collision, alpha decay/reheat,fx/fypinning)animateLayoutnow means "live motion", defaults on, and is finally exposed in the control panelWhy
The graph looked dead:
graph-builderbaked a static layout at build time and sigma drew frozen coordinates, the force worker was gated off with no UI to enable it, and no drag handlers existed.Written in-repo rather than pulling in
d3-force— adding it re-resolved shared transitives (@floating-ui/dom1.7.6 → 1.8.0) and broke 1151 renderer tests. Lockfile is untouched.