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

Leaving a room doesn't update the `RoomLoadingState`

Open jmartinesp opened this issue 1 year ago • 2 comments

I was trying to implement some logic in the client based on both the room summaries list updated by the RoomListEntriesListener and the loading state that comes from RoomListLoadingStateListener.

I was testing the scenarios where you have 0 and 1 items in the list to make sure the empty, loading and loaded states are displayed correctly, and I found that, having just 1 room, when leaving it, the entries are updated but the loadingState isn't: the RoomListLoadingState is still Loaded(maximum_number_of_rows = 1).

maximum_number_of_rows docs say:

It does not mean that there are exactly this many rooms to display. Usually, the room entries are represented by RoomListEntry. The room entry might have been synced or not synced yet, but we know for sure (from the server), that there will be this amount of rooms in the list at the end.

But I'm not sure that applies here: that description explains the room list will be lazy loaded and in the end there will be maximum_number_of_rows items, while in our case it's impossible that there will be that many because one was deleted.

jmartinesp avatar Feb 16 '24 08:02 jmartinesp

Hmm, that's strange because we have this code here:

https://github.com/matrix-org/matrix-rust-sdk/blob/bd6d0e959a8ebdd7d3cc7a7a38f31497f7d023a6/crates/matrix-sdk-ui/src/room_list_service/room_list.rs#L90-L98

which is responsible to update the room loading state accordingly.

We even have a test for that:

https://github.com/matrix-org/matrix-rust-sdk/blob/bd6d0e959a8ebdd7d3cc7a7a38f31497f7d023a6/crates/matrix-sdk-ui/tests/integration/room_list_service.rs#L1301-L1456

Are you sure the server replies with the expected value?

Hywan avatar Feb 21 '24 19:02 Hywan

I just tried setting up the debugger, in an account with a single room: when leaving that room I get this in the debugger.

image

And I don't get any other updates of the loading state later. I uploaded a rageshake with the Android logs, but I couldn't find anything interesting in them, but I wasn't sure what to look for in the first place so I might have just missed something.

jmartinesp avatar Feb 22 '24 07:02 jmartinesp