final-form / final-form/react-final-form

Async validation triggers field render twice

Open
#320 5 comments 5 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
7.4k
Forks
497
PR merge metrics
No merged PRs in 30d

Description

### Are you submitting a **bug report** or a **feature request**?

Not sure if this is a bug or a current feature 🤔

### What is the current behavior?

When using async form validation (before submit), it triggers field render twice. First one with error set to none and then with actual error. This happens on every keypress.

### What is the expected behavior?

I'd like to make it work as a sync one when there is only one render on keypress and no error state pop before/after validation.

### Sandbox Link

https://codesandbox.io/s/n9kn940k84

In this example, there are both `validateAsync` and `validateSync` for test, open console to see the difference.

### What's your environment?

React Final Form version 3.6.5
Final Form version 4.9.1

@erikras maybe you have an idea what to do with this 🙏

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.