From 56f32d0be9c8ed3d4a68a47fb41f586b147a2885 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Omar=20L=C3=B3pez?= Date: Fri, 10 Feb 2023 14:06:52 -0700 Subject: [PATCH] Fixes/trpc headers (#7045) * Cache fixes * Testing * SWR breaks embed tests --- apps/web/pages/api/trpc/[trpc].ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/apps/web/pages/api/trpc/[trpc].ts b/apps/web/pages/api/trpc/[trpc].ts index df67c51edf..fe306a02d3 100644 --- a/apps/web/pages/api/trpc/[trpc].ts +++ b/apps/web/pages/api/trpc/[trpc].ts @@ -60,9 +60,9 @@ export default trpcNext.createNextApiHandler({ // Our cache can change depending on our current paths value. Since paths is an array, // we want to create a map that can match potential paths with their desired cache value const cacheRules = { - "viewer.public.i18n": `max-age=0, s-maxage=${ONE_DAY_IN_SECONDS}, stale-while-revalidate`, + "viewer.public.i18n": `max-age=${ONE_DAY_IN_SECONDS}, s-maxage=${ONE_DAY_IN_SECONDS}, stale-while-revalidate`, // Revalidation time here should be 1 second, per https://github.com/calcom/cal.com/pull/6823#issuecomment-1423215321 - "viewer.public.slots.getSchedule": `s-maxage=1, stale-while-revalidate=${ONE_DAY_IN_SECONDS}`, + "viewer.public.slots.getSchedule": `max-age=0, s-maxage=1`, } as const; // Find which element above is an exact match for this group of paths @@ -70,8 +70,6 @@ export default trpcNext.createNextApiHandler({ if (matchedPath) defaultHeaders.headers["cache-control"] = cacheRules[matchedPath]; - console.log({ defaultHeaders }); - return defaultHeaders; }, });