Skip to content
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

EuiComboBox: React warning related to duplicate keys #1901

Closed
alisonelizabeth opened this issue Apr 30, 2019 · 4 comments
Closed

EuiComboBox: React warning related to duplicate keys #1901

alisonelizabeth opened this issue Apr 30, 2019 · 4 comments

Comments

@alisonelizabeth
Copy link

To reproduce, create a EuiComboBox that groups options together, where group 1 has an option with the same label as group 2.

For example:

[
  {
     "label": "Based on your indices/aliases",
     "options": [{"label":"kibana_sample_data_logs", "value":"kibana_sample_data_logs"}]
  },
  {
    "label": "Based on your index patterns",
     "options": [{"label":"kibana_sample_data_logs", "value":"kibana_sample_data_logs"}]
  }
]

It looks like the key is created based on the label, which is causing the following React warning in this scenario: Warning: Encountered two children with the same key

@cchaos
Copy link
Contributor

cchaos commented Apr 30, 2019

Unfortunately, this is as designed and a known restriction for EuiComboBox.

Screen Shot 2019-04-30 at 11 42 08 AM

A different component (EuiSelectable) uses the same logic and therefore the same restrictions, but there's talk about possibly allowing a unique key to the object.

@alisonelizabeth
Copy link
Author

@cchaos thanks for sharing! I will go ahead and close this.

@sebelga
Copy link
Contributor

sebelga commented Jun 27, 2019

I reopen the issue as I did not understand why it is not possible to give a unique key to the combo box options. @cchaos

@thompsongl
Copy link
Contributor

#3803 tracks the request to allow id and duplicate label content.

Closing this in favor of that issue and the solution in the linked PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants