Skip to content
public-library›Rules›TanStack Router›With TanStack Query, load route data into the Query cache

With TanStack Query, load route data into the Query cache

When an app uses TanStack Query, make it the only cache for server data: loaders call queryClient.ensureQueryData with the same query options the component reads, and components read with useSuspenseQuery. Set defaultPreloadStaleTime: 0 so the router always runs loaders and Query decides whether to fetch.

In the full rule