When I use FieldArray move helper it creates wrong errors object:
{
arrayField: [undefined]
}
Validation after using FieldArray move helper, should not produce an incorrect result
Try to rearrange items on the list.
https://codesandbox.io/s/blissful-fast-zpbyl
| Software | Version(s) |
| ---------------- | ---------- |
| Formik |2.1.4|
I did some digging around and I found that the move callback uses updateArrayField with alterTouched and alterErrors set to true. When these values are set to true they reuse the move function as the alterTouched and alterErrors function.
I believe it does this so that any field with errors also has its errors moved. I do agree that something is off, the "error" appears and disappears after every other move. In reading through the code this appears to be due to implementation beyond the FieldArray. Although this does appear follow documented behavior, I'm curious if there isn't a solution.
https://jaredpalmer.com/formik/docs/api/fieldarray#fieldarray-validation-gotchas
With validation this seems to cause larger issues - https://codesandbox.io/s/still-haze-x0xf4
Are there any updates to this issue? I'm also getting [null] whenever invoking .remove() with FieldArray
Any updates? Using FieldArray I have errors which looks like { myArrayField: [null, null, 'some error'] } and when I use remove(2); errors object looks like { myArrayField: [null, null] } and form is marked as invalid even though it is valid.
@jaredpalmer What is the level of interest in resolving this issue? I am happy to take it across the finish line
Most helpful comment
@jaredpalmer What is the level of interest in resolving this issue? I am happy to take it across the finish line