Tree: onDrop should not attempt a copy of node values #5080
Labels
Type: Enhancement
Issue contains an enhancement related to a specific component. Additional functionality has been add
Milestone
Describe the bug
onDrop
does aJSON.parse(JSON.stringify(props.value))
to copy nodes. I assume this has to do with reference equality. This has a few issues when implementing drag'n'drop:TypeError
Reproducer
https://codesandbox.io/s/primereact-test-forked-p5vxlv?file=/src/index.js
PrimeReact version
10.0.3
React version
17.x
Language
ALL
Build / Runtime
Create React App (CRA)
Browser(s)
No response
Steps to reproduce the behavior
Open sandbox
Drag one node to another
Observer circular reference TypeError
Comment out node 3
Drag one node to another
Observe console.log with different data than the original node
Expected behavior
Drag'n'drop should not edit node data.
I'm willing to add a PR for this. I made a small test and just copying the
values
array seems to work fine. Is this expected? Or should a more deeper/recursive copy be done?The text was updated successfully, but these errors were encountered: