Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

onCanvasDrop creates two nodes #122

Closed
Livshind15 opened this issue Apr 10, 2020 · 4 comments · Fixed by #169
Closed

onCanvasDrop creates two nodes #122

Livshind15 opened this issue Apr 10, 2020 · 4 comments · Fixed by #169

Comments

@Livshind15
Copy link

because of React.StrictMode setState updaters will run twice in strict mode in development, This causes a double call to onCanvasDrop function and create double node

@Livshind15 Livshind15 changed the title onCanvasDrop creates two node onCanvasDrop creates two nodes Apr 10, 2020
@daveabes
Copy link

Yes I was experiencing the same issue. When structuring my components differently from the examples, the on Node Dropped event is called 2 times.

@MrBlenny
Copy link
Owner

MrBlenny commented May 9, 2020

What do you suggest the solution to this is?

@prativm
Copy link

prativm commented May 18, 2020

@MrBlenny
Experiencing the same issue. it creates two nodes with different IDs.

@ChrisCardoz
Copy link

@MrBlenny I noticed the error occurring when I started to useContext() for the state of my graph according to this example.
https://codesandbox.io/embed/condescending-moon-jke7z

When I used this model for the state of the graph, I couldn't figure out how to update the state of the graph from the node, but I did not experience this error.
https://github.com/MrBlenny/react-flow-chart/blob/master/stories/CustomNodeInner.tsx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants