From 4f595c7cad66d574d75c5c2cc48b856643b6a880 Mon Sep 17 00:00:00 2001 From: ValdiANS Date: Wed, 10 Dec 2025 17:31:21 +0700 Subject: [PATCH] chore: wrap router.replace in useEffect --- src/app/page.tsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/app/page.tsx b/src/app/page.tsx index 0330b478..9fe5b724 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -1,5 +1,6 @@ 'use client'; +import { useEffect } from 'react'; import { usePathname, useRouter } from 'next/navigation'; import { useAuth } from '@/services/hooks/useAuth'; import { redirectToSSO } from '@/lib/auth-helper'; @@ -10,9 +11,11 @@ export default function Home() { const router = useRouter(); const pathname = usePathname(); - if (pathname === '/') { - router.replace('/dashboard'); - } + useEffect(() => { + if (pathname === '/') { + router.replace('/dashboard'); + } + }, [pathname]); if (isLoadingUser) { return (