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

FieldArray validate does not work with an initial row in initialValues #163

Open
gschwa opened this issue May 26, 2021 · 1 comment
Open

Comments

@gschwa
Copy link

gschwa commented May 26, 2021

Are you submitting a bug report or a feature request?

bug report

What is the current behavior?

The current behavior is that when there are existing rows in initialValues the FieldArrays validate function when returning [undefined] impacts the field level validation. Interestingly, this does not affect any new rows.

See: https://codesandbox.io/s/react-final-form-field-arrays-forked-bqtle?file=/index.js

The field level validation checks if the value === bad. You will notice that typing bad in the first row does not result in an error but in any new rows it does work. The FieldArray's validate is simply: () => [undefined]

What is the expected behavior?

FieldArray validation should not impact Field level validation. This worked in:

  • final-form 4.17.0
  • final-form-arrays 2.0.0
  • react-final-form 4.1.0
  • react-final-form-arrays 2.0.3

but fails in:

  • final-form 4.18.0
  • final-form-arrays 3.0.0
  • react-final-form 6.0.0
  • react-final-form-arrays 3.0.0

Sandbox Link

https://codesandbox.io/s/react-final-form-field-arrays-forked-bqtle?file=/index.js

What's your environment?

This worked in:

  • final-form 4.17.0
  • final-form-arrays 2.0.0
  • react-final-form 4.1.0
  • react-final-form-arrays 2.0.3

but fails in:

  • final-form 4.18.0
  • final-form-arrays 3.0.0
  • react-final-form 6.0.0
  • react-final-form-arrays 3.0.0

Other information

@gschwa gschwa changed the title FieldArray validate does not work with intial row in initialValues FieldArray validate does not work with an initial row in initialValues May 26, 2021
@kubakrupski
Copy link

I have exactly the same problem, @gschwa did you find any temporary workaround for this?

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

No branches or pull requests

2 participants