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

table-state

Fungsinya

Skill ini menjelaskan cara menyimpan pengaturan tabel, seperti halaman saat ini, dalam state Octane dan menampilkannya di layar. Skill ini untuk pengembang yang tabel dan halamannya harus tetap selaras.

Kapan dipakai

  • ✓Saat sebuah tombol halaman harus menampilkan halaman tabel saat ini dan memperbaruinya saat diklik.
  • ✓Saat Anda perlu meneruskan pengaturan tabel dari state Octane ke dalam tabel.
  • ✓Saat nilai tabel tidak disegarkan di layar setelah berubah.

Link skill

https://github.com/TanStack/table/blob/main/packages/octane-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/octane-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 menjaga nomor halaman tabel Octane saya tetap diperbarui di layar saat saya klik berikutnya?”

5 skill baru setiap minggu. 1 menit baca.

Cara kerjanya

Skill menunjukkan cara menyimpan pengaturan dalam state Octane, meneruskan nilai beserta setter-nya ke tabel, dan membaca state terpilih di markup.

Konten teknis (SKILL.md asli)

Teks asli dari pembuat, dalam bahasa Inggris, langsung dari GitHub.

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

useTable selects all registered state by default. Its second argument changes the selected shape exposed as table.state and shallow-gates owner rerenders. Atom .get() and table.store.state reads are snapshots; use selected state or a rendered table.Subscribe to update the UI.

Controlled slice setup

import { useState } from 'octane'
import {
  rowPaginationFeature,
  tableFeatures,
  useTable,
} from '@tanstack/octane-table'

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

function PageStatus() @{
  const [pagination, setPagination] = useState({ pageIndex: 0, pageSize: 20 })
  const table = useTable({
    features,
    columns,
    data,
    state: { pagination },
    onPaginationChange: setPagination,
  })

  <button onClick={() => table.nextPage()}>
    Page {String(table.state.pagination.pageIndex + 1)}
  </button>
}

Reactive boundaries

  • Pass both the controlled value and its callback. Octane setters accept Table's value-or-updater callbacks; a callback alone cannot feed the new value back.
  • Render <table.Subscribe> as a component. Calling it as a normal function shares the owner's compiler slots instead of creating an independent hook scope.
  • useTable stages fresh options for same-render reads. Controlled state reaches the store only from an accepted layout commit, so abandoned work cannot publish speculative values.
  • A stable atom from @tanstack/octane-store is a direct synchronous owner. Table writes reach it immediately; it takes precedence over controlled state for the same slice.
  • Keep features, columns, and data stable. Use the default selector until render cost justifies narrower subscriptions.

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/octane-table/src/index.d.ts, the matching *.tsrx.d.ts sidecar, and src/types.ts. This package publishes authored source; core APIs are in installed @tanstack/table-core/dist/.

Pertanyaan umum

Mengapa membaca nilai dengan get() tidak memperbarui layar?

Pembacaan itu hanya snapshot, sehingga layar diperbarui hanya dari state terpilih atau komponen subscribe yang dirender.

Bisakah setter menerima fungsi pembaruan?

Bisa. Setter Octane menerima callback nilai atau pembaruan yang juga dipakai tabel.

Apa yang harus saya teruskan agar state tetap selaras?

Teruskan nilai terkontrol beserta callback-nya, karena callback saja tidak dapat mengembalikan nilai baru.

Detail

Deskripsi asli dari pembuat

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

repo: TanStack/table

Popularitas

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

Apakah skill ini berguna?

0

Masuk untuk memberi suara.

Komentar

  • …

Skill lain dari repositori ini

Skill serupa