Skip to content

Commit

Permalink
fix: remove array copy
Browse files Browse the repository at this point in the history
Co-authored-by: Inomdzhon Mirdzhamolov <[email protected]>
  • Loading branch information
EldarMuhamethanov and inomdzhon authored Jan 16, 2025
1 parent d5939d6 commit 0a98d90
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions packages/vkui/src/components/ChipsSelect/useChipsSelect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,13 +258,11 @@ function transformOptions<O extends ChipOption>({
return [{ placeholder: emptyText }];
}

const sortedOptions = sortFn
? [...filteredOptionsProp].sort((optionA, optionB) => {
return sortFn(optionA, optionB, inputValue);
})
: filteredOptionsProp;
if (sortFn) {
filteredOptionsProp.sort((optionA, optionB) => sortFn(optionA, optionB, inputValue));
}

const parsedOptions = transformValue(sortedOptions, getOptionValue, getOptionLabel);
const parsedOptions = transformValue(filteredOptionsProp, getOptionValue, getOptionLabel);

if (selectedBehavior === 'hide') {
const selected = value.map((item) => item.value);
Expand Down

0 comments on commit 0a98d90

Please sign in to comment.