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

Warning about usage of options and async validators #612

Closed
mwe-ontec opened this issue Nov 30, 2022 · 0 comments · Fixed by #624
Closed

Warning about usage of options and async validators #612

mwe-ontec opened this issue Nov 30, 2022 · 0 comments · Fixed by #624

Comments

@mwe-ontec
Copy link

Describe the bug

When using RxFormBuilder with entities decorated with async() the following warning is issued at runtime multiple times:
It looks like you're constructing using a FormControl with both an options argument and an
async validators argument. Mixing these arguments will cause your async validators to be dropped.
You should either put all your validators in the options object, or in separate validators
arguments. For example:

// Using validators arguments
fc = new FormControl(42, Validators.required, myAsyncValidator);

// Using AbstractControlOptions
fc = new FormControl(42, {validators: Validators.required, asyncValidators: myAV});

// Do NOT mix them: async validators will be dropped!
fc = new FormControl(42, {validators: Validators.required}, /* Oops! */ myAsyncValidator);

Expected Behavior

No warnings shown at runtime

To Reproduce

Create a FormGroup using an entity with synchronous and async validators.

Url (stackblitz or plunker or other)

Package Version

@rxweb/reactive-form-validators@13.0.0

alizedebray added a commit to alizedebray/rxweb that referenced this issue Jan 16, 2023
the validators argument of the FormControl should not be used when
validators are configured in the options argument.
Fixes rxweb#612
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 a pull request may close this issue.

1 participant