本文へスキップ
Skillpedia
WebサイトとUI(フロントエンド)29k · #9810

table-state

できること

このスキルは、シグナルで作られたAngularアプリで、現在のページなどの表の状態がどう働くかを説明します。表と自分のコンポーネントが、同じ値に反応する必要がある開発者向けです。

使う場面

  • ✓テンプレートに、表の現在のページ番号や他の設定を表示する必要があるとき。
  • ✓表のページの設定をAngularのシグナルにつなぐ必要があるとき。
  • ✓表が変わった後に、計算された値やエフェクトが更新されないとき。

スキルのリンク

https://github.com/TanStack/table/blob/main/packages/angular-table/skills/table-state/SKILL.md

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/TanStack/table/blob/main/packages/angular-table/skills/table-state/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

AIへの頼み方の例

“Angularの表の現在のページ番号を、ボタンのラベルに表示するにはどうすればよいですか。”

毎週5つの新しいスキル。1分で読めます。

仕組み

表の状態をシグナルに保持し、表に渡し、コールバックを通じて更新する方法を示します。そうすることで、両方が同じ状態を保ちます。

技術的な内容(元のSKILL.md)

作者による元のテキスト(英語)をGitHubからそのまま表示しています。

Load intent load @tanstack/table-core#table-state first for shared ownership, initialization, updater, and reset rules.

Angular-backed atom reads participate in tracking inside templates, computed, and effect. A value captured outside those contexts is only a snapshot. Use computed for derivation or equality control; wrapping an atom is not required to make it reactive.

Controlled signal setup

<!-- skill-snippet:check tsconfig=scripts/skill-snippets-angular.tsconfig.json -->
import { Component, signal } from '@angular/core'
import {
  injectTable,
  rowPaginationFeature,
  tableFeatures,
} from '@tanstack/angular-table'

const features = tableFeatures({ rowPaginationFeature })
const columns = [{ accessorKey: 'name' }]
const data = [{ name: 'Ada' }]

@Component({
  selector: 'page-status',
  template: `<button (click)="table.nextPage()">
    Page {{ table.atoms.pagination.get().pageIndex + 1 }}
  </button>`,
})
export class PageStatus {
  readonly pagination = signal({ pageIndex: 0, pageSize: 20 })
  readonly table = injectTable(() => ({
    features,
    columns,
    data,
    state: { pagination: this.pagination() },
    onPaginationChange: (next) =>
      typeof next === 'function'
        ? this.pagination.update(next)
        : this.pagination.set(next),
  }))
}

Reactive boundaries

  • Construct in Angular injection context. Signal writes used by the initializer rerun it and call setOptions; hoist features and columns and keep data references stable.
  • Supply both state.pagination and onPaginationChange when a signal owns the slice. Resolve updater functions with .update(next) instead of storing the function with .set(next).
  • For shared state, create a stable atom with @tanstack/angular-store and pass it through atoms. Its writes do not need to flow through a controlled signal in the initializer.
  • Use table.store.get() for the flat state. Prefer table.atoms.<slice>.get() for narrow tracked reads.

Read for the task

For advanced reactive boundaries, shared atoms, or detailed subscription examples, read reactivity. For construction or rendering setup, read getting-started.

API discovery

Inspect node_modules/@tanstack/angular-table/dist/types/ for the bundled public declarations. Inspect feature APIs under node_modules/@tanstack/table-core/dist/features/.

よくある質問

表の値をリアクティブにするのに、特別なヘルパーが常に必要ですか?

いいえ、値をヘルパーで包む必要は、リアクティブにするためには必要ないとスキルは述べています。

コピーした値が更新されないのはなぜですか?

テンプレート、計算された値、エフェクトの外で読まれた値は単なるスナップショットなので、自動では更新されません。

表はどこで作るべきですか?

表はinjectTableで作られ、Angularのインジェクションのコンテキストで実行される必要があります。

詳細

作者による元の説明

Read and control Table v9 state in angular. Use for tracked reads, subscriptions, controlled slices, and framework-specific reactive boundaries.

repo: TanStack/table

人気

GitHubのスター
29k
ランキング
#9810
ライセンス
MIT
更新日
2026/10/21

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル