Disable trpc route cahce?
I have this code to fetch some data from my db and return it, however if i call the endpoint again, the data is the same even if the db is different? Does trpc cache the old data on new request? If so i dont want this
5 Replies
However when i go to
http://localhost:3000/api/trpc/getClient
and test i get the fresh data on every request?this is because of react-query’s caching
if you set cacheTime to 0 in your useQuery call options, it won’t cache the response
but im using
The Nextjs server trpc so it only has the
query
method on ithmm idk about that one tbh, @julius ?
app router master
The ”new”, experimental, nextHttpLink does set cache tags, so that’s why you’re seeing that behavior, it’s expected.
You can set a revalidation time on how long you want the fetch request to be cached for in the link options, or just use the old/normal httpLink/httpBatchLink if you dont want any caching