Closed zsobral closed 4 years ago
This was introduced in 2.0.7
probably in https://github.com/jaredpalmer/formik/commit/9da32887cf61bdb2d08be90d863b35d537ebfe7c.
@wingedearth
Yes, this change has broken all usage of FieldArrays
. Could it please be reverted?
Going to revert now.
Simply reverting will bring back the bug of errors: { someField: [] } caused isValid to be false when it should be true for FieldArrays
so the field with the empty array should be preserved for values but removed from errors (if there are no errors)
I have an another issue, i think something changed and it makes empty array issue and my issue. When use setFieldValue passing same length array what is not deep equal array with prev array, "FastField" component doesn't re-render. It was not happened with version 2.0.6.
not fixed with latest release
I also returned to version 06. because all data in the form of an array is deleted if an empty array is returned - chips, radioGroup, etc...
hi. any updates on this?
FYI, this also breaks when explicitly setting a value to []
setFieldValue('stuff', [])
sets the field stuff
to undefined, which in our case, is an unwanted/breaking behavior. Should prob be a major version change for that.
Thanks for all the awesome work on Formik. I ❤️ forms in React now b/c of Formik.
repro https://codesandbox.io/s/formik-example-934n6 but you probably don't need it.
it seems that 2.0.3 and 2.0.8 have the same problem
Still facing the same issue.
@DalerAsrorov have you tried 2.0.11? It should be fixed in that version.
I'm facing the same issue on 2.0.11.
Using setFieldValue(field.name, [])
deletes the field from the form.
I can't use <FieldArray />
neither, as it doesn't allow custom props as <Field />
does.
Ex:
<FieldArray
component={CustomComponent}
customPropForCustomCompoent="value"
/>
customPropForCustomCompoent
will be missed.
@donperi can you make a sandbox reproducing the issue? I tried this one and seems to be ok on 2.0.11 https://codesandbox.io/s/formik-example-6021m (Change the email and see the props output)
Sure @viniciusdacal, but give me some time. I'm busy with another stuff atm.
Can someone make a PR?
Im out of office this week
I tested on latest version and it's working ok for me. If we manage to get a sandbox which we can repro the issue, I can work on it.
I'm using 2.1.1 now, the issue was solved for me
I will upgrade to 2.1.1
and see if it works for me too.
I believe this was fixed in the latest release
Just updated to 2.1.1 now and can confirm that the issue is resolved for me
confirm - everything is ok
🐛 Bug report
Current Behavior
when use setFieldValue passing a empty array the field is deleted from the values
Expected behavior
expected to set the field value to be an empty array
Reproducible example
https://codesandbox.io/s/formik-codesandbox-template-leltv
Your environment