Skip to main content

table-state

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

Datos de origen

Repositorio
TanStack/table
Última actividad en el origen
12 de octubre de 2026 a las 16:41
Idioma detectado de SKILL.md
inglés
Estrellas
28.493
Forks
3589

Opciones de instalación

De forma predeterminada está seleccionado el prompt que primero revisa el origen. Puedes cambiar a un comando directo o descargar una copia local.

Revisa los archivos de origen

Lee SKILL.md y los archivos complementarios que muestra SkillsMP antes de decidir si quieres instalarlo.

Explorador de archivos
2 archivos

Mostrando SKILL.md

SKILL.md
Instrucciones de origen · Vista previa de solo lectura
name
table-state
description
Read and control Table v9 state in vue. Use for tracked reads, subscriptions, controlled slices, and framework-specific reactive boundaries.
metadata
{"type":"framework","library":"@tanstack/vue-table","framework":"vue","library_version":"9.3.1"}
requires
["@tanstack/table-core#table-state"]
sources
["TanStack/table:docs/framework/vue/guide/table-state.md","TanStack/table:examples/vue/basic-external-state","TanStack/table:packages/vue-table/src/useTable.ts"]
# 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: ```ts 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](references/reactivity.md). 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.
Ver en GitHub