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(control): avoid throw of error with async validator #98

Merged
merged 1 commit into from
Jul 28, 2021

Conversation

C0ZEN
Copy link
Contributor

@C0ZEN C0ZEN commented Jul 27, 2021

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows our guidelines: CONTRIBUTING.md#commit
  • Tests for the changes have been added (for bug fixes / features) → tried but not able to come up with a reproduction
  • Docs have been added / updated (for bug fixes / features) → not needed IMO

PR Type

What kind of change does this PR introduce?

[x] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Documentation content changes
[ ] Other... Please describe:

What is the current behavior?

When creating a control with an async validator instantly resolved with for example of(null), the extended class (Angular native control) will call the method internally during the class instantiation through the super causing a throw of error since the code except that the setErrors has a valid not nil errorsSubject.
The constructor is creating just after this the subject.

Issue Number: #91

What is the new behavior?

The control's method setErrors will no longer throw an error when errorsSubject is not yet created.

Does this PR introduce a breaking change?

[ ] Yes
[x] No

Other information

Fixes #91

@NetanelBasal NetanelBasal merged commit 102b32d into ngneat:master Jul 28, 2021
@C0ZEN C0ZEN deleted the fix/async-validator-throw branch July 28, 2021 07:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FormControl.errorsSubject is undefined when using asyncValidator
2 participants