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

cleanup arrays if the last value, which is not undefined, gets removed from it #3406

Conversation

giggo1604
Copy link

This fixes an error where you can get to an invalid error state if you remove an array field which has a corresponding error.

Here is a basic example of the original problem: https://codesandbox.io/s/formik-example-forked-gi0kc?file=/index.js

If the empty field gets removed the form will not turn valid because the array is not "empty" and therefore gets not removed from the parent object.

An other way to to fix this might be to rewrite the isEmptyArray assertion to also consider arrays with only undefined values as empty.

@changeset-bot
Copy link

changeset-bot bot commented Nov 9, 2021

🦋 Changeset detected

Latest commit: dcc63d9

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
formik Patch
formik-native Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Nov 9, 2021

Someone is attempting to deploy a commit to the Formium Team on Vercel.

A member of the Team first needs to authorize it.

@giggo1604 giggo1604 force-pushed the fix-arrays-not-getting-cleanup-properly branch from d7033d5 to dcc63d9 Compare November 9, 2021 22:11
@giggo1604
Copy link
Author

@jaredpalmer @johnrom any chance to get this process going?

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.

1 participant