@tanstack/vue-table 9.2.6 → 9.2.7
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.
- package/dist/useTable.d.ts +7 -4
- package/dist/useTable.js +2 -2
- package/package.json +1 -1
- package/skills/getting-started/SKILL.md +1 -1
- package/skills/getting-started/references/create-table-hook.md +2 -18
- package/skills/migrate-v8-to-v9/SKILL.md +2 -2
- package/skills/migrate-v8-to-v9/references/adapter-migration.md +1 -1
- package/skills/table-state/SKILL.md +3 -3
- package/skills/table-state/references/reactivity.md +5 -27
package/dist/useTable.d.ts
CHANGED
|
@@ -3,8 +3,11 @@ import { RowData, Table, TableFeatures, TableOptions } from "@tanstack/table-cor
|
|
|
3
3
|
//#region src/useTable.d.ts
|
|
4
4
|
export 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]>; };
|
|
5
5
|
export type VueTable<TFeatures extends TableFeatures, TData extends RowData> = Table<TFeatures, TData> & {
|
|
6
|
-
/**
|
|
7
|
-
*
|
|
6
|
+
/**
|
|
7
|
+
* @deprecated Read table APIs or `table.atoms` directly inside templates,
|
|
8
|
+
* render functions, computed values, or watcher sources. Vue tracks those
|
|
9
|
+
* reads natively. This compatibility wrapper only passes atoms to its child
|
|
10
|
+
* function and adds no subscription logic.
|
|
8
11
|
*/
|
|
9
12
|
Subscribe: (props: {
|
|
10
13
|
children: (atoms: Table<TFeatures, TData>['atoms']) => VNode | Array<VNode>;
|
|
@@ -15,8 +18,8 @@ export type VueTable<TFeatures extends TableFeatures, TData extends RowData> = T
|
|
|
15
18
|
*
|
|
16
19
|
* Table options may contain Vue refs or computed values. The adapter unwraps
|
|
17
20
|
* those reactive inputs, watches them with synchronous flushing, and keeps the
|
|
18
|
-
* table options in sync.
|
|
19
|
-
*
|
|
21
|
+
* table options in sync. Read table APIs or atoms inside templates, render
|
|
22
|
+
* functions, computed values, or watcher sources to track updates.
|
|
20
23
|
*
|
|
21
24
|
* @example
|
|
22
25
|
* ```ts
|
package/dist/useTable.js
CHANGED
|
@@ -17,8 +17,8 @@ function getReactiveOptionDeps(options) {
|
|
|
17
17
|
*
|
|
18
18
|
* Table options may contain Vue refs or computed values. The adapter unwraps
|
|
19
19
|
* those reactive inputs, watches them with synchronous flushing, and keeps the
|
|
20
|
-
* table options in sync.
|
|
21
|
-
*
|
|
20
|
+
* table options in sync. Read table APIs or atoms inside templates, render
|
|
21
|
+
* functions, computed values, or watcher sources to track updates.
|
|
22
22
|
*
|
|
23
23
|
* @example
|
|
24
24
|
* ```ts
|
package/package.json
CHANGED
|
@@ -102,25 +102,9 @@ The typed context exists only below the corresponding dynamic wrapper.
|
|
|
102
102
|
|
|
103
103
|
Source: `packages/vue-table/src/createTableHook.ts`
|
|
104
104
|
|
|
105
|
-
###
|
|
105
|
+
### Read state in the consuming component
|
|
106
106
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
```tsx
|
|
110
|
-
<table.Subscribe>
|
|
111
|
-
{(atoms) => <Pager page={atoms.pagination.get()} />}
|
|
112
|
-
</table.Subscribe>
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
Correct:
|
|
116
|
-
|
|
117
|
-
```tsx
|
|
118
|
-
<table.Subscribe
|
|
119
|
-
children={(atoms) => <Pager page={atoms.pagination.get()} />}
|
|
120
|
-
/>
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
Vue’s adapter expects an explicit `children` prop in JSX.
|
|
107
|
+
Read table APIs and atoms inside the component's template or render function. Vue tracks those reads natively. Use a child component when you need a separate render boundary; `table.Subscribe` is deprecated.
|
|
124
108
|
|
|
125
109
|
Source: `packages/vue-table/src/useTable.ts`
|
|
126
110
|
|
|
@@ -5,7 +5,7 @@ metadata:
|
|
|
5
5
|
type: lifecycle
|
|
6
6
|
library: '@tanstack/vue-table'
|
|
7
7
|
framework: vue
|
|
8
|
-
library_version: '9.2.
|
|
8
|
+
library_version: '9.2.7'
|
|
9
9
|
requires:
|
|
10
10
|
- '@tanstack/table-core#migrate-v8-to-v9'
|
|
11
11
|
sources:
|
|
@@ -26,7 +26,7 @@ Framework prerequisite: Vue 3.2 or newer (`vue >=3.2`).
|
|
|
26
26
|
- [ ] Keep features and columns stable, configure explicit features/row-model slots, and complete the shared core checklist.
|
|
27
27
|
- [ ] Replace `getState()` with tracked atom reads or intentional whole-store reads. Use `computed` for derived template values.
|
|
28
28
|
- [ ] Pair controlled reactive values with callbacks that resolve both updater forms, or supply stable Vue Store atoms. Remove global `onStateChange`.
|
|
29
|
-
- [ ]
|
|
29
|
+
- [ ] Replace deprecated `table.Subscribe` calls with native reactive reads. Use a child component when you need to preserve a separate component render boundary.
|
|
30
30
|
- [ ] Adopt FlexRender cell/header/footer shorthand; the old render/props shape remains supported.
|
|
31
31
|
- [ ] Use `tableOptions` or `createTableHook` only for repeated conventions and explicit context-hook export types when needed to break circular inference.
|
|
32
32
|
|
|
@@ -21,7 +21,7 @@ const table = useTable({ features, columns, data })
|
|
|
21
21
|
- Pass a `ref` or `computed` as `data`; the adapter unwraps and syncs it. Do not pass `data.value`, which is only a snapshot. A getter returning `data.value` is also supported.
|
|
22
22
|
- `table.getState().sorting` becomes the narrow `table.atoms.sorting.get()`. Use `table.store.get()` only for a full snapshot/debug output.
|
|
23
23
|
- Wrap atom reads in Vue `computed` when deriving template values.
|
|
24
|
-
-
|
|
24
|
+
- Replace deprecated `table.Subscribe` calls with direct atom reads inside templates, render functions, computed getters, or watcher sources. If it was used as a component to isolate rendering, move the reads into a child component.
|
|
25
25
|
- Controlled refs need getter-backed state slices plus per-slice callbacks that resolve value-or-function `Updater`s.
|
|
26
26
|
- The top-level `onStateChange` is removed. Use per-slice callbacks, external atoms, or `table.store.subscribe` to observe everything.
|
|
27
27
|
- External atoms come from `@tanstack/vue-store` and are supplied through `atoms`. Never provide both `atoms.pagination` and `state.pagination`.
|
|
@@ -5,7 +5,7 @@ metadata:
|
|
|
5
5
|
type: framework
|
|
6
6
|
library: '@tanstack/vue-table'
|
|
7
7
|
framework: vue
|
|
8
|
-
library_version: '9.2.
|
|
8
|
+
library_version: '9.2.7'
|
|
9
9
|
requires:
|
|
10
10
|
- '@tanstack/table-core#table-state'
|
|
11
11
|
sources:
|
|
@@ -22,7 +22,7 @@ Before starting, run `intent load @tanstack/table-core#table-state` for shared o
|
|
|
22
22
|
|
|
23
23
|
Vue-backed atom reads track dependencies inside templates, `computed`, `watch`, or a render boundary. `const page = table.atoms.pagination.get()` outside tracking captures a snapshot. Keep reactive option inputs as refs, computed values, or getters; passing `.value` once breaks later synchronization.
|
|
24
24
|
|
|
25
|
-
`table.Subscribe`
|
|
25
|
+
`table.Subscribe` is deprecated. Read table APIs or atoms directly inside templates, render functions, computed getters, or watcher sources. Use a child component when reads need a separate component render boundary.
|
|
26
26
|
|
|
27
27
|
## Control a slice
|
|
28
28
|
|
|
@@ -58,7 +58,7 @@ const pageSize = computed(() => table.atoms.pagination.get().pageSize)
|
|
|
58
58
|
|
|
59
59
|
Assign the resolved updater result to the ref. For shared atom ownership, use a stable `@tanstack/vue-store` atom in `atoms.<slice>` instead of mirroring the same slice in controlled refs.
|
|
60
60
|
|
|
61
|
-
For computed-state synchronization failures, updater mistakes, or
|
|
61
|
+
For computed-state synchronization failures, updater mistakes, or render boundaries, read [reactivity details](references/reactivity.md). If this task changes processing features, run `intent load @tanstack/table-core#table-features` and read the relevant feature references.
|
|
62
62
|
|
|
63
63
|
## API discovery
|
|
64
64
|
|
|
@@ -40,15 +40,15 @@ const onPaginationChange = (
|
|
|
40
40
|
|
|
41
41
|
Pass `state: controlledState` and `onPaginationChange` to `useTable`.
|
|
42
42
|
|
|
43
|
-
###
|
|
43
|
+
### Read atoms in a render function
|
|
44
|
+
|
|
45
|
+
Return JSX that reads the atom directly from the component's render function:
|
|
44
46
|
|
|
45
47
|
```tsx
|
|
46
|
-
table.
|
|
47
|
-
children: (atoms) => <span>{atoms.pagination.get().pageIndex + 1}</span>,
|
|
48
|
-
})
|
|
48
|
+
<span>{table.atoms.pagination.get().pageIndex + 1}</span>
|
|
49
49
|
```
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
`table.Subscribe` is deprecated and adds no subscription logic. Use a child component to isolate rendering when needed.
|
|
52
52
|
|
|
53
53
|
## Common mistakes
|
|
54
54
|
|
|
@@ -115,28 +115,6 @@ Table callbacks accept either a value or a function of the previous value.
|
|
|
115
115
|
|
|
116
116
|
Source: `examples/vue/basic-external-state/src/App.tsx`
|
|
117
117
|
|
|
118
|
-
### MEDIUM Supplying JSX children as a slot
|
|
119
|
-
|
|
120
|
-
Wrong:
|
|
121
|
-
|
|
122
|
-
```tsx
|
|
123
|
-
<table.Subscribe>
|
|
124
|
-
{(atoms) => <span>{atoms.pagination.get().pageIndex}</span>}
|
|
125
|
-
</table.Subscribe>
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
Correct:
|
|
129
|
-
|
|
130
|
-
```tsx
|
|
131
|
-
<table.Subscribe
|
|
132
|
-
children={(atoms) => <span>{atoms.pagination.get().pageIndex}</span>}
|
|
133
|
-
/>
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
The Vue adapter declares `Subscribe(props: { children })` and expects the explicit prop.
|
|
137
|
-
|
|
138
|
-
Source: `packages/vue-table/src/useTable.ts`
|
|
139
|
-
|
|
140
118
|
## API discovery
|
|
141
119
|
|
|
142
120
|
Inspect `node_modules/@tanstack/vue-table/dist/useTable.d.ts` and `reactivity.d.ts`; inspect the exact state slice in the installed core feature directory.
|