-
-
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
Feature: Pass Yup context to validationSchema using new prop validationSchemaContext in <Formik> #3852
base: main
Are you sure you want to change the base?
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
What can be done to move this PR forward? I could really use this feature and I'd be happy to contribute, but it looks like this has gone 8 months with no feedback from code owners :( |
I just ripped out RHF and replaced it with Formik because RHF doesn't support errors being raised on fields that weren't touched (although it supported contexts!), only to find out Formik doesn't currently support Yup Contexts 😅, I would love it if this PR could gain some momentum! |
+1, would appreciate this PR's prioritization. |
Chiming in as this is an issue my team faces regularly |
+1 on this being a useful feature to me and my team |
Closes #3450
<Formik>
component calledvalidationSchemaContext
for Yup context, which is then passed to the validationSchema here (see below):formik/packages/formik/src/Formik.tsx
Lines 230 to 241 in ccdcb39
Note the
validateYupSchema
function already had an optionalcontext
argument, and it also already had a third argument calledsync
which is set to default to false in the function definition. , no changes were made below. (see below)formik/packages/formik/src/Formik.tsx
Lines 1079 to 1091 in ccdcb39
Wrote tests in both
Formik.test.tsx
and inyupHelpers.test.ts
.Added types for the new prop.
Updated the docs to include the new prop in the
<Formik>
api page