-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Non-value passed to custom computed equality check #1208
Comments
Seems like bug indeed. Summoning @jamiewinder @mweststrate |
I think you're right about the cause and solution to this problem. I'll add a PR to sort this in the next few days if I manage to claw some free time (unless someone beats me to it!). |
I've tried to fix this in #1213. Please let me know if I should assign it to anyone in particular. |
@chrisdoble sorry for the late response! Was kinda drown in github notifications :) Anyway thanks for the thorough analysis, I am pretty sure you are right and the correct behavior imho should be that the comparer indeed shouldn't be called in these cases. Will review asap |
The documentation for
computed
'sequals
option statesI interpreted this to mean that custom equality functions will only ever be passed values that were returned from the derivation function. Is that correct? I believe I've found a situation where this isn't the case.
A snippet that reproduces the behaviour:
undefined
was never returned from the derivation function() => observable.get() + 1
, so I didn't expect it to be passed to the equality function. After disposing the observer and establishing a new one, I either expected the equality function not to be called, or to be called with 2 and 2.I think this is happening because
ComputedValue::value
is assignedundefined
when it becomes unobserved (code) and this is then passed toequals
when it becomes observed again (code). Perhaps it should be assignednew CaughtException(null)
as it is in the constructor (code) which would bypass the equality check (code)?The text was updated successfully, but these errors were encountered: