TanStackT
TanStack2y ago
6 replies
hurt-tomato

Unable to cache data with `prefetchQuery` on server + `useQuery` in client

Test-case: https://stackblitz.com/edit/stackblitz-starters-skmfha?file=app%2Fform%2Fposts.tsx

Each time ./posts gets refreshed, the terminal prints "in getPosts" which is a message sent by the getPosts() function. I was under the assumption that getPosts() function will only be called again once the cached data expired, but it seems to be called every time the page gets refresh.

Is this the expected behaviour or am I doing something wrong?
StackBlitzLaurentiu T
The React framework for production
Next.js Starter - StackBlitz
Was this page helpful?