From 2e871b0761786c00042ba32ec002049cbae17cf6 Mon Sep 17 00:00:00 2001 From: Nicholas Tindle Date: Thu, 3 Apr 2025 17:16:39 -0500 Subject: [PATCH] fix(frontend): bad handling on error prompts (#9754) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I oopsed and had an extra unneeded parameter (as @majdyz pointed out) and wasn't respected everywhere it was used. ### Changes 🏗️ - Remove parameter - update all the places AuthFeedback is called ### Checklist 📋 #### For code changes: - [ ] I have clearly listed my changes in the PR description - [ ] I have made a test plan - [ ] I have tested my changes according to the test plan: - [ ] Test all pages with authfeedback on it Co-authored-by: Bently --- autogpt_platform/frontend/src/app/login/page.tsx | 7 ++++++- .../frontend/src/app/reset_password/page.tsx | 13 +++++++++++-- autogpt_platform/frontend/src/app/signup/page.tsx | 4 ---- .../frontend/src/components/auth/AuthFeedback.tsx | 6 ++---- 4 files changed, 19 insertions(+), 11 deletions(-) diff --git a/autogpt_platform/frontend/src/app/login/page.tsx b/autogpt_platform/frontend/src/app/login/page.tsx index 797c8ad85e..629854c4d5 100644 --- a/autogpt_platform/frontend/src/app/login/page.tsx +++ b/autogpt_platform/frontend/src/app/login/page.tsx @@ -26,6 +26,7 @@ import { PasswordInput, } from "@/components/auth"; import { loginFormSchema } from "@/types/auth"; +import { getBehaveAs } from "@/lib/utils"; export default function LoginPage() { const { supabase, user, isUserLoading } = useSupabase(); @@ -147,7 +148,11 @@ export default function LoginPage() { Login - + Update password - + ) : ( @@ -178,7 +183,11 @@ export default function ResetPasswordPage() { > Send reset email - + )} diff --git a/autogpt_platform/frontend/src/app/signup/page.tsx b/autogpt_platform/frontend/src/app/signup/page.tsx index 7268f1ff33..10b59b5c9f 100644 --- a/autogpt_platform/frontend/src/app/signup/page.tsx +++ b/autogpt_platform/frontend/src/app/signup/page.tsx @@ -36,7 +36,6 @@ export default function SignupPage() { const router = useRouter(); const [isLoading, setIsLoading] = useState(false); //TODO: Remove after closed beta - const [showErrorPrompt, setShowErrorPrompt] = useState(false); const form = useForm>({ resolver: zodResolver(signupFormSchema), @@ -64,13 +63,11 @@ export default function SignupPage() { setFeedback("User with this email already exists"); return; } else { - setShowErrorPrompt(true); setFeedback(error); } return; } setFeedback(null); - setShowErrorPrompt(false); }, [form], ); @@ -193,7 +190,6 @@ export default function SignupPage() { diff --git a/autogpt_platform/frontend/src/components/auth/AuthFeedback.tsx b/autogpt_platform/frontend/src/components/auth/AuthFeedback.tsx index 98d808ff8e..835ed118dd 100644 --- a/autogpt_platform/frontend/src/components/auth/AuthFeedback.tsx +++ b/autogpt_platform/frontend/src/components/auth/AuthFeedback.tsx @@ -7,14 +7,12 @@ import { BehaveAs } from "@/lib/utils"; interface Props { message?: string | null; isError?: boolean; - showErrorPrompt?: boolean; behaveAs?: BehaveAs; } export default function AuthFeedback({ message = "", isError = false, - showErrorPrompt = false, behaveAs = BehaveAs.CLOUD, }: Props) { // If there's no message but isError is true, show a default error message @@ -41,7 +39,7 @@ export default function AuthFeedback({ )} {/* Cloud-specific help */} - {showErrorPrompt && behaveAs === BehaveAs.CLOUD && ( + {isError && behaveAs === BehaveAs.CLOUD && (
The provided email may not be allowed to sign up. @@ -85,7 +83,7 @@ export default function AuthFeedback({ )} {/* Local-specific help */} - {showErrorPrompt && behaveAs === BehaveAs.LOCAL && ( + {isError && behaveAs === BehaveAs.LOCAL && (