@tanstack/table-core 9.0.0-beta.37 → 9.0.0-beta.42

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. package/README.md +1 -0
  2. package/dist/core/headers/buildHeaderGroups.cjs.map +1 -1
  3. package/dist/core/headers/buildHeaderGroups.d.cts +1 -1
  4. package/dist/core/headers/buildHeaderGroups.d.ts +1 -1
  5. package/dist/core/headers/buildHeaderGroups.js.map +1 -1
  6. package/dist/core/headers/coreHeadersFeature.utils.cjs +7 -7
  7. package/dist/core/headers/coreHeadersFeature.utils.cjs.map +1 -1
  8. package/dist/core/headers/coreHeadersFeature.utils.js +7 -7
  9. package/dist/core/headers/coreHeadersFeature.utils.js.map +1 -1
  10. package/dist/core/table/coreTablesFeature.utils.cjs +1 -1
  11. package/dist/core/table/coreTablesFeature.utils.cjs.map +1 -1
  12. package/dist/core/table/coreTablesFeature.utils.js +1 -1
  13. package/dist/core/table/coreTablesFeature.utils.js.map +1 -1
  14. package/dist/features/column-ordering/columnOrderingFeature.types.d.cts +5 -5
  15. package/dist/features/column-ordering/columnOrderingFeature.types.d.ts +5 -5
  16. package/dist/features/column-ordering/columnOrderingFeature.utils.cjs +6 -6
  17. package/dist/features/column-ordering/columnOrderingFeature.utils.cjs.map +1 -1
  18. package/dist/features/column-ordering/columnOrderingFeature.utils.d.cts +3 -3
  19. package/dist/features/column-ordering/columnOrderingFeature.utils.d.ts +3 -3
  20. package/dist/features/column-ordering/columnOrderingFeature.utils.js +6 -6
  21. package/dist/features/column-ordering/columnOrderingFeature.utils.js.map +1 -1
  22. package/dist/features/column-pinning/columnPinningFeature.cjs +44 -39
  23. package/dist/features/column-pinning/columnPinningFeature.cjs.map +1 -1
  24. package/dist/features/column-pinning/columnPinningFeature.d.cts +6 -1
  25. package/dist/features/column-pinning/columnPinningFeature.d.ts +6 -1
  26. package/dist/features/column-pinning/columnPinningFeature.js +45 -40
  27. package/dist/features/column-pinning/columnPinningFeature.js.map +1 -1
  28. package/dist/features/column-pinning/columnPinningFeature.types.d.cts +49 -38
  29. package/dist/features/column-pinning/columnPinningFeature.types.d.ts +49 -38
  30. package/dist/features/column-pinning/columnPinningFeature.utils.cjs +154 -146
  31. package/dist/features/column-pinning/columnPinningFeature.utils.cjs.map +1 -1
  32. package/dist/features/column-pinning/columnPinningFeature.utils.d.cts +81 -73
  33. package/dist/features/column-pinning/columnPinningFeature.utils.d.ts +81 -73
  34. package/dist/features/column-pinning/columnPinningFeature.utils.js +141 -133
  35. package/dist/features/column-pinning/columnPinningFeature.utils.js.map +1 -1
  36. package/dist/features/column-sizing/columnSizingFeature.cjs +4 -4
  37. package/dist/features/column-sizing/columnSizingFeature.cjs.map +1 -1
  38. package/dist/features/column-sizing/columnSizingFeature.js +5 -5
  39. package/dist/features/column-sizing/columnSizingFeature.js.map +1 -1
  40. package/dist/features/column-sizing/columnSizingFeature.types.d.cts +18 -12
  41. package/dist/features/column-sizing/columnSizingFeature.types.d.ts +18 -12
  42. package/dist/features/column-sizing/columnSizingFeature.utils.cjs +24 -20
  43. package/dist/features/column-sizing/columnSizingFeature.utils.cjs.map +1 -1
  44. package/dist/features/column-sizing/columnSizingFeature.utils.d.cts +18 -14
  45. package/dist/features/column-sizing/columnSizingFeature.utils.d.ts +18 -14
  46. package/dist/features/column-sizing/columnSizingFeature.utils.js +24 -20
  47. package/dist/features/column-sizing/columnSizingFeature.utils.js.map +1 -1
  48. package/dist/features/column-visibility/columnVisibilityFeature.utils.cjs +16 -16
  49. package/dist/features/column-visibility/columnVisibilityFeature.utils.cjs.map +1 -1
  50. package/dist/features/column-visibility/columnVisibilityFeature.utils.d.cts +3 -3
  51. package/dist/features/column-visibility/columnVisibilityFeature.utils.d.ts +3 -3
  52. package/dist/features/column-visibility/columnVisibilityFeature.utils.js +16 -16
  53. package/dist/features/column-visibility/columnVisibilityFeature.utils.js.map +1 -1
  54. package/dist/static-functions.cjs +16 -16
  55. package/dist/static-functions.d.cts +3 -3
  56. package/dist/static-functions.d.ts +3 -3
  57. package/dist/static-functions.js +3 -3
  58. package/package.json +1 -1
  59. package/skills/api-not-found/SKILL.md +113 -0
  60. package/skills/client-vs-server/SKILL.md +164 -0
  61. package/skills/column-faceting/SKILL.md +91 -0
  62. package/skills/column-filtering/SKILL.md +82 -0
  63. package/skills/column-ordering/SKILL.md +75 -0
  64. package/skills/column-pinning/SKILL.md +89 -0
  65. package/skills/column-resizing/SKILL.md +91 -0
  66. package/skills/column-sizing/SKILL.md +72 -0
  67. package/skills/column-visibility/SKILL.md +75 -0
  68. package/skills/core/SKILL.md +140 -0
  69. package/skills/custom-features/SKILL.md +207 -0
  70. package/skills/expanding/SKILL.md +80 -0
  71. package/skills/global-filtering/SKILL.md +84 -0
  72. package/skills/grouping/SKILL.md +50 -394
  73. package/skills/migrate-v8-to-v9/SKILL.md +230 -390
  74. package/skills/pagination/SKILL.md +35 -344
  75. package/skills/row-pinning/SKILL.md +47 -238
  76. package/skills/row-selection/SKILL.md +39 -351
  77. package/skills/sorting/SKILL.md +35 -299
  78. package/skills/table-features/SKILL.md +153 -0
  79. package/skills/typescript/SKILL.md +126 -0
  80. package/src/core/headers/buildHeaderGroups.ts +1 -1
  81. package/src/core/headers/coreHeadersFeature.utils.ts +7 -7
  82. package/src/core/table/coreTablesFeature.utils.ts +1 -1
  83. package/src/features/column-ordering/columnOrderingFeature.types.ts +5 -5
  84. package/src/features/column-ordering/columnOrderingFeature.utils.ts +9 -9
  85. package/src/features/column-pinning/columnPinningFeature.ts +64 -59
  86. package/src/features/column-pinning/columnPinningFeature.types.ts +49 -38
  87. package/src/features/column-pinning/columnPinningFeature.utils.ts +163 -155
  88. package/src/features/column-sizing/columnSizingFeature.ts +6 -6
  89. package/src/features/column-sizing/columnSizingFeature.types.ts +18 -12
  90. package/src/features/column-sizing/columnSizingFeature.utils.ts +31 -27
  91. package/src/features/column-visibility/columnVisibilityFeature.utils.ts +15 -15
  92. package/skills/column-definitions/SKILL.md +0 -330
  93. package/skills/column-layout/SKILL.md +0 -326
  94. package/skills/column-layout/references/subsystems.md +0 -220
  95. package/skills/customizing-feature-behavior/SKILL.md +0 -423
  96. package/skills/filtering/SKILL.md +0 -375
  97. package/skills/filtering/references/faceting-and-fuzzy.md +0 -218
  98. package/skills/row-expanding/SKILL.md +0 -356
  99. package/skills/setup/SKILL.md +0 -390
  100. package/skills/state-management/SKILL.md +0 -403
