Skip to content

Commit

Permalink
feat(core): import AsyncStackTaggingZone if available (#46693)
Browse files Browse the repository at this point in the history
Import `AsyncStackTaggingZoneSpec` if the user imported
`zone.js/plugins/async-stack-tagging` bundle. So the user can
use `console.trace` to output the `async task` information more
clearly.

PR Close #46693
  • Loading branch information
JiaLiPassion authored and thePunderWoman committed Jul 11, 2022
1 parent 848a009 commit 19e6d9c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion goldens/size-tracking/aio-payloads.json
Expand Up @@ -12,7 +12,7 @@
"aio-local": {
"uncompressed": {
"runtime": 4325,
"main": 459842,
"main": 460353,
"polyfills": 33922,
"styles": 73640,
"light-theme": 78276,
Expand Down
8 changes: 4 additions & 4 deletions goldens/size-tracking/integration-payloads.json
Expand Up @@ -2,7 +2,7 @@
"cli-hello-world": {
"uncompressed": {
"runtime": 1083,
"main": 125325,
"main": 125830,
"polyfills": 33824
}
},
Expand All @@ -19,14 +19,14 @@
"cli-hello-world-ivy-compat": {
"uncompressed": {
"runtime": 1102,
"main": 132311,
"main": 132816,
"polyfills": 33957
}
},
"cli-hello-world-ivy-i18n": {
"uncompressed": {
"runtime": 926,
"main": 124982,
"main": 125487,
"polyfills": 35252
}
},
Expand Down Expand Up @@ -55,7 +55,7 @@
"standalone-bootstrap": {
"uncompressed": {
"runtime": 1090,
"main": 83013,
"main": 83515,
"polyfills": 33945
}
},
Expand Down
5 changes: 5 additions & 0 deletions packages/core/src/zone/ng_zone.ts
Expand Up @@ -138,6 +138,11 @@ export class NgZone {

self._outer = self._inner = Zone.current;

if ((Zone as any)['AsyncStackTaggingZoneSpec']) {
const AsyncStackTaggingZoneSpec = (Zone as any)['AsyncStackTaggingZoneSpec'];
self._inner = self._inner.fork(new AsyncStackTaggingZoneSpec('Angular'));
}

if ((Zone as any)['TaskTrackingZoneSpec']) {
self._inner = self._inner.fork(new ((Zone as any)['TaskTrackingZoneSpec'] as any));
}
Expand Down

0 comments on commit 19e6d9c

Please sign in to comment.