Skip to content

Commit

Permalink
Merge pull request #3000 from metabrainz/LB-1635
Browse files Browse the repository at this point in the history
LB-1635: Navigation history broken when clicking on a user's stats
  • Loading branch information
MonkeyDo authored Oct 21, 2024
2 parents 4ac93f1 + bf40599 commit 0dc2ca2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion frontend/js/src/search/Search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ export default function Search() {

React.useEffect(() => {
if (invalidSearchTypes(searchType)) {
setSearchParams({ search_term: searchTerm, search_type: "artist" });
setSearchParams(
{ search_term: searchTerm, search_type: "artist" },
{ replace: true }
);
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [searchType]);
Expand Down
2 changes: 1 addition & 1 deletion frontend/js/src/user/stats/UserReports.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export default function UserReports() {

React.useEffect(() => {
if (!range || isInvalidStatRange(range)) {
setSearchParams({ range: "week" });
setSearchParams({ range: "week" }, { replace: true });
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [range]);
Expand Down

0 comments on commit 0dc2ca2

Please sign in to comment.