Skip to content

Commit

Permalink
Merge pull request #700 from Orfium/fix/NDS-864_filter_label_doesnt_u…
Browse files Browse the repository at this point in the history
…pdate_externally_v4

[NDS-864] fix: filter label doesnt update externally
  • Loading branch information
kostasdano authored Nov 2, 2023
2 parents 0df3029 + 3872369 commit 445225f
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 445225f

Please sign in to comment.