-
Notifications
You must be signed in to change notification settings - Fork 3.4k
fix(select): don't change form state when adding to a form #11491
Conversation
We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google. |
I already have a CLA, any help on resolving that check point? |
CLAs look good, thanks! |
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 looks reasonable to me at first glance. I had a few minor consistency and naming recommendations.
I was happy to see that this doesn't require major changes to any of the existing tests.
Thank you for the contribution!
Please make sure to amend your commit and force push it back up to your branch so that you can avoid needing to squash commits.
…lect elements * Remove code which causes side effect on form elements * Add a delay to the initial render of a multiple select so that it doesn't set the element to dirty on initialization. Fixes angular#11490
@Splaktar I'm not sure if i'm supposed to resolve the conversations for the PR comments. I did one, then I thought, maybe thats for you to resolve. |
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. I'll send this to presubmit testing and hope that it doesn't run into any tests that depend on the old/broken behavior.
…lect elements (angular#11491) * Remove code which causes side effect on form elements * Add a delay to the initial render of a multiple select so that it doesn't set the element to dirty on initialization. Fixes angular#11490
This appears to have caused the following regression: #11571 |
Fixes #11490
PR Checklist
Please check that your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number: #11490
The select/multiple has code it in which causes a side-effect on the containing form by explicitly setting the form state to pristine anytime one is added with a set model value. This errant code was introduced originally to try to fix an issue where during initialization the control thought it was being updated and would implicitly mark the form dirty. This is obviously a deal breaker when using this control in dynamic forms.
What is the new behavior?
Now the control initializes so that it does not think it is being updated and the "corrective" side-effect has been removed. Adding and removing these controls from a dynamic form no longer changes the form state.
Does this PR introduce a breaking change?
Other information