Skip to content

Commit

Permalink
fix: fix multi combobox empty state problem
Browse files Browse the repository at this point in the history
Co-Authored-By: Minghan Zhang <[email protected]>
  • Loading branch information
Sh1n3zZ and zmh-program committed Mar 31, 2024
1 parent abd05d8 commit ad51b17
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/src/components/ui/combo-box.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export function Combobox({
const [open, setOpen] = React.useState(defaultOpen ?? false);
const valueList = React.useMemo((): string[] => {
// list set (if some element in current value is not in list, it will be added)
const set = new Set([...list, value]);
const set = new Set([...list, (value ?? "")]);
return [...set];
}, [list]);

Expand Down
2 changes: 1 addition & 1 deletion app/src/components/ui/multi-combobox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export function MultiCombobox({
const [open, setOpen] = React.useState(defaultOpen ?? false);
const valueList = React.useMemo((): string[] => {
// list set (if some element in current value is not in list, it will be added)
const set = new Set([...list, ...value]);
const set = new Set([...list, ...(value ?? [])]);
return [...set];
}, [list]);

Expand Down

0 comments on commit ad51b17

Please sign in to comment.