Skip to content

Commit

Permalink
NONE) fix: fix multi select single pick (#92)
Browse files Browse the repository at this point in the history
* chore: fix dependency array

* chore: update version

* chore: add optional chaining
  • Loading branch information
dohui-son authored Jun 20, 2024
1 parent fea1497 commit 8370fa7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"author": "Corca <[email protected]>",
"description": "Design System for Corca, Inc.",
"private": false,
"version": "0.0.25",
"version": "0.0.26",
"type": "module",
"packageManager": "[email protected]",
"main": "dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion src/components/Select/MultiSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export function MultiSelect<T extends string | number>({

const selectedOptionItem = useMemo(() => {
return options.filter(option => selectedValues.includes(option.value as T));
}, [options.length, selectedValues.length]);
}, [options.length, selectedValues?.length, options?.[0]?.value, selectedValues?.[0]]);

const optionItems: BasicOptionItem[] = useMemo(() => {
if (search.searchable && searchInputValue) {
Expand Down
5 changes: 4 additions & 1 deletion src/components/Select/MultiSelectInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ export function MultiSelectInput<T extends string | number>({
showIcon = true,
...props
}: SelectInputBaseProps<T>) {
const itemMaxWidth = useMemo(() => getItemButtonMaxWidth(optionItems.length), [optionItems]);
const itemMaxWidth = useMemo(
() => getItemButtonMaxWidth(optionItems.length),
[optionItems?.length],
);

return (
<SelectInputWrapper width={width} onClick={onClick}>
Expand Down

0 comments on commit 8370fa7

Please sign in to comment.