frontend-collective/react-sortable-tree

How to get prevParentNode when onMoveNode ?

TomPast opened this issue · 1 comments

Hey, I want to get the prevParentNode when i'm moving a node from a parent to another. Currently, with onMoveNode args I can get the prevPath and prevTreeIndex but I can't get the prevParentNode (I can have the nextParentNode)
I could just retrieve the prevParentNode by doing a getNodeAtPath with the previous path but it's impossible if i'm moving the node above the previous parent node because its modifying his path.

How could I get the prevParentNode ? Thanks by advance

I finally found, my getNodeKey was set to Default based on the treeIndex.
Just changed it to :
const getNodeKey = ({ node }) => node.noderef
And then I can access to the prevParentNode using getNodeAtPath with the prevPath