How to reproduce
Copy and paste the code above. Run the project and click on button Submit.
Actual Result
Error is not displayed
Expected Result
The error is displayed under Select: "items field must have at least 1 items"
Description
Form.Item doesn't show the error, because it sets "touched" to false. It handles "touched" incorrectly when it is an empty array.
I researched this problem and understood why this is happening:
If the touched field is an empty array, it means that the field is touched. https://github.com/formium/formik/issues/3344#issuecomment-925001220
The Problem
The following code incorrectly handles an empty touched array -> Form.Item: 28. If a touched array is empty, then it sets isTouched to false.
Hello everyone! ✋
I'm using
validationSchema
forFormik
component and usingForm.Item
to display validation errors.Code:
How to reproduce Copy and paste the code above. Run the project and click on button
Submit
.Actual Result Error is not displayed
Expected Result The error is displayed under
Select
: "items field must have at least 1 items"Description Form.Item doesn't show the error, because it sets "touched" to false. It handles "touched" incorrectly when it is an empty array. I researched this problem and understood why this is happening: If the touched field is an empty array, it means that the field is touched. https://github.com/formium/formik/issues/3344#issuecomment-925001220
The Problem The following code incorrectly handles an empty touched array -> Form.Item: 28. If a touched array is empty, then it sets
isTouched
tofalse
.Thanks for the answers and help!