From 8bf8ac94a283d6477cac7677b77b3f85c002e745 Mon Sep 17 00:00:00 2001 From: "Builder.io" Date: Fri, 8 Aug 2025 10:17:39 +0000 Subject: [PATCH] Force immediate redirect when no user, don't wait for loading cgen-3aedfef317d043e8abcacda51949333a --- client/pages/Dashboard.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/client/pages/Dashboard.tsx b/client/pages/Dashboard.tsx index 3a106665..2bc8b0d7 100644 --- a/client/pages/Dashboard.tsx +++ b/client/pages/Dashboard.tsx @@ -55,15 +55,16 @@ export default function Dashboard() { }); useEffect(() => { - if (!authLoading && !user) { + // Force redirect immediately if no user + if (!user) { setIsLoading(false); - navigate("/login"); + navigate("/login", { replace: true }); return; } if (user && profile) { loadDashboardData(); - } else if (!authLoading) { + } else if (user && !profile && !authLoading) { setIsLoading(false); } }, [user, profile, authLoading, navigate]);