fix(presence): your own status shows at once (and clears) in the member list #475

Merged
jared merged 1 commits from fix/own-presence-display into lotus 2026-10-28 06:50:03 -04:00
Owner

Reported by Jared: after changing your status it didn't appear in the sidebar's member list until you switched rooms.

Reproduced: with the members drawer open, set a quick status and close Settings.

  • The server has the status, and the presence event with status_msg arrives in /sync about 4 s later.
  • The drawer still doesn't show it after 10 s.

Cause: the SDK creates our own User object at startup with new User(userId) (client.js), not User.createUser. Unlike everyone else's, its User.* events are therefore never re-emitted on the client.

  • The shared presence store (PERF-1) listens on the client, so it never heard our own presence changes.
  • The User object itself was updated, so a remount (switching rooms) re-read it and showed the status.

Fix (useUserPresence.ts)

  • The store also refreshes on the ClientEvent.Event the SDK emits for every sync presence event, which it does after updating the User.
  • The status is read from the latest presence event instead of user.presenceStatusMsg. Second bug found on the way: the SDK only overwrites that field with a non-empty status_msg, so a cleared status stayed visible to everyone until reload.

Tested

  • New e2e test in local-homeserver.spec.ts: set a quick status, close Settings, it shows in the drawer; clear it, and it disappears.
  • The test fails on lotus without the fix (the status never appears) and passes with it.
  • The existing status and presence e2e tests pass (3/3).
  • 1,446 unit tests pass, lint is at 28 warnings, and Prettier is clean.

🤖 Generated with Claude Code

https://claude.ai/code/session_017PCb59uY3UKqDqt7B6hzd5

**Reported by Jared:** after changing your status it didn't appear in the sidebar's member list until you switched rooms. **Reproduced:** with the members drawer open, set a quick status and close Settings. - The server has the status, and the presence event with `status_msg` arrives in `/sync` about 4 s later. - The drawer still doesn't show it after 10 s. **Cause:** the SDK creates **our own** `User` object at startup with `new User(userId)` (`client.js`), not `User.createUser`. Unlike everyone else's, its `User.*` events are therefore never re-emitted on the client. - The shared presence store (PERF-1) listens on the client, so it never heard our own presence changes. - The `User` object itself was updated, so a remount (switching rooms) re-read it and showed the status. **Fix (`useUserPresence.ts`)** - The store also refreshes on the `ClientEvent.Event` the SDK emits for every sync presence event, which it does after updating the `User`. - The status is read from the latest presence event instead of `user.presenceStatusMsg`. **Second bug found on the way:** the SDK only overwrites that field with a *non-empty* `status_msg`, so a cleared status stayed visible to everyone until reload. **Tested** - New e2e test in `local-homeserver.spec.ts`: set a quick status, close Settings, it shows in the drawer; clear it, and it disappears. - **The test fails on `lotus` without the fix** (the status never appears) and passes with it. - The existing status and presence e2e tests pass (3/3). - 1,446 unit tests pass, lint is at 28 warnings, and Prettier is clean. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_017PCb59uY3UKqDqt7B6hzd5
jared added 1 commit 2026-10-28 06:28:50 -04:00
fix(presence): your own status shows at once (and clears) in the member list
CI / Build & Quality Checks (push) Skipped
CI / Secret scan (gitleaks) (push) Skipped
CI / Playwright smoke (e2e) (push) Skipped
CI / Secret scan (gitleaks) (pull_request) Successful in 48s
CI / Build & Quality Checks (pull_request) Successful in 3m31s
CI / Trigger Desktop Build (pull_request) Skipped
CI / Docker image build & smoke test (pull_request) Skipped
CI / Playwright smoke (e2e) (pull_request) Successful in 17m34s
c247024bcd
Reported: after changing your status it did not appear in the members
drawer until you switched rooms.

The SDK creates our own User object with `new User()` instead of
User.createUser, so its User.* events are never re-emitted on the client.
The shared presence store (PERF-1) listens on the client, so it never heard
our own presence changes; a remount (room switch) re-read the User and
showed it. The store now also refreshes on the ClientEvent.Event the SDK
emits for every sync presence event (after updating the User).

Also read the status from the latest presence event: the SDK only
overwrites presenceStatusMsg with a non-empty status_msg, so a cleared
status lingered (for everyone) until reload.

e2e: set a quick status, close settings, it shows in the drawer; clear it,
it goes. Fails without the fix (status never appears).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017PCb59uY3UKqDqt7B6hzd5
jared scheduled this pull request to auto merge when all checks succeed 2026-10-28 06:28:54 -04:00
jared merged commit 6d86d25b7f into lotus 2026-10-28 06:50:03 -04:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: LotusGuild/cinny#475