Open mattcreager opened 10 years ago
The similar problem still exists when dealing with child arrays. I've created a fork of your plunker illustrating the issue.
The output is:
model is: undefined was: undefined
model is: ["d", "e", "f"] was: undefined
model is: undefined was: ["d", "e", "f"]
model is: ["a", "b", "c"] was: undefined
model is: undefined was: ["a", "b", "c"]
model is: ["d", "e", "f"] was: undefined
As you can see, there are odd model is: undefined
runs while performing only two $set
s. This behavior leads to undesirable animation issues.
Ah, arrays are being handled as primitive values, we need to implement the same solution for both primitives and objects, thanks again @artch I'll drop a PR in :)
Any progress with this? It really hurts when it comes to animation in many cases.
The issue has been replicated in this plunker.
Each
$set
operation should be followed by a single$watchCollection
event being triggered. As is demonstrated in the plunker, an additional event is being triggered, as the model is cleared and refreshed with the current data.