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

Use Object.is in useSyncExternalStore #3776

Merged

Conversation

zalishchuk
Copy link
Contributor

Fixes #3774

Copy link
Member

@marvinhagemeister marvinhagemeister left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great, thank you so much for making a PR! Let's add a test case for this so that we don't ever regress on it in the future 👍

@coveralls
Copy link

coveralls commented Oct 24, 2022

Coverage Status

Coverage increased (+0.0007%) to 99.531% when pulling 9f7a922 on zalishchuk:use-sync-external-store-fix into 9d4b2dc on preactjs:master.

@zalishchuk
Copy link
Contributor Author

@marvinhagemeister I'm not sure how it would be correct to test the absence of an infinite loop, but I pushed a simple test similar to the original implementation, to test that getSnapshot can return NaN without causing an infinite loop.

@marvinhagemeister
Copy link
Member

@zalishchuk That test is perfect!

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.

Zustand NaN infinite loop
3 participants