Skip to content

Commit

Permalink
fixed Back navigation should also show previous search result
Browse files Browse the repository at this point in the history
  • Loading branch information
qcdyx committed Aug 13, 2024
1 parent 9f6000e commit 516d2cb
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions web-app/src/app/screens/Feeds/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,15 @@ export default function Feed(): React.ReactElement {
}, [activeSearch, activePagination]);

useEffect(() => {
const newQeury = searchParams.get('q') ?? '';
if (newQeury !== searchQuery) {
setSearchQuery(newQeury);
const newQuery = searchParams.get('q') ?? '';
if (newQuery !== searchQuery) {
setSearchQuery(newQuery);
setActiveSearch(newQuery);
}
const newOffset =
searchParams.get('o') !== null ? Number(searchParams.get('o')) : 1;
if (newOffset !== activePagination) {
setActivePagination(newOffset);
}
}, [searchParams]);

Expand Down

0 comments on commit 516d2cb

Please sign in to comment.