Row selection acting strange when using fully controlled table
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 28.4k
- Forks
- 3.6k
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 10
Description
Describe the bug
When I try to use table row selection with fully controlled state and i'm on the second page, then it selects the first page.
I think it's either the selection function is not accounting for the page index in getToggleAllPageRowsSelectedHandler OR it is re-rendering the page index back to 0.
Your minimal, reproducible example
Steps to reproduce
- Go to second, third, or fourth page of table
- Click the header selection
- See that something did get selected.
- Go back to first page and see the first page gets selected.
Expected behavior
As a user I expect to see the page that im on get selected when using the header selection.
How often does this bug happen?
Every time
Screenshots or Videos
No response
Platform
mac OS, chrome, Version 112.0.5615.49 (Official Build) (arm64)
react-table version
8.8.5
TypeScript version
No response
Additional context
No response
Terms & Code of Conduct
- I agree to follow this project's Code of Conduct
- 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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the minimal reproduction in CodeSandbox, especially src/main.tsx around lines 667-702, and reproduce the issue on the second, third, or fourth page. Inspect getToggleAllPageRowsSelectedHandler and the controlled pagination behavior. Done means header selection selects the currently displayed page rather than the first page.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100