question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Formik doesn't update isValidating onBlur and onChange, only onSubmit

See original GitHub issue

🐛 Bug report

Current Behavior

isValidating doesn’t reflect async validator being run onBlur and onChange even if it actually runs, as evident by ErrorMessage rendering

Expected behavior

isValidating should update even onBlur and onChange I checked in react-final-form, and it does the correct thing there, updating validating.

Reproducible example

https://codesandbox.io/s/hardcore-proskuriakova-qp9uc

Software Version(s)
Formik 1.5.7
React 16.8.6
TypeScript N/A
Browser Chrome 74
npm/Yarn npm@6.5.0
Operating System Windows

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:8
  • Comments:14 (5 by maintainers)

github_iconTop GitHub Comments

7reactions
lingolexcommented, Jan 6, 2020

We have run into the same problem. Right now, a field that requires async validation is marked as valid while waiting for the server response, after which it can jump to invalid if the validation failed. Very confusing for our users.

5reactions
jaredpalmercommented, Jan 6, 2020

Problem was/is that firing isValidating was causing too many rerenders and crushing perf

Read more comments on GitHub >

github_iconTop Results From Across the Web

React Formik - Trigger validation only on form submit
You can control when Formik runs validation by changing the values of <Formik validateOnChange> and/or <Formik validateOnBlur> props ...
Read more >
Validation - Formik
2 const validate = (values, props /* only available when using withFormik */) => { ... It will run after any onChange and...
Read more >
React form validation solutions: An ultimate roundup
This roundup is a comprehensive look at some of the most popular solutions for form management and validation in React.
Read more >
Migration from Formik - Final Form Docs
React Final Form validates on every change by default, and setting validateOnBlur to true is a way to tell React Final Form to...
Read more >
How to use formik with useFormik prop in react
Formik is a super cool library and I use it every time. ... I just set a state on submit and shown a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found