Skip to content

Commit

Permalink
fix: browser back button does not work
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosthe19916 committed May 10, 2024
1 parent 96ff948 commit 327785d
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions client/src/app/hooks/useUrlParams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,16 @@ export const useUrlParams = <
const existingSearchParams = new URLSearchParams(search);
// We prefix the params object here so the serialize function doesn't have to care about the keyPrefix.
const newPrefixedSerializedParams = withPrefixes(serialize(newParams));
navigate({
pathname,
search: trimAndStringifyUrlParams({
existingSearchParams,
newPrefixedSerializedParams,
}),
});
navigate(
{
pathname,
search: trimAndStringifyUrlParams({
existingSearchParams,
newPrefixedSerializedParams,
}),
},
{ replace: true }
);
};

// We use useLocation here so we are re-rendering when the params change.
Expand Down

0 comments on commit 327785d

Please sign in to comment.