CodeVetter
← All unpacks
CodeVetter · Repo Unpack evidence

TanStack/query

Scanned commit 29859ae60c dated 2026-10-02 — last upstream commit. Generated by codevetter 1.15.0 on 2026-10-02.

github.com/TanStack/query ↗ · 3553 files · 11.7 MB

Become a Sponsor! TanStack Query An async state management library built to simplify fetching, caching, synchronizing, and updating server state.

Deep analysis by cli:codex via the codex CLI on 2026-10-02 (421s) — every claim below links to its cited source files. Source inspection; upstream code and tests were not executed.

Overview

TanStack Query is a TypeScript library for application developers who need to fetch, cache, synchronize, and update asynchronous server state across UI frameworks. Its framework-independent QueryClient, caches, retry machinery, and observers power framework adapters, with optional persistence, hydration, cross-tab synchronization, developer tools, and ESLint rules. This brief investigates commit 29859ae60c8dca0a5cdbf8abccc775b655cf43e2 through bounded source inspection, including concrete startup, fetch, mutation, and persistence flows.

System map

The repository distributes libraries rather than one deployed application. Query-core supplies state ownership and execution primitives; framework packages translate those primitives into framework lifecycle and reactivity. Persistence and broadcast packages introduce optional storage and messaging boundaries, while developer tools observe and manipulate the same caches. The inspected workspace uses pnpm and Nx, with package builds and Changesets publication.

Feature catalog

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.

Data flow

Keys and options enter through adapters or QueryClient methods and resolve into shared cache entries. Application callbacks produce raw data, while observers derive presentation results and notify framework subscribers. Mutations retain variables and optimistic context separately from query data. Hydration, persistence, and broadcast transfer snapshots across explicit external boundaries.

Behavior traces

The investigation followed startup, primary fetch, optimistic mutation, and persistent restoration through concrete source files. These are source execution traces rather than observed runtime recordings. Each trace retains important conditional branches, including stale-cache reuse, restoration gating, cancellation, and scope queues. The offline example supplies an application-level path connecting these library mechanisms.

Testing signals

Tests and CI were inspected, not executed; test existence and assertions are not passing results. The inspected suites use Vitest, fake timers, jsdom, React Testing Library, and type assertions. They exercise cache timing, observer transitions, mutation queues, hydration, restoration, and throttling. This inventory is bounded: the sampled tests do not establish production network, storage, browser, or every-adapter coverage.

Risk map

These risks are source observations and explicitly labeled hypotheses, not confirmed vulnerabilities. The most consequential boundaries are request-local cache ownership, serialized data, incoming broadcast snapshots, and callback execution. Shared core behavior also has broad adapter impact and several compatibility branches. Release tooling performs privileged external actions and was inspected only as public source.

Extension points

Extensions attach through options, callbacks, subscriptions, adapter primitives, and separate packages. Query and mutation functions are the main transport boundary, while persister contracts provide storage substitution. Manager setters allow environments and frameworks to replace event or scheduling behavior. Typed registration and ESLint rule tables supply compile-time and tooling extension mechanisms.

Contributor handoff

Tests and CI were inspected, not executed, and this source inventory is bounded rather than exhaustive. Future agents should begin with repository instructions, the owning package, and the relevant core-to-adapter flow. Core edits require attention to cache identity, observer timing, cancellation, mutation callbacks, and external snapshots. Validation commands below are recommendations for a future authorized implementation task, not actions performed during this investigation.

Languages

LanguageFilesShare of source
Markdown1766docs/config
TypeScript99178%
JSON307docs/config
JavaScript17414%
Svelte867%
HTML78docs/config
Vue202%
CSS19docs/config

Start reading here

Probable source entrypoint: packages/ — inferred from the directory tree and manifest, not the upstream docs.

Source roots

packages/ (946 files)

Repository structure

Top-level pathFiles
docs/1660
packages/946
examples/803
integrations/102
.github/10
scripts/7
media/2
.nx/1

Docs found: AGENTS.mdCONTRIBUTING.mdREADME.mddocs/community-resources.mddocs/eslint/eslint-plugin-query.mddocs/eslint/exhaustive-deps.mddocs/eslint/infinite-query-property-order.mddocs/eslint/mutation-property-order.mddocs/eslint/no-rest-destructuring.mddocs/eslint/no-unstable-deps.md

Package

package.json — root, 33 declared dependencies.

@arethetypeswrong/cli@changesets/changelog-github@changesets/cli@cspell/eslint-plugin@size-limit/preset-small-lib@tanstack/eslint-config@tanstack/typedoc-config@testing-library/jest-dom@types/node@vitest/coverage-istanbul@vitest/eslint-plugineslint

CI & config entrypoints

Structural health signals

Average score 6.9/10 across 96 analyzed source files; 34 hotspots surfaced.

These are deterministic review leads — size, churn, and structural signals — not proof of a bug in this project.

Recent history