Chuyển đến nội dung
Skillpedia
Website và giao diện (frontend)29k · #9830

table-state

Skill này làm gì

Skill này giải thích cách các thiết lập của bảng, như trang hiện tại, hoạt động trong ứng dụng Solid. Skill dành cho lập trình viên Solid cần bảng và các component của mình phản ứng với cùng một giá trị.

Khi nào nên dùng

  • ✓Khi một template Solid cần hiển thị trang hiện tại hoặc một thiết lập khác của bảng.
  • ✓Khi bạn cần nối một thiết lập của bảng với một signal hoặc memo của Solid.
  • ✓Khi một giá trị đọc trong thân component không cập nhật sau khi bảng thay đổi.

Liên kết skill

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

Sao 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

Hãy dùng skill này để giúp tôi: https://github.com/TanStack/table/blob/main/packages/solid-table/skills/table-state/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Làm sao để hiển thị số trang hiện tại của bảng Solid trong nhãn nút và luôn giữ nó được cập nhật?”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Skill chỉ cách đọc các atom của bảng bên trong JSX, memo hoặc effect, nơi Solid theo dõi chúng, và cách truyền các signal được điều khiển với setter nhận hàm cập nhật.

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.

Solid table state

Before starting, run intent load @tanstack/table-core#table-state for shared ownership, initialization, updates, and resets.

Read reactive state

The adapter backs table atoms with Solid signals and memos. Read table.atoms.<slice>.get() inside JSX, createMemo, createEffect, or another tracked scope. A value captured once outside tracking is only a snapshot. Solid has no React-style selected table.state.

table.Subscribe is deprecated and adds no subscription or tracking scope. Read table.atoms directly inside JSX, memos, or effects. Component bodies are untracked; keep reads inside tracked scopes. Track the required atoms instead of adding whole-store forced rerenders.

Control a slice

Keep features and columns stable. Expose changing data and controlled state through getters. Solid setters already accept Table's raw values and updater functions:

import { createMemo, createSignal } from 'solid-js'
import {
  createTable,
  rowPaginationFeature,
  tableFeatures,
  type PaginationState,
} from '@tanstack/solid-table'

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

export function PageControl() {
  const [data] = createSignal([{ name: 'Ada' }])
  const [pagination, setPagination] = createSignal<PaginationState>({
    pageIndex: 0,
    pageSize: 20,
  })
  const table = createTable({
    features,
    columns,
    get data() {
      return data()
    },
    state: {
      get pagination() {
        return pagination()
      },
    },
    onPaginationChange: setPagination,
  })
  const pageSize = createMemo(() => table.atoms.pagination.get().pageSize)
  return (
    <button onClick={() => table.setPageSize(50)}>
      {pageSize()} rows per page
    </button>
  )
}

When wrapping a setter to add a side effect, resolve both updater forms before storing the result. For shared atom ownership, use createAtom from @tanstack/solid-store and pass it in atoms.<slice>.

For external atoms, custom updater wrappers, or tracking failures, 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/solid-table/dist/createTable.d.ts and reactivity.d.ts; inspect @tanstack/solid-store declarations for external atoms.

Câu hỏi thường gặp

Vì sao đọc một giá trị trong thân component không cập nhật?

Solid không theo dõi các lần đọc trong thân component, nên giá trị ở đó chỉ là một bản chụp.

Có còn cần component Subscribe của bảng không?

Không. Skill nói nó đã bị loại bỏ và việc đọc trực tiếp các atom của bảng trong JSX, memo hoặc effect là cách thay thế.

Setter có nhận hàm cập nhật không?

Có. Setter của Solid nhận cả giá trị thường lẫn hàm cập nhật, đúng như bảng yêu cầu.

Chi tiết

Mô tả gốc của tác giả

Read and control Table v9 state in solid. 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
#9830
Giấy phép
MIT
Cập nhật
21/10/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự