Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export function table_autoResetPageIndex<
table.options.autoResetPageIndex ??
!table.options.manualPagination
) {
table_resetPageIndex(table)
table_resetPageIndex(table, true)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,19 @@ describe('table_autoResetPageIndex', () => {
expect(table.atoms.pagination.get().pageIndex).toBe(0)
})

it('should reset to the first page instead of the initial page index', () => {
const table = makeTable(25, {
initialState: { pagination: { pageIndex: 1, pageSize: 10 } },
})

table.setPageIndex(2)
expect(table.atoms.pagination.get().pageIndex).toBe(2)

table_autoResetPageIndex(table)

expect(table.atoms.pagination.get().pageIndex).toBe(0)
})

it('should not reset when manualPagination is set', () => {
const onPaginationChange = vi.fn()
const table = makeTable(25, {
Expand Down
Loading