final-form / final-form/react-final-form-arrays
Problem with initialValues, FieldArray and unshift
- Dominant language
- TypeScript
- Stars
- 210
- Forks
- 69
- PR merge metrics
- No merged PRs in 30d
Description
Hi.
I have a form with some initial values. I use FieldArray to render. If i use push to add empty entries, everything works just fine. But if I use unshift (and I want to insert at top), form is completely broken.
I have managed to trim down my problem to this sandbox:
https://codesandbox.io/s/react-typescript-343gf
In that sandbox, you can toggle any checkbox and remove/add new entries.
Go ahead and change row 70 from
push("sla", undefined);
to
unshift("sla", undefined);
Once you click on "Create new" now, the form is broken. The new item is checked (should be unchecked), and you cannot toggle any checkboxes...
Is this a bug, or am I not seeing the obvious error in my code?
Contributor guide
Assessment
This issue has not been assessed yet.