OBPIH-6933 User can manually enter a page number outside the valid page range#5016
OBPIH-6933 User can manually enter a page number outside the valid page range#5016awalkowiak merged 3 commits intodevelopfrom
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #5016 +/- ##
=========================================
Coverage 7.74% 7.74%
Complexity 859 859
=========================================
Files 613 613
Lines 42621 42621
Branches 10350 10350
=========================================
Hits 3303 3303
Misses 38825 38825
Partials 493 493 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
src/js/hooks/useTablePagination.js
Outdated
| }); | ||
|
|
||
| const onPageChange = (page) => { | ||
| const maxPage = Math.floor(totalCount / pagination.pageSize); |
There was a problem hiding this comment.
Does maxPage have to be recalculated on each page change?
There was a problem hiding this comment.
do you suggest using useCallback with totalCount and pageSize as a dependency?
There was a problem hiding this comment.
yeah, we can use it, this can be cached until filters are applied (totalCount changes/page size changes)
src/js/hooks/useTablePagination.js
Outdated
|
|
||
| const onPageChange = (page) => { | ||
| const maxPage = Math.floor(totalCount / pagination.pageSize); | ||
| if (maxPage < page) { |
There was a problem hiding this comment.
nitpicky, but since the comparators below start with the page, for me personally it would be more readable if it was:
if (page > maxPage)
but it's my own preference so I'm not requesting a change
src/js/hooks/useTablePagination.js
Outdated
| }); | ||
|
|
||
| const onPageChange = (page) => { | ||
| const maxPage = Math.floor(totalCount / pagination.pageSize); |
There was a problem hiding this comment.
yeah, we can use it, this can be cached until filters are applied (totalCount changes/page size changes)
7adb923 to
eb3c438
Compare
No description provided.