Skip to content

Commit a184f69

Browse files
committed
Pass injector scope to promises
1 parent a401cdb commit a184f69

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/zones.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ function getSchedulers() {
8181
var alreadyWarned = false;
8282
function warnOutsideInjectionContext(original: any, operation: string) {
8383
if (isDevMode()) {
84-
console.warn(`Firebase API called outside injection context: ${operation}(${original})`);
84+
console.warn(`Firebase API called outside injection context: ${operation}(${original.name})`);
8585
if (!alreadyWarned) {
8686
alreadyWarned = true;
8787
console.error("Calling Firebase APIs outside of an Injection context may destabilize your application leading to subtle change-detection and hydration bugs. Find more at https://github.com/angular/angularfire/blob/main/docs/zones.md");
@@ -196,8 +196,8 @@ export const ɵzoneWrap = <T= unknown>(it: T, blockUntilFirst: boolean): T => {
196196
() =>
197197
new Promise((resolve, reject) => {
198198
pendingTasks.run(() => ret).then(
199-
(it) => run(() => resolve(it)),
200-
(reason) => run(() => reject(reason))
199+
(it) => runInInjectionContext(injector, () => run(() => resolve(it))),
200+
(reason) => runInInjectionContext(injector, () => run(() => reject(reason)))
201201
);
202202
})
203203
);

0 commit comments

Comments
 (0)