Scheduling infrastructure for absolutely everyone.
perf: remove WithLayout HOC from private booking page and booking embed (#19189)
Benny Joo207804bd970c
diff --git a/apps/web/app/(use-page-wrapper)/booking/[uid]/embed/page.tsx b/apps/web/app/(use-page-wrapper)/booking/[uid]/embed/page.tsxnew file mode 100644index 00000000000..d0e4c69b5a1--- /dev/null+++ b/apps/web/app/(use-page-wrapper)/booking/[uid]/embed/page.tsx@@ -0,0 +1,21 @@+import withEmbedSsrAppDir from "app/WithEmbedSSR";+import type { PageProps as ServerPageProps } from "app/_types";+import { cookies, headers } from "next/headers";++import { buildLegacyCtx } from "@lib/buildLegacyCtx";++import OldPage from "~/bookings/views/bookings-single-view";+import {+ getServerSideProps,+ type PageProps as ClientPageProps,+} from "~/bookings/views/bookings-single-view.getServerSideProps";++const getEmbedData = withEmbedSsrAppDir<ClientPageProps>(getServerSideProps);++const ServerPage = async ({ params, searchParams }: ServerPageProps) => {+ const context = buildLegacyCtx(headers(), cookies(), params, searchParams);+ const props = await getEmbedData(context);+ return <OldPage {...props} />;+};++export default ServerPage;diff --git a/apps/web/app/d/[link]/[slug]/page.tsx b/apps/web/app/(use-page-wrapper)/d/[link]/[slug]/page.tsxsimilarity index 81%rename from apps/web/app/d/[link]/[slug]/page.tsxrename to apps/web/app/(use-page-wrapper)/d/[link]/[slug]/page.tsxindex 2e3ffac4baa..68fc6cd3fd2 100644--- a/apps/web/app/d/[link]/[slug]/page.tsx+++ b/apps/web/app/(use-page-wrapper)/d/[link]/[slug]/page.tsx@@ -1,7 +1,6 @@import { withAppDirSsr } from "app/WithAppDirSsr";import type { PageProps as _PageProps } from "app/_types";import { _generateMetadata } from "app/_utils";-import { WithLayout } from "app/layoutHOC";import { cookies, headers } from "next/headers";import { buildLegacyCtx } from "@lib/buildLegacyCtx";@@ -27,4 +26,11 @@ export const generateMetadata = async ({ params, searchParams }: _PageProps) =>};const getData = withAppDirSsr<PageProps>(getServerSideProps);-export default WithLayout({ getLayout: null, Page: Type, getData })<"P">;+const ServerPage = async ({ params, searchParams }: _PageProps) => {+ const legacyCtx = buildLegacyCtx(headers(), cookies(), params, searchParams);+ const pageProps = await getData(legacyCtx);++ return <Type {...pageProps} />;+};++export default ServerPage;diff --git a/apps/web/app/booking/[uid]/embed/page.tsx b/apps/web/app/booking/[uid]/embed/page.tsxdeleted file mode 100644index 28f96ba531c..00000000000--- a/apps/web/app/booking/[uid]/embed/page.tsx+++ /dev/null@@ -1,9 +0,0 @@-import withEmbedSsrAppDir from "app/WithEmbedSSR";-import { WithLayout } from "app/layoutHOC";--import OldPage from "~/bookings/views/bookings-single-view";-import { getServerSideProps, type PageProps } from "~/bookings/views/bookings-single-view.getServerSideProps";--const getEmbedData = withEmbedSsrAppDir<PageProps>(getServerSideProps);--export default WithLayout({ getLayout: null, getData: getEmbedData, Page: OldPage });diff --git a/apps/web/lib/hooks/useIsBookingPage.ts b/apps/web/lib/hooks/useIsBookingPage.tsindex ffa6804e028..3245b5a2be7 100644--- a/apps/web/lib/hooks/useIsBookingPage.ts+++ b/apps/web/lib/hooks/useIsBookingPage.ts@@ -4,7 +4,9 @@ import { useCompatSearchParams } from "@calcom/lib/hooks/useCompatSearchParams";export default function useIsBookingPage(): boolean {const pathname = usePathname();- const isBookingPage = ["/booking/", "/cancel", "/reschedule"].some((route) => pathname?.startsWith(route));+ const isBookingPage = ["/booking", "/cancel", "/reschedule", "/d"].some((route) =>+ pathname?.startsWith(route)+ );const searchParams = useCompatSearchParams();const userParam = Boolean(searchParams?.get("user"));diff --git a/apps/web/modules/bookings/views/bookings-single-view.tsx b/apps/web/modules/bookings/views/bookings-single-view.tsxindex 407778fef60..a2664ca60b7 100644--- a/apps/web/modules/bookings/views/bookings-single-view.tsx+++ b/apps/web/modules/bookings/views/bookings-single-view.tsx@@ -1133,8 +1133,6 @@ const DisplayLocation = ({<p className={className}>{locationToDisplay}</p>);-Success.isBookingPage = true;-type RecurringBookingsProps = {eventType: PageProps["eventType"];recurringBookings: PageProps["recurringBookings"];diff --git a/apps/web/modules/d/[link]/d-type-view.tsx b/apps/web/modules/d/[link]/d-type-view.tsxindex d4b781b162d..d4bc2246ee9 100644--- a/apps/web/modules/d/[link]/d-type-view.tsx+++ b/apps/web/modules/d/[link]/d-type-view.tsx@@ -33,5 +33,3 @@ export default function Type({</main>);}--Type.isBookingPage = true;