@@ -1,390 +0,0 @@
1
- ---
2
- name: setup
3
- description: >
4
- Install a TanStack Table v9 framework adapter and wire up a first table with
5
- `tableFeatures({...})` declaring `features` (which now also carries row model
6
- factories like `sortedRowModel: createSortedRowModel()`, `filteredRowModel:
7
- createFilteredRowModel()`, `paginatedRowModel: createPaginatedRowModel()`, and
8
- fn registries like `sortFns`/`filterFns`), a
9
- `createColumnHelper<typeof features, TData>()` column set, and the framework
10
- `useTable` / `injectTable` / `createTable` / `constructTable` entry point.
11
- Covers the registry model, why `features` must be module-scoped, when to reach
12
- for `stockFeatures`, and `coreFeatures`.
13
- type: core
14
- library: tanstack-table
15
- library_version: '9.0.0-alpha.48'
16
- requires:
17
- - state-management
18
- - column-definitions
19
- sources:
20
- - TanStack/table:docs/installation.md
21
- - TanStack/table:docs/overview.md
22
- - TanStack/table:docs/guide/tables.md
23
- - TanStack/table:docs/guide/features.md
24
- - TanStack/table:packages/table-core/src/index.ts
25
- - TanStack/table:examples/react/basic-use-table/src/main.tsx
26
- ---
27
-
28
- This skill builds on `tanstack-table/state-management` and `tanstack-table/column-definitions`. Read those first for the v9 atom model and the `createColumnHelper<typeof features, TData>()` shape.
29
-
30
- ## Setup
31
-
32
- TanStack Table v9 separates a framework-agnostic core (`@tanstack/table-core`) from per-framework adapters. Every table — vanilla or framework — must declare the `features` option at construction time: the registry of feature plugins, row model factories, and fn registries.
33
-
34
- ```ts
35
- // Framework-agnostic, using @tanstack/table-core directly.
36
- import {
37
- constructTable,
38
- tableFeatures,
39
- createColumnHelper,
40
- rowSortingFeature,
41
- createSortedRowModel,
42
- sortFns,
43
- } from '@tanstack/table-core'
44
-
45
- type Person = { firstName: string; lastName: string; age: number }
46
-
47
- // 1. Declare features at MODULE scope (stable reference). This is required —
48
- // a fresh `features` object on every call destroys feature registration.
49
- const features = tableFeatures({
50
- rowSortingFeature,
51
- // Row model factories and fn registries live on the features object.
52
- sortedRowModel: createSortedRowModel(),
53
- sortFns,
54
- })
55
-
56
- // 2. Build a column helper bound to BOTH TFeatures and TData.
57
- const columnHelper = createColumnHelper<typeof features, Person>()
58
-
59
- const columns = columnHelper.columns([
60
- columnHelper.accessor('firstName', { header: 'First' }),
61
- columnHelper.accessor('lastName', { header: 'Last' }),
62
- columnHelper.accessor('age', { header: 'Age', sortFn: 'alphanumeric' }),
63
- ])
64
-
65
- const data: Person[] = [
66
- { firstName: 'Ada', lastName: 'Lovelace', age: 36 },
67
- { firstName: 'Grace', lastName: 'Hopper', age: 85 },
68
- ]
69
-
70
- const table = constructTable({
71
- features,
72
- columns,
73
- data,
74
- })
75
-
76
- // Read header groups and row model to render.
77
- table.getHeaderGroups()
78
- table.getRowModel().rows
79
- ```
80
-
81
- Framework adapters wrap this with reactivity:
82
-
83
- | Framework | Entry point | Package |
84
- | ------------------------------ | ---------------------------------------------- | ------------------------- |
85
- | React, Preact, Vue, Solid, Lit | `useTable` / `createTable` / `TableController` | `@tanstack/<fw>-table` |
86
- | Angular | `injectTable` | `@tanstack/angular-table` |
87
- | Svelte 5 | `createTable` (runes) | `@tanstack/svelte-table` |
88
- | Vanilla JS | `constructTable` + `storeReactivityBindings()` | `@tanstack/table-core` |
89
-
90
- ## Core Patterns
91
-
92
- ### Minimum table (no extra features)
93
-
94
- ```ts
95
- const features = tableFeatures({}) // core features only
96
- const table = constructTable({
97
- features,
98
- columns,
99
- data,
100
- })
101
- ```
102
-
103
- `tableFeatures({})` is the canonical "I only want the core read pipeline" setup.
104
-
105
- ### Add features and their row models together
106
-
107
- ```ts
108
- import {
109
- rowSortingFeature,
110
- rowPaginationFeature,
111
- columnFilteringFeature,
112
- createSortedRowModel,
113
- createFilteredRowModel,
114
- createPaginatedRowModel,
115
- sortFns,
116
- filterFns,
117
- } from '@tanstack/table-core'
118
-
119
- const features = tableFeatures({
120
- rowSortingFeature,
121
- rowPaginationFeature,
122
- columnFilteringFeature,
123
- sortedRowModel: createSortedRowModel(),
124
- filteredRowModel: createFilteredRowModel(),
125
- paginatedRowModel: createPaginatedRowModel(),
126
- sortFns,
127
- filterFns,
128
- })
129
-
130
- const table = constructTable({
131
- features,
132
- columns,
133
- data,
134
- })
135
- ```
136
-
137
- Each feature and its row-model factory are registered together — TypeScript exposes the feature's APIs (`table.setSorting`, `table.nextPage`, `table.setColumnFilters`) only when its feature plugin is present in `features`.
138
-
139
- ### Vanilla JS reactivity binding
140
-
141
- ```ts
142
- import { constructTable, tableFeatures } from '@tanstack/table-core'
143
- import { storeReactivityBindings } from '@tanstack/table-core'
144
-
145
- const features = tableFeatures({})
146
-
147
- const table = constructTable({
148
- features,
149
- columns,
150
- data,
151
- // Use the vanilla binding when no framework adapter exists
152
- _processingMode: 'core',
153
- })
154
-
155
- // Subscribe to a slice
156
- const unsub = table.atoms.sorting.subscribe((sorting) => {
157
- console.log('sorting changed', sorting)
158
- })
159
- ```
160
-
161
- ### `stockFeatures` for v8-like "everything on"
162
-
163
- Reach for this only as a transitional aid. It re-introduces v8 bundle size (~15–20kb) and undoes v9's tree-shaking benefit.
164
-
165
- ```ts
166
- import { stockFeatures, tableFeatures } from '@tanstack/table-core'
167
-
168
- // Discouraged in new code. Register only what you use.
169
- const features = tableFeatures(stockFeatures)
170
- ```
171
-
172
- ## Common Mistakes
173
-
174
- ### [CRITICAL] API/state slice missing because the feature was not registered in `features`
175
-
176
- Wrong:
177
-
178
- ```ts
179
- // rowSortingFeature missing — table.setSorting / state.sorting unavailable
180
- const features = tableFeatures({}) // empty
181
- const table = useTable({ features, columns, data })
182
- table.setSorting([{ id: 'age', desc: true }]) // ❌ does not exist on this table type
183
- ```
184
-
185
- Correct:
186
-
187
- ```ts
188
- // Register every feature you intend to use; include its row model factory and fns
189
- const features = tableFeatures({
190
- rowSortingFeature,
191
- rowPaginationFeature,
192
- sortedRowModel: createSortedRowModel(),
193
- paginatedRowModel: createPaginatedRowModel(),
194
- sortFns,
195
- })
196
- const table = useTable({ features, columns, data })
197
- ```
198
-
199
- In v9, `features` is a tree-shakeable registry — TypeScript hides APIs for unregistered features and the runtime atom is never created. Agents who see `table.setColumnFilters` "missing" often incorrectly conclude the API was removed.
200
-
201
- Source: maintainer interview (Phase 4, 2026-05-17)
202
-
203
- ### [CRITICAL] Hallucinating v7 / v8 `useReactTable` + `getCoreRowModel()` shape
204
-
205
- Wrong:
206
-
207
- ```ts
208
- // v7
209
- import { useTable, useSortBy } from 'react-table'
210
- const table = useTable({ columns, data }, useSortBy)
211
-
212
- // v8
213
- import { useReactTable, getCoreRowModel } from '@tanstack/react-table'
214
- const table = useReactTable({
215
- columns,
216
- data,
217
- getCoreRowModel: getCoreRowModel(),
218
- })
219
- ```
220
-
221
- Correct:
222
-
223
- ```ts
224
- import {
225
- useTable,
226
- tableFeatures,
227
- rowSortingFeature,
228
- createSortedRowModel,
229
- sortFns,
230
- } from '@tanstack/react-table'
231
-
232
- const features = tableFeatures({
233
- rowSortingFeature,
234
- sortedRowModel: createSortedRowModel(),
235
- sortFns,
236
- })
237
- const table = useTable({ features, columns, data })
238
- ```
239
-
240
- v7→v8 and v8→v9 both reshaped the API substantially. Agents trained on older data confidently emit v7/v8 shapes; v9 requires `features` with row model factories registered on it.
241
-
242
- Source: maintainer interview (Phase 4, 2026-05-17)
243
-
244
- ### [HIGH] Calling `tableFeatures({})` inside the component body
245
-
246
- Wrong:
247
-
248
- ```tsx
249
- function MyTable() {
250
- // ❌ new object every render — destroys stable feature registration
251
- const features = tableFeatures({ rowSortingFeature })
252
- const table = useTable({ features, columns, data })
253
- }
254
- ```
255
-
256
- Correct:
257
-
258
- ```tsx
259
- // ✅ module-scoped, stable reference
260
- const features = tableFeatures({ rowSortingFeature })
261
-
262
- function MyTable() {
263
- const table = useTable({ features, columns, data })
264
- }
265
- ```
266
-
267
- A fresh `features` reference on each render churns the table's feature registry — the same way unstable `columns` or `data` cause infinite re-renders. Hoist to module scope or memoize.
268
-
269
- Source: docs/guide/data.md; examples/react/basic-use-table/src/main.tsx
270
-
271
- ### [HIGH] Adding a row-model factory without registering its feature
272
-
273
- Wrong:
274
-
275
- ```ts
276
- // rowSortingFeature missing — sortedRowModel is orphaned and never runs
277
- const features = tableFeatures({
278
- rowPaginationFeature,
279
- sortedRowModel: createSortedRowModel(), // no-op without rowSortingFeature
280
- paginatedRowModel: createPaginatedRowModel(),
281
- sortFns,
282
- })
283
- const table = useTable({ features, columns, data })
284
- ```
285
-
286
- Correct:
287
-
288
- ```ts
289
- const features = tableFeatures({
290
- rowSortingFeature,
291
- rowPaginationFeature,
292
- sortedRowModel: createSortedRowModel(),
293
- paginatedRowModel: createPaginatedRowModel(),
294
- sortFns,
295
- })
296
- const table = useTable({ features, columns, data })
297
- ```
298
-
299
- Row-model factories only run if their matching feature is in `features`. Runtime silently degrades.
300
-
301
- Source: docs/guide/row-models.md; examples/react/basic-external-atoms/src/main.tsx
302
-
303
- ### [CRITICAL] Reimplementing what built-in APIs already provide
304
-
305
- Wrong:
306
-
307
- ```ts
308
- // ❌ Reimplements sorting state manually instead of using the API
309
- const [sorting, setSorting] = useState([])
310
- const sortedData = useMemo(() => [...data].sort((a, b) => /* …custom… */), [data, sorting])
311
- // then uses sortedData directly, bypassing the table
312
- ```
313
-
314
- Correct:
315
-
316
- ```ts
317
- const features = tableFeatures({
318
- rowSortingFeature,
319
- sortedRowModel: createSortedRowModel(),
320
- sortFns,
321
- })
322
- const table = useTable({ features, columns, data })
323
- // then: table.setSorting(...), column.toggleSorting(), header.getToggleSortingHandler()
324
- ```
325
-
326
- TanStack Table IS a state-management coordinator. The maintainer flags hand-rolled state/sort/filter loops as the #1 tell that an AI wrote the code. Reach for `table.setSorting`, `row.toggleSelected`, `table.nextPage`, `table.setColumnFilters`, `column.toggleVisibility` first.
327
-
328
- Source: maintainer interview (Phase 4, 2026-05-17)
329
-
330
- ### [HIGH] Bundling `stockFeatures` when only a few features are used
331
-
332
- Wrong:
333
-
334
- ```ts
335
- // Pulls in every feature even though only sorting+pagination are used
336
- import { stockFeatures, tableFeatures } from '@tanstack/react-table'
337
- const features = tableFeatures(stockFeatures)
338
- ```
339
-
340
- Correct:
341
-
342
- ```ts
343
- import {
344
- tableFeatures,
345
- rowSortingFeature,
346
- rowPaginationFeature,
347
- } from '@tanstack/react-table'
348
- const features = tableFeatures({ rowSortingFeature, rowPaginationFeature })
349
- ```
350
-
351
- Tree-shaking via `features` is the headline reason for the v9 redesign. `stockFeatures` exists as a v8-style transitional escape hatch, not a default.
352
-
353
- Source: maintainer interview (Phase 4, 2026-05-17)
354
-
355
- ### [CRITICAL] Empty array literal for `data` causes infinite re-renders
356
-
357
- Wrong:
358
-
359
- ```tsx
360
- // ❌ Fresh [] each render — infinite loop when items is undefined
361
- const table = useTable({
362
- features,
363
- columns,
364
- data: items ?? [],
365
- })
366
- ```
367
-
368
- Correct:
369
-
370
- ```tsx
371
- // ✅ Hoist the empty fallback OR memoize
372
- const EMPTY: Person[] = []
373
-
374
- const table = useTable({
375
- features,
376
- columns,
377
- data: items ?? EMPTY,
378
- })
379
- // or: const data = useMemo(() => items ?? [], [items])
380
- ```
381
-
382
- A new `[]` reference each render means the table sees a fresh `data` prop and rebuilds row models. Top recurring beginner issue.
383
-
384
- Source: https://github.com/TanStack/table/issues/4566; https://github.com/TanStack/table/issues/6002
385
-
386
- ## See also
387
-
388
- - `tanstack-table/state-management` — atom model, ownership precedence, state slices
389
- - `tanstack-table/column-definitions` — `createColumnHelper<typeof features, TData>()` and `getRowId`
390
- - `tanstack-table/migrate-v8-to-v9` — full rename + restructure table for v8 → v9 upgrades