-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
fix(material/form-field): trigger CD when form gets reassigned #30395
base: main
Are you sure you want to change the base?
Conversation
@@ -378,6 +378,8 @@ export class MatFormField | |||
this._initializeControl(this._previousControl); | |||
this._previousControl = this._control; | |||
} | |||
|
|||
this._changeDetectorRef.markForCheck(); |
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.
can we move this inside the above if
block? we should only need to do it if the control actually changed
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.
I guess this broke something and I can't debug this right now cause running input tests makes this laptop go brrrr. I will get back to this later. I'm sorry for delay!
although it shouldn't have broke anything.
I think it never goes into the if statement above when form is getting reassigned.
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.
Ok, I guess the above if-block was unrelated then, but this still feels like its marking for check far too often. I'm a little bit worried that this could have negative performance implications.
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.
I have switched the login to check if the validator on the control has changed or not. I couldn't get my head around this any other way as NgOnChange didn't include formControl and equal checks on control doesn't return true either. I'm open to suggestions for improvements.
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.
whoops, I was too trigger happy with the approve before I noticed the test was still failing
no more working |
gets reassigned fixes the issue we were not marking component for changes when form is reassigned making it not update UI for required asterisk fixes angular#29066
fixes the issue we were not marking component for changes when form is reassigned making it not update UI for required asterisk
fixes #29066