-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Closed
Description
Version info
Angular:
9.1.4
Firebase:
7.14.2
AngularFire:
6.0.0
I have a UsersService
which fetches users over https callable functions.
Subscribing to the observable returned breaks the change detection in my component.
Changing the changeDetection
to ChangeDetectionStrategy.OnPush
and explicitly calling ChangeDetectorRef.markForCheck()
and ApplicationRef.tick()
or running the subscribe block in an NgZone
fixes the problem.
Steps to set up and reproduce
class MyService {
constructor(protected firebaseFunctions: AngularFireFunctions) {}
fetch() {
const f = this.firebaseFunctions.httpsCallable("myFunc");
return f({});
}
}
class MyComponent implements OnInit {
res: any;
constructor(private service: MyService, private zone: NgZone) {}
ngOnInit() {
this.service.fetch().subscribe((res) => {
this.res = res;
// This works:
// this.zone.run(() => {
// this.res = res;
// });
});
}
}
Expected behavior
Shouldnt break change detection or explicitly state how to work around it in docs.
Actual behavior
Does not work.
Metadata
Metadata
Assignees
Labels
No labels