-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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
[Autocomplete] Inconsistent option Format Between Single and Multiple Fields #45043
Comments
Can you share a reproduction. I can't reproduce, the value I get is the same for example in this demo: https://stackblitz.com/edit/react-fujuhrhe?file=Demo.tsx |
@mnajdova, thank you for taking the time to look into the issue. I managed to resolve it by adjusting the structure of my value. The confusion stemmed from the name |
I'm glad you figured it out @aress31. Closing as such. |
This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue. Note @aress31 How did we do? Your experience with our support team matters to us. If you have a moment, please share your thoughts in this short Support Satisfaction survey. |
@DiegoAndai that doesn't change that the function name doesn't reflect the use and that one would expect it to take the options as arg as opposed to the value. Is anything planned to either rename the func or have it do what the name would suggest it does? |
This is tracked in #31192. Please upvote the issue, as we use the upvotes to prioritize work. I can't give an ETA for the change though. |
Steps to reproduce
Add two
autocomplete
fields that share the same set ofoptions
.Configure one field with
multiple: true
and the other withmultiple: false
.Use the following
getOptionLabel
implementation:Current behavior
When the
multiple
property is set totrue
, the option passed togetOptionLabel
has the following format:However, when
multiple
is set tofalse
, the option passed togetOptionLabel
has the following format:This difference in format requires additional checks and transformations in the code, which seems unintended and may be a bug. Consistent formatting for the option object, regardless of the
multiple
property, would simplify the handling and reduce unnecessary transformations.Expected behavior
option
withingetOptionLabel
should have the following, consistent, data structure:Context
No response
Your environment
npx @mui/envinfo
Search keywords: autcomplete
The text was updated successfully, but these errors were encountered: