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

nullable() not woking on version 1.0.0 #1916

Closed
mtr1990 opened this issue Feb 14, 2023 · 5 comments
Closed

nullable() not woking on version 1.0.0 #1916

mtr1990 opened this issue Feb 14, 2023 · 5 comments

Comments

@mtr1990
Copy link

mtr1990 commented Feb 14, 2023

Describe the bug

  • nullable() not woking on version 1.0.0

To Reproduce

  • For version 0.32.11 with firstName: yup.string().required("firstName is required").nullable(true) => WORK
  • For version 1.0.0 with firstName: yup.string().required("firstName is required").nullable() => NOT WORK

Check in : https://codesandbox.io/s/snowy-https-0l49w7?file=/src/Demo.tsx

Expected behavior

  • Error will appear with nullable() property in version 1.0.0

Platform (please complete the following information):

@jquense
Copy link
Owner

jquense commented Feb 14, 2023

this is working, please read the major changes in v1 #1906

@jquense jquense closed this as completed Feb 14, 2023
@jquense
Copy link
Owner

jquense commented Feb 14, 2023

Sorry, a little quick. yup is working as it's supposed to here, if you just validate via the schema it doesn't throw an error on v1 which is correct. It seems tho that something else is happening in RHF that is causing it to continue to error on submit

@mtr1990
Copy link
Author

mtr1990 commented Feb 14, 2023

Thank you!

firstName: yup.string().nullable().required("firstName is required") WORKED

@jquense
Copy link
Owner

jquense commented Feb 14, 2023

note that the nullable doesn't do anything there, it's immediately overridden by required

@mtr1990
Copy link
Author

mtr1990 commented Feb 15, 2023

Hi,

Can provide an example of nullable in this case?

note that the nullable doesn't do anything there, it's immediately overridden by required
=> I have tested for both RHF and Formik both seem not working as expected.

RHF
https://codesandbox.io/s/snowy-https-0l49w7?file=/src/Demo.tsx

Formik
https://stackblitz.com/edit/react-ocqvn9?file=src%2FApp.js,src%2Findex.js

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants