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

validateOnBlur and validateFields are not respected after new Fields are mounted

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

I believe it's a bug.

### What is the current behavior?

In a Form with `validateOnBlur` activated, when having a Field that appears conditionally based on whether another Field has been modified (dirty), after the initial Field (which is already mounted) is modified and the conditional Field appears, the validation of the first Field is performed immediately, ignoring `validateOnBlur` and still triggering the validation of the other Fields, even though they have the `validateFields={[]}` prop configured.

### What is the expected behavior?

When a new Field is registered, the Form's `validateOnBlur` is respected and this new Field with the `validateFields={[]}` prop configured, does not trigger the validation of other Fields.

### Sandbox Link

https://codesandbox.io/s/react-final-form-asynchronous-field-level-validation-example-forked-4v40o?file=/index.js:1597-1608

### What's your environment?

```
"final-form": "4.20.6",
"react-final-form": "6.5.7",

Node 12.20.1
React Native 0.66.3
```

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.