Closed aaronnuu closed 6 years ago
Well it DOES say it needs a refactor... haha.. But yeah, I am running into the same (?) issue.
The first time I blur on a field it passes validation (even if it shouldn't), if I type something in and then erase it and blur again, then it validates properly. This is when using validationSchema / Yup.
Hola! So here's the deal, between open source and my day job and life and what not, I have a lot to manage, so I use a GitHub bot to automate a few things here and there. This particular GitHub bot is going to mark this as stale because it has not had recent activity for a while. It will be closed if no further activity occurs in a few days. Do not take this personally--seriously--this is a completely automated action. If this is a mistake, just make a comment, DM me, send a carrier pidgeon, or a smoke signal.
ProBot automatically closed this due to inactivity. Holler if this is a mistake, and we'll re-open it.
Bug, Feature, or Question?
Bug
Current Behavior
Whenever a FastField is blurred without having a validate function or when validateOnBlur is false it will set the error for that field on the Formik state to the field's current error state, which unless validateOnChange is true will always be undefined. It doesn't use the Formik validate function or validationSchema when validate isn't given as a prop to the FastField.
Desired Behavior
The Formik validate function should be run on blur if a validate function isn't defined on the FastField but validateOnBlur is true.
Suggested Solutions
The logic for validating on blur should be the same as when validating on change - by using the top level validate function or validation schema if a validate prop is not supplied to the FastField.