-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
fix(ComboBox): ensure unique keys #4999
Conversation
This change swiches React `key`s of the items of `<Dropdown>` as well as the one of `<ComboBox>` from their text content to provided keys in data. This is applying the corresponding logic of `<MultiSelect>`. In this way duplicate item text won't yeild duplicate React keys. Fixes carbon-design-system#4969.
Deploy preview for the-carbon-components ready! Built with commit 0a657cd https://deploy-preview-4999--the-carbon-components.netlify.com |
Deploy preview for carbon-elements ready! Built with commit 0a657cd |
Deploy preview for carbon-components-react ready! Built with commit 0a657cd https://deploy-preview-4999--carbon-components-react.netlify.com |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me, tested with the sandbox code in the original issue and no duplicate key warnings are emitted
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! 🎉
This change switches React
key
s of the items of<Dropdown>
as well as the one of<ComboBox>
from their text content to provided keys in data.This is applying the corresponding logic of
<MultiSelect>
.In this way duplicate item text won't yeild duplicate React keys.
Fixes #4969.
Changelog
Changed
<Dropdown>
as well as the one of<ComboBox>
from their text content to provided keys in data.Testing / Reviewing
Testing should make sure
<Dropdown>
and<ComboBox>
are not broken.