table
table copied to clipboard
getIsAllRowsSelected returns unexpected result when using manual pagination
Describe the bug
When using manualPagination and supplying a pageCount, and then calling the function returned by getToggleAllPageRowsSelectedHandler - would expect getIsAllRowsSelected to be false, but this is not the case.
In fact, I would expect it to be impossible for getIsAllRowsSelected to be true whenever pageCount is greater than 1 when using manualPagination - is this the wrong mental model or a bug?
Your minimal, reproducible example
https://codesandbox.io/p/sandbox/busy-jones-p3qqnd?file=%2Fsrc%2Fmain.tsx&selection=%5B%7B%22endColumn%22%3A6%2C%22endLineNumber%22%3A97%2C%22startColumn%22%3A1%2C%22startLineNumber%22%3A86%7D%5D
Steps to reproduce
- Click "Toggle all page rows selected"
- Observe output
Expected behavior
As a user I would expect it to be impossible for getIsAllRowsSelected to be true whenever pageCount is greater than 1 when using manualPagination, as the table can't know the ids of those rows in order to "select" them
How often does this bug happen?
Every time
Screenshots or Videos
No response
Platform
MacOS / Chrome
react-table version
8.7.9
TypeScript version
No response
Additional context
No response
Terms & Code of Conduct
- [X] I agree to follow this project's Code of Conduct
- [X] I understand that if my bug cannot be reliable reproduced in a debuggable environment, it will probably not be fixed and this issue may even be closed.
I suppose you can use getIsAllPageRowsSelected (returns whether or not all rows on the current page are selected.) instead of getIsAllRowsSelected.
If you are using manual pagination; and if the pagination info comes from the server, than, it is more appropriate to use getToggleAllPageRowsSelectedHandler, getIsAllPageRowsSelected, getIsSomePageRowsSelected, toggleAllPageRowsSelected APIs, which are all related with the current page.
I suppose you can use getIsAllPageRowsSelected (returns whether or not all rows on the current page are selected.) instead of getIsAllRowsSelected.
If you are using manual pagination; and if the pagination info comes from the server, than, it is more appropriate to use getToggleAllPageRowsSelectedHandler, getIsAllPageRowsSelected, getIsSomePageRowsSelected, toggleAllPageRowsSelected APIs, which are all related with the current page.
Yep, this all makes sense.
Isn't it weird though, that getIsAllRowsSelected would return true when the library knows that a) pagination is handled externally, and b) the page count is greater than 1? I would expect that getIsAllRowsSelected should always be false in this case. Maybe just me.
I suppose you can use getIsAllPageRowsSelected (returns whether or not all rows on the current page are selected.) instead of getIsAllRowsSelected.
If you are using manual pagination; and if the pagination info comes from the server, than, it is more appropriate to use getToggleAllPageRowsSelectedHandler, getIsAllPageRowsSelected, getIsSomePageRowsSelected, toggleAllPageRowsSelected APIs, which are all related with the current page.
Yep, this all makes sense.
Isn't it weird though, that
getIsAllRowsSelectedwould returntruewhen the library knows that a) pagination is handled externally, and b) the page count is greater than 1? I would expect thatgetIsAllRowsSelectedshould always befalsein this case. Maybe just me.
Make sense to me