CodeVetter · Repo Unpack · Feature catalog
TanStack/query
The public product is a family of APIs for server-state management. Inspected features include reactive and imperative queries, mutations, pagination, background refresh, streaming, and server/client hydration. Persistence and cross-tab synchronization are optional integrations. Developer tools and lint rules support application debugging and API usage.
- React exports useQuery, useQueries, Suspense query variants, prefetch hooks, useInfiniteQuery, mutation hooks, activity indicators, providers, and option factories.
- queryClient.query resolves stale data through fetch or returns fresh cached data, then applies optional select; infiniteQuery marks options as infinite and delegates to query.
- Queries support dependent execution through enabled or skipToken, initial data, selected results, and previous-page placeholders through keepPreviousData.
- Background refresh supports mount, focus, reconnect, and interval triggers; interval fetching respects enabled/server checks and focus unless refetchIntervalInBackground is enabled.
- Infinite queries fetch forward or backward using page-parameter callbacks, maintain pages and pageParams together, stop when subsequent parameters are nullish, and bound retained pages through maxPages.
- Mutations expose fire-and-forget mutate and promise-returning mutateAsync, optimistic lifecycle callbacks, and serialization for mutations sharing scope.id.
- Optional state portability includes hydrate/dehydrate, storage-backed cache persistence, cross-tab broadcasts, and streamed AsyncIterable accumulation with reset, append, or replace refetch modes.
- Devtools provides query/mutation views, filtering and sorting state, offline controls, and JSON cache editing; the ESLint plugin provides eight registered rules with recommended and stricter configurations.