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
@@ -1,3 +1,4 @@
|
||||
import { getTRPCContext } from "app/_trpc/context";
|
||||
import type { GetServerSidePropsContext } from "next";
|
||||
import { z } from "zod";
|
||||
|
||||
@@ -11,11 +12,11 @@ import { maybeGetBookingUidFromSeat } from "@calcom/lib/server/maybeGetBookingUi
|
||||
import { BookingRepository } from "@calcom/lib/server/repository/booking";
|
||||
import prisma from "@calcom/prisma";
|
||||
import { customInputSchema, EventTypeMetaDataSchema } from "@calcom/prisma/zod-utils";
|
||||
import { meRouter } from "@calcom/trpc/server/routers/viewer/me/_router";
|
||||
import { createCallerFactory } from "@calcom/trpc/server/trpc";
|
||||
|
||||
import type { inferSSRProps } from "@lib/types/inferSSRProps";
|
||||
|
||||
import { ssrInit } from "@server/lib/ssr";
|
||||
|
||||
const stringToBoolean = z
|
||||
.string()
|
||||
.optional()
|
||||
@@ -45,13 +46,15 @@ export async function getServerSideProps(context: GetServerSidePropsContext) {
|
||||
"@lib/booking"
|
||||
);
|
||||
|
||||
const ssr = await ssrInit(context);
|
||||
const session = await getServerSession({ req: context.req });
|
||||
let tz: string | null = null;
|
||||
let userTimeFormat: number | null = null;
|
||||
let requiresLoginToUpdate = false;
|
||||
if (session) {
|
||||
const user = await ssr.viewer.me.get.fetch();
|
||||
const trpcContext = await getTRPCContext();
|
||||
const createCaller = createCallerFactory(meRouter);
|
||||
const caller = createCaller(trpcContext);
|
||||
const user = await caller.get();
|
||||
tz = user.timeZone;
|
||||
userTimeFormat = user.timeFormat;
|
||||
}
|
||||
@@ -218,7 +221,6 @@ export async function getServerSideProps(context: GetServerSidePropsContext) {
|
||||
profile,
|
||||
eventType,
|
||||
recurringBookings: await getRecurringBookings(bookingInfo.recurringEventId),
|
||||
trpcState: ssr.dehydrate(),
|
||||
dynamicEventName: bookingInfo?.eventType?.eventName || "",
|
||||
bookingInfo,
|
||||
paymentStatus: payment,
|
||||
|
||||
@@ -12,10 +12,6 @@ vi.mock("@calcom/lib/constants", async () => {
|
||||
|
||||
function mockedUserPageComponentProps(props: Partial<React.ComponentProps<typeof UserPage>>) {
|
||||
return {
|
||||
trpcState: {
|
||||
mutations: [],
|
||||
queries: [],
|
||||
},
|
||||
themeBasis: "dark",
|
||||
safeBio: "My Bio",
|
||||
profile: {
|
||||
|
||||
Reference in new issue
Block a user