From 6ebf0db389a92b9cec5a17189b32adb682652107 Mon Sep 17 00:00:00 2001 From: Hariom Balhara Date: Sat, 26 Apr 2025 17:05:23 +0530 Subject: [PATCH] Handle acme.cal.local root path (#20981) --- apps/web/lib/__tests__/getThemeProviderProps.test.ts | 5 +++++ apps/web/lib/getThemeProviderProps.ts | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/apps/web/lib/__tests__/getThemeProviderProps.test.ts b/apps/web/lib/__tests__/getThemeProviderProps.test.ts index 09ccbfbd82..9b9dedca38 100644 --- a/apps/web/lib/__tests__/getThemeProviderProps.test.ts +++ b/apps/web/lib/__tests__/getThemeProviderProps.test.ts @@ -195,6 +195,11 @@ describe("getUniqueIdentifierForBookingPage", () => { const result = getUniqueIdentifierForBookingPage({ pathname: path }); expect(result).toBe(expected); }); + + it("should return / for root path", () => { + const result = getUniqueIdentifierForBookingPage({ pathname: "/" }); + expect(result).toBe("/"); + }); }); describe("Team Pages", () => { diff --git a/apps/web/lib/getThemeProviderProps.ts b/apps/web/lib/getThemeProviderProps.ts index ac17ffe256..1d032a576c 100644 --- a/apps/web/lib/getThemeProviderProps.ts +++ b/apps/web/lib/getThemeProviderProps.ts @@ -16,6 +16,11 @@ const enum ThemeSupport { * The theme stays same for same identifier. */ export function getUniqueIdentifierForBookingPage({ pathname }: { pathname: string }) { + if (pathname === "/") { + // For Org domains, we could have a booking page at root path too, so we use '/' as identifier + // As localStorage isn't shared for different org domains, it's safe to use '/' as identifier + return "/"; + } const pathTokens = pathname.split("/").slice(1); // If it is a booking page then it could be one of the following: