table-state
できること
ページ番号などのテーブルの設定を、Vueのrefで管理し、テンプレートで読む方法を説明します。テーブルとページを同期させたいVue開発者向けです。
使う場面
- ✓Vueのテンプレートで現在のページなど、テーブルの設定を表示する必要があるとき。
- ✓テーブルのページ送りをrefや算出値につなぐ必要があるとき。
- ✓スクリプト内で一度読んだテーブルの値が、変更後も更新されないとき。
スキルのリンク
https://github.com/TanStack/table/blob/main/packages/vue-table/skills/table-state/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“次へをクリックしたとき、Vueテーブルのページ番号が画面で更新されるようにする方法を教えてください。”
毎週5つの新しいスキル。1分で読めます。
仕組み
ページ送りの設定をrefで保持し、更新用コールバックと一緒に算出状態としてテーブルに渡し、テンプレートで読む方法を示します。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
Vue table state
Before starting, run intent load @tanstack/table-core#table-state for shared ownership, initialization, updates, and resets.
Read reactive state
Vue-backed atom reads track dependencies inside templates, computed, watch, or a render boundary. const page = table.atoms.pagination.get() outside tracking captures a snapshot. Keep reactive option inputs as refs, computed values, or getters; passing .value once breaks later synchronization.
table.Subscribe is deprecated. Read table APIs or atoms directly inside templates, render functions, computed getters, or watcher sources. Use a child component when reads need a separate component render boundary.
Control a slice
Keep features and columns stable. Preserve both the reactive value and its matching callback:
import { computed, ref } from 'vue'
import {
rowPaginationFeature,
tableFeatures,
useTable,
type PaginationState,
type Updater,
} from '@tanstack/vue-table'
const features = tableFeatures({ rowPaginationFeature })
const columns = [{ accessorKey: 'name' }]
const data = ref([{ name: 'Ada' }])
const pagination = ref<PaginationState>({ pageIndex: 0, pageSize: 20 })
const state = computed(() => ({ pagination: pagination.value }))
const table = useTable({
features,
columns,
data,
state,
onPaginationChange: (next: Updater<PaginationState>) => {
pagination.value =
typeof next === 'function' ? next(pagination.value) : next
},
})
const pageSize = computed(() => table.atoms.pagination.get().pageSize)
Assign the resolved updater result to the ref. For shared atom ownership, use a stable @tanstack/vue-store atom in atoms.<slice> instead of mirroring the same slice in controlled refs.
For computed-state synchronization failures, updater mistakes, or render boundaries, read reactivity details. If this task changes processing features, run intent load @tanstack/table-core#table-features and read the relevant feature references.
API discovery
Inspect node_modules/@tanstack/vue-table/dist/useTable.d.ts and reactivity.d.ts; inspect the matching core feature declarations for the controlled slice.
よくある質問
スクリプトで一度読んだ値が更新されないのはなぜですか?
追跡の外での読み取りはスナップショットになり、そのスナップショットは後から更新されないからです。
テーブルには.valueを渡すべきですか?
いいえ。.valueを一度渡すと後の同期が壊れるため、リアクティブな入力はrefや算出値、ゲッターのままにするよう、このスキルは説明しています。
table.Subscribeはまだ使いますか?
非推奨です。テンプレートでテーブルのAPIやatomsを直接読むよう勧めています。
詳細
作者による元の説明
Read and control Table v9 state in vue. Use for tracked reads, subscriptions, controlled slices, and framework-specific reactive boundaries.
repo: TanStack/table
人気
- GitHubのスター
- 29k
- ランキング
- #9843
- ライセンス
- MIT
- 更新日
- 2026/10/21
コメント
- …
このリポジトリの他のスキル
getting-started
29kエージェントが、Alpine.jsでTanStack Tableを使ってデータテーブルを作り、表示する方法を教えます。セットアップ、リアクティブなデータ、行の描画を扱います。
table-state
29kエージェントが、Alpine.jsで表の状態(現在のページなど)を読み取り、制御する方法を教えます。その状態が変わると、画面が更新されます。
devtools
29kエージェントが、Angularの表をTanStack Devtoolsのパネルに登録する方法を教えます。開発者はアプリを作りながら、各表を調べられます。
getting-started
29kエージェントが、AngularでTanStack Tableの表を作り、表示する方法を教えます。injectTableの設定、テンプレートの描画、行データの更新を扱います。
似ているスキル
angular-developer
280kエージェントがAngularのコードを作成し、プロジェクト構成についてアドバイスできるようにします。新しいプロジェクトの開始、コード部品の作成、パフォーマンスやアクセシビリティの改善に役立ちます。
frontend-a11y
280kエージェントが Web インターフェースを誰にとっても使いやすくするよう支援します。スクリーンリーダーやキーボード操作に対応し、サイトやアプリが適切に動作するようにします。
frontend-patterns
280kエージェントがフロントエンド開発の最新パターンを適用できるようにします。React と Next.js において、パフォーマンスの最適化、状態管理、ベストプラクティスの遵守を行います。