H-5655: Refactor selection logic and migrate to @xyflow/react v12#8523
H-5655: Refactor selection logic and migrate to @xyflow/react v12#8523
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
2 Skipped Deployments
|
This stack of pull requests is managed by Graphite. Learn more about stacking. |
a4cb46c to
4043333
Compare
4043333 to
47518e4
Compare
47518e4 to
4a51729
Compare
PR SummaryMedium Risk Overview Refactors editor selection into a typed Adds new PropertiesPanel flows for arc selection ( Adjusts coordinate semantics to consistently store SDCPN node centers while Written by Cursor Bugbot for commit 278aaa6. This will update automatically on new commits. Configure here. |
Add a `partialSelection` user setting (default true) that controls whether drag-to-select picks up partially intersected nodes. Refactor the viewport settings dialog to use a reusable SettingRow grid component. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Remove FocusNodeRegistrar and all focusNode/registerFocusNode plumbing from the editor context. Viewport centering on node selection will be revisited as a dedicated feature. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Selected nodes render with a light blue fill and stroke in the MiniMap. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Move deletion keyboard handling from SDCPNView's onKeyDown to the global keyboard shortcuts hook using useEffectEvent, so Delete/Backspace works from anywhere in Petrinaut. Extend deleteItemsByIds to also handle types, differential equations, and parameters. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…temsByIds Expose `isSelected(id)` and `hasSelection` from EditorContext so consumers no longer need direct access to the SelectionMap for simple lookups. Change `deleteItemsByIds` to accept typed SelectionMap, enabling it to partition by item type and skip irrelevant collections. Migrate all 12 UI consumers. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…e test deps - Convert ELK top-left positions to center coordinates in calculateGraphLayout, matching the convention used by useSdcpnToReactFlow and useApplyNodeChanges - Accept dims parameter instead of using deprecated nodeDimensions alias, so layout uses correct dimensions for compact vs classic mode - Fix selection guards to check base map instead of prevSelection, preventing previously-selected canvas nodes from being dropped during box-select when non-canvas items are selected - Re-add @testing-library/dom and @testing-library/react devDependencies needed by unit tests that were incorrectly removed with browser test cleanup Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…rc index names Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ations When a type or differential equation is deleted, clear references to it from places and equations to avoid unresolvable IDs in the SDCPN JSON. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… fix drag-end cleanup - Stabilize setSelection with useCallback to prevent useSelectionCleanup effect from re-running on every render - Remove unused addToSelection and removeFromSelection - Add early return in selection updater when nothing changed to avoid unnecessary re-renders - Always clear per-node dragging state on drag-end even without position Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
7f99391 to
3dfb714
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
|
Re: cursor bot's "Selection cleanup uses stale state" — valid point. Switched to |
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>


🌟 What is the purpose of this PR?
Refactor the selection logic in Petrinaut and migrate to
@xyflow/reactv12. This centralizes selection state inEditorContext, adds multi-selection support, and improves keyboard shortcut handling.🔗 Related links
🔍 What does this change?
@xyflow/reactv12 with updated APIs and typesEditorContextwithisSelected/hasSelectionhelpersPre-Merge Checklist 🚀
🚢 Has this modified a publishable library?
This PR:
📜 Does this require a change to the docs?
The changes in this PR:
🕸️ Does this require a change to the Turbo Graph?
The changes in this PR:
EditorContextand ReactFlow's internal state still needs enhancements🐾 Next steps
🛡 What tests cover this?
❓ How to test this?