@tanstack/table-core 8.0.0-alpha.69 → 8.0.0-alpha.70

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/table-core",
3
3
  "author": "Tanner Linsley",
4
- "version": "8.0.0-alpha.69",
4
+ "version": "8.0.0-alpha.70",
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,7 @@ import { functionalUpdate, makeStateUpdater, memo } from '../utils'
11
11
  export type PaginationState = {
12
12
  pageIndex: number
13
13
  pageSize: number
14
- pageCount: number
14
+ pageCount?: number
15
15
  }
16
16
 
17
17
  export type PaginationTableState = {
@@ -58,12 +58,10 @@ export type PaginationInstance<TGenerics extends TableGenerics> = {
58
58
 
59
59
  //
60
60
 
61
- const defaultPageCount = -1
62
61
  const defaultPageIndex = 0
63
62
  const defaultPageSize = 10
64
63
 
65
64
  const getDefaultPaginationState = (): PaginationState => ({
66
- pageCount: defaultPageCount,
67
65
  pageIndex: defaultPageIndex,
68
66
  pageSize: defaultPageSize,
69
67
  })
@@ -173,7 +171,7 @@ export const Pagination: TableFeature = {
173
171
  },
174
172
  setPageCount: updater =>
175
173
  instance.setPagination(old => {
176
- let newPageCount = functionalUpdate(updater, old.pageCount)
174
+ let newPageCount = functionalUpdate(updater, old.pageCount ?? -1)
177
175
 
178
176
  if (typeof newPageCount === 'number') {
179
177
  newPageCount = Math.max(-1, newPageCount)
@@ -253,7 +251,8 @@ export const Pagination: TableFeature = {
253
251
 
254
252
  getPageCount: () => {
255
253
  const { pageCount } = instance.getState().pagination
256
- if (pageCount > 0) {
254
+
255
+ if (typeof pageCount !== 'undefined') {
257
256
  return pageCount
258
257
  }
259
258