frontend: SimpleTable: Fix pagination bug#6477
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: skools-here The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
There was a problem hiding this comment.
Pull request overview
This PR fixes an off-by-one pagination boundary in SimpleTable that could leave users on an empty page when the total row count is an exact multiple of rowsPerPage (e.g., 10 items with rowsPerPage=10 while on page index 1).
Changes:
- Tightened the invalid-page guard to treat
page * rowsPerPage === displayData.lengthas out of range, and corrected the fallback page calculation to the max valid index. - Adjusted the filtered-data page reset condition to also handle exact boundary matches.
- Added a regression unit test covering the exact-multiple boundary case.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| frontend/src/components/common/SimpleTable.tsx | Fixes page validity checks and fallback page computation at exact pagination boundaries. |
| frontend/src/components/common/SimpleTable.test.tsx | Adds regression coverage for boundary behavior when the requested page would otherwise render empty. |
595b5e9 to
f38b29f
Compare
eb32b57 to
f19d9c9
Compare
Summary
Fixes a bug in SimpleTable where navigating to an empty page occurs when the total number of items is an exact multiple of the page size (e.g. exactly 10 items, viewing the second page).
Related Issue
Fixes #6476
Changes