Skip to content

fix: handle zero pages edge case in Pagination component#528

Merged
ECWireless merged 3 commits intorefactor/seperate-pagination-componentfrom
copilot/sub-pr-527
Feb 2, 2026
Merged

fix: handle zero pages edge case in Pagination component#528
ECWireless merged 3 commits intorefactor/seperate-pagination-componentfrom
copilot/sub-pr-527

Conversation

Copy link
Contributor

Copilot AI commented Feb 1, 2026

Addresses review feedback from #527 to prevent displaying "Page 1 of 0" when no data exists.

Changes

  • Added early return when totalPages === 0 to hide pagination controls entirely
  • Keeps the component self-contained and reusable across all use cases
const Pagination = ({ totalPages, ... }: PaginationProps) => {
  // Don't render pagination when there are no pages
  if (totalPages === 0) {
    return null;
  }
  
  return <Flex>...</Flex>;
};

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@vercel
Copy link
Contributor

vercel bot commented Feb 1, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
explorer-arbitrum-one Ready Ready Preview, Comment Feb 2, 2026 3:35pm

Request Review

Co-authored-by: rickstaa <17570430+rickstaa@users.noreply.github.com>
Copilot AI changed the title [WIP] WIP address feedback on table pagination component refactor fix: handle zero pages edge case in Pagination component Feb 1, 2026
Copilot AI requested a review from rickstaa February 1, 2026 19:05
@ECWireless ECWireless marked this pull request as ready for review February 2, 2026 15:27
@ECWireless ECWireless self-requested a review as a code owner February 2, 2026 15:27
Copilot AI review requested due to automatic review settings February 2, 2026 15:27
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a UI edge case in the Pagination component by preventing the display of "Page 1 of 0" when no data is available. The fix adds an early return that hides pagination controls entirely when totalPages === 0, addressing feedback from PR #527 where the Pagination component was initially extracted as a reusable component.

Changes:

  • Added zero pages check with early return in Pagination component to hide controls when no pages exist

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@ECWireless ECWireless merged commit c5dcce7 into refactor/seperate-pagination-component Feb 2, 2026
2 checks passed
@ECWireless ECWireless deleted the copilot/sub-pr-527 branch February 2, 2026 15:36
ECWireless added a commit that referenced this pull request Feb 2, 2026
* refactor: extract table pagination into reusable component

Move table pagination logic into seperate component so it can be reused
across the app.

Co-authored-by: roaring30s <okaaycrypto@gmail.com>

* fix: handle zero pages edge case in Pagination component (#528)

* Initial plan

* fix: hide pagination when totalPages is 0

Co-authored-by: rickstaa <17570430+rickstaa@users.noreply.github.com>

* Update components/Table/Pagination.tsx

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: rickstaa <17570430+rickstaa@users.noreply.github.com>
Co-authored-by: ECWireless <40322776+ECWireless@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* fix: add accessibility attributes to Pagination

* chore: simplify totalPages check in Pagination

---------

Co-authored-by: roaring30s <okaaycrypto@gmail.com>
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: rickstaa <17570430+rickstaa@users.noreply.github.com>
Co-authored-by: ECWireless <40322776+ECWireless@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: ECWireless <elliott@coopallc.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants