From 2922c8fe7777742610e1e0ea8be63e6483c41fcf Mon Sep 17 00:00:00 2001 From: Benny Joo Date: Tue, 26 Aug 2025 07:20:12 -0400 Subject: [PATCH] perf: Move runtime redirects to build-time redirects in next.config.js (#23325) * routing forms * auth new * settings route * apps installed * next.config.js --- .../(use-page-wrapper)/apps/installed/page.tsx | 7 ------- .../apps/routing-forms/page.tsx | 7 ------- .../settings/(admin-layout)/admin/apps/page.tsx | 17 ----------------- apps/web/app/auth/new/page.tsx | 5 ----- apps/web/app/routing-forms/page.tsx | 7 ------- apps/web/next.config.js | 16 +++++++++++++++- 6 files changed, 15 insertions(+), 44 deletions(-) delete mode 100644 apps/web/app/(use-page-wrapper)/apps/installed/page.tsx delete mode 100644 apps/web/app/(use-page-wrapper)/apps/routing-forms/page.tsx delete mode 100644 apps/web/app/(use-page-wrapper)/settings/(admin-layout)/admin/apps/page.tsx delete mode 100644 apps/web/app/auth/new/page.tsx delete mode 100644 apps/web/app/routing-forms/page.tsx diff --git a/apps/web/app/(use-page-wrapper)/apps/installed/page.tsx b/apps/web/app/(use-page-wrapper)/apps/installed/page.tsx deleted file mode 100644 index c602a66bd7..0000000000 --- a/apps/web/app/(use-page-wrapper)/apps/installed/page.tsx +++ /dev/null @@ -1,7 +0,0 @@ -import { redirect } from "next/navigation"; - -const Page = () => { - redirect("/apps/installed/calendar"); -}; - -export default Page; diff --git a/apps/web/app/(use-page-wrapper)/apps/routing-forms/page.tsx b/apps/web/app/(use-page-wrapper)/apps/routing-forms/page.tsx deleted file mode 100644 index 06a1a03d53..0000000000 --- a/apps/web/app/(use-page-wrapper)/apps/routing-forms/page.tsx +++ /dev/null @@ -1,7 +0,0 @@ -import { redirect } from "next/navigation"; - -const ServerPage = async () => { - redirect("/apps/routing-forms/forms"); -}; - -export default ServerPage; diff --git a/apps/web/app/(use-page-wrapper)/settings/(admin-layout)/admin/apps/page.tsx b/apps/web/app/(use-page-wrapper)/settings/(admin-layout)/admin/apps/page.tsx deleted file mode 100644 index f0e91e15d6..0000000000 --- a/apps/web/app/(use-page-wrapper)/settings/(admin-layout)/admin/apps/page.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import { _generateMetadata } from "app/_utils"; -import { redirect } from "next/navigation"; - -export const generateMetadata = async () => - await _generateMetadata( - (t) => t("apps"), - (t) => t("admin_apps_description"), - undefined, - undefined, - "/settings/admin/apps" - ); - -const Page = () => { - redirect("/settings/admin/apps/calendar"); -}; - -export default Page; diff --git a/apps/web/app/auth/new/page.tsx b/apps/web/app/auth/new/page.tsx deleted file mode 100644 index 87df23a99f..0000000000 --- a/apps/web/app/auth/new/page.tsx +++ /dev/null @@ -1,5 +0,0 @@ -import { redirect } from "next/navigation"; - -export default function Page() { - redirect(process.env.NEXT_PUBLIC_WEBAPP_URL || "https://app.cal.com"); -} diff --git a/apps/web/app/routing-forms/page.tsx b/apps/web/app/routing-forms/page.tsx deleted file mode 100644 index ba222ba476..0000000000 --- a/apps/web/app/routing-forms/page.tsx +++ /dev/null @@ -1,7 +0,0 @@ -import { redirect } from "next/navigation"; - -const Page = () => { - redirect("/apps/routing-forms/forms"); -}; - -export default Page; diff --git a/apps/web/next.config.js b/apps/web/next.config.js index bbc93995ba..4f8c665613 100644 --- a/apps/web/next.config.js +++ b/apps/web/next.config.js @@ -295,6 +295,10 @@ const nextConfig = (phase) => { source: "/routing/:path*", destination: "/apps/routing-forms/:path*", }, + { + source: "/routing-forms", + destination: "/apps/routing-forms/forms", + }, { source: "/success/:path*", has: [ @@ -548,7 +552,7 @@ const nextConfig = (phase) => { }, { source: "/apps/routing-forms", - destination: "/routing/forms", + destination: "/apps/routing-forms/forms", permanent: false, }, { @@ -556,6 +560,11 @@ const nextConfig = (phase) => { destination: "/app-store/:path*", permanent: true, }, + { + source: "/auth/new", + destination: process.env.NEXT_PUBLIC_WEBAPP_URL || "https://app.cal.com", + permanent: true, + }, { source: "/auth/signup", destination: "/signup", @@ -653,6 +662,11 @@ const nextConfig = (phase) => { destination: "/settings/platform", permanent: true, }, + { + source: "/settings/admin/apps", + destination: "/settings/admin/apps/calendar", + permanent: true, + }, // OAuth callbacks when sent to localhost:3000(w would be expected) should be redirected to corresponding to WEBAPP_URL ...(process.env.NODE_ENV === "development" && // Safer to enable the redirect only when the user is opting to test out organizations