Fixes/trpc headers (#7045)
* Cache fixes * Testing * SWR breaks embed tests
This commit is contained in:
parent
17c374e7d4
commit
56f32d0be9
|
@ -60,9 +60,9 @@ export default trpcNext.createNextApiHandler({
|
||||||
// Our cache can change depending on our current paths value. Since paths is an array,
|
// 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
|
// we want to create a map that can match potential paths with their desired cache value
|
||||||
const cacheRules = {
|
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
|
// 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;
|
} as const;
|
||||||
|
|
||||||
// Find which element above is an exact match for this group of paths
|
// 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];
|
if (matchedPath) defaultHeaders.headers["cache-control"] = cacheRules[matchedPath];
|
||||||
|
|
||||||
console.log({ defaultHeaders });
|
|
||||||
|
|
||||||
return defaultHeaders;
|
return defaultHeaders;
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue
Block a user