-
Notifications
You must be signed in to change notification settings - Fork 947
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
Option with value 0 has different behavior than any other number in dropdown #6617
Comments
cc @Rekl0w |
it probably needs to be |
No, it is weird that i tried almost everything but not works for this. I also tried to use old version of this function but still the same behavior. I guess this is another bug. @melloware |
The case where I tested was for the one with the 'value' key set. Maybe the isNotEmpty should check the output of resolveFieldData? const getOptionValue = (option) => {
if (props.optionValue) {
return ObjectUtils.resolveFieldData(option, props.optionValue);
} else {
const optionValue = ObjectUtils.resolveFieldData(option, "value");
return ObjectUtils.isNotEmpty(optionValue) ? optionValue : option;
}
}; Edit: const getOptionValue = (option) => {
if (props.optionValue) {
return ObjectUtils.resolveFieldData(option, props.optionValue);
} else {
return option.hasOwnProperty("value") ? ObjectUtils.resolveFieldData(option, "value") : option;
}
}; |
Ok. I'll test some more tomorrow |
Describe the bug
Hi,
Seems like the behavior has been changed by commit 7312fe4.
return props.optionValue ? ObjectUtils.resolveFieldData(option, props.optionValue) : ObjectUtils.resolveFieldData(option, 'value') || option;
The || here passes option through if the value is 0.
0 || "Test" == "Test"
true
Reproducer
No response
PrimeReact version
10.6.5
React version
18.x
Language
TypeScript
Build / Runtime
Create React App (CRA)
Browser(s)
No response
Steps to reproduce the behavior
No response
Expected behavior
No response
The text was updated successfully, but these errors were encountered: