deferred updates: only notify computed changed if it was evaluated#2240
deferred updates: only notify computed changed if it was evaluated#2240
Conversation
|
Is it possible for you to provide a sample using the latest knockout (3.4.2) showing the incorrect behavior?
Is it possible for a computed to be marked dirty and then not be recalculated, i.e. for it to be marked dirty and then somehow "get discarded"? |
|
https://jsfiddle.net/mbest/zvqv620e/ |
|
Thanks. The behavior of the default In this case, because object equality is not good enough for the default equalityComparer the behavior is perhaps surprising. But, isn't this by design? E.g., see http://stackoverflow.com/questions/12714761/why-does-knockout-jss-default-equality-comparer-treat-non-primitive-types-as-no You of course already know, but with an "appropriate" Is this an issue with https://jsfiddle.net/fastfasterfastest/n1vbj5dc/ |
|
@mbest Do you agree that this issue has nothing to do with |
|
The default |
|
I didn't say that there was a problem with default
When not using
Today, with I am not sure I am convinced there is an issue here. I am concerned about #2234 being fixed, though. |
The problem is that with |
How is that possible - how can a computed observable notify subscribers of a change in its value without (first) being re-evaluated to determine the value with which to notify? |
I traced into the sources, and it seems the answer to my question is yes. At least when I had thought that if a computed was marked dirty it would (eventually) be re-evaluated, thus my comments above. |
|
I've attached the fix here. |
847d1f1 to
fa17c59
Compare
Currently, if a computed has a non-primitive value, it will always notify a change if it was marked as dirty. It should only notify a change if it was actually recalculated. Thus it's not sufficient to base the notify decision solely on the value, as is currently done.