Closed marcellino-ornelas closed 3 months ago
Current work around
const handleChangeRowsPerPage = useCallback(
(event: React.ChangeEvent<HTMLInputElement>): void => {
table.setPageIndex(0);
table.setPageSize(Number(event.target.value));
},
[table],
);
In my initial testing, it appears to me that the table is going back to the correct initial page upon a sort, but not upon a pageSize
change.
This is the expected behavior. Only events such as sorting, filtering, or grouping should trigger an auto-reset. Changing the page size should not trigger this. Your workaround is the solution if you want that behavior though.
There are edge case scenarios that are similar to this, but not exactly the same that are being considered to be fixed. https://github.com/TanStack/table/pull/5031
TanStack Table version
8.15.0
Framework/Library version
^18.2.0
Describe the bug
Hello, Im running into a issue with the
autoResetPageIndex
showing/processing the incorrect page Index when using client side pagination and changing the rows per page.Steps to reproduce
Page 3 of 10,000
show 20
You will now see the incorrect number
Page 2 of 5,000
Expected behavior
Page 3 of 10,000
show 20
You should now see
Page 1 of 5,000
How often does this bug happen?
Every time
Platform
TypeScript version
5.1.6
Your Minimal, Reproducible Example - (Sandbox Highly Recommended)
https://stackblitz.com/edit/tanstack-table-csasqf?file=src%2Fmain.tsx
Screenshots or Videos (Optional)
https://github.com/TanStack/query/assets/35247622/969eb333-4b99-499a-85b9-4b9415224ca9
Do you intend to try to help solve this bug with your own PR?
No, because I do not know how
Terms & Code of Conduct