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

Yup validation "branch is not a function" also "yup.ref" not working correctly #626

Open
sajera opened this issue May 16, 2023 · 5 comments

Comments

@sajera
Copy link

sajera commented May 16, 2023

The "yup" validation is not working correctly. Please take a look at example

Sandbox

@foxhound87
Copy link
Owner

foxhound87 commented May 17, 2023

Hello, how can I replicate this issue branch is not a function?
The yup.ref could not be available currently. Use related prop correctly.
The field related prop cannot be a boolean, it accepts an array of the paths of the related fields.

@sajera
Copy link
Author

sajera commented May 17, 2023

There is a comment on how to replicate it. Here line 744-785.

The property related doesn't make any sense in this issue. That was different experiments within that Sandbox.

"The yup.ref could not be available currently" - means this YUP integration is useless because no way to validate related fields using yup.
That's sad to know 😭

@sajera sajera closed this as completed May 17, 2023
@sajera sajera reopened this May 17, 2023
@foxhound87
Copy link
Owner

branch is not a function should be related to yup package, the version 1 has changes.
Try to use a function on then and otherwise props:

password: yup.string().when("email", {
  is: true,
  then: () => yup.string().required(),
  otherwise: () => yup.string()
}),

about the yup.ref function, I have to figure out how to implement it in the driver.

@foxhound87
Copy link
Owner

I also checked the driver code and I cant' find a solution to the yup.ref function.
I think this should already work and could be an issue of yup itself.

@sajera
Copy link
Author

sajera commented May 17, 2023

Seems weird. That solution was taken from the another project with another technologies and work fine there. At any case thank you, for your investigation. Feel free to close the issue due to absent solutions or improvements around it.

At any cases the relations between fields not working as expected with "yup" it's too sad.

.when and .ref - implement ability to change validation rules based on current form values of other fields. Means they can't work if you trying to check fields values separated or partially.

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