-
Notifications
You must be signed in to change notification settings - Fork 26.8k
refactor(core): Async tagging zone dev #47416
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
4e239cf to
a1e0e54
Compare
a1e0e54 to
43cb391
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall LGTM.
One implementation nit is to consider doing this in one commit so this change is very clearly a move from zone.js to @angular/core, instead of a delete and add across two commits.
Two trade offs are being made here which I want to be explicit about:
- Moving
AsyncStackTaggingZoneSpecinto@angular/coremeans that other users of Zone can't get this debugging benefit.zone.jsis experimental I think and not recommended or widely used outside of Angular, so maybe we're just ok with that. - This change presents a required runtime dependency on Zone.js in Angular dev builds, which might cause trouble with users who run Angular without Zones.
AsyncStackTaggingZoneSpecwill always be tree shaken in prod mode, so it's not an issue there, but in dev mode it will be retained.- Technically
@angular/corealready has a required peer dep onzone.jsaccording topackage.json, but that's easy to ignore. With this change, I think it would be a hard error to not have azone.jspeer dep. - Do we understand the runtime impact of importing
AsyncStackTaggingZoneSpecwithout the rest ofzone.js? - If the runtime impact is a problem, then in google3 I think we'd need a patch to tree shake
AsyncStackTaggingZoneSpecusage out for zoneless use cases. I'm less certain of our options in the CLI without moving the import topolyfills.tsorenvironments.ts.
As long as we are ok with 1. and can make sure zoneless apps work in a reasonable fashion for 2., then I'm good with this change.
|
@dgp1130 , thank you for the review, I will make this PR into a single commit.
|
8c9510a to
64e08ba
Compare
devversion
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM for dev-infra .bzl
dgp1130
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SGTM @JiaLiPassion, thanks for clarifying the runtime impact for Zoneless users.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, just a couple minor comments.
64e08ba to
1c349a6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JiaLiPassion thanks for addressing the feedback! Just left a tiny comment about the any type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JiaLiPassion do we still need as any here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AndrewKushnir , thank you, forget this one, just updated and remove this any.
1. Remove `zone-async-tagging` implementation from zone.js and move the implementation to `@angular/core`, so `@angular/core` can import this package more easily for better treeshaking. 2. Add `async tagging zone` implemenation into `@angular/core` package. So we don't need to get the `AsyncStackTaggingZoneSpec` from `global` instance, we can import the `class` directly for better treeshaking. 3. Only load this ZoneSpec when `ngDevMode` is `true`.
1c349a6 to
ae0fabe
Compare
pkozlowski-opensource
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Reviewed-for: size-tracking
jelbourn
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
alxhub
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed-for: global-approvers
|
This PR was merged into the repository by commit 8637253. |
) 1. Remove `zone-async-tagging` implementation from zone.js and move the implementation to `@angular/core`, so `@angular/core` can import this package more easily for better treeshaking. 2. Add `async tagging zone` implemenation into `@angular/core` package. So we don't need to get the `AsyncStackTaggingZoneSpec` from `global` instance, we can import the `class` directly for better treeshaking. 3. Only load this ZoneSpec when `ngDevMode` is `true`. PR Close angular#47416
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
zone-async-taggingimplementation from zone.js and move theimplementation to
@angular/core, so@angular/corecan import thispackage more easily for better treeshaking.
async tagging zoneimplemenation into@angular/corepackage.So we don't need to get the
AsyncStackTaggingZoneSpecfromglobalinstance, we can import the
classdirectly for better treeshaking.ngDevModeistrue.