CodeVetter · Repo Unpack · System map
TanStack/query
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.
- The root is a private ESM workspace pinned to pnpm@12.4.2; workspace membership includes packages, integrations, and framework examples, with Vue 2 and Nuxt examples excluded.
- Query-core's public entrypoint exports QueryClient, QueryCache, MutationCache, observers, hydration, managers, cancellation types, and experimental_streamedQuery.
- QueryClient creates or accepts QueryCache and MutationCache instances and owns client defaults, key-specific default registries, and lifecycle subscriptions.
- React connects observers through useSyncExternalStore; Vue computes unwrapped options and updates reactive state; Svelte uses runes and observer subscriptions with lifecycle cleanup.
- Runtime caches are in memory: QueryCache constructs a Map keyed by query hash, while MutationCache constructs a mutation Set and a scope-to-mutations Map.
- Network execution is delegated to application queryFn and mutationFn callbacks; the offline example implements fetch requests and MSW handlers outside query-core.
- Root test:pr runs affected Nx checks, test:ci runs checks across projects, and build:all excludes examples and integrations; Nx orders dependency compilation and build targets.
- Published core packages expose ESM, CommonJS, declarations, and source conditions; shared tsdown factories generate modern and legacy bundles, and the release workflow builds before Changesets publication.