Clariity / react-chessboard

The React Chessboard Library used at ChessOpenings.co.uk. Inspired and adapted from the unmaintained Chessboard.jsx.
https://react-chessboard.vercel.app
MIT License
335 stars 101 forks source link

fix maximum update depth exceeded issue #113

Closed poorneshhn closed 10 months ago

poorneshhn commented 10 months ago

I saw this issue on stackoverflow [https://stackoverflow.com/questions/77380011/simple-component-in-react-chessboard-is-causing-constant-maximum-update-depth-e].

The issue is,

since metrics variable which is an object is given as a dependency to useEffect which in turn sets a state variable, there was infinite re-render.

Attaching a screenshot for your reference. chessboard-rerender-issue

vercel[bot] commented 10 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-chessboard ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 28, 2023 7:02pm