jaredpalmer / formik

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

isValidating should be true when low priority validation is scheduled #2884

Closed johnrom closed 3 years ago

johnrom commented 4 years ago

🐛 Bug report

Current Behavior

Currently, when low priority validation is scheduled, the next render doesn't have access to that information.

Expected behavior

We should be able to test when validation is scheduled, because values and errors may not match.

Reproducible example

In the following example, I have a test for isValidating and errors.myNumber. I am double-validating with a special div that prints the message "This message should never appear." when the form is not validating but the value within values is not valid. The validation is scheduled during this time, and that should be something we can detect and prevent this message from displaying.

https://codesandbox.io/s/formik-codesandbox-template-forked-rozm4?file=/index.js

Suggested solution(s)

I think isValidating should be true during renders when low priority validation is scheduled. Or we need to add another prop like willValidate or isValidationScheduled to test for this case.

Your environment

See sandbox.

github-actions[bot] commented 3 years ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 60 days

johnrom commented 3 years ago

I think this issue is resolved since we removed the underlying scheduling mechanism.