-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Add missing validationSchema to Formik context #2933
base: main
Are you sure you want to change the base?
Conversation
|
@JoseLion is attempting to deploy a commit to the Formium Team on Vercel. A member of the Team first needs to authorize it. |
This is ok by me especially since it exists in the types already. The only issue I see with it is that some users may create a new Yup object on each render. and if that's the case, this prop will change on every render, and cause more updates. Not sure how much of a problem that is. I don't use Yup, so I'll defer to someone else whether that's an issue or not. |
related #2751 |
@johnrom thank you for your response 🙂 I think the most common use-case will be exactly what is mentioned in #2751. As I think about it, it seems unlikely that a new Yup object is created on each render, but it could happen. I hope it's not much of a problem because that is the only way of getting validation info into abstracted field components. 😅 |
93a41f0
to
24716ac
Compare
This pull request 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 |
24716ac
to
7d793e2
Compare
@jaredpalmer any news on this one? It's not super critical, but I think it would be great to have this 🙂 Cheers!! |
This pull request 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 |
Any movement on this? Would be very useful to us |
7d793e2
to
6797460
Compare
I just updated the branch, so this is ready to merge if there're no concerns 🙂 |
This pull request 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 |
I don't think we should pass through this or the I'd be open to passing these values via a secondary Context which contains only Formik Configuration: const Formik = () => {
// formikApi is completely memoized
// formikConfig is more volatile based on usage
const [formik, config] = useFormik(...formikProps);
return <FormikProvider value={formik}>
<FormikConfigProvider value={config}>
{/* children */}
</FormikConfigProvider>
</FormikProvider>
}
const useFormikConfig = () => useContext(FormikConfig.Consumer); @jaredpalmer if this is something we want to do, I can make these changes to my v3 branch |
6797460
to
f1545e8
Compare
I updated this branch just in case. Thanks again @johnrom for looking into this 🙂 |
This pull request 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 |
@github-actions plz no |
This pull request 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 |
This pull request 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 |
FYI this change is available in my v3 PR #3231 |
This pull request 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 |
f1545e8
to
eb55e7a
Compare
@johnrom I updated this branch just in case. However, it's great to know this is coming in v3, is there an ETA for v3 yet? 🙂 |
Hi @jaredpalmer, @johnrom!
I noticed the
validationSchema
was missing when usinguseFormikContext
. The types say it's there, but it always returnsundefined
. I took a look, and it seems it was missing from the context value definition, so I decided to open this small PR to lend a hand with this.Hope this helps 🙂