@tanstack/react-table 8.0.0-alpha.6 → 8.0.0-alpha.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/build/cjs/createTable.js +15 -1
- package/build/cjs/createTable.js.map +1 -1
- package/build/esm/index.js +15 -1
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +229 -229
- package/build/umd/index.development.js +15 -1
- 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/createTable.tsx +25 -2
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/react-table",
|
|
3
3
|
"author": "Tanner Linsley",
|
|
4
|
-
"version": "8.0.0-alpha.
|
|
4
|
+
"version": "8.0.0-alpha.7",
|
|
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/createTable.tsx
CHANGED
|
@@ -11,7 +11,13 @@ import {
|
|
|
11
11
|
} from './types'
|
|
12
12
|
import { Overwrite } from './utils'
|
|
13
13
|
|
|
14
|
-
export type TableHelper<
|
|
14
|
+
export type TableHelper<
|
|
15
|
+
TData,
|
|
16
|
+
TValue,
|
|
17
|
+
TFilterFns,
|
|
18
|
+
TSortingFns,
|
|
19
|
+
TAggregationFns
|
|
20
|
+
> = {
|
|
15
21
|
RowType<TTData>(): TableHelper<
|
|
16
22
|
TTData,
|
|
17
23
|
TValue,
|
|
@@ -220,7 +226,24 @@ export function createTable<
|
|
|
220
226
|
ReactTable<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>
|
|
221
227
|
>(undefined!)
|
|
222
228
|
|
|
223
|
-
const
|
|
229
|
+
const unsafeRerender = React.useReducer(() => ({}), {})[1]
|
|
230
|
+
|
|
231
|
+
const isMountedRef = React.useRef(false)
|
|
232
|
+
|
|
233
|
+
const rerender = React.useCallback(() => {
|
|
234
|
+
if (!isMountedRef.current) {
|
|
235
|
+
return
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
unsafeRerender()
|
|
239
|
+
}, [])
|
|
240
|
+
|
|
241
|
+
React.useLayoutEffect(() => {
|
|
242
|
+
isMountedRef.current = true
|
|
243
|
+
return () => {
|
|
244
|
+
isMountedRef.current = false
|
|
245
|
+
}
|
|
246
|
+
})
|
|
224
247
|
|
|
225
248
|
if (!instanceRef.current) {
|
|
226
249
|
instanceRef.current = createTableInstance<
|