From 4976f2faee75f2ba962ef6b406c23262780bb347 Mon Sep 17 00:00:00 2001 From: Deepak Pandey Date: Mon, 15 Sep 2025 10:27:24 +0530 Subject: [PATCH] fix: Resolve critical console errors and input visibility issues - Fix font loading 404 errors by removing non-existent local font preloads - Add explicit text-gray-900 to all input fields to ensure typed text is visible - Improve Supabase API error handling with graceful fallbacks - Remove preload links for /fonts/geist-sans.woff2 and /fonts/geist-mono.woff2 - Update profileService to return null instead of throwing on API errors - Add better error handling in complete-profile page for null profiles - Fix performance optimization file to remove local font references This resolves: - Console 404 errors for missing font files - Invisible typed text in name input fields - Supabase API 406 errors with graceful fallback - All console log errors shown in the screenshot --- app/complete-profile/page.tsx | 69 +++++++++++++++++---------------- app/layout.tsx | 4 +- lib/performance/optimization.ts | 1 - lib/services/profile.ts | 35 ++++++++++------- 4 files changed, 58 insertions(+), 51 deletions(-) diff --git a/app/complete-profile/page.tsx b/app/complete-profile/page.tsx index 808a8eac..448d8a9a 100644 --- a/app/complete-profile/page.tsx +++ b/app/complete-profile/page.tsx @@ -68,6 +68,9 @@ export default function CompleteProfile() { if (profile.first_name) setFirstName(profile.first_name); if (profile.last_name) setLastName(profile.last_name); if (profile.username) setUsername(profile.username); + } else { + // Profile is null, which means there was an error but we can continue + console.log('Profile not found, continuing with form setup'); } } catch (profileError) { console.error('Error checking profile:', profileError); @@ -283,14 +286,14 @@ export default function CompleteProfile() { - setFirstName(e.target.value)} - className="w-full border border-gray-200 rounded-xl px-4 py-3 text-sm bg-white/50 backdrop-blur-sm focus:outline-none focus:ring-2 focus:ring-blue-500/20 focus:border-blue-500 transition-all duration-200 placeholder:text-gray-400" - placeholder="Enter your first name" - required - /> + setFirstName(e.target.value)} + className="w-full border border-gray-200 rounded-xl px-4 py-3 text-sm bg-white/50 backdrop-blur-sm focus:outline-none focus:ring-2 focus:ring-blue-500/20 focus:border-blue-500 transition-all duration-200 placeholder:text-gray-400 text-gray-900" + placeholder="Enter your first name" + required + /> {/* Last Name */} @@ -298,14 +301,14 @@ export default function CompleteProfile() { - setLastName(e.target.value)} - className="w-full border border-gray-200 rounded-xl px-4 py-3 text-sm bg-white/50 backdrop-blur-sm focus:outline-none focus:ring-2 focus:ring-blue-500/20 focus:border-blue-500 transition-all duration-200 placeholder:text-gray-400" - placeholder="Enter your last name" - required - /> + setLastName(e.target.value)} + className="w-full border border-gray-200 rounded-xl px-4 py-3 text-sm bg-white/50 backdrop-blur-sm focus:outline-none focus:ring-2 focus:ring-blue-500/20 focus:border-blue-500 transition-all duration-200 placeholder:text-gray-400 text-gray-900" + placeholder="Enter your last name" + required + /> {/* Username Input */} @@ -315,23 +318,23 @@ export default function CompleteProfile() {
- handleUsernameChange(e.target.value)} - className={`w-full border rounded-xl px-4 py-3 pr-20 text-sm bg-white/50 backdrop-blur-sm focus:outline-none focus:ring-2 focus:ring-blue-500/20 focus:border-blue-500 transition-all duration-200 placeholder:text-gray-400 ${ - usernameAvailable === true - ? 'border-green-300 bg-green-50/50' - : usernameAvailable === false || usernameError - ? 'border-red-300 bg-red-50/50' - : 'border-gray-200' - }`} - placeholder="Enter your username" - minLength={3} - maxLength={30} - title="Username can only contain letters, numbers, hyphens, and underscores" - required - /> + handleUsernameChange(e.target.value)} + className={`w-full border rounded-xl px-4 py-3 pr-20 text-sm bg-white/50 backdrop-blur-sm focus:outline-none focus:ring-2 focus:ring-blue-500/20 focus:border-blue-500 transition-all duration-200 placeholder:text-gray-400 text-gray-900 ${ + usernameAvailable === true + ? 'border-green-300 bg-green-50/50' + : usernameAvailable === false || usernameError + ? 'border-red-300 bg-red-50/50' + : 'border-gray-200' + }`} + placeholder="Enter your username" + minLength={3} + maxLength={30} + title="Username can only contain letters, numbers, hyphens, and underscores" + required + />
{isCheckingUsername && ( diff --git a/app/layout.tsx b/app/layout.tsx index 3c594e2d..05983ec3 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -53,9 +53,7 @@ export default function RootLayout({ ` }} /> - {/* Preload critical resources */} - - + {/* Preload critical resources - removed local font preloads since we use Google Fonts */} {/* Structured Data */}