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

can.compute | NaN -> NaN dispatches a change event #2128

Closed
rjgotten opened this Issue Dec 9, 2015 · 1 comment

Comments

Projects
None yet
3 participants
@rjgotten

rjgotten commented Dec 9, 2015

https://github.com/canjs/canjs/blob/master/compute/proto_compute.js#L384

Currently can.compute fails to take into account the fact that NaN !== NaN, which causes computes to dispatch change events when their computed value remains NaN,

@justinbmeyer justinbmeyer added this to the 2.3.7 milestone Dec 15, 2015

@justinbmeyer

This comment has been minimized.

Show comment
Hide comment
@justinbmeyer

justinbmeyer Dec 15, 2015

Contributor

@rjgotten This should be a pretty easy fix. Simply change the logic around:

https://github.com/canjs/canjs/blob/master/compute/proto_compute.js#L384

To check if isNaN(newVal) ? ! isNaN(oldVal) : newValue !== oldValue.

And add a test.

Contributor

justinbmeyer commented Dec 15, 2015

@rjgotten This should be a pretty easy fix. Simply change the logic around:

https://github.com/canjs/canjs/blob/master/compute/proto_compute.js#L384

To check if isNaN(newVal) ? ! isNaN(oldVal) : newValue !== oldValue.

And add a test.

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