Skip to content

Scheduling infrastructure for absolutely everyone.

fix: theme is not configured in app router (#16889)

Benny Joob283f1f8cde1
diff --git a/.env.example b/.env.example
index 120256f91c2..28e2805647f 100644
--- a/.env.example
+++ b/.env.example
@@ -335,6 +335,7 @@ AB_TEST_BUCKET_PROBABILITY=50
APP_ROUTER_EVENT_TYPES_ENABLED=0
APP_ROUTER_SETTINGS_DEVELOPER_ENABLED=0
APP_ROUTER_SETTINGS_ADMIN_ENABLED=0
+APP_ROUTER_SETTINGS_MY_ACCOUNT_ENABLED=0
APP_ROUTER_SETTINGS_PLATFORM_ENABLED=0
APP_ROUTER_SETTINGS_ORG_ENABLED=0
APP_ROUTER_APPS_INSTALLED_CATEGORY_ENABLED=0
diff --git a/apps/web/abTest/middlewareFactory.ts b/apps/web/abTest/middlewareFactory.ts
index 0c4940b8baf..f9437ae94a8 100644
--- a/apps/web/abTest/middlewareFactory.ts
+++ b/apps/web/abTest/middlewareFactory.ts
@@ -9,6 +9,7 @@ const ROUTES: [URLPattern, boolean][] = [
["/event-types", process.env.APP_ROUTER_EVENT_TYPES_ENABLED === "1"] as const,
["/settings/developer/:path*", process.env.APP_ROUTER_SETTINGS_DEVELOPER_ENABLED === "1"] as const,
["/settings/admin/:path*", process.env.APP_ROUTER_SETTINGS_ADMIN_ENABLED === "1"] as const,
+ ["/settings/my-account/:path*", process.env.APP_ROUTER_SETTINGS_MY_ACCOUNT_ENABLED === "1"] as const,
["/settings/platform/:path*", process.env.APP_ROUTER_SETTINGS_PLATFORM_ENABLED === "1"] as const,
["/settings/organizations/:path*", process.env.APP_ROUTER_SETTINGS_ORG_ENABLED === "1"] as const,
["/apps/installed/:category", process.env.APP_ROUTER_APPS_INSTALLED_CATEGORY_ENABLED === "1"] as const,
diff --git a/apps/web/app/layoutHOC.tsx b/apps/web/app/layoutHOC.tsx
index 8f71154e316..7fc8abeda39 100644
--- a/apps/web/app/layoutHOC.tsx
+++ b/apps/web/app/layoutHOC.tsx
@@ -51,7 +51,7 @@ export function WithLayout<T extends Record<string, any>>({
requiresLicense={requiresLicense || !!(Page && "requiresLicense" in Page && Page.requiresLicense)}
nonce={nonce}
themeBasis={null}
- isThemeSupported={!!(Page && "isThemeSupported" in Page && Page.isThemeSupported)}
+ isThemeSupported={Page && "isThemeSupported" in Page ? (Page.isThemeSupported as boolean) : undefined}
isBookingPage={isBookingPage || !!(Page && "isBookingPage" in Page && Page.isBookingPage)}
{...props}>
{pageWithServerLayout}
diff --git a/apps/web/lib/app-providers-app-dir.tsx b/apps/web/lib/app-providers-app-dir.tsx
index 455c882dc8d..cd7ce9eb086 100644
--- a/apps/web/lib/app-providers-app-dir.tsx
+++ b/apps/web/lib/app-providers-app-dir.tsx
@@ -127,8 +127,8 @@ type CalcomThemeProps = Readonly<{
isBookingPage: boolean;
themeBasis: string | null;
nonce: string | undefined;
- isThemeSupported: boolean;
children: React.ReactNode;
+ isThemeSupported?: boolean;
}>;
const CalcomThemeProvider = (props: CalcomThemeProps) => {
@@ -273,7 +273,7 @@ const AppProviders = (props: PageWrapperProps) => {
<CalcomThemeProvider
themeBasis={props.themeBasis}
nonce={props.nonce}
- isThemeSupported={/* undefined gets treated as true */ props.isThemeSupported ?? true}
+ isThemeSupported={/* undefined gets treated as true */ props.isThemeSupported}
isBookingPage={props.isBookingPage || isBookingPage}>
<FeatureFlagsProvider>
<OrgBrandProvider>
diff --git a/apps/web/playwright/change-theme.e2e.ts b/apps/web/playwright/change-theme.e2e.ts
index 186221ff3e2..bef8734d700 100644
--- a/apps/web/playwright/change-theme.e2e.ts
+++ b/apps/web/playwright/change-theme.e2e.ts
@@ -1,8 +1,9 @@
import { expect } from "@playwright/test";
+import { testBothFutureAndLegacyRoutes } from "playwright/lib/future-legacy-routes";
import { test } from "./lib/fixtures";
-test.describe("Change Theme Test", () => {
+testBothFutureAndLegacyRoutes.describe("Change Theme Test", () => {
test("change theme to dark", async ({ page, users }) => {
const pro = await users.create();
await pro.apiLogin();
diff --git a/apps/web/scripts/vercel-app-router-deploy.sh b/apps/web/scripts/vercel-app-router-deploy.sh
index 841e2cc9c24..05d39d18696 100755
--- a/apps/web/scripts/vercel-app-router-deploy.sh
+++ b/apps/web/scripts/vercel-app-router-deploy.sh
@@ -10,6 +10,7 @@ checkRoute "$APP_ROUTER_EVENT_TYPES_ENABLED" app/future/event-types
checkRoute "$APP_ROUTER_AVAILABILITY_ENABLED" app/future/availability
checkRoute "$APP_ROUTER_SETTINGS_DEVELOPER_ENABLED" app/future/settings/developer
checkRoute "$APP_ROUTER_SETTINGS_ADMIN_ENABLED" app/future/settings/admin
+checkRoute "$APP_ROUTER_SETTINGS_MY_ACCOUNT_ENABLED" app/future/settings/my-account
checkRoute "$APP_ROUTER_SETTINGS_PLATFORM_ENABLED" app/future/settings/platform
checkRoute "$APP_ROUTER_SETTINGS_ORG_ENABLED" app/future/settings/organizations
checkRoute "$APP_ROUTER_APPS_INSTALLED_CATEGORY_ENABLED" app/future/apps/installed
diff --git a/turbo.json b/turbo.json
index c1a7ef34340..67e6ae06386 100644
--- a/turbo.json
+++ b/turbo.json
@@ -238,6 +238,7 @@
"APP_ROUTER_GETTING_STARTED_STEP_ENABLED",
"APP_ROUTER_SETTINGS_DEVELOPER_ENABLED",
"APP_ROUTER_SETTINGS_ADMIN_ENABLED",
+ "APP_ROUTER_SETTINGS_MY_ACCOUNT_ENABLED",
"APP_ROUTER_SETTINGS_PLATFORM_ENABLED",
"APP_ROUTER_SETTINGS_ORG_ENABLED",
"APP_ROUTER_SETTINGS_TEAMS_ENABLED",