tremor icon indicating copy to clipboard operation
tremor copied to clipboard

BarList: Encountered two children with the same key

Open marlon360 opened this issue 2 years ago • 0 comments

Hello,

in the BarList component the item.value is used as the key prop. https://github.com/tremorlabs/tremor/blob/a5c979959bedf558b7a7e4fed2eb9f58beca7676/src/components/vis-elements/BarList/BarList.tsx#L63

This causes issues with data that has duplicate values in the list:

Warning: Encountered two children with the same key, 2. 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.

I propose using item.text as the key.

marlon360 avatar Oct 18 '22 14:10 marlon360