Set the room list mode synchronously on a warm launch

The room summary provider subscription only delivers its current state through an
async main queue hop, which can end up queued behind the first render. On a warm
launch, where the cached rooms have already been published before the home screen
exists, that leaves the skeletons up for the whole duration.

Read the current state at the end of init instead, alongside the rooms which were
already being read there.
This commit is contained in:
Stefan Ceriu
2026-08-18 16:07:34 +03:00
parent 8c9edd5ea9
commit e7787f4c3f
2 changed files with 16 additions and 0 deletions
@@ -384,6 +384,14 @@ final class HomeScreenViewModelTests {
enum InviteType { case rooms, spaces }
@Test
func roomListModeIsSetSynchronouslyOnAWarmLaunch() {
setupViewModel()
// No awaiting, the mode must not need the subscription's async delivery.
#expect(context.viewState.roomListMode == .rooms)
}
@Test
func roomListModeWaitsForTheRoomsToPublish() async throws {
let (roomListSubject, stateSubject) = setupViewModelWithManualProvider()