Nodes with parent get selected on drag-selection without even touching
Describe the Bug
Hey!
In the example of node dynamic grouping (https://reactflow.dev/docs/examples/nodes/dynamic-grouping/), a node that has added to a group gets selected on every drag-selection.
Your Example Website or App
https://reactflow.dev/docs/examples/nodes/dynamic-grouping/
Steps to Reproduce the Bug or Issue
- Add a node to any group (new or initialized)
- Make a selection (with shift or whatever you configured) anywhere
Expected behavior
I expected to select the correct ones (obviously, according to selectionMode prop)
Screenshots or Videos
https://github.com/wbkd/react-flow/assets/30879716/60f19ac3-c07e-4598-abcc-ee6e1889ea7e
Platform
- OS: macOS
- Browser: Chrome
Additional context
No response
This looks like a weird bug. Thanks for the report, we will check it!
Also happened to us without grouping but with multi selection. it does seem like on mouse move getNodesInside always detect some kind of previous selection as inside the selection block that invokes onNodesChange with an incorrect selection change. Mostly happens to us only after multi selection + drag regardless of selection mode.
ok, thanks for the info @Bars92
This was an issue with the dynamic grouping example. I already pushed a fix. The issue was, that we need to set dragging: false for a dropped node.
thanks!
For future record, the issue for us was the same (missing dragging: false).
We have implemented copy/paste for nodes and the paste was missing dragging: false on all copied nodes before update, in order to avoid this inconsistency between react flow internal state and our external state.