Fix edges disappearing after node rename#35
Conversation
Deploying polycule-graph with
|
| Latest commit: |
5febbf5
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://0d0074b9.polycule-graph.pages.dev |
| Branch Preview URL: | https://hydra-issue-34-edge-after-re.polycule-graph.pages.dev |
|
@CoralCorvusCortex is it possible to force that rerender without forcing a layout change? |
|
Yes — we can force a Cytoscape re-render/remount without implicitly re-running a layout. I pushed a follow-up commit to this PR that:
Commit: 2dff55b ("Preserve node positions across Cytoscape remount"). So renames will trigger the remount to fix disappearing edges, but the layout/positions should stay as-is. |
|
That doesn't seem to work. instead, can we save the node's coordinate, and then give it back to the new node? |
|
Implemented position preservation on node rename.
Change: |
|
good work, just last thing: on load we need to refresh layout once |
|
Implemented the on-load layout refresh.
Changes: |
|
Follow-up (previous comment got shell-mangled): Implemented the on-load layout refresh.
Change: src/components/GraphView.tsx |
|
Checks: pnpm lint, pnpm test (vitest) |
Fixes #34.\n\nWhen renaming a node we change its element ID + edge endpoints. Cytoscape element IDs are effectively immutable, and react-cytoscapejs may not fully reconcile this structural change, causing edges to disappear until a full re-render.\n\nThis PR forces a Cytoscape remount when the graph's structural identity (node ids + edge endpoints) changes, so renames reliably keep edges visible.\n\nTests: pnpm test