Skip to content

Commit

Permalink
fix: utils
Browse files Browse the repository at this point in the history
  • Loading branch information
pointhalo committed Nov 28, 2023
1 parent 996e8f6 commit bd0f638
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/semi-ui/select/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,13 @@ const getOptionsFromGroup = (selectChildren: React.ReactNode) => {
type = 'group';
// Avoid saving children (reactNode) by... removing other props from the group except children, causing performance problems
let { children, ...restGroupProps } = child.props;
const originKeys = children.map(item => item.key);
let originKeys = [];
if (Array.isArray(children)) {
// if group has children > 1
originKeys = children.map(item => item.key);
} else {
originKeys.push(children.key);
}
children = React.Children.toArray(children);
const childrenOption = children.map((option: React.ReactElement, index: number) => {
let newKey = option.key;
Expand Down

0 comments on commit bd0f638

Please sign in to comment.