jaredpalmer / formik

Build forms in React, without the tears 😭
https://formik.org
Apache License 2.0
34k stars 2.79k forks source link

isInitialValid now is required to make isValid flag false at startup #2048

Open srowe0091 opened 5 years ago

srowe0091 commented 5 years ago

🐛 Bug report

Current Behavior

isValid is being flagged as true upon first entering the form.

Expected behavior

isValid should be marked as false, even if the isInitialValid property has not been set

Suggested solution(s)

document breaking changes, or not require isInitialValid to be set and still have isValid flag false

Additional context

This behavior was not seen in V1 and with the V2 update many changes were made and were not documented under breaking changes.

Your environment

Software Version(s)
Formik latest
React latest
TypeScript
Browser all
npm/Yarn latest
Operating System mac
srowe0091 commented 5 years ago

Has anyone else noticed this behavior?

sclavijo93 commented 5 years ago

@mrowe009 I've noticed too. :(

But this part of the migration talks a litle about it Line 236

difagume commented 5 years ago

I fixed it with @sclavijo93 info, I just added:

<Formik
      validateOnMount
...
srowe0091 commented 5 years ago

@sclavijo93 i see now, that is very well hidden at the the bottom of the page. I didn't realize validateOnMount was running on its own in V1. I figured it was just a flag being set on initial render.

@difagume i also used that solution as well. but thanks for providing the solution so others can see 👍

srowe0091 commented 4 years ago

bump