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

Presence Status Reverts After Page Refresh Despite Correct Toggle State

Open
#4,791 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-Presence O-Occasional S-Minor T-Defect
Dominant language
TypeScript
Stars
2.2k
Forks
704
Avg merge
1d 20h
Merged PRs (30d)
40

Description

We have found out that there is clear inconsistency in user presence status occurs after a page refresh.

Steps to Reproduce:
1. Set the presence status to "Online".
2. Refresh the page.
3. Observe that the displayed status is "Online" but matrix reverts in status_presence to the previous state"Offline", even though the UI toggle retains the newly set status "Online".
4. Refreshing the page without any status change would keep it correct to "Online".
5. Change the status to "Offline".
6. Refresh the page.
7. Presence status will be shown "Offline" but matrix status_presence returns "Online".

Expected Behavior:
Presence status should persist and reflect the user’s last-set value after a page refresh

Observed Behavior:
After refresh, the UI toggle shows the correct status (e.g., "Busy"), but the actual presence data reverts to the prior state. This suggests a synchronization failure between the client’s cached state and the server’s response post-refresh.

Might be Related Issue:
This may connect to [matrix-js-sdk#2535](https://github.com/matrix-org/matrix-js-sdk/issues/2535), which highlights unreliable event triggering for user presence updates. The problem could stem from missing or delayed `User.presence` event emissions after rehydration.

Tested Environments:
- Google Chrome, Microsoft Edge, Safari
- Multiple homeservers and clients
- We use matrix-js-sdk v37.2.0 at the moment

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

Start by reproducing the refresh sequence described in the issue with matrix-js-sdk v37.2.0, then inspect presence rehydration and the User.presence event emissions mentioned as a possible cause. Done means the server-side status_presence and displayed presence remain equal to the user’s last-set value after refresh.

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
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.