Fossil
Fossil
TtRPC
Created by P.S.Nikhil on 12/15/2023 in #❓-help
How to cache trpc server request next.js app router
Holy fck you're right. I feel like a tremendous pleb. This adds the correct Cache-Control headers to the response, and the server respects them. cc @Kenzo
// next.config.js
headers: async () => {
return [
{
source: "/api/trpc/yourRouteName",
headers: [
{
key: "Cache-Control",
value: "public, s-maxage=90, max-age=90",
},
],
},
];
},
// next.config.js
headers: async () => {
return [
{
source: "/api/trpc/yourRouteName",
headers: [
{
key: "Cache-Control",
value: "public, s-maxage=90, max-age=90",
},
],
},
];
},
24 replies
TtRPC
Created by P.S.Nikhil on 12/15/2023 in #❓-help
How to cache trpc server request next.js app router
Can you link to this Kenzo?
24 replies
TtRPC
Created by Time on 4/14/2024 in #❓-help
Getting strange react error in nextjs
Is Config a server component? Make sure you're declaring "use client" at the top
3 replies
TtRPC
Created by P.S.Nikhil on 12/15/2023 in #❓-help
How to cache trpc server request next.js app router
Currently documented tRPC cacheing methods (https://trpc.io/docs/server/caching) won't work as they rely on setting headers which NextJs now overrides (https://nextjs.org/docs/app/api-reference/next-config-js/headers#cache-control)
24 replies
TtRPC
Created by P.S.Nikhil on 12/15/2023 in #❓-help
How to cache trpc server request next.js app router
Yea lots of options with clientside cacheing. Kinda ridiculous there's no docs for app router cacheing
24 replies
TtRPC
Created by P.S.Nikhil on 12/15/2023 in #❓-help
How to cache trpc server request next.js app router
Did you figure this out? I am stumped
24 replies