From 9f80490edefa445c880115861faf2fc046d49daf Mon Sep 17 00:00:00 2001 From: Brody Over <10548119+brody192@users.noreply.github.com> Date: Thu, 19 Dec 2024 00:04:41 -0500 Subject: [PATCH] Update useHashRedirect.ts --- src/hooks/useHashRedirect.ts | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/hooks/useHashRedirect.ts b/src/hooks/useHashRedirect.ts index 3606289fc..ac0396779 100644 --- a/src/hooks/useHashRedirect.ts +++ b/src/hooks/useHashRedirect.ts @@ -1,10 +1,7 @@ import { useEffect } from "react"; -import { useRouter } from "next/router"; import { hashRedirects } from "../../redirects"; export function useHashRedirect() { - const router = useRouter(); - useEffect(() => { const hash = window.location.hash; @@ -13,9 +10,7 @@ export function useHashRedirect() { const redirect = hashRedirects.find( redirect => redirect.source === hash, ); - - if (redirect) router.push(redirect.destination); - }, [router]); - - return; -} + + if (redirect) window.location.replace(redirect.destination); + }, []); +} \ No newline at end of file