From 327785d4529a3be3297b6d14c099e05d8dbcd85f Mon Sep 17 00:00:00 2001 From: carlosthe19916 <2582866+carlosthe19916@users.noreply.github.com> Date: Fri, 10 May 2024 12:20:32 +0200 Subject: [PATCH] fix: browser back button does not work --- client/src/app/hooks/useUrlParams.ts | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/client/src/app/hooks/useUrlParams.ts b/client/src/app/hooks/useUrlParams.ts index 1a24518b..70878d98 100644 --- a/client/src/app/hooks/useUrlParams.ts +++ b/client/src/app/hooks/useUrlParams.ts @@ -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.