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

Cannot read property 'validators' of undefined" in final-form when change version of final-form-arrays

Open 2u4u opened this issue 4 years ago • 1 comments

Are you submitting a bug report or a feature request?

Bug report

What is the current behavior?

Changing version of final-form-arrays in simple example causes error "Cannot read property 'validators' of undefined" in final-form. Steps to reproduce:

  1. Open simple example from docs
  2. Change version of final-form-arrays
    - "final-form-arrays": "1.1.2", + "final-form-arrays": "^1.1.2",
  3. Add customer in the list
  4. Remove customer from the list with click on ❌

What is the expected behavior?

Project works properly

Sandbox Link

Simple example with changed final-form-arrays version

2u4u avatar Feb 12 '21 07:02 2u4u

Not sure if this is helpful:

I stumbled on this while having issues with react-final-form-html5-validation

In a FieldArray with field validation, if I remove any object except the last one, the validation seem to use the old object's data. E.g. I add two objects, then remove the first one, even if I insert valid data, the validation fails on exactly those fields that were not filled in for the removed object.

I was unable to create a sandbox to describe the problem because of the issue described by @2u4u, but downgrading to final-form-arrays 1.1.2, the issue with react-final-form-html5-validation went away in my project, so I suppose it is a problem in this library and not react-final-form-html5-validation.

FWIW here's the sandbox, but downgrading the library, it now works as expected: FieldArray with html5 validation

ewedlund avatar Apr 22 '21 14:04 ewedlund