Skip to content

Commit

Permalink
fixes #7008; fix resetting the filters on page visit
Browse files Browse the repository at this point in the history
  • Loading branch information
rithviknishad committed Jan 11, 2024
1 parent e187977 commit 4e35588
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Common/hooks/useFilters.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ export default function useFilters({ limit = 14 }: { limit?: number }) {

const updateQuery = (filter: FilterState) => {
filter = hasPagination ? { page: 1, limit, ...filter } : filter;
setQueryParams(Object.assign({}, qParams, filter), { replace: true });
const query = Object.assign({}, qParams, filter);
setQueryParams(query, { replace: true });
updateFiltersCache(query);
};
const updatePage = (page: number) => {
if (!hasPagination) return;
Expand All @@ -38,8 +40,6 @@ export default function useFilters({ limit = 14 }: { limit?: number }) {
};
const removeFilter = (param: string) => removeFilters([param]);

useEffect(() => updateFiltersCache(qParams), [qParams]);

useEffect(() => {
const cache = getFiltersCache();
const qParamKeys = Object.keys(qParams);
Expand Down

0 comments on commit 4e35588

Please sign in to comment.