From e77e5d86f232b6f36a8cd1fac26b12c080c88be2 Mon Sep 17 00:00:00 2001 From: "Builder.io" Date: Mon, 10 Nov 2025 21:59:10 +0000 Subject: [PATCH] Fix Login.tsx to not redirect immediately after signin - let Auth context handle it cgen-628b7dd547d74422b71ffd8765b30fd4 --- client/pages/Login.tsx | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/client/pages/Login.tsx b/client/pages/Login.tsx index 84cd835f..f48a6e01 100644 --- a/client/pages/Login.tsx +++ b/client/pages/Login.tsx @@ -147,18 +147,15 @@ export default function Login() { navigate("/onboarding", { replace: true }); } } else { + // Sign in with email/password const result = await signIn(email, password); if (result?.user) { - const params = new URLSearchParams(location.search); - const next = params.get("next"); - const safeNext = next && next.startsWith("/") ? next : null; - navigate( - safeNext || - (result?.user_metadata?.profile_complete - ? "/dashboard" - : "/onboarding"), - { replace: true }, - ); + // Don't navigate immediately - let Auth context update and the useEffect below handle redirect + // This ensures profile data is fetched and profileComplete is properly calculated + toastInfo({ + title: "Signing you in", + description: "Redirecting...", + }); } } } catch (error: any) {