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

Commit

Permalink
feat: allow clear on multiple
Browse files Browse the repository at this point in the history
  • Loading branch information
KaneFreeman committed Aug 31, 2023
1 parent e2d3247 commit 4325905
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ const Autocomplete = function <T>(
);

const clear = useCallback(() => {
onChange(undefined);
}, [onChange]);
onChange(Array.isArray(value) ? [] : undefined);
}, [onChange, value]);

return (
<div className="relative w-full">
Expand Down Expand Up @@ -142,7 +142,7 @@ const Autocomplete = function <T>(
aria-hidden="true"
/>
</Combobox.Button>
{!required && !Array.isArray(value) ? (
{!required ? (
<IconButton variant="text" disabled={disabled} onClick={clear}>
<CloseIcon
className={classNames(
Expand Down

0 comments on commit 4325905

Please sign in to comment.