diff --git a/src/components/auth/modals/hooks.ts b/src/components/auth/modals/hooks.ts index f86ca3a..c961146 100644 --- a/src/components/auth/modals/hooks.ts +++ b/src/components/auth/modals/hooks.ts @@ -5,11 +5,21 @@ export const useSearchParamToggle = (key: string) => { const value = searchParams.get(key) === "true" - const open = () => setSearchParams(prev => ({...prev, [key]: "true"}), {replace: true}) - const close = () => setSearchParams(prev => { - prev.delete(key) - return prev - }, {replace: true}) + const open = () => { + setSearchParams(prev => { + const newParams = new URLSearchParams(prev); + newParams.set(key, "true") + return newParams + }, { replace: true }) + } + + const close = () => { + setSearchParams(prev => { + const newParams = new URLSearchParams(prev); + newParams.delete(key); + return newParams; + }, { replace: true }) + } return { value: value,