-
Notifications
You must be signed in to change notification settings - Fork 26.8k
perf(forms): make built-in ControlValueAccessors more tree-shakable #41146
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
9e00943 to
557aa6c
Compare
petebacondarwin
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.
An alternative approach would be for all built-in CVAs to extend an internal abstract class. Then you could check for a built-in CVA using instanceof. I feel that this would be a more clean approach than a semi-hidden internal property.
557aa6c to
075d210
Compare
|
Thanks for the review @petebacondarwin 👍 As we discussed, I've updated the code to check whether a given CVA is an instance of a class that directly extends |
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! 🍪
Really simple and huge size savings! Great work!
reviewed-for: public-api
reviewed-for: size-tracking
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.
👏🏻
|
Also started a Global Presubmit to verify that there are no edge cases that might be affected. |
petebacondarwin
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 - one suggestion about the docs.
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.
😱
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.
🎉
|
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. |
This commit updates Forms code to avoid direct references to all built-in ControlValueAccessor classes, which
prevents their tree-shaking from production builds. Instead, a new static property is added to all built-in
ControlValueAccessors, which is checked when we need to identify whether a given ControlValueAccessors is a
built-in one.
This PR partially implements #41011.
PR Type
What kind of change does this PR introduce?
Does this PR introduce a breaking change?