Cache with TRPC app router
Hi guys, I'm struggling implementing cache in my nextjs app. I'm using nextjs with TRPC and app router and it seems that both server and client calls to my TRPC routes are in "no-cache" mode.
Have you got any good ressources to change that ? (relevant repository for example)
I want some query to be cached and some not, and maybe implement a full router cached... If someone can help 🙂
3 Replies
Bump. Cannot find a way to have caching respected for trpc endpoints.
[email protected]
I'm able to set cache-control
headers in the createCallerFactory
context, or fetchRequestHandler
's responseContext
but it doesnt seem to have an impact
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)I just made a question about this
Discord
Discord - A New Way to Chat with Friends & Communities
Discord is the easiest way to communicate over voice, video, and text. Chat, hang out, and stay close with your friends and communities.