matrix-org / matrix-org/matrix-js-sdk

room.getJoinedMembers always returns zero room members

Open
#576 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

T-Defect
Dominant language
TypeScript
Stars
2.2k
Forks
704
Avg merge
1d 20h
Merged PRs (30d)
40

Description

I just need to be able to query room members at an arbitrary time (rather than via an event.)

matrixClient.joinRoom(roomId).done(function(room) {
console.log("joined room");
var memberList = room.getJoinedMembers();
console.log("there are %s people in the room.", memberList.length);
for (var i = 0; i < memberList.length; i++) {
console.log(
"(%s) %s",
memberList[i].membership,
memberList[i].name
);
}
});

Always returns zero people in the room, when I know there are several. I have also tried room.currentState.getMembers() and getLiveTimeline().getState('b').getMembers(), same problem.

The only way I can successfully get a list of room members is using the sample code, for when room state changes.

Am I doing this wrong?

tested on 0.8.5 and 0.9.0.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The report names room.getJoinedMembers(), room.currentState.getMembers(), and getLiveTimeline().getState('b').getMembers(); start by reproducing the behavior after joinRoom(roomId) on the referenced SDK versions. Done means the appropriate member query returns existing joined members, not only updates received from later state changes.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.