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: double canvas in react 18 strict mode #161

Merged
merged 2 commits into from
Jul 5, 2023

Conversation

yulinscottkang
Copy link
Contributor

@yulinscottkang yulinscottkang commented Jul 3, 2023

  • Fixes Doubled canvas and container #160

  • Root cause: useEffect is executed twice in development in React 18's strict mode to detect impure functions, causing atlas.Map to initialize twice.

  • Use useRef to ensure atlas.Map is initialized only once between component mount/unmount.

@yulinscottkang yulinscottkang merged commit 7249cec into Azure:master Jul 5, 2023
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 this pull request may close these issues.

Doubled canvas and container
2 participants