Skip to content

Commit

Permalink
fix(TreeSelect): fix crashes while has selected elements and has no i…
Browse files Browse the repository at this point in the history
…tems (#1727)
  • Loading branch information
IsaevAlexandr authored Aug 1, 2024
1 parent 5d5417a commit 0e22bde
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/components/TreeSelect/TreeSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,10 @@ export const TreeSelect = React.forwardRef(function TreeSelect<T>(
<SelectControl
{...controlProps}
selectedOptionsContent={React.Children.toArray(
value.map(
(itemId) => mapItemDataToContentProps(list.structure.itemsById[itemId]).title,
value.map((itemId) =>
itemId in list.structure.itemsById
? mapItemDataToContentProps(list.structure.itemsById[itemId]).title
: '',
),
).join(', ')}
view="normal"
Expand Down

0 comments on commit 0e22bde

Please sign in to comment.