Data Fetching
TanStack Query
Pre-configured QueryClient with optimized defaults and provider setup.
Supported frameworks
Dependencies
→ TanStack Query Documentation
What create-faster adds
Modified files:
src/components/app-providers.tsx- AddsQueryClientProvider
On TanStack Start, TanStack Query is wired into the router instead, with @tanstack/react-router-ssr-query:
src/lib/query-client.ts-makeQueryClient(): 30 secondstaleTime, and pending queries are dehydrated too so a loader can prefetch without awaiting (with tRPC, superjson serializers as well)src/router.tsx-getRouter()builds aQueryClientper request, puts it in the router context asqueryClientand callssetupRouterSsrQueryIntegration, which provides it to the app and streams the server's queries to the browsersrc/routes/__root.tsx- Types the router context withcreateRootRouteWithContext
QueryClient configuration (Next.js):
- Retry: 1 attempt
refetchOnWindowFocus: falsestaleTime: 5 minutesgcTime: 10 minutes

