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

registerField run other Fields' async validation

Open
#659 0 comments 0 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**?

I'm not sure it is a bug report.

### What is the current behavior?

I have an array fields list, each list has 4 fields, and one of them has an async validation (and I use validateOnBlur). When I add an array fields to the form, it will create 4 new fields, and each new field will trigger async validation 3 times, so, every time add a list to this form will run async validation at 12 times. and when I remove a list, every field removed will trigger async validation once.

### What is the expected behavior?

Field-level async validation should only run when I trigger the Field change, or when I blur the Field when I use validateOnBlur.

### Sandbox Link

use field-arrays: https://codesandbox.io/s/react-final-form-field-arrays-nb6ng?fontsize=14
not use field-arrays: https://codesandbox.io/s/react-final-form-synchronous-field-level-validation-l4omy?fontsize=14

### What's your environment?

{
"final-form": "4.18.4",
"react-final-form": "6.3.0",
"react-final-form-arrays": "3.1.0",
"final-form-arrays": "^3.0.0",
}

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.