Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix: run inject in angular injection context
  • Loading branch information
rosostolato committed Dec 26, 2024
commit b5f7e5f1845404f245760efdfb8335d3d13b61ec
5 changes: 3 additions & 2 deletions src/compat/firestore/firestore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ export function associateQuery<T>(collectionRef: CollectionReference<T>, queryFn
export class AngularFirestore {
public readonly firestore: firebase.firestore.Firestore;
public readonly persistenceEnabled$: Observable<boolean>;
private readonly ngZone = inject(NgZone);

/**
* Each Feature of AngularFire has a FirebaseApp injected. This way we
Expand Down Expand Up @@ -197,7 +198,7 @@ export class AngularFirestore {
collectionRef = pathOrRef;
}
const { ref, query } = associateQuery<T>(collectionRef, queryFn);
const refInZone = inject(NgZone).run(() => ref);
const refInZone = this.ngZone.run(() => ref);
return new AngularFirestoreCollection<T>(refInZone, query, this);
}

Expand Down Expand Up @@ -227,7 +228,7 @@ export class AngularFirestore {
} else {
ref = pathOrRef;
}
const refInZone = inject(NgZone).run(() => ref);
const refInZone = this.ngZone.run(() => ref);
return new AngularFirestoreDocument<T>(refInZone, this);
}

Expand Down