Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How does/should Formik respond when a validate function passed to it creates an exception? #1834

Open
wardt7 opened this issue Sep 20, 2019 · 0 comments
Labels

Comments

@wardt7
Copy link

wardt7 commented Sep 20, 2019

❓Question

Hi all,

I've been working on a project recently that uses Formik and was fixing a bug where a form with a custom validation function we were using (which gets passed in as the validate prop on the Formik component) was saying that invalid data was valid. It transpired that this was caused by our custom validation creating an uncaught exception, which has now been fixed.

The surprising thing I found though was that Formik never appeared to do anything with that uncaught exception; instead it just tolerated the error and carried on as if nothing happened (presumably because nothing was returned so there were no 'errors' as such). I'm not quite sure if this is intended or not? I would perhaps have expected either Formik just to completely error out or fail the validation in some way to prevent submission. It just seems a bit counter-intuitive? It would be nice to have an explanation as to why the uncaught exception is handled this way if this is intentional just for future reference.

Side note: Love the library by the way. Been using it for the best part of two years and it's so much better than standard forms.

Toby

@stale stale bot added the stale label Nov 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant