From d991b9880df85bb7fcbff695692db1ff98eb54b4 Mon Sep 17 00:00:00 2001 From: Hiep Le <69354317+hieptl@users.noreply.github.com> Date: Tue, 14 Oct 2025 22:16:45 +0700 Subject: [PATCH] fix(frontend): reo tracker should be available only in the SaaS environment, not in self-hosted instances (#11367) --- frontend/src/hooks/use-reo-tracking.ts | 12 +++++++++--- frontend/src/utils/utils.ts | 8 ++++++++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/frontend/src/hooks/use-reo-tracking.ts b/frontend/src/hooks/use-reo-tracking.ts index 08d8851a2a..8cb81e5a31 100644 --- a/frontend/src/hooks/use-reo-tracking.ts +++ b/frontend/src/hooks/use-reo-tracking.ts @@ -3,6 +3,7 @@ import { useConfig } from "./query/use-config"; import { useGitUser } from "./query/use-git-user"; import { getLoginMethod, LoginMethod } from "#/utils/local-storage"; import reoService, { ReoIdentity } from "#/utils/reo"; +import { isProductionDomain } from "#/utils/utils"; /** * Maps login method to Reo identity type @@ -92,10 +93,14 @@ export const useReoTracking = () => { const { data: user } = useGitUser(); const [hasIdentified, setHasIdentified] = React.useState(false); - // Initialize Reo.dev when in SaaS mode + // Initialize Reo.dev when in SaaS mode and on the correct domain React.useEffect(() => { const initReo = async () => { - if (config?.APP_MODE === "saas" && !reoService.isInitialized()) { + if ( + config?.APP_MODE === "saas" && + isProductionDomain() && + !reoService.isInitialized() + ) { await reoService.init(); } }; @@ -103,10 +108,11 @@ export const useReoTracking = () => { initReo(); }, [config?.APP_MODE]); - // Identify user when user data is available and we're in SaaS mode + // Identify user when user data is available and we're in SaaS mode on correct domain React.useEffect(() => { if ( config?.APP_MODE !== "saas" || + !isProductionDomain() || !user || hasIdentified || !reoService.isInitialized() diff --git a/frontend/src/utils/utils.ts b/frontend/src/utils/utils.ts index dc9e311f71..baf6b85d1a 100644 --- a/frontend/src/utils/utils.ts +++ b/frontend/src/utils/utils.ts @@ -5,6 +5,7 @@ import { SuggestedTaskGroup } from "#/utils/types"; import { ConversationStatus } from "#/types/conversation-status"; import { GitRepository } from "#/types/git"; import { sanitizeQuery } from "#/utils/sanitize-query"; +import { PRODUCT_URL } from "#/utils/constants"; export function cn(...inputs: ClassValue[]) { return twMerge(clsx(inputs)); @@ -49,6 +50,13 @@ export const isMobileDevice = (): boolean => "ontouchstart" in window || navigator.maxTouchPoints > 0; +/** + * Checks if the current domain is the production domain + * @returns True if the current domain matches the production URL + */ +export const isProductionDomain = (): boolean => + window.location.origin === PRODUCT_URL.PRODUCTION; + interface EventActionHistory { args?: { LLM_API_KEY?: string;