From 8c3f5f4886fb5806a4706b21a0fe0b79ce3cdfa7 Mon Sep 17 00:00:00 2001 From: Gresille&Siffle <39056254+GresilleSiffle@users.noreply.github.com> Date: Thu, 19 Dec 2024 15:29:21 +0100 Subject: [PATCH] front: do not forward the offset param to the search page (but restore it when going backward) --- frontend/src/pages/feed/FeedForYou.tsx | 14 +++----------- frontend/src/pages/feed/FeedTopItems.tsx | 2 +- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/frontend/src/pages/feed/FeedForYou.tsx b/frontend/src/pages/feed/FeedForYou.tsx index b9fa9cb1ec..9ebdcfea8e 100644 --- a/frontend/src/pages/feed/FeedForYou.tsx +++ b/frontend/src/pages/feed/FeedForYou.tsx @@ -62,10 +62,10 @@ const FeedForYou = () => { dispatch( updateBackNagivation({ backPath: location.pathname, - backParams: '', + backParams: offset > 0 ? `offset=${offset}` : '', }) ); - }, [dispatch, location.pathname]); + }, [dispatch, location.pathname, offset]); useEffect(() => { const searchString = new URLSearchParams(userPreferences); @@ -95,12 +95,6 @@ const FeedForYou = () => { fetchEntities(); }, [criterias, offset, options, pollName, userPreferences]); - const makeSearchPageSearchParams = () => { - const searchPageSearchParams = new URLSearchParams(userPreferences); - searchPageSearchParams.set('offset', offset.toString()); - return searchPageSearchParams; - }; - return ( <> { justifyContent="flex-end" gap={1} > - + {!isLoading && entities.count === 0 && ( diff --git a/frontend/src/pages/feed/FeedTopItems.tsx b/frontend/src/pages/feed/FeedTopItems.tsx index e36913ad72..6b9c2897ea 100644 --- a/frontend/src/pages/feed/FeedTopItems.tsx +++ b/frontend/src/pages/feed/FeedTopItems.tsx @@ -155,7 +155,7 @@ const FeedTopItems = () => { new URLSearchParams(location.search), ALLOWED_SEARCH_PARAMS ); - searchPageSearchParams.set('offset', offset.toString()); + searchPageSearchParams.delete('offset'); return searchPageSearchParams; };