# Behavior traces — TanStack/table

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

# Behavior traces — TanStack/table

Scanned commit 23f21c194e6eba2e7f0321e817104d6e118d6141 (2026-10-01). Generated by codevetter codevetter 1.15.0 on 2026-10-02.

Source inspection; upstream code and tests were not executed.

The source walks cover startup, a sorting action, worker processing, asynchronous query pagination, and browser preference persistence. These traces name execution order and retain important bypass and fallback conditions. They describe code behavior without asserting that a browser session or test run reproduced it.
- Sorting-example startup proceeds document.getElementById('root') → ReactDOM.createRoot(...).render(<App />) → makeData(1_000) in useState → useTable with statically registered sorting features and columns; a missing root throws. — [examples/react/sorting/src/main.tsx#L18-L28](https://github.com/TanStack/table/blob/23f21c194e6eba2e7f0321e817104d6e118d6141/examples/react/sorting/src/main.tsx#L18-L28) [examples/react/sorting/src/main.tsx#L94-L119](https://github.com/TanStack/table/blob/23f21c194e6eba2e7f0321e817104d6e118d6141/examples/react/sorting/src/main.tsx#L94-L119) [examples/react/sorting/src/main.tsx#L193-L201](https://github.com/TanStack/table/blob/23f21c194e6eba2e7f0321e817104d6e118d6141/examples/react/sorting/src/main.tsx#L193-L201)
- useTable's initial useState constructs a table with reactReactivity, attaches Subscribe/FlexRender, and creates a render-phase source. constructTable resolves defaults, creates effective atoms/store, then runs each feature's initialization and API hook in one ordered pass. — [packages/react-table/src/useTable.ts#L157-L187](https://github.com/TanStack/table/blob/23f21c194e6eba2e7f0321e817104d6e118d6141/packages/react-table/src/useTable.ts#L157-L187) [packages/table-core/src/core/table/constructTable.ts#L76-L82](https://github.com/TanStack/table/blob/23f21c194e6eba2e7f0321e817104d6e118d6141/packages/table-core/src/core/table/constructTable.ts#L76-L82) [packages/table-core/src/core/table/constructTable.ts#L126-L194](https://github.com/TanStack/table/blob/23f21c194e6eba2e7f0321e817104d6e118d6141/packages/table-core/src/core/table/constructTable.ts#L126-L194) [packages/table-core/src/core/table/constructTable.ts#L196-L223](https://github.com/TanStack/table/blob/23f21c194e6eba2e7f0321e817104d6e118d6141/packages/table-core/src/core/table/constructTable.ts#L196-L223)
- A sortable header click executes getToggleSortingHandler → column_toggleSorting → table_setSorting → setStateSlice → onSortingChange. Disabled columns ignore the event; multi-sort uses isMultiSortEvent and the toggle selects add/remove/toggle/replace behavior. — [examples/react/sorting/src/main.tsx#L134-L151](https://github.com/TanStack/table/blob/23f21c194e6eba2e7f0321e817104d6e118d6141/examples/react/sorting/src/main.tsx#L134-L151) [packages/table-core/src/features/row-sorting/rowSortingFeature.utils.ts#L534-L550](https://github.com/TanStack/table/blob/23f21c194e6eba2e7f0321e817104d6e118d6141/packages/table-core/src/features/row-sorting/rowSortingFeature.utils.ts#L534-L550) [packages/table-core/src/features/row-sorting/rowSortingFeature.utils.ts#L254-L354](https://github.com/TanStack/table/blob/23f21c194e6eba2e7f0321e817104d6e118d6141/packages/table-core/src/features/row-sorting/rowSortingFeature.utils.ts#L254-L354) [packages/table-core/src/utils.ts#L223-L247](https://github.com/TanStack/table/blob/23f21c194e6eba2e7f0321e817104d6e118d6141/packages/table-core/src/utils.ts#L223-L247)
- After sorting state changes, createSortedRowModel reads sorting and the pre-sorted model, skips empty or unusable sort specifications, resolves comparators, sorts copied arrays recursively, and the example renders the first ten getRowModel rows through FlexRender. — [packages/table-core/src/features/row-sorting/createSortedRowModel.ts#L34-L68](https://github.com/TanStack/table/blob/23f21c194e6eba2e7f0321e817104d6e118d6141/packages/table-core/src/features/row-sorting/createSortedRowModel.ts#L34-L68) [packages/table-core/src/features/row-sorting/createSortedRowModel.ts#L79-L93](https://github.com/TanStack/table/blob/23f21c194e6eba2e7f0321e817104d6e118d6141/packages/table-core/src/features/row-sorting/createSortedRowModel.ts#L79-L93) [packages/table-core/src/features/row-sorting/createSortedRowModel.ts#L147-L193](https://github.com/TanStack/table/blob/23f21c194e6eba2e7f0321e817104d6e118d6141/packages/table-core/src/features/row-sorting/createSortedRowModel.ts#L147-L193) [examples/react/sorting/src/main.tsx#L164-L180](https://github.com/TanStack/table/blob/23f21c194e6eba2e7f0321e817104d6e118d6141/examples/react/sorting/src/main.tsx#L164-L180)
- Worker-example startup executes the '/' route loader → getInitialData server function → makeData(10_000) → Route.useLoaderData → useTable. Its module-scoped handle creates a Worker lazily on client reads; without a Worker global, synchronization returns and row-model getters use pre-stage fallbacks. — [examples/react/web-worker-row-models/src/routes/index.tsx#L21-L49](https://github.com/TanStack/table/blob/23f21c194e6eba2e7f0321e817104d6e118d6141/examples/react/web-worker-row-models/src/routes/index.tsx#L21-L49) [examples/react/web-worker-row-models/src/routes/index.tsx#L147-L165](https://github.com/TanStack/table/blob/23f21c194e6eba2e7f0321e817104d6e118d6141/examples/react/web-worker-row-models/src/routes/index.tsx#L147-L165) [packages/table-core/src/worker/createTableWorker.ts#L321-L328](https://github.com/TanStack/table/blob/23f21c194e6eba2e7f0321e817104d6e118d6141/packages/table-core/src/worker/createTableWorker.ts#L321-L328) [packages/table-core/src/worker/createWorkerRowModel.ts#L79-L90](https://github.com/TanStack/table/blob/23f21c194e6eba2e7f0321e817104d6e118d6141/packages/table-core/src/worker/createWorkerRowModel.ts#L79-L90)
- A worker-stage read executes syncTableWorker → ensureWorker → data post when identity changes → postProcess. initTableWorker receives data/state and serializes stage results; handleResult rejects stale requests/data, updates stage versions and worker state, then triggers a trailing request if more input arrived. — [packages/table-core/src/worker/createTableWorker.ts#L300-L365](https://github.com/TanStack/table/blob/23f21c194e6eba2e7f0321e817104d6e118d6141/packages/table-core/src/worker/createTableWorker.ts#L300-L365) [packages/table-core/src/worker/initTableWorker.ts#L68-L112](https://github.com/TanStack/table/blob/23f21c194e6eba2e7f0321e817104d6e118d6141/packages/table-core/src/worker/initTableWorker.ts#L68-L112) [packages/table-core/src/worker/initTableWorker.ts#L119-L164](https://github.com/TanStack/table/blob/23f21c194e6eba2e7f0321e817104d6e118d6141/packages/table-core/src/worker/initTableWorker.ts#L119-L164) [packages/table-core/src/worker/createTableWorker.ts#L216-L278](https://github.com/TanStack/table/blob/23f21c194e6eba2e7f0321e817104d6e118d6141/packages/table-core/src/worker/createTableWorker.ts#L216-L278)
- Query-example sorting invokes its controlled onSortingChange, updates sorting and resets pageIndex to zero, changes the useQuery key, calls fetchData, and supplies the resulting page back to useTable; manual flags prevent duplicate client filtering/sorting/pagination. — [examples/react/with-tanstack-query/src/main.tsx#L127-L171](https://github.com/TanStack/table/blob/23f21c194e6eba2e7f0321e817104d6e118d6141/examples/react/with-tanstack-query/src/main.tsx#L127-L171) [examples/react/with-tanstack-query/src/fetchData.ts#L112-L123](https://github.com/TanStack/table/blob/23f21c194e6eba2e7f0321e817104d6e118d6141/examples/react/with-tanstack-query/src/fetchData.ts#L112-L123)
- Theme persistence executes ModeToggle menu click → context setTheme → localStorage.setItem → React state update → ThemeProvider effect updating root classes. On remount, getItem and isTheme restore the choice; system mode resolves matchMedia when the effect runs. — [examples/react/kitchen-sink-shadcn-base/src/components/mode-toggle.tsx#L12-L33](https://github.com/TanStack/table/blob/23f21c194e6eba2e7f0321e817104d6e118d6141/examples/react/kitchen-sink-shadcn-base/src/components/mode-toggle.tsx#L12-L33) [examples/react/kitchen-sink-shadcn-base/src/components/theme-provider.tsx#L23-L60](https://github.com/TanStack/table/blob/23f21c194e6eba2e7f0321e817104d6e118d6141/examples/react/kitchen-sink-shadcn-base/src/components/theme-provider.tsx#L23-L60)

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)
