matrix-rust-sdk icon indicating copy to clipboard operation
matrix-rust-sdk copied to clipboard

RoomListService never says "running" if you're joined to 0 rooms

Open kegsay opened this issue 1 year ago • 4 comments

In a Complement test I have a user who is invited to a single room only, and joined to none. Using syncService.RoomListService().State(callback) and syncService.State(callback) the following states are emitted in order:

  • sync service => SyncServiceStateRunning (this is done prior to the room list service getting rooms, so things like client.Rooms() will have 0 rooms).
  • room list service => RoomListServiceStateSettingUp

If a user has >0 joined rooms, we then get this afterwards:

  • room list service => RoomListServiceStateRunning

How am I supposed to wait until the first sync is done using the FFI bindings?

kegsay avatar Nov 13 '23 15:11 kegsay

Listening for the all rooms list is what I ended up doing, which seems to work. I think it still is probably a bug that the main room list service isn't emitting running though.

kegsay avatar Nov 20 '23 10:11 kegsay

@kegsay

How am I supposed to wait until the first sync is done using the FFI bindings?

Why do you want to wait? The room list service sync will not wait for a user input. It will continuously sync until it's stopped or an error happens.

Hywan avatar Dec 04 '23 14:12 Hywan

Consider the case where the UI shows a spinner when you open the app, and then if there are 0 rooms it says "you're not in any rooms yet". This requires some kind of callback to say "I've synced and here's your room list".

As I said, I can work around this by looking at the AllRooms list, but this is surprising behaviour API wise.

kegsay avatar Mar 01 '24 11:03 kegsay

Maybe RoomListLoadingState is what you’re looking for.

Hywan avatar Mar 11 '24 08:03 Hywan