This repository has been archived by the owner on Feb 22, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 248
Dirty checker or digest seems buggy #670
Comments
*subscribes to this thread* |
I forgot to add that I'm iterating over that list with |
/sub |
The fact that objects on my list have operator== and hashCode overridden seem to be very important. Removing those methods or implementing them in terms of |
Could you try to setup a minimal test case to reproduce the issue ? |
Note that commenting out <button ng-click="ctrl.addFooBar()">Click me twice!</button>
<ul>
<li ng-repeat="foobar in ctrl.foobars">{{foobar.foo}} - {{foobar.bar}}</li>
</ul> class FooBar {
String foo, bar;
FooBar(this.foo, this.bar);
bool operator==(other) =>
other is FooBar && foo == other.foo && bar == other.bar;
int get hashCode =>
foo.hashCode ^ bar.hashCode;
}
@NgComponent(
templateUrl: "html-snippet-above.html",
publishAs: "ctrl",
selector: "my-component"
)
class MyComponent {
int n = 1;
List<FooBar> tmp = [];
List<FooBar> foobars = [];
void addFooBar() {
tmp.add(new FooBar("foo $n", "bar $n"));
n++;
foobars..clear()..addAll(tmp.map((fb) => new FooBar(fb.foo, fb.bar)));
}
} |
That was a nice subtle bug to find and squash! |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I use AngularDart at commit bb98990.
In my controller I have a
final List<CodeDownloadObjects>
. When handling the return of RPC adding new item I do ..clear()..addAll(downloadsFromRpcResult) to my list.CodeDownloadObject class has hashCode and operator== overridden.
With non-empty list to begin with doing that clear()..addAll causes the following output:
I tried to dig in a bit and changed the return format of
_CollectionChangeRecord.toString()
Here's what I got:
It looks like exactly the same change (from null?!?) over and over again.
It's no different when my code changes the variable to point to new list instead of ..clear..addAll-ing the old one.
The text was updated successfully, but these errors were encountered: