Skip to content
This repository was archived by the owner on Sep 9, 2024. It is now read-only.

Commit 4325905

Browse files
committed
feat: allow clear on multiple
1 parent e2d3247 commit 4325905

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packages/core/src/components/common/autocomplete/Autocomplete.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ const Autocomplete = function <T>(
6969
);
7070

7171
const clear = useCallback(() => {
72-
onChange(undefined);
73-
}, [onChange]);
72+
onChange(Array.isArray(value) ? [] : undefined);
73+
}, [onChange, value]);
7474

7575
return (
7676
<div className="relative w-full">
@@ -142,7 +142,7 @@ const Autocomplete = function <T>(
142142
aria-hidden="true"
143143
/>
144144
</Combobox.Button>
145-
{!required && !Array.isArray(value) ? (
145+
{!required ? (
146146
<IconButton variant="text" disabled={disabled} onClick={clear}>
147147
<CloseIcon
148148
className={classNames(

0 commit comments

Comments
 (0)