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 validators display errors when still resolving promise

See original GitHub issue

Describe the bug Async validators seem to display errors when the promise is still resolving.

Reproduction URL https://codesandbox.io/s/vuelidate-requiredif-issue-forked-xe5ef?file=/src/App.vue

To Reproduce Steps to reproduce the behavior:

  1. Type some text in the box
  2. See that the asyncTest error is shown when resolving the promise
  3. See that when the asyncTest promise is resolved the error is hidden

Expected behavior I would expect while resolving the promise not error to be shown until the Promise returns a false. Sometimes something needs to be validated in the backend and can some time to respond resulting in misleading customers.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
dobromir-hristovcommented, Aug 4, 2021

We always had $invalid, it just used to be true, while the validator was resolving.

I changed that in the PR to keep it false, so no error messages are shown, but the field itself is considered errored, so we don’t accidentally submit a form, while it’s validating.

2reactions
rjd22commented, Jun 16, 2021

@dobromir-hristov atm. I actually check if it’s pending to solve this problem.

But having errors in the error list when it’s not sure if there is even going to be an error is kind of weird developer experience if you ask me.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Consider a form invalid while async validator promises are ...
I know two ways to invalidate a form while async validators are pending, but they're both verbose and/or hacky. // Workaround 1: Mark...
Read more >
Async Validators | JET Developer Cookbook - Oracle
The async validator's validate method returns a Promise that resolves if validation passes and value is updated or rejects with an Error if...
Read more >
Async Blur Validation Example - Redux Form
Asynchronous validation will not be called if synchronous validation is failing for the field just blurred. The errors are displayed in the exact...
Read more >
Mongoose v6.8.2: Validation
There are two equivalent ways to set the validator error message: ... If your validator function returns a promise (like an async function),...
Read more >
The hard error handling case made easy with async/await
We can try to fix this by starting a Promise context and moving the catch down. function(request, response, next) { return Promise.resolve() .then(()...
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