Formik: Yup "with" does not work with Formik

Created on 2 Jul 2018  路  1Comment  路  Source: formium/formik

Describe the bug
When I setup validation scheme with the operator "when" I received an error.

formik.es6.js:6198 Uncaught (in promise) TypeError: Cannot read property 'length' of undefined
at yupToFormErrors (formik.es6.js:6198)
at formik.es6.js:5933

To Reproduce

You can open codesandbox link and try to edit any fields. It will receive an error.


Most helpful comment

The reason it fails here is because the "when" is looking for an "isBig" sibling, which does not exist in your schema. If you simply add, "isBig: Yup.boolean()," to the schema above the "count" definition, everything seems to work.

>All comments

The reason it fails here is because the "when" is looking for an "isBig" sibling, which does not exist in your schema. If you simply add, "isBig: Yup.boolean()," to the schema above the "count" definition, everything seems to work.

Was this page helpful?
0 / 5 - 0 ratings