-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Closed
Description
Scenario in Angular:
Service A:
constructor() {
this.list = this.angularfire.list('/myList');
}
Component A:
onInit() {
this.list = this.serviceA.list;
}
<div *ngFor="let item of list | async">
<componentB />
</div>
Component B:
<componentC />
Component C:
onInit() {
this.list = this.serviceA.list;
}
<div *ngFor="let item of list | async">TEST</div>
Then you update one of the items in list (e.g. through Firebase admin web interface). This will cause the following:
- Component C will be destroyed
- Which causes the async pipe to unsubscribe to the this.list Observable.
- Due to https://github.com/angular/angularfire2/blob/master/src/utils/firebase_list_factory.ts#L139 - all listeners/subscriptions are cancelled to the ref. Since we have two listeners/subscriptions (one at Component C which should cancel, and one at Component A which should NOT cancel), this will break the app (more specifically, Component A's subscription will cancel which it shouldn't).
I'll send a PR ASAP to fix this.