@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/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.6",
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",
@@ -11,7 +11,13 @@ import {
11
11
  } from './types'
12
12
  import { Overwrite } from './utils'
13
13
 
14
- export type TableHelper<TData, TValue, TFilterFns, TSortingFns, TAggregationFns> = {
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 rerender = React.useReducer(() => ({}), {})[1]
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<