tbleckert / react-select-search

⚡️ Lightweight select component for React
https://react-select-search.com
MIT License
676 stars 147 forks source link

Warning: Encountered two children with the same key, `[object Object]-option`. Keys should be unique so that components maintain their identity across updates. Non-unique keys may cause children to be duplicated and/or omitted — the behavior is unsupported and could change in a future version. in ul (created by SelectSearch) in div (created by SelectSearch) in div (created by SelectSearch) #69

Closed aTrueSeeker closed 4 years ago

aTrueSeeker commented 4 years ago

THis happens when i give value in options as JSON object

sjw441500 commented 4 years ago

same issue

sjw441500 commented 4 years ago

you may add a 'value' attribute to each of your data items.

sknutsonsf commented 4 years ago

I am still seeing this message using a three-level structure. Everything has a unique value. Here is an example of the options:

[ { "name": "My Mountain", "value": "ranch_854", "type": "group", "items": [ { "name": "East Almonds", "value": "block_3332", "type": "group", "items": [ { "name": "East Almonds (2020 Season)", "value": "2679" } ] }, { "name": "Pistachios", "value": "block_3333", "type": "group", "items": [ { "name": "Pistachios (A) (2020 Season)", "value": "2680" }, { "name": "Pistachios (B) (2020 Season)", "value": "2681" } ] }, ] }, }

tbleckert commented 4 years ago

@sknutsonsf I can not reproduce this in v1.2. Would you be able to check if this is still an issue? Groups uses a unique group ID for the key and options uses their value as the key. Option values has to be unique for other reasons than this.