perf: Remove ssrInit completely (#20439)
* remove ssrInit completely * remove instances of dehydratedState * fix * refactor * fix type checks * fix linting * Refactor * Refactor * remove log
This commit is contained in:
1 parent
b5b4134b75
commit
75c79f76c8
30 files changed
+70
-209
No files matched your search
@@ -29,7 +29,7 @@ const getData = withAppDirSsr<ClientPageProps>(getServerSideProps);
|
||||
const ServerPage = async ({ params, searchParams }: ServerPageProps) => {
|
||||
const context = buildLegacyCtx(await headers(), await cookies(), await params, await searchParams);
|
||||
|
||||
const { dehydratedState, ...props } = await getData(context);
|
||||
const props = await getData(context);
|
||||
return <SetupView {...props} />;
|
||||
};
|
||||
|
||||
|
||||
@@ -17,9 +17,5 @@ export const withAppDirSsr =
|
||||
|
||||
return {
|
||||
...props,
|
||||
// includes dehydratedState required for future page trpcPropvider
|
||||
...("trpcState" in props && {
|
||||
dehydratedState: props.trpcState,
|
||||
}),
|
||||
};
|
||||
};
|
||||
@@ -42,9 +42,6 @@ const withEmbedSsrAppDir =
|
||||
|
||||
return {
|
||||
...ssrResponse.props,
|
||||
...("trpcState" in ssrResponse.props && {
|
||||
dehydratedState: ssrResponse.props.trpcState,
|
||||
}),
|
||||
isEmbed: true,
|
||||
};
|
||||
};
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
import { cookies, headers } from "next/headers";
|
||||
|
||||
import { getServerSession } from "@calcom/features/auth/lib/getServerSession";
|
||||
import { createContext } from "@calcom/trpc/server/createContext";
|
||||
|
||||
import { buildLegacyRequest } from "@lib/buildLegacyCtx";
|
||||
|
||||
export const getTRPCContext = async () => {
|
||||
const legacyReq = buildLegacyRequest(await headers(), await cookies());
|
||||
return await createContext({ req: legacyReq, res: {} as any }, getServerSession);
|
||||
};
|
||||
Reference in new issue
Block a user