Skip to content

Commit

Permalink
revert changes in useFilters hook (#830)
Browse files Browse the repository at this point in the history
  • Loading branch information
usavkov-epam authored Nov 12, 2024
1 parent 676e061 commit 7f664e2
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions lib/AcqList/hooks/useFilters.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,21 @@ const useFilters = (resetData, initialFilters = INITIAL_FILTERS, options = OPTIO

const applyFilters = useCallback(
(type, value) => {
const newFilters = {};
const newFilters = { ...filters };

if (Array.isArray(value) && value.length === 0) {
newFilters[type] = undefined;
} else {
newFilters[type] = value;
}

setFilters((currentFilters) => ({
...currentFilters,
...newFilters,
}));
setFilters(newFilters);

resetData();

return newFilters;
},
[resetData],
[filters, resetData],
);

const applySearch = useCallback(
Expand Down

0 comments on commit 7f664e2

Please sign in to comment.