You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 26, 2024. It is now read-only.
Repository navigation
This repository was archived by the owner on Feb 26, 2024. It is now read-only.
So I was investigating this yesterday and over the weekend, and what I'm finding is that CollectionAST(FieldReadAST(ContextReferenceAST)) works well, but FieldReadAST(ContextReferenceAST) doesn't (because a CollectionAST handler never does anything).
So, this is the issue we have with a dynamic language like javascript -- we don't know in advance that a particular field must contain a List (or something), it might initially be undefined, and then turn into a list, and then turn into a string, or whatever.
Because of this, there are only really 2 options, I think:
something similar to $watchCollection which will make sure to set up the CollectionAST node, even if the value isn't a collection at the time of parsing
totally scrap the strategy based on a more statically typed language, and do something more dynamic --- let a particular field's handlers change at runtime, and support reporting change between non-collection to collection and vice versa.
I think option 2) could hurt performance a fair bit, but I don't really have a measure of the performance cost.
However, neither of the situations I mentioned have anything to do with 9417cd4 as far as I can tell, so you may be reproducing the issue differently. Can you show a test case?
@mhevery what was the strategy in Dart for handling this? The problem is that the DirtyCheckingRecord with the CollectionHandler is the first thing which is dirty checked, so its internal copy of the array still references the old array (because the FieldRead handler hasn't done its work yet)
There are lots of ways around this, but I want to make sure it's in sync with the dart implementation.
Watching a collection that is stored in a property of an object does not work.
I found the problem, see 9417cd4
The change should be fine, as the line is in the Angular.dart code and was just missing. Could you add unit tests for this?