You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
bug(mat-bottom-sheet): custom form validation is executed multiple times #49959
Yes, this behavior used to work in the previous version
The previous version in which this bug was not present was
13.3.9
Description
For one single change inside a form with custom validation, the validate() method is triggered multiple times.
The parameter is, first time, the form control where the change is applied, then the parent form group, and finaly the abstracted control.
This behavior occurs only within a form inside mat-bottom-sheet and starting from the version 14.x.x.
The bottom sheet doesn't do anything special that would cause the validation to execute multiple times. It's just a dynamically-rendered component that has specific CSS. If there's an issue, it's likely in the forms module.
I've been looking into this, and it's unrelated to the bottom sheet and the forms module. What's happening is the NG_VALIDATORS token provided by the ChildComponent is being injected by all the form directives in spite of the fact that those directives use @Self.
I've opened a PR to address this (#50270) that has more detail.
Activity
crisbeto commentedon Apr 21, 2023
The bottom sheet doesn't do anything special that would cause the validation to execute multiple times. It's just a dynamically-rendered component that has specific CSS. If there's an issue, it's likely in the forms module.
fix(core): fix `Self` flag inside embedded views with custom injectors
garrettld commentedon May 12, 2023
I've been looking into this, and it's unrelated to the bottom sheet and the forms module. What's happening is the NG_VALIDATORS token provided by the ChildComponent is being injected by all the form directives in spite of the fact that those directives use
@Self.I've opened a PR to address this (#50270) that has more detail.
edit: and here's a minimal reproduction: https://stackblitz.com/edit/angular-1fsxct?file=src/main.ts
fix(core): fix `Self` flag inside embedded views with custom injectors (
angular-automatic-lock-bot commentedon Jun 24, 2023
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.
fix(core): fix `Self` flag inside embedded views with custom injectors (