From 387d26d499c3b39c8805d1f523df9cbbcf221325 Mon Sep 17 00:00:00 2001 From: Sukari Stone Date: Thu, 21 Aug 2025 12:32:10 -0700 Subject: [PATCH] Fix email input field issues in onboarding MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add proper input attributes (type, autocomplete, etc.) for better browser compatibility - Handle edge case where session exists but email is missing - Auto-clear problematic sessions with missing email data - Add debug mode (?debug=true) to help diagnose auth issues - Prevent field from getting stuck in disabled state This should resolve the persistent issue where users cannot type in the email field. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- src/components/OnboardingPage.tsx | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/components/OnboardingPage.tsx b/src/components/OnboardingPage.tsx index 26fbb5b..83e7b19 100644 --- a/src/components/OnboardingPage.tsx +++ b/src/components/OnboardingPage.tsx @@ -94,6 +94,12 @@ export default function OnboardingPage() { if (session?.user?.email) { handleSessionEstablished(session.user.email) + } else if (session?.user && !session.user.email) { + // Session exists but email is missing - clear the bad state + console.error('Auth state change: Session without email detected', session.user) + setValue('email', '') + setEmailLocked(false) + void supabase.auth.signOut() // Clear the problematic session } else if (session === null) { // Clear email if user signs out (e.g., in another tab) setValue('email', '') @@ -117,6 +123,20 @@ export default function OnboardingPage() { if (session?.user?.email) { handleSessionEstablished(session.user.email) + } else if (session?.user && !session.user.email) { + // Session exists but email is missing - this is an error state + console.error('Session found but email is missing:', session.user) + if (isMounted) { + setEmailLocked(false) // Ensure field is not locked + setIsCheckingAuth(false) + toast({ + variant: 'destructive', + title: 'Authentication Issue', + description: 'Your session is missing email information. Please try signing in again.' + }) + // Clear the problematic session + void supabase.auth.signOut() + } } else { // No session found, set timeout to allow for magic link processing timeoutId = setTimeout(() => { @@ -318,6 +338,11 @@ export default function OnboardingPage() { + {debugInfo && ( +
+ Debug Info:{debugInfo} +
+ )}