-
Notifications
You must be signed in to change notification settings - Fork 27.1k
Closed
Labels
Milestone
Description
Which @angular/* package(s) are the source of the bug?
Don't known / other
Is this a regression?
No
Description
The resolve method, which is an argument when constructing a Promise when called in an Angular application, does not handle re-call correctly.
The following code executes differently in the console with and without an Angular environment:
const delayedPromise = new Promise((resolve) => {
setTimeout(resolve, 1, 'timeout');
});
new Promise((resolve) => {
resolve(delayedPromise);
resolve('second call');
}).then(console.log);In an Angular environment, "second call" will be printed to the console. And in an environment without Angular, "timeout" will be printed to the console.
Expected behavior:
For the above code, "timeout" is output to the console for the Angular environment
Please provide a link to a minimal reproduction of the bug
https://stackblitz.com/edit/angular-ivy-suszzq?devtoolsheight=33&file=src/app/app.component.ts
Please provide the exception or error you saw
No response
Please provide the environment you discovered this bug in (run ng version)
Angular CLI: 12.2.14
Node: 16.13.1 (Unsupported)
Package Manager: npm 8.3.0
OS: win32 x64
Angular: 12.2.15
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... platform-server, router
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1202.14
@angular-devkit/build-angular 12.2.14
@angular-devkit/core 12.2.14
@angular-devkit/schematics 12.2.14
@angular/cli 12.2.14
@schematics/angular 12.2.14
rxjs 6.6.7
typescript 4.3.5
Anything else?
No response
Reactions are currently unavailable