table-state
Skill này làm gì
Skill này giải thích cách giữ các thiết lập của bảng, như trang hiện tại, trong state của Octane và hiển thị chúng trên màn hình. Skill dành cho lập trình viên cần bảng và trang luôn khớp nhau.
Khi nào nên dùng
- ✓Khi một nút trên trang phải hiển thị trang bảng hiện tại và cập nhật nó khi bấm.
- ✓Khi bạn cần truyền một thiết lập bảng từ state của Octane vào bảng.
- ✓Khi một giá trị bảng không làm mới trên màn hình sau khi nó thay đổi.
Liên kết skill
https://github.com/TanStack/table/blob/main/packages/octane-table/skills/table-state/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Làm sao để giữ số trang trong bảng Octane của tôi luôn cập nhật trên màn hình khi tôi bấm tiếp theo?”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Skill chỉ cách giữ thiết lập trong state của Octane, truyền cả giá trị lẫn hàm cập nhật của nó cho bảng, và đọc trạng thái được chọn trong markup.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
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. useTablestages 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-storeis a direct synchronous owner. Table writes reach it immediately; it takes precedence over controlledstatefor 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/.
Câu hỏi thường gặp
Vì sao đọc giá trị bằng get() không cập nhật màn hình?
Các lần đọc đó là bản chụp nhanh, nên màn hình chỉ cập nhật từ trạng thái được chọn hoặc một component subscribe được render.
Setter có nhận hàm cập nhật không?
Có. Setter của Octane nhận các callback giá trị-hoặc-cập-nhật mà bảng sử dụng.
Tôi cần truyền gì để giữ state đồng bộ?
Hãy truyền cả giá trị được điều khiển lẫn callback của nó, vì chỉ có callback thì không thể đưa giá trị mới trở lại.
Chi tiết
Mô tả gốc của tác giả
Read and control Table v9 state in octane. Use for tracked reads, subscriptions, controlled slices, and framework-specific reactive boundaries.
repo: TanStack/table
Độ phổ biến
- Sao GitHub
- 29k
- Vị trí xếp hạng
- #9818
- Giấy phép
- MIT
- Cập nhật
- 21/10/2026
Bình luận
- …
Thêm skill từ kho mã này
getting-started
29kHướng dẫn agent của bạn cách tạo và hiển thị bảng dữ liệu với TanStack Table trong Alpine.js, gồm thiết lập, dữ liệu phản ứng và hiển thị các hàng.
table-state
29kHướng dẫn agent của bạn cách đọc và điều khiển trạng thái bảng trong Alpine.js, như trang hiện tại, để màn hình cập nhật khi trạng thái đó thay đổi.
devtools
29kHướng dẫn agent của bạn cách đăng ký bảng Angular với bảng điều khiển TanStack Devtools, để lập trình viên có thể kiểm tra từng bảng trong khi xây dựng ứng dụng.
getting-started
29kHướng dẫn agent của bạn cách tạo và hiển thị bảng TanStack trong Angular, gồm thiết lập injectTable, hiển thị trong template và cập nhật dữ liệu hàng.
Skill tương tự
angular-developer
280kGiúp agent của bạn viết code Angular và tư vấn cấu trúc dự án, hữu ích khi bắt đầu dự án mới hoặc cải thiện hiệu suất.
frontend-a11y
280kGiúp agent của bạn làm cho giao diện web dễ tiếp cận với mọi người. Đảm bảo website và ứng dụng hoạt động tốt với trình đọc màn hình và điều hướng bằng bàn phím.
frontend-patterns
280kGiúp agent của bạn áp dụng các mẫu hiện đại trong phát triển frontend. Tối ưu hiệu năng, quản lý trạng thái và tuân theo thực hành tốt nhất với React và Next.js.