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

Async validation strange behaviour #2056

Closed
afitiskin opened this issue Nov 1, 2016 · 3 comments
Closed

Async validation strange behaviour #2056

afitiskin opened this issue Nov 1, 2016 · 3 comments

Comments

@afitiskin
Copy link
Contributor

afitiskin commented Nov 1, 2016

I had a very strange bug on my project when I used async validation for fields. During form filling everything works without any issues, but when I submit the form I got Uncaught (in promise) error. I checked every line of my code and found that if I resolve async validating promise with some data redux-form treat it as an error and fail form submission.

As I see, the problem is here:

const handleErrors = rejected => errors => {
  if (errors && Object.keys(errors).length) {
    stop(errors)
    return errors
  } else if (rejected) {
    stop()
    throw new Error('Asynchronous validation promise was rejected without errors.')
  }
  stop()
  return Promise.resolve()
}

First if statements will not be not passed even if rejected is false. I don't know if it is a feature of a bug?

I forked the repo and added example of the problem.
Form works until you submit it with valid values, you will get error in the console.

@gustavohenke
Copy link
Collaborator

Closing due to inactivity.

In case you still have problems, please open a formal bug report/feature request/docs improvement request.
Otherwise, please ask for help at StackOverflow.

@lock
Copy link

lock bot commented Jun 1, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 1, 2018
@erikras
Copy link
Member

erikras commented Jun 12, 2018

Fix released in v7.4.0.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants