Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Properly handle nested array data in prepareDataForValidation. #2265

Conversation

jamesremuscat
Copy link
Contributor

Previously, we would always return an object even if values was an array. Now, we test to see if values is an array and set data accordingly.

I've included a test for this scenario.

Fixes #2213.

Previously, we would always return an object even if `values` was an
array. Now, we test to see if `values` is an array and set `data`
accordingly.

Fixes jaredpalmer#2213.
@vercel
Copy link

vercel bot commented Feb 3, 2020

This pull request is being automatically deployed with ZEIT Now (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://zeit.co/jared/formik-docs/8d7t0h0yb
✅ Preview: https://formik-docs-git-fork-jamesremuscat-fix-2213-nested-ar-e17f42.jared.now.sh

@codesandbox-ci
Copy link

codesandbox-ci bot commented Feb 3, 2020

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 157603a:

Sandbox Source
Formik TypeScript Playground Configuration

@jaredpalmer jaredpalmer merged commit f117c04 into jaredpalmer:master Feb 6, 2020
@jamesremuscat jamesremuscat deleted the fix/2213-nested-array-validation branch March 1, 2020 12:14
@elmarburke
Copy link

This fix didn't went in release of 2.1.4, right? I still have the issue 😢

@jamesremuscat
Copy link
Contributor Author

@elmarburke No, it was merged just after 2.1.4 was released.

@kononenko-a-m
Copy link

hi @jaredpalmer wanted to ask, if there any plan to release this fix in 2.1.5, and is there any plan in general release 2.1.5?

@multimeric
Copy link

This is a pretty dreadful problem, since it makes nested arrays totally unusable. However I found a workaround, which is to install the CI version of Formik from just after the PR was merged: npm install https://pkg.csb.dev/jaredpalmer/formik/commit/157603ab/formik. You can also use newer builds listed on this page, but the command above seems to work okay for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Nesting arrays shows "invalid value" for first level
5 participants