Maximum update depth exceeded
See original GitHub issueDescribe the Bug
using useNodes, useEdges hooks causing the Maximum update depth exceeded
react error.
Reproduced this by repositioning the nodes.
Your Example Website or App
https://codesandbox.io/s/reactflow-9wb79d?file=/App.js
Steps to Reproduce the Bug or Issue
- Go to this codesanbdox link
- Reposition the nodes
Expected behavior
No error on repositioning the nodes when using useNodes hook
Screenshots or Videos
Platform
- OS: macOS
- Browser: Brave
- Version: 1.45.123
Additional context
No response
Issue Analytics
- State:
- Created 10 months ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
ReactJS: Maximum update depth exceeded error
Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate.
Read more >Fix the "Maximum Update Depth Exceeded" Error in React
Fix the "Maximum Update Depth Exceeded" Error in React ... React is an excellent framework, but it can have some tricky “gotchas.” One...
Read more >Maximum update depth exceeded warning in React
Maximum update depth exceeded warning in React ... This warning can often happen when a component sets the state inside the useEffect hook....
Read more >Maximum update depth exceeded. This can happen when a ...
Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate.
Read more >Maximum update depth exceeded problem without using ...
"Warning: Maximum update depth exceeded. This can happen when a component calls setState inside useEffect, but useEffect either doesn't have ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ah missed this guide. For the current report then we can conclude it occurred due to bad state management. Closing this report. Thank you so much @moklick for the guide.
Did you see the state management guide. The important thing is, that you implement the
onNodesChange
,onEdgesChange
andonConnect
in your store. Then there is no need to sync states, because the one source of truth is your store.