Skip to content

Commit c063a91

Browse files
Zyf665afc163
andauthored
Update src/Select.tsx
Co-authored-by: afc163 <[email protected]>
1 parent bd84fbe commit c063a91

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

src/Select.tsx

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -435,16 +435,10 @@ const Select = React.forwardRef<BaseSelectRef, SelectProps<any, DefaultOptionTyp
435435
const sortedOptions = [...options].sort((a, b) =>
436436
filterSort(a, b, { searchValue: mergedSearchValue }),
437437
);
438-
const sortedOptionsWithNested = sortedOptions.map((item) => {
439-
if (Array.isArray(item.options)) {
440-
return {
441-
...item,
442-
options: sorter(item.options),
443-
};
444-
}
445-
return item;
446-
});
447-
return sortedOptionsWithNested;
438+
return sortedOptions.map((item) => ({
439+
...item,
440+
options: Array.isArray(item.options) ? sorter(item.options) : item.options,
441+
);
448442
};
449443
const orderedFilteredOptions = React.useMemo(() => {
450444
if (!filterSort) {

0 commit comments

Comments
 (0)