matrix-org / matrix-org/matrix-js-sdk
Client Events on Users not reliable
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2.2k
- Forks
- 704
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 40
Description
**Describe the bug**
When you try to listen to User events like `User.presence`, these will not always be triggered.
For example when using an IndexedDBStore, the Cached and Created users will not reemit any events.
My understanding is, that users created through the sync-method `createNewUser`(1) will react to changes from the sync API and reemit events and every other User, that just gets created like `new User(...)` will not.
These "dumb" User models are created in the IndexedDBStore (2) and MemoryStore (3) (so in every case you wanted to use client-caching) and with your own User in startClient (4).
## References:
* [(1) createNewUser](https://github.com/matrix-org/matrix-js-sdk/blob/5367ee18fbd2e87cc2fe4f71e4b678a7c620ab80/src/sync.ts)
* [(2) IndexedDBStore::startup](https://github.com/matrix-org/matrix-js-sdk/blob/5367ee18fbd2e87cc2fe4f71e4b678a7c620ab80/src/store/indexeddb.ts)
* [(3) MemoryStore::onRoomMember](https://github.com/matrix-org/matrix-js-sdk/blob/5367ee18fbd2e87cc2fe4f71e4b678a7c620ab80/src/store/memory.ts)
* [(4) MatrixClient::startClient](https://github.com/matrix-org/matrix-js-sdk/blob/5367ee18fbd2e87cc2fe4f71e4b678a7c620ab80/src/client.ts)
Should every service that needs to create user models depend on the sync helper?
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
Compare the user creation paths in src/sync.ts, src/store/indexeddb.ts, src/store/memory.ts, and src/client.ts, starting with createNewUser and the referenced startup, onRoomMember, and startClient entry points. Determine which instances receive sync updates and reemit events; the issue is done when cached, created, and client-owned Users have reliable event behavior or the supported creation contract is clearly established.
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
- Needs clarification
- Newbie friendliness
- 35/100