-
Notifications
You must be signed in to change notification settings - Fork 248
List watch should report initial content as additions #774
Comments
TODO When this is solved, update ngRepeat and ngClass |
@mhevery (or whoever can help me) I have investigated this a little bit more. The problem is in Watch watch(AST expression, ReactionFn reactionFn) {
WatchRecord<_Handler> watchRecord =
_cache.putIfAbsent(expression.expression,
() => expression.setupWatch(this));
return watchRecord.handler.addReactionFn(reactionFn);
} When watching a collection Then we'll only get notified on the second I'm unsure of to fix this as the behavior should be specific for collections and I'm afraid my changes would have side effects. Any hint on the best solution ? |
I looked into this issue. A fix would require a refactor of the way we do dirty checking for collections and maps. In the general case, Closing for now (but I'll keep this in mind during refactors.) |
@chirayuk thanks for the info.
Do you have any specific things in mind ? If so i would to hear more about that. |
Reopening as the behavior might change with the "unified" change detection (#1348) |
relates to #751
When a list is watch, the first reported
CollectionChangeRecord
contains the list in itsiterable
field and theadditions
is null.We should change this for the
additions
to report all ements as added[null -> <index>]
.It could allow simplifying some code by making the first iteration a common case rather than a special case.
The text was updated successfully, but these errors were encountered: