@tanstack/vue-table 9.0.0-beta.4 → 9.0.0-beta.40

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 (47) hide show
  1. package/README.md +1 -0
  2. package/dist/FlexRender.cjs +2 -3
  3. package/dist/FlexRender.cjs.map +1 -1
  4. package/dist/FlexRender.d.cts +30 -12
  5. package/dist/FlexRender.d.ts +30 -12
  6. package/dist/FlexRender.js +2 -3
  7. package/dist/FlexRender.js.map +1 -1
  8. package/dist/createTableHook.cjs +4 -9
  9. package/dist/createTableHook.cjs.map +1 -1
  10. package/dist/createTableHook.d.cts +49 -21
  11. package/dist/createTableHook.d.ts +49 -21
  12. package/dist/createTableHook.js +4 -9
  13. package/dist/createTableHook.js.map +1 -1
  14. package/dist/experimental-worker-plugin.cjs +9 -0
  15. package/dist/experimental-worker-plugin.d.cts +1 -0
  16. package/dist/experimental-worker-plugin.d.ts +1 -0
  17. package/dist/experimental-worker-plugin.js +3 -0
  18. package/dist/flex-render.d.cts +2 -2
  19. package/dist/flex-render.d.ts +2 -2
  20. package/dist/index.d.cts +3 -3
  21. package/dist/index.d.ts +3 -3
  22. package/dist/reactivity.cjs +2 -6
  23. package/dist/reactivity.cjs.map +1 -1
  24. package/dist/reactivity.js +2 -6
  25. package/dist/reactivity.js.map +1 -1
  26. package/dist/useTable.cjs +3 -7
  27. package/dist/useTable.cjs.map +1 -1
  28. package/dist/useTable.d.cts +1 -8
  29. package/dist/useTable.d.ts +1 -8
  30. package/dist/useTable.js +3 -7
  31. package/dist/useTable.js.map +1 -1
  32. package/package.json +8 -4
  33. package/skills/vue/client-to-server/SKILL.md +21 -26
  34. package/skills/vue/compose-with-tanstack-form/SKILL.md +4 -4
  35. package/skills/vue/compose-with-tanstack-pacer/SKILL.md +6 -3
  36. package/skills/vue/compose-with-tanstack-query/SKILL.md +18 -20
  37. package/skills/vue/compose-with-tanstack-store/SKILL.md +7 -6
  38. package/skills/vue/compose-with-tanstack-virtual/SKILL.md +8 -4
  39. package/skills/vue/getting-started/SKILL.md +55 -49
  40. package/skills/vue/migrate-v8-to-v9/SKILL.md +50 -32
  41. package/skills/vue/production-readiness/SKILL.md +28 -21
  42. package/skills/vue/table-state/SKILL.md +22 -26
  43. package/src/FlexRender.ts +28 -13
  44. package/src/createTableHook.ts +112 -20
  45. package/src/experimental-worker-plugin.ts +1 -0
  46. package/src/reactivity.ts +1 -2
  47. package/src/useTable.ts +3 -11
@@ -3,7 +3,7 @@ name: vue/client-to-server
3
3
  description: >
4
4
  Convert a client-side `@tanstack/vue-table` to server-side. Set `manualPagination` /
5
5
  `manualSorting` / `manualFiltering` / `manualGrouping` / `manualExpanding` for whichever
6
- slices the server owns; drop the matching `rowModels` factories (don't ship
6
+ slices the server owns; omit the matching row model factory from `tableFeatures` (don't ship
7
7
  `paginatedRowModel` when the server paginates); supply `rowCount` so `table.getPageCount()`
8
8
  works; own the relevant state slices via either external atoms (`@tanstack/vue-store`
9
9
  `createAtom` + `options.atoms`) or `state` + `on[State]Change` with getter wrappers. Key any
@@ -87,10 +87,9 @@ watchEffect(() => {
87
87
  if (next != null) rowCount.value = next // keep last known total for pager UI
88
88
  })
89
89
 
90
- // 3) Manual pagination + `rowCount`. NO paginatedRowModel in `rowModels` — server paginates.
90
+ // 3) Manual pagination + `rowCount`. No paginatedRowModel in features — server paginates.
91
91
  const table = useTable({
92
92
  features,
93
- rowModels: {},
94
93
  columns,
95
94
  data: tableData,
96
95
  rowCount,
@@ -104,18 +103,19 @@ Source: `examples/vue/with-tanstack-query/src/App.tsx`, `examples/vue/basic-exte
104
103
 
105
104
  ## Core Patterns
106
105
 
107
- ### 1. The `manual*` flag + `rowModels` drop pair
106
+ ### 1. The `manual*` flag + factory omission pair
108
107
 
109
- Pick which slices live server-side and flip the matching `manual*` flag. **Also drop the
110
- matching `rowModels` factory** — otherwise the table re-processes server-processed rows.
108
+ Pick which slices live server-side and flip the matching `manual*` flag. **Also omit the
109
+ matching row model factory from `tableFeatures`** — otherwise the table re-processes
110
+ server-processed rows.
111
111
 
112
- | Server owns | Set | Drop from `rowModels` |
113
- | ----------- | ------------------------ | --------------------- |
114
- | Pagination | `manualPagination: true` | `paginatedRowModel` |
115
- | Sorting | `manualSorting: true` | `sortedRowModel` |
116
- | Filtering | `manualFiltering: true` | `filteredRowModel` |
117
- | Grouping | `manualGrouping: true` | `groupedRowModel` |
118
- | Expanding | `manualExpanding: true` | `expandedRowModel` |
112
+ | Server owns | Set | Omit from `tableFeatures` |
113
+ | ----------- | ------------------------ | ------------------------- |
114
+ | Pagination | `manualPagination: true` | `paginatedRowModel` |
115
+ | Sorting | `manualSorting: true` | `sortedRowModel` |
116
+ | Filtering | `manualFiltering: true` | `filteredRowModel` |
117
+ | Grouping | `manualGrouping: true` | `groupedRowModel` |
118
+ | Expanding | `manualExpanding: true` | `expandedRowModel` |
119
119
 
120
120
  Column visibility / ordering / pinning / row selection are client-side state and stay as-is.
121
121
 
@@ -127,7 +127,6 @@ Without `rowCount`, `getPageCount()` falls back to `Math.ceil(data.length / page
127
127
  ```ts
128
128
  useTable({
129
129
  features,
130
- rowModels: {},
131
130
  columns,
132
131
  data: tableData,
133
132
  rowCount: dataQuery.data.value?.rowCount, // or a stable ref/computed
@@ -151,7 +150,6 @@ const paginationAtom = createAtom<PaginationState>({
151
150
  })
152
151
  useTable({
153
152
  features,
154
- rowModels: {},
155
153
  columns,
156
154
  data,
157
155
  rowCount,
@@ -169,7 +167,6 @@ const pagination = ref<PaginationState>({ pageIndex: 0, pageSize: 10 })
169
167
 
170
168
  useTable({
171
169
  features,
172
- rowModels: {},
173
170
  columns,
174
171
  data,
175
172
  rowCount,
@@ -230,7 +227,6 @@ the table will paginate that 10-row slice again and show "Page 1 of 1".
230
227
  // ❌
231
228
  useTable({
232
229
  features,
233
- rowModels: {},
234
230
  columns,
235
231
  data: serverPage.rows,
236
232
  rowCount,
@@ -243,13 +239,13 @@ useTable({
243
239
 
244
240
  ```ts
245
241
  // ❌ Factory ships for nothing AND the table re-paginates server-sliced data.
246
- rowModels: {
247
- paginatedRowModel: createPaginatedRowModel()
248
- }
242
+ const features = tableFeatures({
243
+ rowPaginationFeature,
244
+ paginatedRowModel: createPaginatedRowModel(),
245
+ })
249
246
 
250
- // ✅
251
- rowModels: {
252
- }
247
+ // ✅ Omit the factory when the server paginates; keep the feature for its API.
248
+ const features = tableFeatures({ rowPaginationFeature })
253
249
  ```
254
250
 
255
251
  Same applies to `sortedRowModel`, `filteredRowModel`, `groupedRowModel`, `expandedRowModel`
@@ -267,7 +263,6 @@ when the server owns the slice.
267
263
  const pagination = ref({ pageIndex: 0, pageSize: 10 })
268
264
  useTable({
269
265
  features,
270
- rowModels: {},
271
266
  columns,
272
267
  data,
273
268
  rowCount,
@@ -350,8 +345,8 @@ table.setColumnFilters(/* ... */)
350
345
  ### "API missing" because the feature isn't in `features` (CRITICAL — v9-specific)
351
346
 
352
347
  Server-side pagination still needs `rowPaginationFeature` in `tableFeatures({...})` — that's
353
- what surfaces `table.setPageIndex`, `table.nextPage`, `table.getPageCount`. The factory in
354
- `rowModels` is what you drop; the feature stays.
348
+ what surfaces `table.setPageIndex`, `table.nextPage`, `table.getPageCount`. The row model
349
+ factory (`paginatedRowModel`) is what you omit; the feature stays.
355
350
 
356
351
  ```ts
357
352
  const features = tableFeatures({ rowPaginationFeature }) // ✅ even with manualPagination
@@ -60,7 +60,10 @@ type Person = {
60
60
  }
61
61
  type FormRow = Omit<Person, 'subRows'> // <-- avoid TS2589 in form DeepKeys
62
62
 
63
- const features = tableFeatures({ rowPaginationFeature })
63
+ const features = tableFeatures({
64
+ rowPaginationFeature,
65
+ paginatedRowModel: createPaginatedRowModel(),
66
+ })
64
67
  const columnHelper = createColumnHelper<typeof features, FormRow>()
65
68
 
66
69
  // 2) Form owns the data array. The table reads it.
@@ -99,7 +102,6 @@ const columns = computed(() =>
99
102
 
100
103
  const table = useTable({
101
104
  features,
102
- rowModels: { paginatedRowModel: createPaginatedRowModel() },
103
105
  get columns() {
104
106
  return columns.value
105
107
  },
@@ -191,7 +193,6 @@ const form = useForm({ defaultValues: { data: makeData(100) } })
191
193
 
192
194
  const table = useTable({
193
195
  features,
194
- rowModels: { paginatedRowModel: createPaginatedRowModel() },
195
196
  columns,
196
197
  get data() {
197
198
  return form.state.values.data
@@ -324,7 +325,6 @@ const columns = computed(() =>
324
325
  )
325
326
  const table = useTable({
326
327
  features,
327
- rowModels: {},
328
328
  get columns() {
329
329
  return columns.value
330
330
  },
@@ -150,7 +150,6 @@ const throttler = new Throttler(
150
150
 
151
151
  useTable({
152
152
  features,
153
- rowModels: {},
154
153
  columns,
155
154
  data,
156
155
  state: {
@@ -301,8 +300,12 @@ useTable({ ..., data: filtered })
301
300
  ```ts
302
301
  // ✅ Use the table's filter feature; debounce the writer.
303
302
  useTable({
304
- features: tableFeatures({ columnFilteringFeature, globalFilteringFeature }),
305
- rowModels: { filteredRowModel: createFilteredRowModel(filterFns) },
303
+ features: tableFeatures({
304
+ columnFilteringFeature,
305
+ globalFilteringFeature,
306
+ filteredRowModel: createFilteredRowModel(),
307
+ filterFns,
308
+ }),
306
309
  columns,
307
310
  data,
308
311
  })
@@ -4,12 +4,12 @@ description: >
4
4
  Server-side / async data flow for `@tanstack/vue-table` v9 + `@tanstack/vue-query`. Key the
5
5
  `useQuery` query on the table state that drives the request (pagination + sorting + filters).
6
6
  Set `manualPagination` / `manualSorting` / `manualFiltering` for slices the server owns.
7
- Drop the matching `rowModels` factory (don't ship `paginatedRowModel` when the server
8
- paginates). Pass `rowCount` so `table.getPageCount()` works without all rows in memory. Pass
9
- `placeholderData: keepPreviousData` to avoid a "0 rows flash" between pages. The cleanest
10
- wiring uses external `createAtom`s + `options.atoms` so the table writes through to the atom
11
- and the query refetches with no `on[State]Change` plumbing. The canonical Vue example is at
12
- `examples/vue/with-tanstack-query/`.
7
+ Omit the matching row model factory from `tableFeatures` (don't ship `paginatedRowModel` when
8
+ the server paginates). Pass `rowCount` so `table.getPageCount()` works without all rows in
9
+ memory. Pass `placeholderData: keepPreviousData` to avoid a "0 rows flash" between pages. The
10
+ cleanest wiring uses external `createAtom`s + `options.atoms` so the table writes through to
11
+ the atom and the query refetches with no `on[State]Change` plumbing. The canonical Vue example
12
+ is at `examples/vue/with-tanstack-query/`.
13
13
  type: composition
14
14
  library: tanstack-table
15
15
  framework: vue
@@ -87,10 +87,9 @@ watchEffect(() => {
87
87
  if (next != null) rowCount.value = next
88
88
  })
89
89
 
90
- // 5) Manual pagination. No paginatedRowModel — server paginates.
90
+ // 5) Manual pagination. No paginatedRowModel in features — server paginates.
91
91
  const table = useTable({
92
92
  features,
93
- rowModels: {},
94
93
  columns,
95
94
  data: tableData,
96
95
  rowCount,
@@ -219,12 +218,12 @@ const dataQuery = useQuery(() => ({
219
218
  }))
220
219
 
221
220
  const table = useTable({
221
+ // server owns all three slices — no row model factories registered
222
222
  features: tableFeatures({
223
223
  rowSortingFeature,
224
224
  rowPaginationFeature,
225
225
  columnFilteringFeature,
226
226
  }),
227
- rowModels: {}, // server owns all three
228
227
  columns,
229
228
  data: computed(() => dataQuery.data.value?.rows ?? EMPTY),
230
229
  rowCount,
@@ -265,7 +264,6 @@ Query tells it. Always invalidate on writes.
265
264
  // ❌ Table re-paginates the already-paginated server response.
266
265
  useTable({
267
266
  features,
268
- rowModels: {},
269
267
  columns,
270
268
  data: tableData,
271
269
  rowCount,
@@ -286,13 +284,13 @@ server already paginated. The pager locks at "Page 1 of 1".
286
284
 
287
285
  ```ts
288
286
  // ❌ Ships the factory for nothing AND it tries to paginate server-paginated data.
289
- rowModels: {
290
- paginatedRowModel: createPaginatedRowModel()
291
- }
287
+ const features = tableFeatures({
288
+ rowPaginationFeature,
289
+ paginatedRowModel: createPaginatedRowModel(),
290
+ })
292
291
 
293
- // ✅
294
- rowModels: {
295
- }
292
+ // ✅ Omit the factory when the server paginates.
293
+ const features = tableFeatures({ rowPaginationFeature })
296
294
  ```
297
295
 
298
296
  ### Forgetting controlled state in `queryKey` (CRITICAL)
@@ -350,14 +348,14 @@ Same hooks names, different reactivity model (function-returning-options instead
350
348
 
351
349
  ### Hallucinating pre-v9 table APIs (CRITICAL)
352
350
 
353
- `useVueTable` + `getCoreRowModel: getCoreRowModel()` is v8. v9 uses `useTable` +
354
- `features` + `rowModels`. See `tanstack-table/vue/migrate-v8-to-v9`.
351
+ `useVueTable` + `getCoreRowModel: getCoreRowModel()` is v8. v9 uses `useTable` + `features`
352
+ with row model factories as slots. See `tanstack-table/vue/migrate-v8-to-v9`.
355
353
 
356
354
  ### "API missing" because feature not in `features` (CRITICAL — v9-specific)
357
355
 
358
356
  Server-side pagination still needs `rowPaginationFeature` in `tableFeatures({...})`. The
359
- feature gives you `table.nextPage` / `table.setPageIndex` / `table.getPageCount`. The
360
- `rowModels` factory is what you drop; the feature stays.
357
+ feature gives you `table.nextPage` / `table.setPageIndex` / `table.getPageCount`. The row
358
+ model factory (`paginatedRowModel`) is what you omit; the feature stays.
361
359
 
362
360
  ### Reimplementing pagination loop manually (CRITICAL — #1 AI tell)
363
361
 
@@ -57,7 +57,13 @@ import {
57
57
 
58
58
  type Person = { firstName: string; lastName: string; age: number }
59
59
 
60
- const features = tableFeatures({ rowSortingFeature, rowPaginationFeature })
60
+ const features = tableFeatures({
61
+ rowSortingFeature,
62
+ rowPaginationFeature,
63
+ sortedRowModel: createSortedRowModel(),
64
+ paginatedRowModel: createPaginatedRowModel(),
65
+ sortFns,
66
+ })
61
67
  const columnHelper = createColumnHelper<typeof features, Person>()
62
68
  const columns = columnHelper.columns([
63
69
  columnHelper.accessor('firstName', { header: 'First' }),
@@ -82,10 +88,6 @@ const data = ref<Person[]>([])
82
88
  // `table.setSorting()` writes through to your atom.
83
89
  const table = useTable({
84
90
  features,
85
- rowModels: {
86
- sortedRowModel: createSortedRowModel(sortFns),
87
- paginatedRowModel: createPaginatedRowModel(),
88
- },
89
91
  columns,
90
92
  data,
91
93
  atoms: {
@@ -141,7 +143,6 @@ options.atoms[slice] > options.state[slice] > table.baseAtoms[slice]
141
143
  // ❌ Passing both for the SAME slice. `atoms.sorting` wins; `state.sorting` is silently dead.
142
144
  useTable({
143
145
  features,
144
- rowModels: {},
145
146
  columns,
146
147
  data,
147
148
  state: {
@@ -56,7 +56,12 @@ import {
56
56
  import { useVirtualizer } from '@tanstack/vue-virtual'
57
57
  import { makeData, type Person } from './makeData'
58
58
 
59
- const features = tableFeatures({ columnSizingFeature, rowSortingFeature })
59
+ const features = tableFeatures({
60
+ columnSizingFeature,
61
+ rowSortingFeature,
62
+ sortedRowModel: createSortedRowModel(),
63
+ sortFns,
64
+ })
60
65
 
61
66
  const columns: ColumnDef<typeof features, Person>[] = [
62
67
  { accessorKey: 'firstName' },
@@ -68,7 +73,6 @@ const data = ref<Person[]>(makeData(50_000))
68
73
 
69
74
  const table = useTable({
70
75
  features,
71
- rowModels: { sortedRowModel: createSortedRowModel(sortFns) },
72
76
  columns,
73
77
  data,
74
78
  })
@@ -322,8 +326,8 @@ in Vue, not a plain object.
322
326
  ### "API missing" — `getRowModel` returns nothing (CRITICAL — v9-specific)
323
327
 
324
328
  If `table.getRowModel().rows` is empty when data is loaded, the row-model feature for whatever
325
- slice you need (filtering/sorting/grouping) isn't registered. Add it to `tableFeatures({...})`
326
- and `rowModels`.
329
+ slice you need (filtering/sorting/grouping) isn't registered. Add the feature, its factory, and
330
+ its fn registry to `tableFeatures({...})`.
327
331
 
328
332
  ### Reimplementing virtualization manually (CRITICAL — #1 AI tell)
329
333
 
@@ -2,11 +2,11 @@
2
2
  name: vue/getting-started
3
3
  description: >
4
4
  End-to-end first-table walkthrough for `@tanstack/vue-table` v9. Install the adapter, declare
5
- `features` via `tableFeatures({})`, declare `rowModels` with their `*Fns` parameters
6
- (`createSortedRowModel(sortFns)`, `createPaginatedRowModel()`, …), build a column helper with
7
- both `TFeatures` and `TData` generics, instantiate `useTable(options, selector?)` from a
8
- `<script setup>` block, and render with `<FlexRender :cell="cell" />` / `:header="header"`.
9
- New users land here, not on legacy v8 names like `useVueTable`.
5
+ `features` via `tableFeatures({})` (row model factories and fn registries live here as slots),
6
+ build a column helper with both `TFeatures` and `TData` generics, instantiate
7
+ `useTable(options, selector?)` from a `<script setup>` block, and render with
8
+ `<FlexRender :cell="cell" />` / `:header="header"`. New users land here, not on legacy v8
9
+ names like `useVueTable`.
10
10
  type: lifecycle
11
11
  library: tanstack-table
12
12
  framework: vue
@@ -69,7 +69,6 @@ const data = ref<Person[]>([
69
69
 
70
70
  const table = useTable({
71
71
  features,
72
- rowModels: {}, // required — core row model is automatic
73
72
  columns,
74
73
  data,
75
74
  })
@@ -100,8 +99,8 @@ Source: `examples/vue/basic-use-table/src/App.tsx`, `docs/framework/vue/vue-tabl
100
99
  ### What's mandatory in v9
101
100
 
102
101
  - `features` — built via `tableFeatures({...})`. Empty object is fine for a no-features table,
103
- but the option key must exist.
104
- - `rowModels` — `{}` is fine (core row model is automatic). Register factories per feature.
102
+ but the option key must exist. Row model factories and fn registries go here as slots, not
103
+ as a separate `rowModels` option.
105
104
  - `createColumnHelper<typeof features, Person>()` — two generics, in that order. The v8 single
106
105
  generic does not compile.
107
106
 
@@ -122,7 +121,11 @@ import {
122
121
  useTable,
123
122
  } from '@tanstack/vue-table'
124
123
 
125
- const features = tableFeatures({ rowSortingFeature })
124
+ const features = tableFeatures({
125
+ rowSortingFeature,
126
+ sortedRowModel: createSortedRowModel(),
127
+ sortFns,
128
+ })
126
129
  const columnHelper = createColumnHelper<typeof features, Person>()
127
130
  const columns = columnHelper.columns([
128
131
  columnHelper.accessor('firstName', { header: 'First' }),
@@ -133,7 +136,6 @@ const data = ref<Person[]>([])
133
136
 
134
137
  const table = useTable({
135
138
  features,
136
- rowModels: { sortedRowModel: createSortedRowModel(sortFns) },
137
139
  columns,
138
140
  data,
139
141
  })
@@ -159,10 +161,10 @@ const table = useTable({
159
161
 
160
162
  Three rules:
161
163
 
162
- 1. Register the feature in `features` (`rowSortingFeature`).
163
- 2. Provide the matching row model factory in `rowModels`
164
- (`sortedRowModel: createSortedRowModel(sortFns)`). The factory **requires its `*Fns`
165
- parameter** in v9 — this is what makes filter/sort registries tree-shakeable.
164
+ 1. Register the feature in `features` (`rowSortingFeature`) along with its row model factory
165
+ and fn registry as slots on the same object.
166
+ 2. The fn registry (`sortFns`) is what makes filter/sort registries tree-shakeable in v9 — do
167
+ not drop it.
166
168
  3. Wire UI to the built-in API: `column.getToggleSortingHandler()`, `column.getIsSorted()`.
167
169
  Do not reimplement sort logic.
168
170
 
@@ -187,13 +189,12 @@ const features = tableFeatures({
187
189
  rowSortingFeature,
188
190
  rowPaginationFeature,
189
191
  columnFilteringFeature,
190
- })
191
-
192
- const rowModels = {
193
- sortedRowModel: createSortedRowModel(sortFns),
194
- filteredRowModel: createFilteredRowModel(filterFns),
192
+ sortedRowModel: createSortedRowModel(),
193
+ filteredRowModel: createFilteredRowModel(),
195
194
  paginatedRowModel: createPaginatedRowModel(),
196
- }
195
+ sortFns,
196
+ filterFns,
197
+ })
197
198
  ```
198
199
 
199
200
  Then use `table.nextPage()`, `table.setPageIndex(0)`, `table.setColumnFilters(...)`,
@@ -201,7 +202,7 @@ Then use `table.nextPage()`, `table.setPageIndex(0)`, `table.setColumnFilters(..
201
202
 
202
203
  ### 3. App-scoped tables with `createTableHook`
203
204
 
204
- If multiple tables in your app share `features`, `rowModels`, and conventions, prefer
205
+ If multiple tables in your app share a `features` object (with its row model factories and conventions), prefer
205
206
  `createTableHook`. The hook factory returns `useAppTable`, `createAppColumnHelper`, plus
206
207
  context helpers (`useTableContext`, `useCellContext`, `useHeaderContext`).
207
208
 
@@ -217,14 +218,16 @@ import {
217
218
  tableFeatures,
218
219
  } from '@tanstack/vue-table'
219
220
 
220
- const features = tableFeatures({ rowSortingFeature, rowPaginationFeature })
221
+ const features = tableFeatures({
222
+ rowSortingFeature,
223
+ rowPaginationFeature,
224
+ sortedRowModel: createSortedRowModel(),
225
+ paginatedRowModel: createPaginatedRowModel(),
226
+ sortFns,
227
+ })
221
228
 
222
229
  export const { useAppTable, createAppColumnHelper } = createTableHook({
223
230
  features,
224
- rowModels: {
225
- sortedRowModel: createSortedRowModel(sortFns),
226
- paginatedRowModel: createPaginatedRowModel(),
227
- },
228
231
  })
229
232
  ```
230
233
 
@@ -274,7 +277,6 @@ export default defineComponent({
274
277
  const data = ref<Person[]>([])
275
278
  const table = useTable({
276
279
  features,
277
- rowModels: {},
278
280
  columns,
279
281
  get data() {
280
282
  return data.value
@@ -304,7 +306,7 @@ Source: `examples/vue/basic-use-table/src/App.tsx`.
304
306
 
305
307
  ## Common Mistakes
306
308
 
307
- ### Omitting `features` or `rowModels` (CRITICAL)
309
+ ### Omitting `features` (CRITICAL)
308
310
 
309
311
  ```ts
310
312
  // ❌ TS error: Property 'features' is missing in type ...
@@ -312,10 +314,10 @@ const table = useTable({ columns, data })
312
314
 
313
315
  // ✅
314
316
  const features = tableFeatures({})
315
- const table = useTable({ features, rowModels: {}, columns, data })
317
+ const table = useTable({ features, columns, data })
316
318
  ```
317
319
 
318
- Both keys are required even for the simplest table.
320
+ `features` is required even for the simplest table.
319
321
 
320
322
  ### Wrong `createColumnHelper` arity (CRITICAL)
321
323
 
@@ -327,20 +329,25 @@ const columnHelper = createColumnHelper<Person>()
327
329
  const columnHelper = createColumnHelper<typeof features, Person>()
328
330
  ```
329
331
 
330
- ### Calling row-model factories without their `*Fns` parameter (CRITICAL)
332
+ ### Omitting the `*Fns` registry from `tableFeatures` (CRITICAL)
331
333
 
332
334
  ```ts
333
- // ❌ TS error / runtime missing fns.
334
- rowModels: {
335
- sortedRowModel: createSortedRowModel(),
336
- filteredRowModel: createFilteredRowModel(),
337
- }
335
+ // ❌ TS error / runtime missing fns — sort is a no-op.
336
+ const features = tableFeatures({
337
+ rowSortingFeature,
338
+ sortedRowModel: createSortedRowModel(),
339
+ // sortFns missing!
340
+ })
338
341
 
339
- // ✅ Pass the matching registry.
340
- rowModels: {
341
- sortedRowModel: createSortedRowModel(sortFns),
342
- filteredRowModel: createFilteredRowModel(filterFns),
343
- }
342
+ // ✅ Register the fn map as a slot alongside the factory.
343
+ const features = tableFeatures({
344
+ rowSortingFeature,
345
+ columnFilteringFeature,
346
+ sortedRowModel: createSortedRowModel(),
347
+ filteredRowModel: createFilteredRowModel(),
348
+ sortFns,
349
+ filterFns,
350
+ })
344
351
  ```
345
352
 
346
353
  This is what makes v9 tree-shakeable. Filter/sort/aggregation registries are open-ended — do
@@ -351,17 +358,16 @@ not cite a number of built-in fns; just pass `filterFns` / `sortFns` / `aggregat
351
358
  ```ts
352
359
  // ❌ `rowSortingFeature` not registered → `table.setSorting` is `undefined` and a TS error.
353
360
  const features = tableFeatures({})
354
- const table = useTable({ features, rowModels: {}, columns, data })
361
+ const table = useTable({ features, columns, data })
355
362
  table.setSorting([{ id: 'age', desc: true }]) // missing
356
363
 
357
- // ✅ Register the feature AND its row model.
358
- const features = tableFeatures({ rowSortingFeature })
359
- const table = useTable({
360
- features,
361
- rowModels: { sortedRowModel: createSortedRowModel(sortFns) },
362
- columns,
363
- data,
364
+ // ✅ Register the feature, its row model factory, and its fn registry in tableFeatures.
365
+ const features = tableFeatures({
366
+ rowSortingFeature,
367
+ sortedRowModel: createSortedRowModel(),
368
+ sortFns,
364
369
  })
370
+ const table = useTable({ features, columns, data })
365
371
  ```
366
372
 
367
373
  This is the #1 v9-specific failure mode — features must be declared to surface their APIs.