matrix-org / matrix-org/matrix-js-sdk
Typing Indicator Event for Room Admin Not Visible to Other Users Until Refresh or Relogin.
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2.2k
- Forks
- 704
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 40
Description
**Description:**
I am encountering an issue when initiating a new chat room. The problem is that when we create a new chat room, `the room admin's typing indicator event is successfully dispatched from their account/device(which I can check in logs inside the typing observer), but this event is not received or captured in other users system/account(neither the api call is seen in the network tab nor event can be caught in the logs inside the typing observer) in the room`. Consequently, the typing indicator for the admin is not visible to other users, while typing indicators from other users are displayed to everyone in the chat room. But if we refresh or relogin then the typing indicator works as expected even for the admin.
**Steps to Reproduce:**
Initialize a new chat room.
Create a new chat room and the user who creates the room is the group admin with power_level = 100.
Have the admin start typing a message.
Observe that the typing indicator is not visible to other users in the room.
**Expected Behavior:**
When the room admin starts typing, their typing indicator event should be visible to all other users in the room without refresh or relogin.
**Actual Behavior:**
The typing indicator event for the room admin is not visible to other users in the chat room until we refresh or relognin.
**Environment:**
matrix-js-sdk version: [29.1.0]
React version: [18.2.0]
Node.js version: [18.16.0]
Operating System: [Ubuntu 20.04]
**Code:**
```
client.on("RoomMember.typing", (event, member) => {
const customEvent1 = new CustomEvent("MRoomMember.typing", {
detail: {
event,
member
}
})
document.dispatchEvent(customEvent1)
})
```
```
useEffect(() => {
if (id) {
roomId.current = id
}
if (client) {
if (!isEventInit) {
document.addEventListener("MRoomMember.typing", handleTyping)
setIsEventInit(true)
}
}
}, [client, id])
```
```
const handleTyping = (e) => {
const { event, member } = e.detail
if (roomId.current === member.roomId) {
const user = matrixUsers.find(
(data) => data.matrix_user_id === member.userId
)
onTyping({
image: user?.avatar,
name: member.rawDisplayName,
userId: member.userId,
status: member.typing
})
}
}
```
If more information is needed I can provide it.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the client.on("RoomMember.typing") listener and trace the event flow for a newly created room before and after refresh. Reproduce the room-admin scenario using the listed matrix-js-sdk version and inspect how typing events reach other users. Done means other users receive the admin's typing event without refresh or relogin, with coverage for this scenario.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100