fix: tables should always go to the last page when out of bounds#1369
Open
AncientPatata wants to merge 1 commit into
Open
fix: tables should always go to the last page when out of bounds#1369AncientPatata wants to merge 1 commit into
AncientPatata wants to merge 1 commit into
Conversation
lemaitre-aneo
left a comment
Contributor
There was a problem hiding this comment.
What if there is actually no data?
Also, I think the logic should be abstracted, factorized, and tested.
…when out of bounds
170d434 to
d82fa15
Compare
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Motivation
#1367 introduced the "jump to the last page when the current page is out of bounds" behavior, but its page-index math had an off-by-one. The last page was computed as
Math.floor(total / pageSize), which returns the index one past the last page whenevertotalis an exact multiple ofpageSize(e.g.total = 100,pageSize = 10→ index10, but the last valid index is9). That landed the user on another out-of-bounds page.Description
Fix the clamping math so a table that is out of bounds reliably lands on the last page that actually holds data.

Testing
*-data.service.spec.tssuites (applications, partitions, results, sessions, tasks) to assert the corrected last-page index (Math.ceil(total / pageSize) - 1).Impact
Not Applicable.
Additional Information
Not Applicable.
Checklist