perf: Avoid useless dependencies in calendar cache page (#9290)
* increases the time range to cover all time zones * it isolates the getCachedResults and rename to getCalendarsEvents * remove unrelated changes * remove unrelated changes --------- Co-authored-by: zomars <[email protected]>
This commit is contained in:
1 parent
893b67b6c4
commit
585679969a
3 files changed
+57
-4
No files matched your search
@@ -6,13 +6,13 @@
|
||||
import type { GetStaticPaths, GetStaticProps, InferGetStaticPropsType } from "next";
|
||||
import { z } from "zod";
|
||||
|
||||
import { getCachedResults } from "@calcom/core";
|
||||
import getCalendarsEvents from "@calcom/core/getCalendarsEvents";
|
||||
import dayjs from "@calcom/dayjs";
|
||||
import prisma from "@calcom/prisma";
|
||||
|
||||
const paramsSchema = z.object({ user: z.string(), month: z.string() });
|
||||
export const getStaticProps: GetStaticProps<
|
||||
{ results: Awaited<ReturnType<typeof getCachedResults>> },
|
||||
{ results: Awaited<ReturnType<typeof getCalendarsEvents>> },
|
||||
{ user: string }
|
||||
> = async (context) => {
|
||||
const { user: username, month } = paramsSchema.parse(context.params);
|
||||
@@ -33,7 +33,7 @@ export const getStaticProps: GetStaticProps<
|
||||
const endDate = dayjs.utc(month, "YYYY-MM").endOf("month").add(14, "hours").format();
|
||||
try {
|
||||
const results = userWithCredentials?.credentials
|
||||
? await getCachedResults(
|
||||
? await getCalendarsEvents(
|
||||
userWithCredentials?.credentials,
|
||||
startDate,
|
||||
endDate,
|
||||
|
||||
Reference in new issue
Block a user