perf: fetch only by id (#19154)

* perf: fetch only by id

* remove getServerSession

---------

Co-authored-by: hbjORbj <sldisek783@gmail.com>
This commit is contained in:
Udit TakkarandhbjORbj authored and GitHub committed 2025-02-10 02:14:57 +05:30
1 parent 0fb0974769
commit 76c09ca7bf
2 files changed
+5 -35

No files matched your search

@@ -4,10 +4,9 @@ import { _generateMetadata } from "app/_utils";
import { cookies, headers } from "next/headers";
import { z } from "zod";
import { getServerSession } from "@calcom/features/auth/lib/getServerSession";
import { EventTypeRepository } from "@calcom/lib/server/repository/eventType";
import { buildLegacyCtx, buildLegacyRequest } from "@lib/buildLegacyCtx";
import { buildLegacyCtx } from "@lib/buildLegacyCtx";
import type { PageProps as EventTypePageProps } from "@lib/event-types/[type]/getServerSideProps";
import { getServerSideProps } from "@lib/event-types/[type]/getServerSideProps";
@@ -23,9 +22,8 @@ const querySchema = z.object({
});
export const generateMetadata = async ({ params }: _PageProps) => {
const session = await getServerSession({ req: buildLegacyRequest(headers(), cookies()) });
const parsed = querySchema.safeParse(params);
if (!parsed.success || !session?.user?.id) {
if (!parsed.success) {
return await _generateMetadata(
(t) => `${t("event_type")}`,
() => ""
@@ -34,7 +32,6 @@ export const generateMetadata = async ({ params }: _PageProps) => {
const data = await EventTypeRepository.findTitleById({
id: parsed.data.type,
userId: session?.user?.id,
});
return await _generateMetadata(