@tanstack/table-core 8.0.0-alpha.61 → 8.0.0-alpha.62
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/build/cjs/core.js +16 -11
- package/build/cjs/core.js.map +1 -1
- package/build/esm/index.js +16 -11
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +320 -320
- package/build/types/core.d.ts +0 -1
- package/build/umd/index.development.js +16 -11
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +1 -1
- package/build/umd/index.production.js.map +1 -1
- package/package.json +1 -1
- package/src/core.ts +21 -11
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/table-core",
|
|
3
3
|
"author": "Tanner Linsley",
|
|
4
|
-
"version": "8.0.0-alpha.
|
|
4
|
+
"version": "8.0.0-alpha.62",
|
|
5
5
|
"description": "Hooks for building lightweight, fast and extendable datagrids for React",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://github.com/tanstack/react-table#readme",
|
package/src/core.ts
CHANGED
|
@@ -55,7 +55,7 @@ export type TableCore<TGenerics extends TableGenerics> = {
|
|
|
55
55
|
options: RequiredKeys<TableOptions<TGenerics>, 'state'>
|
|
56
56
|
setOptions: (newOptions: Updater<TableOptions<TGenerics>>) => void
|
|
57
57
|
queue: (cb: () => void) => void
|
|
58
|
-
willUpdate: () => void
|
|
58
|
+
// willUpdate: () => void
|
|
59
59
|
getState: () => TableState
|
|
60
60
|
setState: (updater: Updater<TableState>) => void
|
|
61
61
|
render: <TProps>(
|
|
@@ -125,7 +125,7 @@ export function createTableInstance<TGenerics extends TableGenerics>(
|
|
|
125
125
|
} as TableState
|
|
126
126
|
|
|
127
127
|
const queued: (() => void)[] = []
|
|
128
|
-
let queuedTimeout
|
|
128
|
+
let queuedTimeout = false
|
|
129
129
|
|
|
130
130
|
const finalInstance: TableInstance<TGenerics> = {
|
|
131
131
|
...instance,
|
|
@@ -134,18 +134,28 @@ export function createTableInstance<TGenerics extends TableGenerics>(
|
|
|
134
134
|
}, {}) as unknown as TableInstance<TGenerics>),
|
|
135
135
|
queue: cb => {
|
|
136
136
|
queued.push(cb)
|
|
137
|
+
|
|
137
138
|
if (!queuedTimeout) {
|
|
138
|
-
queuedTimeout =
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
139
|
+
queuedTimeout = true
|
|
140
|
+
|
|
141
|
+
// Schedule a microtask to run the queued callbacks after
|
|
142
|
+
// the current call stack (render, etc) has finished.
|
|
143
|
+
Promise.resolve()
|
|
144
|
+
.then(() => {
|
|
145
|
+
console.log(queued)
|
|
146
|
+
while (queued.length) {
|
|
147
|
+
queued.shift()!()
|
|
148
|
+
}
|
|
149
|
+
queuedTimeout = false
|
|
150
|
+
})
|
|
151
|
+
.catch(error =>
|
|
152
|
+
setTimeout(() => {
|
|
153
|
+
throw error
|
|
154
|
+
})
|
|
155
|
+
)
|
|
147
156
|
}
|
|
148
157
|
},
|
|
158
|
+
// willUpdate: () => {},
|
|
149
159
|
initialState,
|
|
150
160
|
reset: () => {
|
|
151
161
|
instance.setState(instance.initialState)
|