Skip to content

Commit

Permalink
front: do not forward the offset param to the search page (but restor…
Browse files Browse the repository at this point in the history
…e it when going backward)
  • Loading branch information
GresilleSiffle committed Dec 19, 2024
1 parent 1331217 commit 8c3f5f4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
14 changes: 3 additions & 11 deletions frontend/src/pages/feed/FeedForYou.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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 (
<>
<ContentHeader
Expand All @@ -122,9 +116,7 @@ const FeedForYou = () => {
justifyContent="flex-end"
gap={1}
>
<SearchIconButtonLink
params={makeSearchPageSearchParams().toString()}
/>
<SearchIconButtonLink params={userPreferences.toString()} />
<PreferencesIconButtonLink hash={`#${pollName}-feed-foryou`} />
</Box>
{!isLoading && entities.count === 0 && (
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/feed/FeedTopItems.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ const FeedTopItems = () => {
new URLSearchParams(location.search),
ALLOWED_SEARCH_PARAMS
);
searchPageSearchParams.set('offset', offset.toString());
searchPageSearchParams.delete('offset');
return searchPageSearchParams;
};

Expand Down

0 comments on commit 8c3f5f4

Please sign in to comment.