# Data flow — TanStack/router

> Canonical page: https://codevetter.com/unpack/router/data-flow

# Data flow — TanStack/router

Scanned commit 1f0f20a3206a28365d74fd2485b9a8eedbf74dd0 (2026-10-01). Generated by codevetter codevetter 1.15.0 on 2026-10-02.

Source inspection; upstream code and tests were not executed.

URLs become parsed locations, inherited validated search values, loader dependencies, and route matches. Client loading carries context and cancellation ownership through reusable resource work into framework presentation. Server requests supply their own Router, middleware context, and serialized transport. Durable outputs in the inspected paths are browser history, generated route files, and session operations delegated to h3.
- defaultParseSearch decodes the query string and attempts JSON parsing of eligible string values, retaining strings on parse failure; stringifySearchWith serializes complex values and preserves parseable strings through symmetric encoding. — [packages/router-core/src/searchParams.ts#L8-L14](https://github.com/TanStack/router/blob/1f0f20a3206a28365d74fd2485b9a8eedbf74dd0/packages/router-core/src/searchParams.ts#L8-L14) [packages/router-core/src/searchParams.ts#L26-L51](https://github.com/TanStack/router/blob/1f0f20a3206a28365d74fd2485b9a8eedbf74dd0/packages/router-core/src/searchParams.ts#L26-L51) [packages/router-core/src/searchParams.ts#L67-L98](https://github.com/TanStack/router/blob/1f0f20a3206a28365d74fd2485b9a8eedbf74dd0/packages/router-core/src/searchParams.ts#L67-L98)
- matchRoutesInternal validates search parent-to-child, merges strict search values, records SearchParamError on failure unless throwOnError is set, and computes loaderDeps plus their JSON hash before match creation. — [packages/router-core/src/router.ts#L1593-L1657](https://github.com/TanStack/router/blob/1f0f20a3206a28365d74fd2485b9a8eedbf74dd0/packages/router-core/src/router.ts#L1593-L1657)
- Client contextualize starts with parent or router context, adds cached route-context contributions, invokes beforeLoad with validated search and additionalContext, and merges its successful result after checking cancellation. — [packages/router-core/src/load-client.ts#L364-L403](https://github.com/TanStack/router/blob/1f0f20a3206a28365d74fd2485b9a8eedbf74dd0/packages/router-core/src/load-client.ts#L364-L403) [packages/router-core/src/load-client.ts#L419-L459](https://github.com/TanStack/router/blob/1f0f20a3206a28365d74fd2485b9a8eedbf74dd0/packages/router-core/src/load-client.ts#L419-L459)
- loadResource creates loader work with a separate AbortController and normalizes outcomes; shared-flight registry membership and leases determine discovery and retention of failed work. — [packages/router-core/src/load-client.ts#L598-L650](https://github.com/TanStack/router/blob/1f0f20a3206a28365d74fd2485b9a8eedbf74dd0/packages/router-core/src/load-client.ts#L598-L650)
- commitLocation places masked locations and hash-scroll metadata into history state, then pushes or replaces publicHref; when no adapter subscribes, it triggers loading itself. — [packages/router-core/src/router.ts#L2276-L2324](https://github.com/TanStack/router/blob/1f0f20a3206a28365d74fd2485b9a8eedbf74dd0/packages/router-core/src/router.ts#L2276-L2324)
- Start memoizes its Router within one request, installs createServerHistory(href), request origin and serialization adapters, then passes serverContext through additionalContext before loading. — [packages/start-server-core/src/createStartHandler.ts#L609-L645](https://github.com/TanStack/router/blob/1f0f20a3206a28365d74fd2485b9a8eedbf74dd0/packages/start-server-core/src/createStartHandler.ts#L609-L645) [packages/start-server-core/src/createStartHandler.ts#L730-L734](https://github.com/TanStack/router/blob/1f0f20a3206a28365d74fd2485b9a8eedbf74dd0/packages/start-server-core/src/createStartHandler.ts#L730-L734)
- RPC puts GET data/context into a serialized payload query parameter and POST data into FormData or JSON; the server deserializes with Seroval and merges client context before trusted server context. — [packages/start-client-core/src/client-rpc/serverFnFetcher.ts#L144-L176](https://github.com/TanStack/router/blob/1f0f20a3206a28365d74fd2485b9a8eedbf74dd0/packages/start-client-core/src/client-rpc/serverFnFetcher.ts#L144-L176) [packages/start-client-core/src/client-rpc/serverFnFetcher.ts#L180-L223](https://github.com/TanStack/router/blob/1f0f20a3206a28365d74fd2485b9a8eedbf74dd0/packages/start-client-core/src/client-rpc/serverFnFetcher.ts#L180-L223) [packages/start-server-core/src/server-functions-handler.ts#L128-L171](https://github.com/TanStack/router/blob/1f0f20a3206a28365d74fd2485b9a8eedbf74dd0/packages/start-server-core/src/server-functions-handler.ts#L128-L171)
- Generated tree content is compared with the cached file before writing; safeFileWrite writes a temporary file, checks the target strategy, renames it, and caches the target's post-rename timestamp. — [packages/router-generator/src/generator.ts#L552-L585](https://github.com/TanStack/router/blob/1f0f20a3206a28365d74fd2485b9a8eedbf74dd0/packages/router-generator/src/generator.ts#L552-L585) [packages/router-generator/src/generator.ts#L1202-L1223](https://github.com/TanStack/router/blob/1f0f20a3206a28365d74fd2485b9a8eedbf74dd0/packages/router-generator/src/generator.ts#L1202-L1223) [packages/router-generator/src/generator.ts#L1250-L1268](https://github.com/TanStack/router/blob/1f0f20a3206a28365d74fd2485b9a8eedbf74dd0/packages/router-generator/src/generator.ts#L1250-L1268)

Every claim links to its cited files at the pinned commit. Citations identify source evidence; they do not establish runtime correctness. Independent CodeVetter scan — not reviewed by upstream maintainers.

## Public product links

- [CodeVetter](https://codevetter.com/)
- [Download](https://codevetter.com/download)
- [Documentation](https://codevetter.com/docs/)
- [Source](https://github.com/Codevetter/codevetter)
