Skip to content

fix(Pagination): single-page pagination bug#1679

Open
JessenReinhart wants to merge 3 commits into
themesberg:mainfrom
JessenReinhart:fix/pagination-1048
Open

fix(Pagination): single-page pagination bug#1679
JessenReinhart wants to merge 3 commits into
themesberg:mainfrom
JessenReinhart:fix/pagination-1048

Conversation

@JessenReinhart

@JessenReinhart JessenReinhart commented Jun 29, 2026

Copy link
Copy Markdown

Fixes issue #1048 where pagination failed to render a single page. Includes regression test.

Summary by CodeRabbit

  • Bug Fixes
    • Fixed pagination rendering to prevent empty/invalid page lists in edge cases by clamping the rendered range.
    • Improved page-button generation so totals of 5 or fewer display all pages, while larger totals use a bounded range.
  • Tests
    • Added coverage for the single-page scenario to ensure exactly one page item renders and shows 1.
  • Documentation
    • Added/updated JSDoc comments for the pagination components.

Resolves themesberg#1048: Pagination component was incorrectly hiding the '1' button
when totalPages=1 due to a hardcoded clamping logic.
@vercel

vercel Bot commented Jun 29, 2026

Copy link
Copy Markdown

@JessenReinhart is attempting to deploy a commit to the Bergside Team on Vercel.

A member of the Team first needs to authorize it.

@changeset-bot

changeset-bot Bot commented Jun 29, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 9be842f

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai

coderabbitai Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7ce224cc-ac01-4d32-a5eb-b5cfb04220cd

📥 Commits

Reviewing files that changed from the base of the PR and between f16b1dd and 9be842f.

📒 Files selected for processing (2)
  • packages/ui/src/components/Pagination/Pagination.test.tsx
  • packages/ui/src/components/Pagination/Pagination.tsx
💤 Files with no reviewable changes (1)
  • packages/ui/src/components/Pagination/Pagination.test.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/ui/src/components/Pagination/Pagination.tsx

📝 Walkthrough

Walkthrough

Updates pagination page-range handling for small totals by clamping the upper bound and rendering all pages directly when totalPages <= 5. Adds a regression test for the single-page case and documents the components.

Changes

Pagination Range Fix

Layer / File(s) Summary
Range clamp, rendering branch, and test
packages/ui/src/components/Pagination/Pagination.tsx, packages/ui/src/components/Pagination/Pagination.test.tsx
Adds lastPageInRange, changes page rendering for small and larger totals, keeps page-change behavior the same, adds JSDoc comments, and verifies that totalPages=1 renders one numbered page item.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~5 minutes

Suggested reviewers

  • rluders

Poem

🐇 One tiny page hops into view,
Clamped and tidy, crisp and new.
Five or fewer? Render them all,
No stray pages left to fall.
Hooray for neat little number-pride!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: fixing the pagination single-page rendering bug.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install failed. For unrecoverable errors, disable the tool in CodeRabbit configuration.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

- Add JSDoc to DefaultPagination and TablePagination components
- Resolves CI docstring coverage warning
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.

1 participant