Skip to content

fix: custom sounds pagination action buttons when the amount exceeds the specified limit#40113

Open
nazabucciarelli wants to merge 5 commits intodevelopfrom
fix/custom-sounds-pagination
Open

fix: custom sounds pagination action buttons when the amount exceeds the specified limit#40113
nazabucciarelli wants to merge 5 commits intodevelopfrom
fix/custom-sounds-pagination

Conversation

@nazabucciarelli
Copy link
Copy Markdown
Contributor

@nazabucciarelli nazabucciarelli commented Apr 10, 2026

Proposed changes (including videos or screenshots)

The issue was that we were relying on data.sounds.length to decide the pagination state, but this value represents the total of records in the page. It actually must depend on data?.total, which represents the total of records.

Behavior after the change:
576829583-d099de44-9eb2-4bd4-ab08-11f297e9d7b8

Issue(s)

CORE-1827 Fix Custom Sounds pagination

Steps to test or reproduce

Login as admin and add more than 25 custom sounds (I suggest as a quick way running custom-sounds API tests many times with after blocks commented out, so no cleanup is done) and observe that you are able to move forwards or backwards with the pagination.

Further comments

Summary by CodeRabbit

  • Bug Fixes

    • Fixed pagination so navigation works when total custom-sounds exceed a page.
  • Tests

    • Added snapshot and pagination tests to validate rendering and enabled forward navigation when total > page size.
  • Documentation

    • Added a Storybook story demonstrating the Custom Sounds table and interaction logging.
  • Chores

    • Added a changeset marking a patch release.

@dionisio-bot
Copy link
Copy Markdown
Contributor

dionisio-bot bot commented Apr 10, 2026

Looks like this PR is not ready to merge, because of the following issues:

  • This PR is missing the 'stat: QA assured' label

Please fix the issues and try again

If you have any trouble, please check the PR guidelines

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 10, 2026

🦋 Changeset detected

Latest commit: 578abd6

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 41 packages
Name Type
@rocket.chat/meteor Patch
@rocket.chat/core-typings Patch
@rocket.chat/rest-typings Patch
@rocket.chat/uikit-playground Patch
@rocket.chat/api-client Patch
@rocket.chat/apps Patch
@rocket.chat/core-services Patch
@rocket.chat/cron Patch
@rocket.chat/ddp-client Patch
@rocket.chat/fuselage-ui-kit Patch
@rocket.chat/gazzodown Patch
@rocket.chat/http-router Patch
@rocket.chat/livechat Patch
@rocket.chat/model-typings Patch
@rocket.chat/ui-avatar Patch
@rocket.chat/ui-client Patch
@rocket.chat/ui-contexts Patch
@rocket.chat/ui-voip Patch
@rocket.chat/web-ui-registration Patch
@rocket.chat/account-service Patch
@rocket.chat/authorization-service Patch
@rocket.chat/ddp-streamer Patch
@rocket.chat/omnichannel-transcript Patch
@rocket.chat/presence-service Patch
@rocket.chat/queue-worker Patch
@rocket.chat/abac Patch
@rocket.chat/federation-matrix Patch
@rocket.chat/license Patch
@rocket.chat/media-calls Patch
@rocket.chat/omnichannel-services Patch
@rocket.chat/pdf-worker Patch
@rocket.chat/presence Patch
rocketchat-services Patch
@rocket.chat/models Patch
@rocket.chat/network-broker Patch
@rocket.chat/omni-core-ee Patch
@rocket.chat/mock-providers Patch
@rocket.chat/ui-video-conf Patch
@rocket.chat/instance-status Patch
@rocket.chat/omni-core Patch
@rocket.chat/server-fetch Patch

Not sure what this means? Click here to learn what changesets are.

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

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 10, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 5b8a294e-4698-463c-a4e1-0b0035c4ed07

📥 Commits

Reviewing files that changed from the base of the PR and between ed36571 and fcf38ae.

📒 Files selected for processing (1)
  • apps/meteor/client/views/admin/customSounds/CustomSoundsTable/CustomSoundsTable.spec.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/meteor/client/views/admin/customSounds/CustomSoundsTable/CustomSoundsTable.spec.tsx
📜 Recent review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: 📦 Build Packages
  • GitHub Check: cubic · AI code reviewer
  • GitHub Check: CodeQL-Build
  • GitHub Check: CodeQL-Build

Walkthrough

Fixes admin Custom Sounds pagination by using the API-provided total count, adds a Storybook story and tests for the table, and introduces a changeset marking a patch release for the @rocket.chat/meteor package.

Changes

Cohort / File(s) Summary
Changeset
\.changeset/tall-flowers-return.md
New changeset marking a patch release and documenting the pagination fix for custom sounds.
Custom Sounds Component
apps/meteor/client/views/admin/customSounds/CustomSoundsTable/CustomSoundsTable.tsx
Pagination count updated from `data.sounds.length
Stories & Tests
apps/meteor/client/views/admin/customSounds/CustomSoundsTable/CustomSoundsTable.stories.tsx, apps/meteor/client/views/admin/customSounds/CustomSoundsTable/CustomSoundsTable.spec.tsx
Added Storybook story with decorators and a Default story; added tests that mock GET /v1/custom-sounds.list with total > page size, snapshot story renders, and assert pagination forward control is enabled and page "2" button exists.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested labels

type: bug

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main fix: pagination action buttons for custom sounds when the count exceeds the configured limit.
Linked Issues check ✅ Passed The PR successfully addresses CORE-1827 by replacing data.sounds.length with data?.total in CustomSoundsTable.tsx, enabling proper pagination when totals exceed page limits.
Out of Scope Changes check ✅ Passed All changes directly address the pagination bug: the core fix, a changeset entry, supporting tests, and Storybook stories for the component.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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 and usage tips.

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 10, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.24%. Comparing base (5af4cf4) to head (578abd6).

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #40113      +/-   ##
===========================================
- Coverage    70.28%   70.24%   -0.05%     
===========================================
  Files         3280     3283       +3     
  Lines       116814   117012     +198     
  Branches     20665    20739      +74     
===========================================
+ Hits         82107    82192      +85     
- Misses       31430    31536     +106     
- Partials      3277     3284       +7     
Flag Coverage Δ
e2e 59.67% <ø> (-0.09%) ⬇️
e2e-api 46.57% <ø> (-0.94%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@nazabucciarelli nazabucciarelli marked this pull request as ready for review April 10, 2026 21:26
@nazabucciarelli nazabucciarelli requested a review from a team as a code owner April 10, 2026 21:26
Copy link
Copy Markdown
Contributor

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

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

juliajforesti
juliajforesti previously approved these changes Apr 13, 2026
Copy link
Copy Markdown
Contributor

@juliajforesti juliajforesti left a comment

Choose a reason for hiding this comment

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

Although there is no test for this fix, I don't think it's price worth paying: it would require adding 25+ custom sounds just to test pagination, which is disproportionate to the fix's simplicity.

Copy link
Copy Markdown
Member

@dougfabris dougfabris left a comment

Choose a reason for hiding this comment

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

Although there is no test for this fix, I don't think it's price worth paying: it would require adding 25+ custom sounds just to test pagination, which is disproportionate to the fix's simplicity.

Actually, a snapshot testing for this table is very welcome here!

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
apps/meteor/client/views/admin/customSounds/CustomSoundsTable/CustomSoundsTable.spec.tsx (1)

28-41: Click forward pagination button and assert second-page content loads; avoid ESLint suppression comments.

The test currently verifies only that the forward button exists and is enabled (lines 36–38), without interacting with it or confirming that navigation actually changes page content. Also, the ESLint suppression comment on line 35 violates the coding guideline to avoid comments in implementation.

Interact with the forward button and assert that second-page content appears (for example, by finding Custom Sound 26 after clicking). This ensures pagination behaves correctly, not just that controls are present. If the forward button lacks a semantic accessible name, consider whether the Pagination component from @rocket.chat/fuselage needs an aria-label attribute or similar fix; the class-based selector is brittle and should be avoided in favor of semantic locators.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@apps/meteor/client/views/admin/customSounds/CustomSoundsTable/CustomSoundsTable.spec.tsx`
around lines 28 - 41, The test currently only checks the forward pagination
control exists; update the test in CustomSoundsTable.spec.tsx to click the
forward pagination button and assert page 2 content loads (e.g., use
screen.getByRole or getByLabelText for the forward control instead of
container.querySelector('.rcx-pagination__forward'), perform userEvent.click on
that control, then await screen.findByText('Custom Sound 26') to confirm
navigation). Remove the ESLint suppression comment and prefer semantic queries
(getByRole/getByLabelText) for the Pagination control; if the Pagination
component (used by the Default story from composeStories(stories)) lacks an
accessible name, add an aria-label when rendering in the story or the test
wrapper so you can select it via getByLabelText.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In
`@apps/meteor/client/views/admin/customSounds/CustomSoundsTable/CustomSoundsTable.spec.tsx`:
- Around line 28-41: The test currently only checks the forward pagination
control exists; update the test in CustomSoundsTable.spec.tsx to click the
forward pagination button and assert page 2 content loads (e.g., use
screen.getByRole or getByLabelText for the forward control instead of
container.querySelector('.rcx-pagination__forward'), perform userEvent.click on
that control, then await screen.findByText('Custom Sound 26') to confirm
navigation). Remove the ESLint suppression comment and prefer semantic queries
(getByRole/getByLabelText) for the Pagination control; if the Pagination
component (used by the Default story from composeStories(stories)) lacks an
accessible name, add an aria-label when rendering in the story or the test
wrapper so you can select it via getByLabelText.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 158a5aa3-3c54-4030-886f-ecd67de6a42b

📥 Commits

Reviewing files that changed from the base of the PR and between f87d50d and ed36571.

⛔ Files ignored due to path filters (1)
  • apps/meteor/client/views/admin/customSounds/CustomSoundsTable/__snapshots__/CustomSoundsTable.spec.tsx.snap is excluded by !**/*.snap
📒 Files selected for processing (2)
  • apps/meteor/client/views/admin/customSounds/CustomSoundsTable/CustomSoundsTable.spec.tsx
  • apps/meteor/client/views/admin/customSounds/CustomSoundsTable/CustomSoundsTable.stories.tsx
✅ Files skipped from review due to trivial changes (1)
  • apps/meteor/client/views/admin/customSounds/CustomSoundsTable/CustomSoundsTable.stories.tsx
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: cubic · AI code reviewer
  • GitHub Check: CodeQL-Build
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx,js}

📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)

**/*.{ts,tsx,js}: Write concise, technical TypeScript/JavaScript with accurate typing in Playwright tests
Avoid code comments in the implementation

Files:

  • apps/meteor/client/views/admin/customSounds/CustomSoundsTable/CustomSoundsTable.spec.tsx
🧠 Learnings (12)
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Utilize Playwright fixtures (`test`, `page`, `expect`) for consistency in test files

Applied to files:

  • apps/meteor/client/views/admin/customSounds/CustomSoundsTable/CustomSoundsTable.spec.tsx
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Use `test.step()` for complex test scenarios to improve organization in Playwright tests

Applied to files:

  • apps/meteor/client/views/admin/customSounds/CustomSoundsTable/CustomSoundsTable.spec.tsx
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Maintain test isolation between test cases in Playwright tests

Applied to files:

  • apps/meteor/client/views/admin/customSounds/CustomSoundsTable/CustomSoundsTable.spec.tsx
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Use `expect` matchers for assertions (`toEqual`, `toContain`, `toBeTruthy`, `toHaveLength`, etc.) instead of `assert` statements in Playwright tests

Applied to files:

  • apps/meteor/client/views/admin/customSounds/CustomSoundsTable/CustomSoundsTable.spec.tsx
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Group related tests in the same file

Applied to files:

  • apps/meteor/client/views/admin/customSounds/CustomSoundsTable/CustomSoundsTable.spec.tsx
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to **/*.spec.ts : Use descriptive test names that clearly communicate expected behavior in Playwright tests

Applied to files:

  • apps/meteor/client/views/admin/customSounds/CustomSoundsTable/CustomSoundsTable.spec.tsx
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.{ts,spec.ts} : Follow Page Object Model pattern consistently in Playwright tests

Applied to files:

  • apps/meteor/client/views/admin/customSounds/CustomSoundsTable/CustomSoundsTable.spec.tsx
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Ensure tests run reliably in parallel without shared state conflicts

Applied to files:

  • apps/meteor/client/views/admin/customSounds/CustomSoundsTable/CustomSoundsTable.spec.tsx
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/page-objects/**/*.ts : Utilize existing page objects pattern from `apps/meteor/tests/e2e/page-objects/`

Applied to files:

  • apps/meteor/client/views/admin/customSounds/CustomSoundsTable/CustomSoundsTable.spec.tsx
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Ensure clean state for each test execution in Playwright tests

Applied to files:

  • apps/meteor/client/views/admin/customSounds/CustomSoundsTable/CustomSoundsTable.spec.tsx
📚 Learning: 2026-03-06T18:10:15.268Z
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 39397
File: packages/gazzodown/src/code/CodeBlock.spec.tsx:47-68
Timestamp: 2026-03-06T18:10:15.268Z
Learning: In tests (especially those using testing-library/dom/jsdom) for Rocket.Chat components, the HTML <code> element has an implicit ARIA role of 'code'. Therefore, screen.getByRole('code') or screen.findByRole('code') will locate <code> elements even without a role attribute. Do not flag findByRole('code') as invalid in reviews; prefer using the implicit role instead of adding role="code" unless necessary for accessibility.

Applied to files:

  • apps/meteor/client/views/admin/customSounds/CustomSoundsTable/CustomSoundsTable.spec.tsx
📚 Learning: 2026-03-27T14:52:56.865Z
Learnt from: dougfabris
Repo: RocketChat/Rocket.Chat PR: 39892
File: apps/meteor/client/views/room/contextualBar/Threads/Thread.tsx:150-155
Timestamp: 2026-03-27T14:52:56.865Z
Learning: In Rocket.Chat, there are two different `ModalBackdrop` components with different prop APIs. During review, confirm the import source: (1) `rocket.chat/fuselage` `ModalBackdrop` uses `ModalBackdropProps` based on `BoxProps` (so it supports `onClick` and other Box/DOM props) and does not have an `onDismiss` prop; (2) `rocket.chat/ui-client` `ModalBackdrop` uses a narrower props interface like `{ children?: ReactNode; onDismiss?: () => void }` and handles Escape keypress and outside mouse-up, and it does not forward arbitrary DOM props such as `onClick`. Flag mismatched props (e.g., `onDismiss` passed to the fuselage component or `onClick` passed to the ui-client component) and ensure the usage matches the correct component being imported.

Applied to files:

  • apps/meteor/client/views/admin/customSounds/CustomSoundsTable/CustomSoundsTable.spec.tsx
🔇 Additional comments (2)
apps/meteor/client/views/admin/customSounds/CustomSoundsTable/CustomSoundsTable.spec.tsx (2)

15-21: Strong bug-repro mock setup for pagination state.

This mock captures the exact regression condition (count page slice vs total overall), so it validates the intended fix path well.


23-26: Good story-level regression coverage.

Parameterized snapshot coverage across composed stories is a solid safety net for UI regressions in this table.

const firstSound = await screen.findByText('Custom Sound 1');
expect(firstSound).toBeInTheDocument();

// eslint-disable-next-line testing-library/no-container, testing-library/no-node-access
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Note for reviewers: added this comment to suppress the warning of using node access instead of name access, since it's the only way to locate the element currently

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.

3 participants