question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Async validation run twice

See original GitHub issue

I call both .passes() and .fails() to check the async validation. Right now I don’t find any solution to check both validation states without calling both of them. This runs the validation twice.

I think we need a method which runs the async function only one time and calls respectively passes/fails callbacks. Or at least a promise implementation (as I proposed in this issue: https://github.com/skaterdav85/validatorjs/issues/127)

For example a possible solution could be to provide a validation function which accept an object with the two callbacks:

validator.validate({
  passes: () => {},
  fails: () => {},
});

We discussed the problem in this issue: https://github.com/foxhound87/mobx-react-form/issues/214

Thank You.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7

github_iconTop GitHub Comments

1reaction
alisherafat01commented, Feb 28, 2018

@foxhound87 Can you write a real example here? I have this issue and can’t figure out how to resolve.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Async validation run twice · Issue #155 · mikeerickson/validatorjs
I call both .passes() and .fails() to check the async validation. Right now I don't find any solution to check both validation states ......
Read more >
Form - Async validation is being called multiple times
if the form is valid, we are making server-side call to save the form, which is again causing async validator to be called...
Read more >
Async validation is triggered multiple times on form.setValues()
You patchData() in setValue() -> the validator is triggered again. I'm guessing Angular internally uses switchMap for the validation Observable, ...
Read more >
Validation — tapir 1.x documentation - SoftwareMill
The validators are run when a value is being decoded from its low-level representation. This is done using the Codec.decode method, which returns...
Read more >
Validation Chain API - express-validator
Runs the current validation chain in an imperative way. app.post('/create-user', async (req, res, next) => { await ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found