@tanstack/vue-table 9.0.0-beta.2 → 9.0.0-beta.20

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 (39) hide show
  1. package/dist/FlexRender.cjs.map +1 -1
  2. package/dist/FlexRender.d.cts +30 -12
  3. package/dist/FlexRender.d.ts +30 -12
  4. package/dist/FlexRender.js.map +1 -1
  5. package/dist/createTableHook.cjs +23 -64
  6. package/dist/createTableHook.cjs.map +1 -1
  7. package/dist/createTableHook.d.cts +16 -20
  8. package/dist/createTableHook.d.ts +16 -20
  9. package/dist/createTableHook.js +23 -64
  10. package/dist/createTableHook.js.map +1 -1
  11. package/dist/flex-render.d.cts +2 -2
  12. package/dist/flex-render.d.ts +2 -2
  13. package/dist/index.d.cts +3 -3
  14. package/dist/index.d.ts +3 -3
  15. package/dist/reactivity.cjs +10 -19
  16. package/dist/reactivity.cjs.map +1 -1
  17. package/dist/reactivity.js +10 -19
  18. package/dist/reactivity.js.map +1 -1
  19. package/dist/useTable.cjs +12 -20
  20. package/dist/useTable.cjs.map +1 -1
  21. package/dist/useTable.d.cts +14 -48
  22. package/dist/useTable.d.ts +14 -48
  23. package/dist/useTable.js +13 -21
  24. package/dist/useTable.js.map +1 -1
  25. package/package.json +4 -4
  26. package/skills/vue/client-to-server/SKILL.md +21 -26
  27. package/skills/vue/compose-with-tanstack-form/SKILL.md +4 -4
  28. package/skills/vue/compose-with-tanstack-pacer/SKILL.md +6 -3
  29. package/skills/vue/compose-with-tanstack-query/SKILL.md +18 -20
  30. package/skills/vue/compose-with-tanstack-store/SKILL.md +7 -6
  31. package/skills/vue/compose-with-tanstack-virtual/SKILL.md +8 -4
  32. package/skills/vue/getting-started/SKILL.md +55 -49
  33. package/skills/vue/migrate-v8-to-v9/SKILL.md +50 -32
  34. package/skills/vue/production-readiness/SKILL.md +28 -21
  35. package/skills/vue/table-state/SKILL.md +22 -26
  36. package/src/FlexRender.ts +28 -13
  37. package/src/createTableHook.ts +18 -82
  38. package/src/reactivity.ts +17 -43
  39. package/src/useTable.ts +25 -96
@@ -1,76 +1,42 @@
1
- import { NoInfer, RowData, Table, TableFeatures, TableOptions, TableState } from "@tanstack/table-core";
2
- import { Atom, ReadonlyAtom, ReadonlyStore, Store } from "@tanstack/vue-store";
1
+ import { RowData, Table, TableFeatures, TableOptions } from "@tanstack/table-core";
3
2
  import { MaybeRef, VNode } from "vue";
4
3
 
5
4
  //#region src/useTable.d.ts
6
- type SubscribeSource<TValue> = Atom<TValue> | ReadonlyAtom<TValue> | Store<TValue> | ReadonlyStore<TValue>;
7
5
  type TableOptionsWithReactiveData<TFeatures extends TableFeatures, TData extends RowData> = { [K in keyof TableOptions<TFeatures, TData>]: K extends 'data' ? MaybeRef<ReadonlyArray<TData>> : MaybeRef<TableOptions<TFeatures, TData>[K]> };
8
- type VueTable<TFeatures extends TableFeatures, TData extends RowData, TSelected = TableState<TFeatures>> = Omit<Table<TFeatures, TData>, 'store'> & {
6
+ type VueTable<TFeatures extends TableFeatures, TData extends RowData> = Omit<Table<TFeatures, TData>, 'store'> & {
9
7
  /**
10
- * @deprecated Prefer `table.state` for render reads,
11
- * `table.atoms.<slice>.get()` for slice snapshots, or
12
- * `table.Subscribe` / `useSelector(table.store, selector)` for explicit
13
- * subscriptions. `table.store.state` is a current-value snapshot and is easy
14
- * to misuse in render code.
8
+ * @deprecated Prefer `table.atoms.<slice>.get()` for slice snapshots, or
9
+ * `table.Subscribe` for explicit subscriptions. `table.store.state` is a
10
+ * current-value snapshot and is easy to misuse in render code.
15
11
  */
16
12
  readonly store: Table<TFeatures, TData>['store'];
17
- /**
18
- * Store mode: `selector` required. Source mode: pass `source` (atom or store); omit
19
- * `selector` for the whole value (identity), or pass `selector` to project. Split
20
- * overloads so source-only infers `TSourceValue` for `children` (see React `Subscribe`).
21
- */
22
- Subscribe: {
23
- <TSourceValue>(props: {
24
- source: SubscribeSource<TSourceValue>;
25
- selector?: undefined;
26
- children: ((state: Readonly<TSourceValue>) => VNode | Array<VNode>) | VNode | Array<VNode>;
27
- }): VNode | Array<VNode>;
28
- <TSourceValue, TSubSelected>(props: {
29
- source: SubscribeSource<TSourceValue>;
30
- selector: (state: TSourceValue) => TSubSelected;
31
- children: ((state: Readonly<TSubSelected>) => VNode | Array<VNode>) | VNode | Array<VNode>;
32
- }): VNode | Array<VNode>;
33
- <TSubSelected>(props: {
34
- selector: (state: NoInfer<TableState<TFeatures>>) => TSubSelected;
35
- children: ((state: Readonly<TSubSelected>) => VNode | Array<VNode>) | VNode | Array<VNode>;
36
- }): VNode | Array<VNode>;
37
- };
38
- /**
39
- * The selected state of the table. This state may not match the structure of
40
- * the full table state because it is selected by the selector function that
41
- * you pass as the 2nd argument to `useTable`.
42
- *
43
- * @example
44
- * const table = useTable(options, (state) => ({ globalFilter: state.globalFilter })) // only globalFilter is part of the selected state
45
- *
46
- * console.log(table.state.globalFilter)
13
+ /** Creates a reactive render boundary. The child function reads the table
14
+ * atoms it needs, so Vue only tracks those atom reads.
47
15
  */
48
- readonly state: Readonly<TSelected>;
16
+ Subscribe: (props: {
17
+ children: (atoms: Table<TFeatures, TData>['atoms']) => VNode | Array<VNode>;
18
+ }) => VNode | Array<VNode>;
49
19
  };
50
20
  /**
51
21
  * Creates a Vue table instance backed by Vue-aware TanStack Store atoms.
52
22
  *
53
23
  * Table options may contain Vue refs or computed values. The adapter unwraps
54
24
  * those reactive inputs, watches them with synchronous flushing, and keeps the
55
- * table options in sync. The optional selector projects from `table.store` and
56
- * exposes the selected value on `table.state`.
25
+ * table options in sync. Use `table.Subscribe` or native Vue computed values
26
+ * around `table.atoms.<slice>.get()` for selected reactive reads.
57
27
  *
58
28
  * @example
59
29
  * ```ts
60
30
  * const table = useTable(
61
31
  * {
62
32
  * features,
63
- * rowModels: {},
64
33
  * columns,
65
34
  * data,
66
35
  * },
67
- * (state) => ({ pagination: state.pagination }),
68
36
  * )
69
- *
70
- * table.state.pagination
71
37
  * ```
72
38
  */
73
- declare function useTable<TFeatures extends TableFeatures, TData extends RowData, TSelected = TableState<TFeatures>>(tableOptions: TableOptions<TFeatures, TData> | TableOptionsWithReactiveData<TFeatures, TData>, selector?: (state: TableState<TFeatures>) => TSelected): VueTable<TFeatures, TData, TSelected>;
39
+ declare function useTable<TFeatures extends TableFeatures, TData extends RowData>(tableOptions: TableOptions<TFeatures, TData> | TableOptionsWithReactiveData<TFeatures, TData>): VueTable<TFeatures, TData>;
74
40
  //#endregion
75
- export { SubscribeSource, TableOptionsWithReactiveData, VueTable, useTable };
41
+ export { TableOptionsWithReactiveData, VueTable, useTable };
76
42
  //# sourceMappingURL=useTable.d.cts.map
@@ -1,76 +1,42 @@
1
1
  import { MaybeRef, VNode } from "vue";
2
- import { NoInfer, RowData, Table, TableFeatures, TableOptions, TableState } from "@tanstack/table-core";
3
- import { Atom, ReadonlyAtom, ReadonlyStore, Store } from "@tanstack/vue-store";
2
+ import { RowData, Table, TableFeatures, TableOptions } from "@tanstack/table-core";
4
3
 
5
4
  //#region src/useTable.d.ts
6
- type SubscribeSource<TValue> = Atom<TValue> | ReadonlyAtom<TValue> | Store<TValue> | ReadonlyStore<TValue>;
7
5
  type TableOptionsWithReactiveData<TFeatures extends TableFeatures, TData extends RowData> = { [K in keyof TableOptions<TFeatures, TData>]: K extends 'data' ? MaybeRef<ReadonlyArray<TData>> : MaybeRef<TableOptions<TFeatures, TData>[K]> };
8
- type VueTable<TFeatures extends TableFeatures, TData extends RowData, TSelected = TableState<TFeatures>> = Omit<Table<TFeatures, TData>, 'store'> & {
6
+ type VueTable<TFeatures extends TableFeatures, TData extends RowData> = Omit<Table<TFeatures, TData>, 'store'> & {
9
7
  /**
10
- * @deprecated Prefer `table.state` for render reads,
11
- * `table.atoms.<slice>.get()` for slice snapshots, or
12
- * `table.Subscribe` / `useSelector(table.store, selector)` for explicit
13
- * subscriptions. `table.store.state` is a current-value snapshot and is easy
14
- * to misuse in render code.
8
+ * @deprecated Prefer `table.atoms.<slice>.get()` for slice snapshots, or
9
+ * `table.Subscribe` for explicit subscriptions. `table.store.state` is a
10
+ * current-value snapshot and is easy to misuse in render code.
15
11
  */
16
12
  readonly store: Table<TFeatures, TData>['store'];
17
- /**
18
- * Store mode: `selector` required. Source mode: pass `source` (atom or store); omit
19
- * `selector` for the whole value (identity), or pass `selector` to project. Split
20
- * overloads so source-only infers `TSourceValue` for `children` (see React `Subscribe`).
21
- */
22
- Subscribe: {
23
- <TSourceValue>(props: {
24
- source: SubscribeSource<TSourceValue>;
25
- selector?: undefined;
26
- children: ((state: Readonly<TSourceValue>) => VNode | Array<VNode>) | VNode | Array<VNode>;
27
- }): VNode | Array<VNode>;
28
- <TSourceValue, TSubSelected>(props: {
29
- source: SubscribeSource<TSourceValue>;
30
- selector: (state: TSourceValue) => TSubSelected;
31
- children: ((state: Readonly<TSubSelected>) => VNode | Array<VNode>) | VNode | Array<VNode>;
32
- }): VNode | Array<VNode>;
33
- <TSubSelected>(props: {
34
- selector: (state: NoInfer<TableState<TFeatures>>) => TSubSelected;
35
- children: ((state: Readonly<TSubSelected>) => VNode | Array<VNode>) | VNode | Array<VNode>;
36
- }): VNode | Array<VNode>;
37
- };
38
- /**
39
- * The selected state of the table. This state may not match the structure of
40
- * the full table state because it is selected by the selector function that
41
- * you pass as the 2nd argument to `useTable`.
42
- *
43
- * @example
44
- * const table = useTable(options, (state) => ({ globalFilter: state.globalFilter })) // only globalFilter is part of the selected state
45
- *
46
- * console.log(table.state.globalFilter)
13
+ /** Creates a reactive render boundary. The child function reads the table
14
+ * atoms it needs, so Vue only tracks those atom reads.
47
15
  */
48
- readonly state: Readonly<TSelected>;
16
+ Subscribe: (props: {
17
+ children: (atoms: Table<TFeatures, TData>['atoms']) => VNode | Array<VNode>;
18
+ }) => VNode | Array<VNode>;
49
19
  };
50
20
  /**
51
21
  * Creates a Vue table instance backed by Vue-aware TanStack Store atoms.
52
22
  *
53
23
  * Table options may contain Vue refs or computed values. The adapter unwraps
54
24
  * those reactive inputs, watches them with synchronous flushing, and keeps the
55
- * table options in sync. The optional selector projects from `table.store` and
56
- * exposes the selected value on `table.state`.
25
+ * table options in sync. Use `table.Subscribe` or native Vue computed values
26
+ * around `table.atoms.<slice>.get()` for selected reactive reads.
57
27
  *
58
28
  * @example
59
29
  * ```ts
60
30
  * const table = useTable(
61
31
  * {
62
32
  * features,
63
- * rowModels: {},
64
33
  * columns,
65
34
  * data,
66
35
  * },
67
- * (state) => ({ pagination: state.pagination }),
68
36
  * )
69
- *
70
- * table.state.pagination
71
37
  * ```
72
38
  */
73
- declare function useTable<TFeatures extends TableFeatures, TData extends RowData, TSelected = TableState<TFeatures>>(tableOptions: TableOptions<TFeatures, TData> | TableOptionsWithReactiveData<TFeatures, TData>, selector?: (state: TableState<TFeatures>) => TSelected): VueTable<TFeatures, TData, TSelected>;
39
+ declare function useTable<TFeatures extends TableFeatures, TData extends RowData>(tableOptions: TableOptions<TFeatures, TData> | TableOptionsWithReactiveData<TFeatures, TData>): VueTable<TFeatures, TData>;
74
40
  //#endregion
75
- export { SubscribeSource, TableOptionsWithReactiveData, VueTable, useTable };
41
+ export { TableOptionsWithReactiveData, VueTable, useTable };
76
42
  //# sourceMappingURL=useTable.d.ts.map
package/dist/useTable.js CHANGED
@@ -1,8 +1,7 @@
1
1
  import { flatMerge, mergeProxy } from "./merge-proxy.js";
2
2
  import { vueReactivity } from "./reactivity.js";
3
- import { unref, watch } from "vue";
3
+ import { getCurrentScope, onScopeDispose, unref, watch } from "vue";
4
4
  import { constructTable } from "@tanstack/table-core";
5
- import { shallow, useSelector } from "@tanstack/vue-store";
6
5
 
7
6
  //#region src/useTable.ts
8
7
  function getOptionsWithReactiveValues(options) {
@@ -18,36 +17,37 @@ function getReactiveOptionDeps(options) {
18
17
  *
19
18
  * Table options may contain Vue refs or computed values. The adapter unwraps
20
19
  * those reactive inputs, watches them with synchronous flushing, and keeps the
21
- * table options in sync. The optional selector projects from `table.store` and
22
- * exposes the selected value on `table.state`.
20
+ * table options in sync. Use `table.Subscribe` or native Vue computed values
21
+ * around `table.atoms.<slice>.get()` for selected reactive reads.
23
22
  *
24
23
  * @example
25
24
  * ```ts
26
25
  * const table = useTable(
27
26
  * {
28
27
  * features,
29
- * rowModels: {},
30
28
  * columns,
31
29
  * data,
32
30
  * },
33
- * (state) => ({ pagination: state.pagination }),
34
31
  * )
35
- *
36
- * table.state.pagination
37
32
  * ```
38
33
  */
39
- function useTable(tableOptions, selector) {
34
+ function useTable(tableOptions) {
40
35
  const syncTableOptions = (table, options) => {
41
36
  table.setOptions((prev) => flatMerge(prev, getOptionsWithReactiveValues(options)));
42
37
  };
38
+ const reactivity = vueReactivity();
43
39
  const mergedOptions = mergeProxy(tableOptions, { features: {
44
- coreReativityFeature: vueReactivity(),
40
+ coreReactivityFeature: reactivity,
45
41
  ...unref(tableOptions.features) ?? {}
46
42
  } });
47
43
  const coreTable = constructTable(mergeProxy(getOptionsWithReactiveValues(mergedOptions), { mergeOptions: (defaultOptions, newOptions) => {
48
44
  return flatMerge(defaultOptions, newOptions);
49
45
  } }));
50
46
  const table = coreTable;
47
+ if (getCurrentScope()) onScopeDispose(() => {
48
+ var _reactivity$unmount;
49
+ return (_reactivity$unmount = reactivity.unmount) === null || _reactivity$unmount === void 0 ? void 0 : _reactivity$unmount.call(reactivity);
50
+ });
51
51
  watch(() => getReactiveOptionDeps(mergedOptions), () => {
52
52
  syncTableOptions(coreTable, mergedOptions);
53
53
  }, { immediate: true });
@@ -64,18 +64,10 @@ function useTable(tableOptions, selector) {
64
64
  }, (controlledValues) => {
65
65
  if (controlledValues.length > 0) syncTableOptions(coreTable, mergedOptions);
66
66
  }, { immediate: true });
67
- table.Subscribe = ((props) => {
68
- const selected = useSelector(props.source ?? table.store, props.selector, { compare: shallow });
69
- if (typeof props.children === "function") return props.children(selected.value);
70
- return props.children;
71
- });
72
- const stateStore = useSelector(table.store, selector);
73
- return {
74
- ...table,
75
- get state() {
76
- return stateStore.value;
77
- }
67
+ table.Subscribe = (props) => {
68
+ return props.children(table.atoms);
78
69
  };
70
+ return table;
79
71
  }
80
72
 
81
73
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"useTable.js","names":[],"sources":["../src/useTable.ts"],"sourcesContent":["import { unref, watch } from 'vue'\nimport { constructTable } from '@tanstack/table-core'\nimport { shallow, useSelector } from '@tanstack/vue-store'\nimport { flatMerge, mergeProxy } from './merge-proxy'\nimport { vueReactivity } from './reactivity'\nimport type {\n Atom,\n ReadonlyAtom,\n ReadonlyStore,\n Store,\n} from '@tanstack/vue-store'\nimport type {\n NoInfer,\n RowData,\n Table,\n TableFeatures,\n TableOptions,\n TableState,\n} from '@tanstack/table-core'\nimport type { MaybeRef, VNode } from 'vue'\n\nexport type SubscribeSource<TValue> =\n | Atom<TValue>\n | ReadonlyAtom<TValue>\n | Store<TValue>\n | ReadonlyStore<TValue>\n\nexport type TableOptionsWithReactiveData<\n TFeatures extends TableFeatures,\n TData extends RowData,\n> = {\n [K in keyof TableOptions<TFeatures, TData>]: K extends 'data'\n ? MaybeRef<ReadonlyArray<TData>>\n : MaybeRef<TableOptions<TFeatures, TData>[K]>\n}\n\nfunction getOptionsWithReactiveValues<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(options: TableOptionsWithReactiveData<TFeatures, TData>) {\n const resolvedOptions: Record<string, unknown> = {}\n\n for (const key of Object.keys(options)) {\n resolvedOptions[key] = unref(\n options[key as keyof TableOptionsWithReactiveData<TFeatures, TData>],\n )\n }\n\n return mergeProxy(options, resolvedOptions)\n}\n\nfunction getReactiveOptionDeps<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(options: TableOptionsWithReactiveData<TFeatures, TData>) {\n return Object.keys(options).map((key) =>\n unref(options[key as keyof TableOptionsWithReactiveData<TFeatures, TData>]),\n )\n}\n\nexport type VueTable<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TSelected = TableState<TFeatures>,\n> = Omit<Table<TFeatures, TData>, 'store'> & {\n /**\n * @deprecated Prefer `table.state` for render reads,\n * `table.atoms.<slice>.get()` for slice snapshots, or\n * `table.Subscribe` / `useSelector(table.store, selector)` for explicit\n * subscriptions. `table.store.state` is a current-value snapshot and is easy\n * to misuse in render code.\n */\n readonly store: Table<TFeatures, TData>['store']\n /**\n * Store mode: `selector` required. Source mode: pass `source` (atom or store); omit\n * `selector` for the whole value (identity), or pass `selector` to project. Split\n * overloads so source-only infers `TSourceValue` for `children` (see React `Subscribe`).\n */\n Subscribe: {\n <TSourceValue>(props: {\n source: SubscribeSource<TSourceValue>\n selector?: undefined\n children:\n | ((state: Readonly<TSourceValue>) => VNode | Array<VNode>)\n | VNode\n | Array<VNode>\n }): VNode | Array<VNode>\n <TSourceValue, TSubSelected>(props: {\n source: SubscribeSource<TSourceValue>\n selector: (state: TSourceValue) => TSubSelected\n children:\n | ((state: Readonly<TSubSelected>) => VNode | Array<VNode>)\n | VNode\n | Array<VNode>\n }): VNode | Array<VNode>\n <TSubSelected>(props: {\n selector: (state: NoInfer<TableState<TFeatures>>) => TSubSelected\n children:\n | ((state: Readonly<TSubSelected>) => VNode | Array<VNode>)\n | VNode\n | Array<VNode>\n }): VNode | Array<VNode>\n }\n /**\n * The selected state of the table. This state may not match the structure of\n * the full table state because it is selected by the selector function that\n * you pass as the 2nd argument to `useTable`.\n *\n * @example\n * const table = useTable(options, (state) => ({ globalFilter: state.globalFilter })) // only globalFilter is part of the selected state\n *\n * console.log(table.state.globalFilter)\n */\n readonly state: Readonly<TSelected>\n}\n\n/**\n * Creates a Vue table instance backed by Vue-aware TanStack Store atoms.\n *\n * Table options may contain Vue refs or computed values. The adapter unwraps\n * those reactive inputs, watches them with synchronous flushing, and keeps the\n * table options in sync. The optional selector projects from `table.store` and\n * exposes the selected value on `table.state`.\n *\n * @example\n * ```ts\n * const table = useTable(\n * {\n * features,\n * rowModels: {},\n * columns,\n * data,\n * },\n * (state) => ({ pagination: state.pagination }),\n * )\n *\n * table.state.pagination\n * ```\n */\nexport function useTable<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TSelected = TableState<TFeatures>,\n>(\n tableOptions:\n | TableOptions<TFeatures, TData>\n | TableOptionsWithReactiveData<TFeatures, TData>,\n selector?: (state: TableState<TFeatures>) => TSelected,\n): VueTable<TFeatures, TData, TSelected> {\n const syncTableOptions = (\n table: Table<TFeatures, TData>,\n options: TableOptionsWithReactiveData<TFeatures, TData>,\n ) => {\n table.setOptions((prev) =>\n flatMerge(prev, getOptionsWithReactiveValues(options)),\n )\n }\n\n const mergedOptions = mergeProxy(tableOptions, {\n features: {\n coreReativityFeature: vueReactivity(),\n ...(unref(tableOptions.features) ?? {}),\n },\n }) as TableOptionsWithReactiveData<TFeatures, TData>\n\n const resolvedOptions = mergeProxy(\n getOptionsWithReactiveValues(mergedOptions),\n {\n // Remove state and onStateChange - store handles it internally\n mergeOptions: (\n defaultOptions: TableOptions<TFeatures, TData>,\n newOptions: Partial<TableOptions<TFeatures, TData>>,\n ) => {\n return flatMerge(defaultOptions, newOptions)\n },\n },\n ) as TableOptions<TFeatures, TData>\n\n const coreTable = constructTable(resolvedOptions)\n const table = coreTable as unknown as VueTable<TFeatures, TData, TSelected>\n\n watch(\n () => getReactiveOptionDeps(mergedOptions),\n () => {\n syncTableOptions(coreTable, mergedOptions)\n },\n { immediate: true },\n )\n\n watch(\n () => {\n const controlledState = unref(tableOptions.state) as\n | Record<string, unknown>\n | undefined\n const controlledAtoms = unref(tableOptions.atoms) as\n | Record<string, unknown>\n | undefined\n\n if (!controlledState) {\n return []\n }\n\n const controlledValues: Array<unknown> = []\n\n for (const key of Object.keys(table.initialState)) {\n if (!(key in controlledState) || controlledAtoms?.[key] !== undefined) {\n continue\n }\n\n // Reading only controlled state slices here lets Vue subscribe to\n // getters/computed values that are passed through `options.state`.\n controlledValues.push(controlledState[key])\n }\n\n return controlledValues\n },\n (controlledValues) => {\n if (controlledValues.length > 0) {\n syncTableOptions(coreTable, mergedOptions)\n }\n },\n { immediate: true },\n )\n\n table.Subscribe = ((props: {\n source?: SubscribeSource<unknown>\n selector?: ((state: unknown) => unknown) | undefined\n children:\n | ((state: Readonly<unknown>) => VNode | Array<VNode>)\n | VNode\n | Array<VNode>\n }) => {\n const source = props.source ?? table.store\n const selected = useSelector(source as never, props.selector as never, {\n compare: shallow,\n })\n if (typeof props.children === 'function') {\n return props.children(selected.value as Readonly<unknown>)\n }\n return props.children\n }) as VueTable<TFeatures, TData, TSelected>['Subscribe']\n\n const stateStore = useSelector(table.store, selector)\n\n return {\n ...table,\n get state() {\n return stateStore.value\n },\n }\n}\n"],"mappings":";;;;;;;AAoCA,SAAS,6BAGP,SAAyD;CACzD,MAAM,kBAA2C,CAAC;CAElD,KAAK,MAAM,OAAO,OAAO,KAAK,OAAO,GACnC,gBAAgB,OAAO,MACrB,QAAQ,IACV;CAGF,OAAO,WAAW,SAAS,eAAe;AAC5C;AAEA,SAAS,sBAGP,SAAyD;CACzD,OAAO,OAAO,KAAK,OAAO,CAAC,CAAC,KAAK,QAC/B,MAAM,QAAQ,IAA4D,CAC5E;AACF;;;;;;;;;;;;;;;;;;;;;;;;AAiFA,SAAgB,SAKd,cAGA,UACuC;CACvC,MAAM,oBACJ,OACA,YACG;EACH,MAAM,YAAY,SAChB,UAAU,MAAM,6BAA6B,OAAO,CAAC,CACvD;CACF;CAEA,MAAM,gBAAgB,WAAW,cAAc,EAC7C,UAAU;EACR,sBAAsB,cAAc;EACpC,GAAI,MAAM,aAAa,QAAQ,KAAK,CAAC;CACvC,EACF,CAAC;CAeD,MAAM,YAAY,eAbM,WACtB,6BAA6B,aAAa,GAC1C,EAEE,eACE,gBACA,eACG;EACH,OAAO,UAAU,gBAAgB,UAAU;CAC7C,EACF,CAG6C,CAAC;CAChD,MAAM,QAAQ;CAEd,YACQ,sBAAsB,aAAa,SACnC;EACJ,iBAAiB,WAAW,aAAa;CAC3C,GACA,EAAE,WAAW,KAAK,CACpB;CAEA,YACQ;EACJ,MAAM,kBAAkB,MAAM,aAAa,KAAK;EAGhD,MAAM,kBAAkB,MAAM,aAAa,KAAK;EAIhD,IAAI,CAAC,iBACH,OAAO,CAAC;EAGV,MAAM,mBAAmC,CAAC;EAE1C,KAAK,MAAM,OAAO,OAAO,KAAK,MAAM,YAAY,GAAG;GACjD,IAAI,EAAE,OAAO,uFAAoB,gBAAkB,UAAS,QAC1D;GAKF,iBAAiB,KAAK,gBAAgB,IAAI;EAC5C;EAEA,OAAO;CACT,IACC,qBAAqB;EACpB,IAAI,iBAAiB,SAAS,GAC5B,iBAAiB,WAAW,aAAa;CAE7C,GACA,EAAE,WAAW,KAAK,CACpB;CAEA,MAAM,cAAc,UAOd;EAEJ,MAAM,WAAW,YADF,MAAM,UAAU,MAAM,OACS,MAAM,UAAmB,EACrE,SAAS,QACX,CAAC;EACD,IAAI,OAAO,MAAM,aAAa,YAC5B,OAAO,MAAM,SAAS,SAAS,KAA0B;EAE3D,OAAO,MAAM;CACf;CAEA,MAAM,aAAa,YAAY,MAAM,OAAO,QAAQ;CAEpD,OAAO;EACL,GAAG;EACH,IAAI,QAAQ;GACV,OAAO,WAAW;EACpB;CACF;AACF"}
1
+ {"version":3,"file":"useTable.js","names":[],"sources":["../src/useTable.ts"],"sourcesContent":["import { getCurrentScope, onScopeDispose, unref, watch } from 'vue'\nimport { constructTable } from '@tanstack/table-core'\nimport { flatMerge, mergeProxy } from './merge-proxy'\nimport { vueReactivity } from './reactivity'\nimport type {\n RowData,\n Table,\n TableFeatures,\n TableOptions,\n TableState,\n} from '@tanstack/table-core'\nimport type { MaybeRef, VNode } from 'vue'\n\nexport type TableOptionsWithReactiveData<\n TFeatures extends TableFeatures,\n TData extends RowData,\n> = {\n [K in keyof TableOptions<TFeatures, TData>]: K extends 'data'\n ? MaybeRef<ReadonlyArray<TData>>\n : MaybeRef<TableOptions<TFeatures, TData>[K]>\n}\n\nfunction getOptionsWithReactiveValues<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(options: TableOptionsWithReactiveData<TFeatures, TData>) {\n const resolvedOptions: Record<string, unknown> = {}\n\n for (const key of Object.keys(options)) {\n resolvedOptions[key] = unref(\n options[key as keyof TableOptionsWithReactiveData<TFeatures, TData>],\n )\n }\n\n return mergeProxy(options, resolvedOptions)\n}\n\nfunction getReactiveOptionDeps<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(options: TableOptionsWithReactiveData<TFeatures, TData>) {\n return Object.keys(options).map((key) =>\n unref(options[key as keyof TableOptionsWithReactiveData<TFeatures, TData>]),\n )\n}\n\nexport type VueTable<\n TFeatures extends TableFeatures,\n TData extends RowData,\n> = Omit<Table<TFeatures, TData>, 'store'> & {\n /**\n * @deprecated Prefer `table.atoms.<slice>.get()` for slice snapshots, or\n * `table.Subscribe` for explicit subscriptions. `table.store.state` is a\n * current-value snapshot and is easy to misuse in render code.\n */\n readonly store: Table<TFeatures, TData>['store']\n /** Creates a reactive render boundary. The child function reads the table\n * atoms it needs, so Vue only tracks those atom reads.\n */\n Subscribe: (props: {\n children: (atoms: Table<TFeatures, TData>['atoms']) => VNode | Array<VNode>\n }) => VNode | Array<VNode>\n}\n\n/**\n * Creates a Vue table instance backed by Vue-aware TanStack Store atoms.\n *\n * Table options may contain Vue refs or computed values. The adapter unwraps\n * those reactive inputs, watches them with synchronous flushing, and keeps the\n * table options in sync. Use `table.Subscribe` or native Vue computed values\n * around `table.atoms.<slice>.get()` for selected reactive reads.\n *\n * @example\n * ```ts\n * const table = useTable(\n * {\n * features,\n * columns,\n * data,\n * },\n * )\n * ```\n */\nexport function useTable<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n tableOptions:\n | TableOptions<TFeatures, TData>\n | TableOptionsWithReactiveData<TFeatures, TData>,\n): VueTable<TFeatures, TData> {\n const syncTableOptions = (\n table: Table<TFeatures, TData>,\n options: TableOptionsWithReactiveData<TFeatures, TData>,\n ) => {\n table.setOptions((prev) =>\n flatMerge(prev, getOptionsWithReactiveValues(options)),\n )\n }\n\n const reactivity = vueReactivity()\n\n const mergedOptions = mergeProxy(tableOptions, {\n features: {\n coreReactivityFeature: reactivity,\n ...(unref(tableOptions.features) ?? {}),\n },\n }) as TableOptionsWithReactiveData<TFeatures, TData>\n\n const resolvedOptions = mergeProxy(\n getOptionsWithReactiveValues(mergedOptions),\n {\n // Remove state and onStateChange - store handles it internally\n mergeOptions: (\n defaultOptions: TableOptions<TFeatures, TData>,\n newOptions: Partial<TableOptions<TFeatures, TData>>,\n ) => {\n return flatMerge(defaultOptions, newOptions)\n },\n },\n ) as TableOptions<TFeatures, TData>\n\n const coreTable = constructTable(resolvedOptions)\n const table = coreTable as unknown as VueTable<TFeatures, TData>\n\n if (getCurrentScope()) {\n onScopeDispose(() => reactivity.unmount?.())\n }\n\n watch(\n () => getReactiveOptionDeps(mergedOptions),\n () => {\n syncTableOptions(coreTable, mergedOptions)\n },\n { immediate: true },\n )\n\n watch(\n () => {\n const controlledState = unref(tableOptions.state) as\n | Record<string, unknown>\n | undefined\n const controlledAtoms = unref(tableOptions.atoms) as\n | Record<string, unknown>\n | undefined\n\n if (!controlledState) {\n return []\n }\n\n const controlledValues: Array<unknown> = []\n\n for (const key of Object.keys(table.initialState)) {\n if (!(key in controlledState) || controlledAtoms?.[key] !== undefined) {\n continue\n }\n\n // Reading only controlled state slices here lets Vue subscribe to\n // getters/computed values that are passed through `options.state`.\n controlledValues.push(controlledState[key])\n }\n\n return controlledValues\n },\n (controlledValues) => {\n if (controlledValues.length > 0) {\n syncTableOptions(coreTable, mergedOptions)\n }\n },\n { immediate: true },\n )\n\n table.Subscribe = (props: {\n children: (atoms: Table<TFeatures, TData>['atoms']) => VNode | Array<VNode>\n }) => {\n return props.children(table.atoms)\n }\n\n return table\n}\n"],"mappings":";;;;;;AAsBA,SAAS,6BAGP,SAAyD;CACzD,MAAM,kBAA2C,CAAC;CAElD,KAAK,MAAM,OAAO,OAAO,KAAK,OAAO,GACnC,gBAAgB,OAAO,MACrB,QAAQ,IACV;CAGF,OAAO,WAAW,SAAS,eAAe;AAC5C;AAEA,SAAS,sBAGP,SAAyD;CACzD,OAAO,OAAO,KAAK,OAAO,CAAC,CAAC,KAAK,QAC/B,MAAM,QAAQ,IAA4D,CAC5E;AACF;;;;;;;;;;;;;;;;;;;;AAuCA,SAAgB,SAId,cAG4B;CAC5B,MAAM,oBACJ,OACA,YACG;EACH,MAAM,YAAY,SAChB,UAAU,MAAM,6BAA6B,OAAO,CAAC,CACvD;CACF;CAEA,MAAM,aAAa,cAAc;CAEjC,MAAM,gBAAgB,WAAW,cAAc,EAC7C,UAAU;EACR,uBAAuB;EACvB,GAAI,MAAM,aAAa,QAAQ,KAAK,CAAC;CACvC,EACF,CAAC;CAeD,MAAM,YAAY,eAbM,WACtB,6BAA6B,aAAa,GAC1C,EAEE,eACE,gBACA,eACG;EACH,OAAO,UAAU,gBAAgB,UAAU;CAC7C,EACF,CAG6C,CAAC;CAChD,MAAM,QAAQ;CAEd,IAAI,gBAAgB,GAClB,qBAAqB;;2CAAW,kGAAU;EAAC;CAG7C,YACQ,sBAAsB,aAAa,SACnC;EACJ,iBAAiB,WAAW,aAAa;CAC3C,GACA,EAAE,WAAW,KAAK,CACpB;CAEA,YACQ;EACJ,MAAM,kBAAkB,MAAM,aAAa,KAAK;EAGhD,MAAM,kBAAkB,MAAM,aAAa,KAAK;EAIhD,IAAI,CAAC,iBACH,OAAO,CAAC;EAGV,MAAM,mBAAmC,CAAC;EAE1C,KAAK,MAAM,OAAO,OAAO,KAAK,MAAM,YAAY,GAAG;GACjD,IAAI,EAAE,OAAO,uFAAoB,gBAAkB,UAAS,QAC1D;GAKF,iBAAiB,KAAK,gBAAgB,IAAI;EAC5C;EAEA,OAAO;CACT,IACC,qBAAqB;EACpB,IAAI,iBAAiB,SAAS,GAC5B,iBAAiB,WAAW,aAAa;CAE7C,GACA,EAAE,WAAW,KAAK,CACpB;CAEA,MAAM,aAAa,UAEb;EACJ,OAAO,MAAM,SAAS,MAAM,KAAK;CACnC;CAEA,OAAO;AACT"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanstack/vue-table",
3
- "version": "9.0.0-beta.2",
3
+ "version": "9.0.0-beta.20",
4
4
  "description": "Headless UI for building powerful tables & datagrids for Vue.",
5
5
  "author": "Tanner Linsley",
6
6
  "license": "MIT",
@@ -50,13 +50,13 @@
50
50
  "skills"
51
51
  ],
52
52
  "dependencies": {
53
- "@tanstack/table-core": "9.0.0-beta.1",
54
- "@tanstack/vue-store": "^0.11.0"
53
+ "@tanstack/store": "^0.11.0",
54
+ "@tanstack/table-core": "9.0.0-beta.20"
55
55
  },
56
56
  "devDependencies": {
57
57
  "@vitejs/plugin-vue": "^6.0.7",
58
58
  "eslint-plugin-vue": "^10.9.2",
59
- "vue": "^3.5.35"
59
+ "vue": "^3.5.38"
60
60
  },
61
61
  "peerDependencies": {
62
62
  "vue": ">=3.2"
@@ -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: {