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

fix: Maximum update depth exceeded error #1569

Merged
merged 1 commit into from
Nov 27, 2024

Conversation

Dzuming
Copy link
Contributor

@Dzuming Dzuming commented Nov 27, 2024

  • The problem is, that sometimes (for example during resize as in the video below) in this place
 useLayoutEffect(() => {
     if (contentAvailable && position && !(maximized || wasMaximized)) {
       const newValue = calcEdgePosition(viewport);
       setPosition((current) => (isEqual(newValue, current) ? current : newValue));
     }
   }, [contentAvailable, wasMaximized, calcEdgePosition, maximized, position, viewport]);

setPosition falls into an infinite loop, i suspect that it can be a race condition, and since we have a dependencies position, the values differ

  • the issue was reported by a few people in different non-deterministic contexts, however here are the easiest steps to reproduce it

Before:

Screen.Recording.2024-09-13.at.13.05.27.mov

After:

Screen.Recording.2024-09-13.at.13.06.29.mov

@Dzuming Dzuming merged commit 5a98ef5 into dev Nov 27, 2024
4 checks passed
@Dzuming Dzuming deleted the NU-1807-fix-Maximum-update-depth-exceeded-error branch November 27, 2024 13:38
Copy link
Contributor

🎉 This PR is included in version 1.9.1-beta.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

Copy link
Contributor

github-actions bot commented Dec 6, 2024

🎉 This PR is included in version 1.9.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

1 participant