diff --git a/lib/AcqList/hooks/useFilters.js b/lib/AcqList/hooks/useFilters.js index e266baa5..ce6f6160 100644 --- a/lib/AcqList/hooks/useFilters.js +++ b/lib/AcqList/hooks/useFilters.js @@ -22,7 +22,7 @@ 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; @@ -30,16 +30,13 @@ const useFilters = (resetData, initialFilters = INITIAL_FILTERS, options = OPTIO newFilters[type] = value; } - setFilters((currentFilters) => ({ - ...currentFilters, - ...newFilters, - })); + setFilters(newFilters); resetData(); return newFilters; }, - [resetData], + [filters, resetData], ); const applySearch = useCallback(