Skip to content

Commit bb6a6b5

Browse files
committed
fix: autoResetPagination uses !manualPagination for default
1 parent aa8ff19 commit bb6a6b5

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

packages/table-core/src/features/Pagination.ts

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ export type PaginationOptions<TGenerics extends TableGenerics> = {
3333

3434
export type PaginationDefaultOptions = {
3535
onPaginationChange: OnChangeFn<PaginationState>
36-
autoResetPageIndex: boolean
3736
}
3837

3938
export type PaginationInstance<TGenerics extends TableGenerics> = {
@@ -82,7 +81,6 @@ export const Pagination: TableFeature = {
8281
): PaginationDefaultOptions => {
8382
return {
8483
onPaginationChange: makeStateUpdater('pagination', instance),
85-
autoResetPageIndex: true,
8684
}
8785
},
8886

@@ -101,13 +99,10 @@ export const Pagination: TableFeature = {
10199
return
102100
}
103101

104-
if (instance.options.autoResetAll === false) {
105-
return
106-
}
107-
108102
if (
109-
instance.options.autoResetAll === true ||
110-
instance.options.autoResetPageIndex
103+
instance.options.autoResetAll ??
104+
instance.options.autoResetPageIndex ??
105+
!instance.options.manualPagination
111106
) {
112107
if (queued) return
113108
queued = true
@@ -138,7 +133,7 @@ export const Pagination: TableFeature = {
138133
let pageIndex = functionalUpdate(updater, old.pageIndex)
139134

140135
const maxPageIndex =
141-
old.pageCount && old.pageCount > 0
136+
typeof old.pageCount !== 'undefined'
142137
? old.pageCount - 1
143138
: Number.MAX_SAFE_INTEGER
144139

0 commit comments

Comments
 (0)