Skip to content

Commit

Permalink
🐛 Update DropdownList key prop to use getItemValue
Browse files Browse the repository at this point in the history
Closes #1804
  • Loading branch information
baptisteArno committed Sep 25, 2024
1 parent 32690cb commit c54e674
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion apps/builder/src/components/DropdownList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export const DropdownList = <T extends Item>({
<Stack maxH={"35vh"} overflowY="auto" spacing="0">
{items.map((item) => (
<MenuItem
key={item as unknown as string}
key={getItemValue(item)}
maxW="500px"
overflow="hidden"
whiteSpace="nowrap"
Expand All @@ -133,3 +133,8 @@ const getItemLabel = (item?: Item) => {
if (typeof item === "object") return item.label;
return item;
};

const getItemValue = (item: Item) => {
if (typeof item === "object") return item.value;
return item;
};

0 comments on commit c54e674

Please sign in to comment.