# Behavior traces — TanStack/router

> Canonical page: https://codevetter.com/unpack/router/behavior-traces

# Behavior traces — 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.

The investigation followed browser startup, client navigation, server rendering, RPC, and generated-file output through their concrete functions. Each trace retains meaningful branches such as canonical redirects, document navigation, method mismatch, or unchanged generated output. Authentication persistence was also traced through a browser-test fixture and the session wrapper. These are source-derived execution paths, not observed runtime runs.
- Browser startup: main.tsx imports routeTree → createRouter → Router constructor → RouterCore.update → ReactDOM.createRoot → RouterProvider → Matches → client Transitioner; rendering occurs only when #app exists and has empty innerHTML. — [benchmarks/bundle-size/scenarios/react-router-full/src/main.tsx#L1-L22](https://github.com/TanStack/router/blob/1f0f20a3206a28365d74fd2485b9a8eedbf74dd0/benchmarks/bundle-size/scenarios/react-router-full/src/main.tsx#L1-L22) [packages/react-router/src/router.ts#L91-L118](https://github.com/TanStack/router/blob/1f0f20a3206a28365d74fd2485b9a8eedbf74dd0/packages/react-router/src/router.ts#L91-L118) [packages/router-core/src/router.ts#L1219-L1231](https://github.com/TanStack/router/blob/1f0f20a3206a28365d74fd2485b9a8eedbf74dd0/packages/router-core/src/router.ts#L1219-L1231) [packages/react-router/src/Matches.tsx#L47-L64](https://github.com/TanStack/router/blob/1f0f20a3206a28365d74fd2485b9a8eedbf74dd0/packages/react-router/src/Matches.tsx#L47-L64)
- Initial client load: Transitioner subscribes history to router.load → updateLatestLocation → buildLocation with search validation → replace/ignoreBlocker if the URL is noncanonical; otherwise it loads synchronously unless already resolved or a transaction exists. — [packages/react-router/src/Transitioner.tsx#L39-L90](https://github.com/TanStack/router/blob/1f0f20a3206a28365d74fd2485b9a8eedbf74dd0/packages/react-router/src/Transitioner.tsx#L39-L90)
- Primary link action: handleClick intercepts only an enabled, unmodified, unprevented left click targeting self → router.navigate → buildAndCommitLocation → commitLocation → history push/replace → subscribed router.load → loadClientRoute; absolute href or reloadDocument takes documentNavigation. — [packages/react-router/src/link.tsx#L433-L461](https://github.com/TanStack/router/blob/1f0f20a3206a28365d74fd2485b9a8eedbf74dd0/packages/react-router/src/link.tsx#L433-L461) [packages/router-core/src/router.ts#L2382-L2433](https://github.com/TanStack/router/blob/1f0f20a3206a28365d74fd2485b9a8eedbf74dd0/packages/router-core/src/router.ts#L2382-L2433) [packages/router-core/src/router.ts#L2313-L2324](https://github.com/TanStack/router/blob/1f0f20a3206a28365d74fd2485b9a8eedbf74dd0/packages/router-core/src/router.ts#L2313-L2324) [packages/react-router/src/Transitioner.tsx#L39-L41](https://github.com/TanStack/router/blob/1f0f20a3206a28365d74fd2485b9a8eedbf74dd0/packages/react-router/src/Transitioner.tsx#L39-L41)
- Client route work: loadClientRoute matches routes and acquires resources → creates a LoadTransaction → runClientTransaction; contextualize establishes inherited context and beforeLoad, while loadResource executes normalized loader work. — [packages/router-core/src/load-client.ts#L1962-L2012](https://github.com/TanStack/router/blob/1f0f20a3206a28365d74fd2485b9a8eedbf74dd0/packages/router-core/src/load-client.ts#L1962-L2012) [packages/router-core/src/load-client.ts#L364-L459](https://github.com/TanStack/router/blob/1f0f20a3206a28365d74fd2485b9a8eedbf74dd0/packages/router-core/src/load-client.ts#L364-L459) [packages/router-core/src/load-client.ts#L598-L638](https://github.com/TanStack/router/blob/1f0f20a3206a28365d74fd2485b9a8eedbf74dd0/packages/router-core/src/load-client.ts#L598-L638)
- HTML request: createStartHandler normalizes the URL → global middleware → handleServerRoutes → executeRouter → attachRouterServerSsrUtils → router.load → serverSsr.dehydrate → renderer callback; malformed protocol-relative paths redirect with 308 and incompatible Accept headers return 406. — [packages/start-server-core/src/createStartHandler.ts#L552-L568](https://github.com/TanStack/router/blob/1f0f20a3206a28365d74fd2485b9a8eedbf74dd0/packages/start-server-core/src/createStartHandler.ts#L552-L568) [packages/start-server-core/src/createStartHandler.ts#L688-L703](https://github.com/TanStack/router/blob/1f0f20a3206a28365d74fd2485b9a8eedbf74dd0/packages/start-server-core/src/createStartHandler.ts#L688-L703) [packages/start-server-core/src/createStartHandler.ts#L721-L768](https://github.com/TanStack/router/blob/1f0f20a3206a28365d74fd2485b9a8eedbf74dd0/packages/start-server-core/src/createStartHandler.ts#L721-L768) [packages/start-server-core/src/createStartHandler.ts#L771-L795](https://github.com/TanStack/router/blob/1f0f20a3206a28365d74fd2485b9a8eedbf74dd0/packages/start-server-core/src/createStartHandler.ts#L771-L795)
- React streaming: defaultStreamHandler → renderRouterToStream → React readable-stream renderer when available, otherwise pipeable renderer → transformReadableStreamWithRouter → createSsrStreamResponse; bot detection waits for full readiness rather than ordinary shell readiness. — [packages/react-router/src/ssr/defaultStreamHandler.tsx#L5-L12](https://github.com/TanStack/router/blob/1f0f20a3206a28365d74fd2485b9a8eedbf74dd0/packages/react-router/src/ssr/defaultStreamHandler.tsx#L5-L12) [packages/react-router/src/ssr/renderRouterToStream.tsx#L30-L68](https://github.com/TanStack/router/blob/1f0f20a3206a28365d74fd2485b9a8eedbf74dd0/packages/react-router/src/ssr/renderRouterToStream.tsx#L30-L68) [packages/react-router/src/ssr/renderRouterToStream.tsx#L71-L121](https://github.com/TanStack/router/blob/1f0f20a3206a28365d74fd2485b9a8eedbf74dd0/packages/react-router/src/ssr/renderRouterToStream.tsx#L71-L121)
- Server RPC: serverFnFetcher serializes and fetches → createStartHandler extracts serverFnId → handleServerAction resolves getServerFnById with client origin → rejects method mismatch before decoding → invokes action → returns a raw Response or serialized result. — [packages/start-client-core/src/client-rpc/serverFnFetcher.ts#L116-L176](https://github.com/TanStack/router/blob/1f0f20a3206a28365d74fd2485b9a8eedbf74dd0/packages/start-client-core/src/client-rpc/serverFnFetcher.ts#L116-L176) [packages/start-server-core/src/createStartHandler.ts#L669-L685](https://github.com/TanStack/router/blob/1f0f20a3206a28365d74fd2485b9a8eedbf74dd0/packages/start-server-core/src/createStartHandler.ts#L669-L685) [packages/start-server-core/src/server-functions-handler.ts#L78-L95](https://github.com/TanStack/router/blob/1f0f20a3206a28365d74fd2485b9a8eedbf74dd0/packages/start-server-core/src/server-functions-handler.ts#L78-L95) [packages/start-server-core/src/server-functions-handler.ts#L149-L198](https://github.com/TanStack/router/blob/1f0f20a3206a28365d74fd2485b9a8eedbf74dd0/packages/start-server-core/src/server-functions-handler.ts#L149-L198)
- Output and persistence paths: Vite configResolved → initConfigAndGenerator → generate → Generator.run → generatorInternal → physical/virtual discovery → safeFileWrite; separately, the auth fixture's loginFn validates fixed test credentials → useSession → session.update → redirect, and logoutFn clears the session before redirecting. — [packages/router-plugin/src/core/router-generator-plugin.ts#L30-L64](https://github.com/TanStack/router/blob/1f0f20a3206a28365d74fd2485b9a8eedbf74dd0/packages/router-plugin/src/core/router-generator-plugin.ts#L30-L64) [packages/router-plugin/src/core/router-generator-plugin.ts#L79-L83](https://github.com/TanStack/router/blob/1f0f20a3206a28365d74fd2485b9a8eedbf74dd0/packages/router-plugin/src/core/router-generator-plugin.ts#L79-L83) [packages/router-generator/src/generator.ts#L354-L403](https://github.com/TanStack/router/blob/1f0f20a3206a28365d74fd2485b9a8eedbf74dd0/packages/router-generator/src/generator.ts#L354-L403) [e2e/react-start/basic/src/utils/auth-docs.ts#L19-L37](https://github.com/TanStack/router/blob/1f0f20a3206a28365d74fd2485b9a8eedbf74dd0/e2e/react-start/basic/src/utils/auth-docs.ts#L19-L37)

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)
