react-arborist icon indicating copy to clipboard operation
react-arborist copied to clipboard

Dragging parent into a child - critical issue

Open Arthur-Ruthenberg opened this issue 1 year ago • 3 comments

When a parent folder is being dragged into a child there is no check to prohibit this from happening. This causes the entire subtree to disappear.

Arthur-Ruthenberg avatar Aug 22 '22 07:08 Arthur-Ruthenberg

Uh oh.

Well, there is code that prevents this from happening (ass you can see it in this demo, but there must be hole somewhere. Would you mind posting the options that you are passing to the <Tree> component? Also what version of the code are you on?

Since this is a controlled component, you'll be handing the "move" operation in your own code. You can make a check there. That can be a workaround until I discover the bug.

jameskerr avatar Aug 22 '22 17:08 jameskerr

Try dragging a folder to the end of one of it's children. For example - House of Tully beneath Caitlin

I did implement a failsafe within my onmove function, but I guess it should be prohibited by the drag movement. The functionality that calculates the drop position - the blue underline.

Arthur-Ruthenberg avatar Aug 23 '22 11:08 Arthur-Ruthenberg

Yup, I can reproduce. Thanks for reporting it. I'll find the bug now and fix it in the next release. I'm glad there's a workaround for you.

jameskerr avatar Aug 23 '22 16:08 jameskerr