Don't hold the room list on skeletons for an empty filtered result

The room list keeps showing skeletons while the provider reports loaded
but no summaries have published yet, to avoid flashing an empty list
before the first batch lands. That guard also fired when a filter
(chips, space or search) legitimately matched nothing, leaving the home
screen on placeholders forever instead of showing the empty filter
state.
This commit is contained in:
Stefan Ceriu
2026-09-30 14:41:45 +03:00
parent d3604e8115
commit 4fe58c2d0a
2 changed files with 17 additions and 2 deletions
@@ -408,6 +408,19 @@ final class HomeScreenViewModelTests {
try await deferred.fulfill()
}
@Test
func roomListModeDoesntHoldSkeletonsForAnEmptyFilteredResult() async throws {
let (roomListSubject, stateSubject) = setupViewModelWithManualProvider()
#expect(context.viewState.roomListMode == .skeletons)
// A filter is active before anything has published and the filtered list is loaded but empty.
context.filtersState.activateFilter(.people)
let deferred = deferFulfillment(context.$viewState) { $0.roomListMode == .rooms }
roomListSubject.send([])
stateSubject.send(.loaded(totalNumberOfRooms: 8))
try await deferred.fulfill()
}
@Test
func roomListModeDoesntReturnToSkeletonsWhenTheRoomsAreFilteredOut() async throws {
let (roomListSubject, stateSubject) = setupViewModelWithManualProvider()