Skip to content

fix(members): fetch up to 500 members and show correct total in sidebar - #1411

Open
swarnendusahu10-dotcom wants to merge 1 commit into
RocketChat:developfrom
swarnendusahu10-dotcom:fix/issue-1286-member-list-truncation
Open

swarnendusahu10-dotcom wants to merge 1 commit into
RocketChat:developfrom
swarnendusahu10-dotcom:fix/issue-1286-member-list-truncation

Conversation

@swarnendusahu10-dotcom

Copy link
Copy Markdown
Contributor

What does this PR fix?

Closes #1286

Problem

Two related bugs:

  1. getChannelMembers() had no count param, so Rocket.Chat defaulted to
    returning only 100 members. Rooms with more than 100 members were silently
    truncated — no warning, no indication. This also broke @-mention autocomplete
    for any user beyond the first 100.

  2. RoomMember.js showed "Showing N of N" using filteredMembers.length
    for both values, so the total was always wrong — the actual room member
    count (already stored in channelInfo.usersCount) was never read.

Fix

  • Added count=500 to getChannelMembers() — raises the cap from 100 to 500,
    covering the vast majority of real-world rooms
  • RoomMember.js now reads channelInfo.usersCount (already in the Zustand
    store, zero extra API calls) as the authoritative total, with a safe fallback
    to members.length if not yet loaded
  • @-mention autocomplete benefits automatically — no separate change needed

Known limitation

This moves the hard cap from 100 → 500, not removes it. Rooms with 500+
members will still be partially truncated. Full lazy pagination (load-more on
scroll) would be the proper long-term solution but is a larger feature addition
outside the scope of this bug fix.

Files changed

  • packages/api/src/EmbeddedChatApi.ts — getChannelMembers() URL
  • packages/react/src/views/RoomMembers/RoomMember.js — "Showing X of Y" display

getChannelMembers() called /channels.members (and /groups.members) without
a count param, so Rocket.Chat defaulted to returning 100 results. Rooms
with more than 100 members were silently truncated.

RoomMember.js displayed 'Showing N of N' using filteredMembers.length for
both values, so the total was always the same as the visible count —
never reflecting the actual room member count.

Fixes:
- Add count=500 to getChannelMembers() to fetch up to 500 members
- Import useChannelStore in RoomMember.js
- Use channelInfo.usersCount as the authoritative total in 'Showing X of Y'
- Fallback to members.length when channelInfo not yet loaded

Fixes RocketChat#1286

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Member list silently truncated at 100 — "Showing N of N" shows array length instead of actual total

1 participant