-
-
Notifications
You must be signed in to change notification settings - Fork 95
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
Re-assigning NaN is seen as a value change #614
Comments
I don't want to say this won't be supported here, but I'd really, really recommend against setting |
Just for context, I discovered through through doing |
You should really never call I believe the intention here is to still ship ES5, so Again, not saying we won't, but I at least would prefer not to. It's a bad pattern to pass |
Environment
@preact/signals-core
@preact/signals
@preact/signals-react
Describe the bug
In JavaScript,
NaN === NaN
evaluates tofalse
. A consequence of this is that a signal with the valueNaN
will trigger an update if the value is again assigned asNaN
. In the worst case, this might lead to an infinite loop with a two-way UI binding if the receiving end is also treatingNaN
in the same way.To Reproduce
This logs
NaN
twice even though it's expected that the last row shouldn't lead to running the effect again.Expected behavior
Expected that the dirty checking logic has a special case for re-assigning
NaN
The text was updated successfully, but these errors were encountered: