Skip to content

Commit

Permalink
fix: filter label doesnt update externally v4
Browse files Browse the repository at this point in the history
  • Loading branch information
kostasdano committed Nov 1, 2023
1 parent 62f598a commit 3872369
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/components/Filter/Filter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ const Filter = React.forwardRef<HTMLButtonElement, Props>((props, ref) => {
const [searchValue, setSearchValue] = React.useState('');
const [filterLabel, setFilterLabel] = React.useState(selectedItem?.label ?? defaultValue.label);

React.useEffect(() => {
setFilterLabel(selectedItem?.label ?? defaultValue.label);
}, [defaultValue.label, selectedItem?.label]);

const hasSelectedValue =
Boolean(selectedItem?.value) && selectedItem?.value !== defaultValue.value;

Expand Down

0 comments on commit 3872369

Please sign in to comment.