Langsung ke konten
Skillpedia
Website & UI (frontend)29k · #9843

table-state

Fungsinya

Skill ini menjelaskan cara menyimpan pengaturan tabel, seperti halaman saat ini, dalam ref Vue dan membacanya di template. Skill ini untuk pengembang Vue yang tabel dan halamannya harus tetap selaras.

Kapan dipakai

  • ✓Saat template Vue harus menampilkan halaman saat ini atau pengaturan tabel lainnya.
  • ✓Saat Anda perlu menghubungkan paginasi tabel ke ref atau nilai computed.
  • ✓Saat nilai tabel yang dibaca sekali di kode script tidak diperbarui setelah perubahan.

Link skill

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

Salin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.

Cara pakai

Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.

Pesan siap tempel

Gunakan skill ini untuk membantu saya: https://github.com/TanStack/table/blob/main/packages/vue-table/skills/table-state/SKILL.md Baca file SKILL.md di link tersebut dan ikuti instruksinya untuk tugas saya.
Mau AI Anda menemukan skill seperti ini sendiri?Pasang MCP Skillpedia gratis: cukup satu baris, dan AI mencari di antara 15.000+ skill sebelum tiap tugas.Pasang dalam 1 menit →

Contoh permintaan ke AI

“Bagaimana cara membuat nomor halaman tabel Vue saya diperbarui di layar saat saya klik berikutnya?”

5 skill baru setiap minggu. 1 menit baca.

Cara kerjanya

Skill menunjukkan cara menyimpan pengaturan paginasi dalam ref, meneruskannya ke tabel sebagai state computed dengan callback pembaruan yang sesuai, lalu membacanya di template.

Konten teknis (SKILL.md asli)

Teks asli dari pembuat, dalam bahasa Inggris, langsung dari 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.

Pertanyaan umum

Mengapa nilai yang dibaca sekali di script tidak diperbarui?

Pembacaan di luar pelacakan hanya menangkap snapshot, dan snapshot itu tidak akan menyegarkan diri nanti.

Haruskah saya meneruskan .value ke tabel?

Tidak. Skill menyatakan meneruskan .value sekali akan merusak sinkronisasi berikutnya, jadi input reaktif tetap berupa ref, nilai computed, atau getter.

Apakah table.Subscribe masih dipakai?

Sudah usang. Skill menyarankan membaca API atau atom tabel langsung di template.

Detail

Deskripsi asli dari pembuat

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

repo: TanStack/table

Popularitas

Bintang GitHub
29k
Peringkat
#9843
Lisensi
MIT
Diperbarui
21/10/2026

Apakah skill ini berguna?

0

Masuk untuk memberi suara.

Komentar

  • …

Skill lain dari repositori ini

Skill serupa