You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have verified that I use latest version of all @mantine/* packages
What version of @mantine/* packages do you have in package.json?
Latest
What package has an issue?
@mantine/core
What framework do you use?
Vite
In which browsers you can reproduce the issue?
All
Describe the bug
If the Combobox has duplicate options, Mantine fails instead of showing a warning, unlike React.
This might result in unexpected failures if the data coming from the backend has duplicate data all of a sudden and the frontend code was not written defensively to make the incoming data unique.
For example, if the Combobox appears in a Modal, the Modal crashes and is not shown at all.
It would be hard to make sure every input to Combobox is unique in all cases, so I think the validation should be relaxed and applied on-demand.
If possible, include a link to a codesandbox with a minimal reproduction
No response
Possible fix
No response
Self-service
I would be willing to implement a fix for this issue
The text was updated successfully, but these errors were encountered:
It is not planned to change this behavior. If options are not unique, Combobox component will not work correctly, all of its features are bound to option value, including keyboard navigation, option retrieving from the list and scrolling to a specific option. The function is implemented to throw an error to explicitly notify the developer that the data cannot be processed.
To fix the issue, transform the data on your side before passing it to the component.
@rtivital OK, I see. I still think it is a bit too punishing as users might not be aware of this restriction.
In any case, I opened this PR that at least provides some warning in the docs about the uniqueness requirement: #7181
There might be a better place to communicate this in the docs as most may not look at the props tab of these components. Maybe we put that in the first paragraph of each component?
Dependencies check up
What version of @mantine/* packages do you have in package.json?
Latest
What package has an issue?
@mantine/core
What framework do you use?
Vite
In which browsers you can reproduce the issue?
All
Describe the bug
If the Combobox has duplicate options, Mantine fails instead of showing a warning, unlike React.
This might result in unexpected failures if the data coming from the backend has duplicate data all of a sudden and the frontend code was not written defensively to make the incoming data unique.
For example, if the Combobox appears in a Modal, the Modal crashes and is not shown at all.
It would be hard to make sure every input to Combobox is unique in all cases, so I think the validation should be relaxed and applied on-demand.
If possible, include a link to a codesandbox with a minimal reproduction
No response
Possible fix
No response
Self-service
The text was updated successfully, but these errors were encountered: