table-state

Manages TanStack Table state in Angular using signal-backed atoms and controlled signals.

28.4k|3.6k|Updated Oct 20, 2016
One-click install
npx skills add https://github.com/TanStack/table --skill table-state
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: table-state
Source: https://github.com/TanStack/table/tree/main/packages/angular-table/skills/table-state
Command: npx skills add https://github.com/TanStack/table --skill table-state

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @tanstack/angular-table, @tanstack/angular-store, @tanstack/table-core.

What problem does it solve?

Managing TanStack Table state in Angular is error-prone: developers must decide who owns each state slice, handle value-or-updater callbacks correctly, and avoid performance issues caused by injectTable initializer reruns when signals change.

Core Features & Use Cases

  • State Ownership Patterns: Choose between internal state, initialState, external @tanstack/angular-store atoms, or controlled Angular signals for each state slice.
  • Signal Integration: Read table.atoms directly in templates, computed, and effect with automatic Angular signal tracking.
  • Updater Resolution: Correctly handle value-or-updater callbacks in onPaginationChange and similar handlers without corrupting state.
  • Use Case: You are building an Angular datagrid whose pagination state must sync with a query cache. Create a stable atom with createAtom from @tanstack/angular-store, pass it via the atoms option, and let table APIs update it without rerunning the injectTable initializer.

Quick Start

Show me how to control TanStack Table pagination state in my Angular component using a signal and the onPaginationChange callback.

Frequently Asked Questions about table-state

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I control TanStack Table state with Angular signals?

Pass a signal read into the state option, such as state: { pagination: this.pagination() }, and provide the matching onPaginationChange callback. The callback receives a value or updater function, so resolve it with typeof next === 'function' before calling set or update.

How do I share TanStack Table state with an external store in Angular?

Create a stable atom with createAtom from @tanstack/angular-store and pass it through the atoms option, for example atoms: { pagination: this.paginationAtom }. Table APIs update the atom directly without a change callback or initializer reruns.

Why does my injectTable initializer keep rerunning in Angular?

Signal reads inside the injectTable initializer are tracked, so any controlled signal write reruns it and calls setOptions. Hoist static work like features and columns outside the initializer and only read dynamic signals inside it.

Can I use initialState together with external atoms in TanStack Table?

No, each state slice should have exactly one owner. External atoms override controlled state, which overrides initial state, so passing both initialState and an atom for the same slice causes the initial value to be ignored.

Why does storing the updater function from onPaginationChange break my table state?

Change callbacks receive either a raw value or an updater function. Calling this.pagination.set(next) directly stores the function itself as state; instead check typeof next === 'function' and use signal.update(next) for updaters.