From 1146ea22742486b6716246c835cfd80b0d4bc314 Mon Sep 17 00:00:00 2001 From: Hiep Le <69354317+hieptl@users.noreply.github.com> Date: Wed, 14 Jan 2026 19:22:38 +0700 Subject: [PATCH] refactor(frontend): create a feature flag for google recaptcha (#12402) --- frontend/src/components/features/auth/login-content.tsx | 3 ++- frontend/src/utils/feature-flags.ts | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/frontend/src/components/features/auth/login-content.tsx b/frontend/src/components/features/auth/login-content.tsx index 4ff8220ca2..3ce2e87b4e 100644 --- a/frontend/src/components/features/auth/login-content.tsx +++ b/frontend/src/components/features/auth/login-content.tsx @@ -12,6 +12,7 @@ import { TermsAndPrivacyNotice } from "#/components/shared/terms-and-privacy-not import { useRecaptcha } from "#/hooks/use-recaptcha"; import { useConfig } from "#/hooks/query/use-config"; import { displayErrorToast } from "#/utils/custom-toast-handlers"; +import { ENABLE_RECAPTCHA } from "#/utils/feature-flags"; export interface LoginContentProps { githubAuthUrl: string | null; @@ -38,7 +39,7 @@ export function LoginContent({ // reCAPTCHA - only need token generation, verification happens at backend callback const { isReady: recaptchaReady, executeRecaptcha } = useRecaptcha({ - siteKey: config?.RECAPTCHA_SITE_KEY, + siteKey: ENABLE_RECAPTCHA() ? config?.RECAPTCHA_SITE_KEY : undefined, }); const gitlabAuthUrl = useAuthUrl({ diff --git a/frontend/src/utils/feature-flags.ts b/frontend/src/utils/feature-flags.ts index cba6d7caf3..83cd8151bd 100644 --- a/frontend/src/utils/feature-flags.ts +++ b/frontend/src/utils/feature-flags.ts @@ -20,3 +20,4 @@ export const ENABLE_TRAJECTORY_REPLAY = () => export const USE_PLANNING_AGENT = () => loadFeatureFlag("USE_PLANNING_AGENT"); export const ENABLE_PUBLIC_CONVERSATION_SHARING = () => loadFeatureFlag("PUBLIC_CONVERSATION_SHARING"); +export const ENABLE_RECAPTCHA = () => loadFeatureFlag("RECAPTCHA");