perf: Server-Side Data Fetching in App Router: SettingsLayout / AdminLayout (#16537)

Co-authored-by: Joe Au-Yeung <[email protected]>
This commit is contained in:
Benny JooandJoe Au-Yeung authored and GitHub committed 2024-09-09 14:38:51 -07:00
1 parent 71443ef23d
commit 706d7dff42
25 files changed
+929 -874

No files matched your search

+3 -9
View File
@@ -1,11 +1,10 @@
import type { 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";
import PageWrapper from "@components/PageWrapperAppDir";
import { ssrInit } from "@server/lib/ssr";
import Logout from "~/auth/logout-view";
@@ -20,7 +19,6 @@ export const generateMetadata = async () => {
const Page = async ({ params, searchParams }: PageProps) => {
// cookie will be cleared in `/apps/web/middleware.ts`
const h = headers();
const nonce = h.get("x-nonce") ?? undefined;
const context = buildLegacyCtx(h, cookies(), params, searchParams);
const ssr = await ssrInit(context);
const props = {
@@ -28,11 +26,7 @@ const Page = async ({ params, searchParams }: PageProps) => {
query: context.query,
};
return (
<PageWrapper requiresLicense={false} getLayout={null} nonce={nonce} themeBasis={null}>
<Logout {...props} />
</PageWrapper>
);
return <Logout {...props} />;
};
export default Page;
export default WithLayout({ getLayout: null, ServerPage: Page })<"P">;
@@ -10,4 +10,4 @@ export const generateMetadata = async () =>
() => "admin_description"
);
export default WithLayout({ getLayout, Page: LegacyPage })<"P">;
export default WithLayout({ getServerLayout: getLayout, Page: LegacyPage })<"P">;
@@ -2,4 +2,4 @@ import { WithLayout } from "app/layoutHOC";
import { getLayout } from "@components/auth/layouts/AdminLayoutAppDir";
export default WithLayout({ getLayout })<"L">;
export default WithLayout({ getServerLayout: getLayout })<"L">;
@@ -2,4 +2,4 @@ import { WithLayout } from "app/layoutHOC";
import { getLayout } from "@calcom/features/settings/appDir/SettingsLayoutAppDir";
export default WithLayout({ getLayout: getLayout })<"L">;
export default WithLayout({ getServerLayout: getLayout })<"L">;
@@ -3,9 +3,7 @@ import LegacyPage, {
} from "@pages/settings/organizations/[id]/onboard-members";
import type { PageProps } from "app/_types";
import { _generateMetadata } from "app/_utils";
import { headers } from "next/headers";
import PageWrapper from "@components/PageWrapperAppDir";
import { WithLayout } from "app/layoutHOC";
export const generateMetadata = async () =>
await _generateMetadata(
@@ -14,18 +12,7 @@ export const generateMetadata = async () =>
);
const Page = ({ params }: PageProps) => {
const h = headers();
const nonce = h.get("x-nonce") ?? undefined;
return (
<PageWrapper
getLayout={(page: React.ReactElement) => buildWrappedOnboardTeamMembersPage(params.id, page)}
requiresLicense={false}
nonce={nonce}
themeBasis={null}>
<LegacyPage />
</PageWrapper>
);
return buildWrappedOnboardTeamMembersPage(params.id, <LegacyPage />);
};
export default Page;
export default WithLayout({ Page });
@@ -2,4 +2,4 @@ import { WithLayout } from "app/layoutHOC";
import { getLayout } from "@calcom/features/settings/appDir/SettingsLayoutAppDir";
export default WithLayout({ getLayout });
export default WithLayout({ getServerLayout: getLayout });
@@ -2,4 +2,4 @@ import { WithLayout } from "app/layoutHOC";
import { getLayout } from "@calcom/features/settings/appDir/SettingsLayoutAppDir";
export default WithLayout({ getLayout });
export default WithLayout({ getServerLayout: getLayout });
@@ -2,4 +2,4 @@ import { WithLayout } from "app/layoutHOC";
import { getLayout } from "@calcom/features/settings/appDir/SettingsLayoutAppDir";
export default WithLayout({ getLayout });
export default WithLayout({ getServerLayout: getLayout });
@@ -2,4 +2,4 @@ import { WithLayout } from "app/layoutHOC";
import { getLayout } from "@calcom/features/settings/appDir/SettingsLayoutAppDir";
export default WithLayout({ getLayout });
export default WithLayout({ getServerLayout: getLayout });
@@ -2,4 +2,4 @@ import { WithLayout } from "app/layoutHOC";
import { getLayout } from "@calcom/features/settings/appDir/SettingsLayoutAppDir";
export default WithLayout({ getLayout });
export default WithLayout({ getServerLayout: getLayout });
@@ -2,4 +2,4 @@ import { WithLayout } from "app/layoutHOC";
import { getLayout } from "@calcom/features/settings/appDir/SettingsLayoutAppDir";
export default WithLayout({ getLayout });
export default WithLayout({ getServerLayout: getLayout });
@@ -2,4 +2,4 @@ import { WithLayout } from "app/layoutHOC";
import { getLayout } from "@calcom/features/settings/appDir/SettingsLayoutAppDir";
export default WithLayout({ getLayout });
export default WithLayout({ getServerLayout: getLayout });
@@ -2,4 +2,4 @@ import { WithLayout } from "app/layoutHOC";
import { getLayout } from "@calcom/features/settings/appDir/SettingsLayoutAppDir";
export default WithLayout({ getLayout });
export default WithLayout({ getServerLayout: getLayout });
@@ -2,4 +2,4 @@ import { WithLayout } from "app/layoutHOC";
import { getLayout } from "@calcom/features/settings/appDir/SettingsLayoutAppDir";
export default WithLayout({ getLayout });
export default WithLayout({ getServerLayout: getLayout });
@@ -2,4 +2,4 @@ import { WithLayout } from "app/layoutHOC";
import { getLayout } from "@calcom/features/settings/appDir/SettingsLayoutAppDir";
export default WithLayout({ getLayout })<"L">;
export default WithLayout({ getServerLayout: getLayout })<"L">;