T
TanStack2y ago
rival-black

Posts refetch in example

In https://tanstack.com/router/v1/docs/examples/react/basic-react-query-file-based when switching from Posts page to Home page or Layouts page the ["posts"] query is not cached and gets refetched. Why? Posts instead are correctly cached. Thanks
React Router Basic React Query File Based Example | TanStack Router...
An example showing how to implement Basic React Query File Based in React Router
4 Replies
fascinating-indigo
fascinating-indigo2y ago
are you looking at the query-devtools? or at router-devtools? what's your definition of "not cached" and "correctly cached" here?
rival-black
rival-blackOP2y ago
Inspecting network connections I just noticed that refetches are done as I described: switching from posts page to home or layouts pages and back. Whereas refetching does not happen when revisiting the single post pages. I just guessed it was a problem with the cache but not sure whose cache. Can I provide other info? I’m stuck on this 😅 thanks for the help
fascinating-indigo
fascinating-indigo2y ago
check the two devtools i suspect what you see is the classic react-query "stale-while-revalidate" logic
rival-black
rival-blackOP2y ago
I think it is due to the “defaults” of useQuery/useSuspendedQuery.

Did you find this page helpful?