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

Should methods like MatrixClient.getRooms() throw a warning/error if client was not started?

Open
#904 1 comment 0 reactions 0 assignees View on GitHub
A-Documentation Easy Help Wanted T-Enhancement
Dominant language
TypeScript
Stars
2.2k
Forks
704
Avg merge
1d 20h
Merged PRs (30d)
40

Description

I lost quite some time with a bug that was caused by me calling `MatrixClient.createRoom` then `MatrixClient.getRooms` without having called `MatrixClient.startClient` (as a result the client was not syncing and not updating its room list, even though the call to `createRoom` did return successfully with a room Id).

I think that, unless there *are* some use cases where it makes sense to call `MatrixClient.getRooms` on a client that has not been started yet, the method should probably throw an error or a warning if the client was not started.

This would apply to every method that requires the client to be synchronizing.

Contributor guide

Open the contributing guide

Research direction

Start with the MatrixClient.createRoom, MatrixClient.getRooms, and MatrixClient.startClient entry points described in the issue, then identify other methods that require synchronization. Done means calls made before the client is started consistently produce the agreed warning or error behavior.

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.