Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@AndrewKushnir
Copy link
Contributor

This PR contains a cherry-picked commit from #41189, which had marge conflicts with the patch (11.2.x) branch due to the fact that min/max validator directives are only available in master.

…ar#41189)

Currently the `Validators` class contains a number of static methods that represent different validators as well as some helper methods. Since class methods are not tree-shakable, any reference to the `Validator` class retains all of its methods (even if you've used just one).

This commit refactors the code to extract the logic into standalone functions and use these functions in the code instead of referencing them via `Validators` class. That should make the code more tree-shakable. The `Validators` class still retains its structure and calls these standalone methods internally to keep this change backwards-compatible.

PR Close angular#41189
@AndrewKushnir AndrewKushnir added area: performance Issues related to performance area: forms target: patch This PR is targeted for the next patch release cross-cutting: tree-shaking PullApprove: disable labels Mar 15, 2021
@ngbot ngbot bot modified the milestone: Backlog Mar 15, 2021
@google-cla google-cla bot added the cla: yes label Mar 15, 2021
@AndrewKushnir AndrewKushnir marked this pull request as ready for review March 15, 2021 18:43
@AndrewKushnir AndrewKushnir added the action: merge The PR is ready for merge by the caretaker label Mar 15, 2021
@jessicajaniuk
Copy link
Contributor

Closed by commit 804b6b6

jessicajaniuk pushed a commit that referenced this pull request Mar 15, 2021
… (#41220)

Currently the `Validators` class contains a number of static methods that represent different validators as well as some helper methods. Since class methods are not tree-shakable, any reference to the `Validator` class retains all of its methods (even if you've used just one).

This commit refactors the code to extract the logic into standalone functions and use these functions in the code instead of referencing them via `Validators` class. That should make the code more tree-shakable. The `Validators` class still retains its structure and calls these standalone methods internally to keep this change backwards-compatible.

PR Close #41189

PR Close #41220
This was referenced Mar 18, 2021
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Apr 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: merge The PR is ready for merge by the caretaker area: forms area: performance Issues related to performance cla: yes cross-cutting: tree-shaking PullApprove: disable target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants