fix(fuselage): handle empty pagination state by RuhaaBhalerao · Pull Request #42982 · RocketChat/Rocket.Chat · GitHub
Skip to content

fix(fuselage): handle empty pagination state - #42982

Open
RuhaaBhalerao wants to merge 1 commit into
RocketChat:developfrom
RuhaaBhalerao:fix/fuselage-pagination-empty-state
Open

RuhaaBhalerao wants to merge 1 commit into
RocketChat:developfrom
RuhaaBhalerao:fix/fuselage-pagination-empty-state

Conversation

@RuhaaBhalerao

@RuhaaBhalerao RuhaaBhalerao commented Oct 21, 2026 •

Copy link
Copy Markdown

Proposed changes

  • Disable Previous and Next pagination buttons when the result count is zero.
  • Display Showing results 0 - 0 of 0 for empty result sets.
  • Prevent Next navigation when the current page is at or beyond the last available page.
  • Add regression tests for empty-state behavior and normal pagination.

Issue(s)

Fixes an empty-state bug in the Fuselage Pagination component. When count = 0, the Next button was enabled and clicking it could call onSetCurrent(25). The results label also displayed Showing results 1 - 0 of 0.

No linked issue identified.

Steps to test or reproduce

  1. Run yarn workspace "@rocket.chat/fuselage" test Pagination.spec.tsx.
  2. Render the Pagination component with count={0}.
  3. Verify that both Previous and Next buttons are disabled.
  4. Verify that the results label reads Showing results 0 - 0 of 0.
  5. Verify that clicking Next does not invoke onSetCurrent.
  6. Verify that normal single-page and multi-page pagination behavior remains correct.

Further comments

Validation completed:

  • Pagination tests: 9 passed.
  • Fuselage TypeScript typecheck: passed with 0 errors.
  • ESLint on modified files: passed with 0 errors.
  • git diff --check: passed.

Summary by CodeRabbit

  • Bug Fixes

    • Pagination now displays a starting result value of 0 when no results are available.
    • Previous and next navigation controls are disabled when there are no pages.
  • Tests

    • Expanded pagination coverage for accessibility, custom labels, empty and single-page results, page navigation, last-page behavior, and out-of-range pages.

@dionisio-bot

dionisio-bot Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

@changeset-bot

changeset-bot Bot commented Oct 21, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: ce4fe6e

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

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 2 files

View guided diff | Re-trigger cubic

@coderabbitai

coderabbitai Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b4df9931-8ef5-4712-b9f3-7a8332541e4f
📥 Commits

Reviewing files that changed from the base of the PR and between 9209eae and ce4fe6e.

📒 Files selected for processing: 2
  • packages/fuselage/src/components/Pagination/Pagination.spec.tsx
  • packages/fuselage/src/components/Pagination/Pagination.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

📜 Recent review details
🔇 Additional comments: 2
packages/fuselage/src/components/Pagination/Pagination.tsx: 1

22-22: LGTM!

Also applies to: 109-109, 135-135

packages/fuselage/src/components/Pagination/Pagination.spec.tsx: 1

2-2: LGTM!

Also applies to: 5-5, 15-80, 82-87

Walkthrough

Pagination now displays a start value of zero for empty results. It disables previous and next navigation when no pages exist. Tests cover empty results, page boundaries, and page advancement.

Changes

Pagination behavior

Layer / File(s) Summary
Empty results and page boundaries
packages/fuselage/src/components/Pagination/Pagination.tsx, packages/fuselage/src/components/Pagination/Pagination.spec.tsx
The results label starts at zero when the count is zero. Navigation buttons are disabled when no pages exist or their page boundary is reached. Tests cover empty and single-page results, page advancement, and out-of-range pages.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested labels: type: bug

Suggested reviewers: tassoevan

Merge Risk: ⚪ Minimal · up to ce4fe

The empty-pagination behavior appears ready to merge after normal checks.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: fixing empty pagination state handling in Fuselage.
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2…
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.
Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2 files.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Errors were encountered while retrieving linked issues.

Errors: 1
  • JIRA integration encountered authorization issues. Please disconnect and reconnect the integration in the CodeRabbit UI.

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.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant