perf: Move PlainChat up the hierarchy to remove rerenders (#19255)

* perf: Move PlainChat up the hierarchy to remove rerenders

* rmeove yarn lock

---------

Co-authored-by: Nizzy <[email protected]>
Co-authored-by: nizzy <[email protected]>
This commit is contained in:
authored and GitHub committed 2025-02-12 19:13:54 +00:00
1 parent cc2f16411b
commit d027f8004a
6 files changed
+10 -24

No files matched your search

+5 -4
View File
@@ -1,11 +1,13 @@
import { createHmac } from "crypto";
import type { NextRequest } from "next/server";
import { cookies, headers } from "next/headers";
import { NextResponse } from "next/server";
import { z } from "zod";
import { getServerSession } from "@calcom/features/auth/lib/getServerSession";
import { apiRouteMiddleware } from "@calcom/lib/server/apiRouteMiddleware";
import { buildLegacyRequest } from "@lib/buildLegacyCtx";
const responseSchema = z.object({
hash: z.string(),
email: z.string().email(),
@@ -15,9 +17,8 @@ const responseSchema = z.object({
chatAvatarUrl: z.string(),
});
async function handler(request: NextRequest) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const session = await getServerSession({ req: request as any });
async function handler() {
const session = await getServerSession({ req: buildLegacyRequest(headers(), cookies()) });
if (!session?.user?.email) {
return NextResponse.json({ error: "Unauthorized - No session email found" }, { status: 401 });
}