You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Neither !== or !Object.is is perfect solution. For !==, we have NaN !== NaN being true. For !Object.is, we have !Object.is(0, -0) being true.
This is probably not a significant issue. The worst outcome is we would fail to skip propagating state changes and re-render DOM when we indeed can skip (i.e.: when the new value in the s.val = <new value> call is semantically the same as the existing one). Thus we're just wasting some computation in rare circumstances. This will not cause any semantic issue for apps built with VanJS.
Among 2 options, I personally believe !== is slightly better than !Object.is. We might encounter the comparison between 0 and -0 more often than the comparison between NaN and NaN, as NaN shouldn't usually occur for a semantically correct app.
The code uses
!==
to compare old and new values.The problem is, if at least one of the values is
NaN
the condition will always betrue
We can fix the problem by using
Object.is
:The text was updated successfully, but these errors were encountered: