-
Notifications
You must be signed in to change notification settings - Fork 929
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
baseSchema.concat(otherSchema) overwrites baseSchema properties when otherSchema properties are undefined #1160
Labels
Comments
After spending some time on the issue i came to this conclusion ( codesandox had problems when testing so will leave it here):
|
hmm no it's not intended. it should work like it used to. |
I coppied
|
cemalettin-work
added a commit
to cemalettin-work/yup
that referenced
this issue
Dec 12, 2020
cemalettin-work
added a commit
to cemalettin-work/yup
that referenced
this issue
Dec 12, 2020
cemalettin-work
added a commit
to cemalettin-work/yup
that referenced
this issue
Dec 12, 2020
cemalettin-work
changed the title
mixed.label() have different behavior after version 0.32 ( maybe only in nested schemas / form fields ? )
baseSchema.concat(otherSchema) overwrites baseSchema properties when otherSchema properties are undefined
Dec 12, 2020
cemalettin-work
added a commit
to cemalettin-work/yup
that referenced
this issue
Dec 13, 2020
cemalettin-work
added a commit
to cemalettin-work/yup
that referenced
this issue
Dec 13, 2020
Concatting schemas can overwrite previous non-undefined values with undefined
1 task
cemalettin-work
added a commit
to cemalettin-work/yup
that referenced
this issue
Dec 13, 2020
jquense
pushed a commit
that referenced
this issue
Dec 13, 2020
cemalettin-work
added a commit
to NCI-Agency/anet
that referenced
this issue
Dec 14, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
Last_Edit: It is because of this code https://github.com/jquense/yup/blob/master/src/schema.ts#L231-L233 ,
combined.spec
has every propertyundefined
, it would work ifcombined.spec
properties were non-existent instead ofundefined
:const mergedSpec = { ...base.spec, ...combined.spec };
First_Edit: Looking a bit deeper, i am now not sure if it is caused by mixed.label(), but since the only thing we change is the yup version and this unexpected behavior occurs, i will keep this issue as is, hopefully someone experienced in yup can investigate or realize the reason why this happens.
Calling mixed.label("Custom label") does work on version 0.31.0 but not on 0.32.5+.
Example screenshots from v.0.31.0 and v.0.32.5+
v.0.31.0:
v.0.32.5+:
To Reproduce
Quite complex form logic react and formik, will try to extract the logic and edit here.
Expected behavior
I would expect the previous behavior of setting a label to work on error messages.
Platform (please complete the following information):
Additional context
Using with react + formik
The text was updated successfully, but these errors were encountered: