Skip to content

Commit

Permalink
feat: go to the last page when page size overflows
Browse files Browse the repository at this point in the history
  • Loading branch information
Keith-CY committed Jan 24, 2024
1 parent cef2427 commit e57e75d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/pages/Transaction/TransactionComp/TransactionComp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ export const TransactionComp = ({
searchParams.set(pageField, `${page}`)
if (size) {
searchParams.set('page_size', `${size}`)
const total = (type === 'inputs' ? displayInputs.meta?.total : displayOutputs.meta?.total) ?? 0
const maxPage = Math.ceil(total / size)
if (page > maxPage) {
searchParams.set(pageField, `${maxPage}`)
}
}
const url = `${pathname}?${searchParams.toString()}`
history.push(url)
Expand Down

0 comments on commit e57e75d

Please sign in to comment.