react-final-form icon indicating copy to clipboard operation
react-final-form copied to clipboard

validateOnBlur and validateFields are not respected after new Fields are mounted

Open marllonfrizzo opened this issue 3 years ago • 0 comments

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

marllonfrizzo avatar Jan 11 '22 14:01 marllonfrizzo