From 83eb96df121c1271d8ff51f560c299a4bc2dc4e5 Mon Sep 17 00:00:00 2001 From: Deep Santoshwar Date: Sat, 1 Aug 2026 23:26:30 +0530 Subject: [PATCH 1/2] fix(auth): disable Google sign-in button until OAuth script is ready useGoogleLogin from @react-oauth/google only returns the login callback, not a ready flag, so clicking before the Google script finishes loading was a silent no-op. Track readiness via GoogleOAuthProvider's onScriptLoadSuccess/onScriptLoadError and disable the button until then. --- frontend/web/components/GoogleButton.tsx | 10 ++++++++-- frontend/web/components/pages/HomePage.tsx | 4 ++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/frontend/web/components/GoogleButton.tsx b/frontend/web/components/GoogleButton.tsx index 2c3eab18e5ee..66e0f8133598 100644 --- a/frontend/web/components/GoogleButton.tsx +++ b/frontend/web/components/GoogleButton.tsx @@ -5,6 +5,7 @@ import { Icon } from './icons' type GoogleButtonProps = { className?: string + ready?: boolean onSuccess?: ( tokenResponse: Omit< TokenResponse, @@ -12,7 +13,11 @@ type GoogleButtonProps = { >, ) => void } -const GoogleButton: FC = ({ className, onSuccess }) => { +const GoogleButton: FC = ({ + className, + onSuccess, + ready, +}) => { const login = useGoogleLogin({ onSuccess: (tokenResponse) => { onSuccess?.(tokenResponse) @@ -24,7 +29,8 @@ const GoogleButton: FC = ({ className, onSuccess }) => { className={className} theme='secondary' key='google' - onClick={() => login()} + disabled={!ready} + onClick={() => ready && login()} > Google diff --git a/frontend/web/components/pages/HomePage.tsx b/frontend/web/components/pages/HomePage.tsx index c5ac2a28b4c8..d6b19592cc38 100644 --- a/frontend/web/components/pages/HomePage.tsx +++ b/frontend/web/components/pages/HomePage.tsx @@ -36,6 +36,7 @@ import useSignupExperiment from 'common/useSignupExperiment' const HomePage: React.FC = () => { const history = useHistory() const location = useLocation() + const [googleReady, setGoogleReady] = useState(false) const [allRequirementsMet, setAllRequirementsMet] = useState(false) const [email, setEmail] = useState('') const [firstName, setFirstName] = useState('') @@ -231,9 +232,12 @@ const HomePage: React.FC = () => { clientId={ JSON.parse(Utils.getFlagsmithValue('oauth_google')).clientId } + onScriptLoadSuccess={() => setGoogleReady(true)} + onScriptLoadError={() => setGoogleReady(false)} > { document.location.href = `${ document.location.origin From 57068bd49960e253e49a0f651c40a1dcea8d5491 Mon Sep 17 00:00:00 2001 From: Deep Santoshwar Date: Sun, 2 Aug 2026 00:11:43 +0530 Subject: [PATCH 2/2] fix(auth): make GoogleButton's ready prop required Optional meant an omitted prop was indistinguishable from "not ready yet" at the type level, silently leaving a future caller's button permanently disabled. There's currently one caller and it already passes ready explicitly. --- frontend/web/components/GoogleButton.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/web/components/GoogleButton.tsx b/frontend/web/components/GoogleButton.tsx index 66e0f8133598..33c3a98b2f9d 100644 --- a/frontend/web/components/GoogleButton.tsx +++ b/frontend/web/components/GoogleButton.tsx @@ -5,7 +5,7 @@ import { Icon } from './icons' type GoogleButtonProps = { className?: string - ready?: boolean + ready: boolean onSuccess?: ( tokenResponse: Omit< TokenResponse,