xyflow icon indicating copy to clipboard operation
xyflow copied to clipboard

Nodes with parent get selected on drag-selection without even touching

Open cacoos opened this issue 3 years ago • 6 comments

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

  1. Add a node to any group (new or initialized)
  2. 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

cacoos avatar Jul 25 '23 19:07 cacoos

This looks like a weird bug. Thanks for the report, we will check it!

moklick avatar Jul 27 '23 07:07 moklick

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. test

Bars92 avatar Jul 27 '23 11:07 Bars92

ok, thanks for the info @Bars92

moklick avatar Jul 31 '23 13:07 moklick

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.

moklick avatar Aug 03 '23 13:08 moklick

thanks!

cacoos avatar Aug 03 '23 15:08 cacoos

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.

Bars92 avatar Aug 08 '23 10:08 Bars92