Skip to content
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(forms): changes to status not always being emitted to statusChanges observable for async validators. #42553

Closed
wants to merge 1 commit into from

Conversation

dylhunn
Copy link
Contributor

@dylhunn dylhunn commented Jun 10, 2021

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • angular.io application / infrastructure changes
  • Other... Please describe:

What is the current behavior?

When a FormControl, FormArray, or FormGroup is first constructed, if an async validator is attached, the statusChanges observable should receive a message when the validator complete (i.e. pending -> valid/invalid).

Issue Number: 42553

What is the new behavior?

If the validator was provided as part of the constructor options, it was previously not fired at construction time. That is fixed in this PR.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Fixes #42553

@AndrewKushnir
Copy link
Contributor

Just as an additional context: the original changes were added in PR #38354 (we can look at that PR to see which tests we should add in this PR).

@ngbot ngbot bot added this to the Backlog milestone Jun 11, 2021
@dylhunn dylhunn marked this pull request as ready for review June 11, 2021 16:42
@dylhunn
Copy link
Contributor Author

dylhunn commented Jun 11, 2021

For reference, here's a TGP run: https://test.corp.google.com/ui#id=OCL:378802147:BASE:378802259:1623386981464:3da3dae8

While there is breakage, it's a very limited amount which can probably be fixed by hand.

@dylhunn dylhunn added the action: review The PR is still awaiting reviews from at least one requested reviewer label Jun 11, 2021
@dylhunn
Copy link
Contributor Author

dylhunn commented Jun 11, 2021

TGP was green (surprisingly) after rerunning flakes. Also updated the issue number in the original PR, which was incorrect.

Copy link
Contributor

@AndrewKushnir AndrewKushnir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix @dylhunn 👍
The changes look good, I've just added a few minor comments related to tests.

packages/forms/test/form_array_spec.ts Outdated Show resolved Hide resolved
packages/forms/test/form_array_spec.ts Outdated Show resolved Hide resolved
packages/forms/test/form_array_spec.ts Outdated Show resolved Hide resolved
packages/forms/test/form_array_spec.ts Outdated Show resolved Hide resolved
packages/forms/test/form_control_spec.ts Outdated Show resolved Hide resolved
@AndrewKushnir AndrewKushnir added action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews target: patch This PR is targeted for the next patch release and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Jun 11, 2021
@AndrewKushnir
Copy link
Contributor

@dylhunn FYI I've also added the target: patch label, since it should be safe to land in the next patch version, given that the TGP is fully green.

…es observable for async validators.

When a FormControl, FormArray, or FormGroup is first constructed, if an async validator is attached, the `statusChanges` observable should receive a message when the validator complete (i.e. pending -> valid/invalid). If the validator was provided as part of the constructor options, it was not fired at construction time, which is fixed in this PR.

Fixes angular#35309.
@dylhunn dylhunn added action: merge The PR is ready for merge by the caretaker and removed action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews labels Jun 14, 2021
@alxhub alxhub closed this in 7180ec9 Jun 14, 2021
alxhub pushed a commit that referenced this pull request Jun 14, 2021
…es observable for async validators. (#42553)

When a FormControl, FormArray, or FormGroup is first constructed, if an async validator is attached, the `statusChanges` observable should receive a message when the validator complete (i.e. pending -> valid/invalid). If the validator was provided as part of the constructor options, it was not fired at construction time, which is fixed in this PR.

Fixes #35309.

PR Close #42553
@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 Jul 15, 2021
@dylhunn dylhunn deleted the statuschanges branch December 14, 2021 23:07
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 cla: yes target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants