Skip to content

Commit b5f7e5f

Browse files
committed
fix: run inject in angular injection context
1 parent bc926a8 commit b5f7e5f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/compat/firestore/firestore.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ export function associateQuery<T>(collectionRef: CollectionReference<T>, queryFn
121121
export class AngularFirestore {
122122
public readonly firestore: firebase.firestore.Firestore;
123123
public readonly persistenceEnabled$: Observable<boolean>;
124+
private readonly ngZone = inject(NgZone);
124125

125126
/**
126127
* Each Feature of AngularFire has a FirebaseApp injected. This way we
@@ -197,7 +198,7 @@ export class AngularFirestore {
197198
collectionRef = pathOrRef;
198199
}
199200
const { ref, query } = associateQuery<T>(collectionRef, queryFn);
200-
const refInZone = inject(NgZone).run(() => ref);
201+
const refInZone = this.ngZone.run(() => ref);
201202
return new AngularFirestoreCollection<T>(refInZone, query, this);
202203
}
203204

@@ -227,7 +228,7 @@ export class AngularFirestore {
227228
} else {
228229
ref = pathOrRef;
229230
}
230-
const refInZone = inject(NgZone).run(() => ref);
231+
const refInZone = this.ngZone.run(() => ref);
231232
return new AngularFirestoreDocument<T>(refInZone, this);
232233
}
233234

0 commit comments

Comments
 (0)