Commit 9b929ffb authored by tom's avatar tom

fix pagination

parent f02904c3
...@@ -73,7 +73,6 @@ export default function useQueryWithPages<Response extends ResponseWithPaginatio ...@@ -73,7 +73,6 @@ export default function useQueryWithPages<Response extends ResponseWithPaginatio
// we dont have pagination params for the first page // we dont have pagination params for the first page
let nextPageQuery: typeof router.query; let nextPageQuery: typeof router.query;
if (page === 2) { if (page === 2) {
queryClient.clear();
nextPageQuery = omit(router.query, PAGINATION_FIELDS); nextPageQuery = omit(router.query, PAGINATION_FIELDS);
} else { } else {
const nextPageParams = { ...pageParams[page - 2] }; const nextPageParams = { ...pageParams[page - 2] };
...@@ -85,6 +84,7 @@ export default function useQueryWithPages<Response extends ResponseWithPaginatio ...@@ -85,6 +84,7 @@ export default function useQueryWithPages<Response extends ResponseWithPaginatio
.then(() => { .then(() => {
animateScroll.scrollToTop({ duration: 0 }); animateScroll.scrollToTop({ duration: 0 });
setPage(prev => prev - 1); setPage(prev => prev - 1);
page === 2 && queryClient.clear();
}); });
}, [ router, page, pageParams, queryClient ]); }, [ router, page, pageParams, queryClient ]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment