From 268a829d4abf1be693066b0d379e77d2186b2a7b Mon Sep 17 00:00:00 2001 From: Deepak Pandey Date: Mon, 15 Sep 2025 13:25:28 +0530 Subject: [PATCH 1/2] Fix username availability check and form submission - Make username availability check more lenient on database errors - Allow form submission when username check fails (assume available) - Fix submit button disabled state to only block when username is definitely unavailable - Improve error handling for 406 Supabase errors - Ensure form can be submitted even with database connectivity issues --- app/complete-profile/page.tsx | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/app/complete-profile/page.tsx b/app/complete-profile/page.tsx index ded953c4..1dec375f 100644 --- a/app/complete-profile/page.tsx +++ b/app/complete-profile/page.tsx @@ -139,15 +139,20 @@ export default function CompleteProfile() { .single(); if (error && error.code !== 'PGRST116') { - throw error; + console.error('Username check error:', error); + // If there's a database error, assume username is available to allow form submission + setUsernameAvailable(true); + setUsernameError(''); + return; } // If no data found, username is available setUsernameAvailable(!data); } catch (error) { console.error('Error checking username:', error); - setUsernameAvailable(null); - setUsernameError('Unable to check username availability'); + // On any error, assume username is available to allow form submission + setUsernameAvailable(true); + setUsernameError(''); } finally { setIsCheckingUsername(false); } @@ -186,7 +191,7 @@ export default function CompleteProfile() { return; } - if (!usernameAvailable) { + if (usernameAvailable === false) { toast.error('Username is not available'); return; } @@ -275,7 +280,7 @@ export default function CompleteProfile() { Welcome! Let's set up your profile

- Complete your profile to get started with CodeUnia. This will only take a moment. + Complete your profile to get started with Codeunia. This will only take a moment.

@@ -419,9 +424,9 @@ export default function CompleteProfile() { {/* Submit Button */}