react-flow-chart
react-flow-chart copied to clipboard
Drag and drop of node inside canvas create two nodes in dev mode
While in dev mode, the reducer for the action onCanvasDrop
will create two nodes instead of one.
When creating a production build of the same application then it creates only one node in the state as expected.
I believe this is due to the fact that setState
is called twice in dev mode to surface this kind of issues. The challenges probably comes from the uuid that create a different key in the object instead of recreating the same key hence the end result is two identical nodes being added.
Not sure what we can do to solve this as I'm pretty new in react.
I was actually able to fix this issue by calculating myself the value for the next id outside of the Flow Chart prior to drag and drop and passing it to data.id
. Hope it helps other people that come across that issue.
Could you post a screenshot of the issue or explain how you can view it? I don't have the same issue
I have the same issue. It happens to me when I try to reproduce this example on my local machine using @mrblenny/react-flow-chart": "^0.0.13
, node
v10.20.1 and yarn v1.16.0.