You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Maybe not the cleanest approach, but i would probably just iterate the array differently from the object. Use Object.keys for an object, and if Array.isArray() returns true, use a for loop or .forEach instead.
Your environment
Software
Version(s)
Formik
2.0.3
React
16.9.0
TypeScript
n/a
Browser
Firefox
npm/Yarn
1.13.0
Operating System
Mac OS 10.14.5 (mojave)
The text was updated successfully, but these errors were encountered:
馃悰 Bug report
Current Behavior
I have a fairly large complex data shape that goes into the form i'm working on, but the example piece is like this:
Then when it runs through the validation function, it has the wrong shape by the time it reaches yup.
Can find the source for this here: https://github.com/jaredpalmer/formik/blob/master/src/Formik.tsx#L994. Since it's using
for in
, it's treated as an object regardless if it's an array or not.Expected behavior
I'd like it so the shape remains the same, and it can validate against my yup validation:
Reproducible example
I tried running the code sandbox, but it seems to be giving me zero validation errors. https://codesandbox.io/s/formik-codesandbox-template-dtyw2
Suggested solution(s)
Maybe not the cleanest approach, but i would probably just iterate the array differently from the object. Use Object.keys for an object, and if Array.isArray() returns true, use a for loop or .forEach instead.
Your environment
The text was updated successfully, but these errors were encountered: