Skip to content

Commit 22b6d3c

Browse files
committed
A better fix I think
1 parent 1183c22 commit 22b6d3c

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/zones.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -169,14 +169,15 @@ export const ɵzoneWrap = <T= unknown>(it: T, blockUntilFirst: boolean, logLevel
169169
} else if (ret instanceof Promise) {
170170
// eslint-disable-next-line @typescript-eslint/no-misused-promises
171171
return run(
172-
() =>
173-
new Promise((resolve, reject) => {
174-
pendingTasks.run(() => ret.then(
172+
() => {
173+
pendingTasks.run(() => ret);
174+
return new Promise((resolve, reject) => {
175+
ret.then(
175176
(it) => runInInjectionContext(injector, () => run(() => resolve(it))),
176177
(reason) => runInInjectionContext(injector, () => run(() => reject(reason)))
177178
)
178-
);
179-
}));
179+
});
180+
});
180181
} else if (typeof ret === 'function' && taskDone) {
181182
// Handle unsubscribe
182183
// function() is needed for the arguments object

0 commit comments

Comments
 (0)