mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-10-31 08:15:24 +00:00
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:
@@ -334,12 +334,14 @@ class HomeScreenViewModel: HomeScreenViewModelType, HomeScreenViewModelProtocol
|
||||
}
|
||||
|
||||
private func updateRoomListMode(with roomSummaryProviderState: RoomSummaryProviderState, hasRooms: Bool) {
|
||||
let isFiltering = state.bindings.filtersState.isFiltering || state.selectedSpaceFilter != nil || state.bindings.isSearchFieldFocused
|
||||
|
||||
let roomListMode: HomeScreenRoomListMode = if !roomSummaryProviderState.isLoaded {
|
||||
.skeletons // Still loading.
|
||||
} else if roomSummaryProviderState.totalNumberOfRooms == 0 {
|
||||
.empty // Loaded, there are no rooms at all.
|
||||
} else if hasRooms {
|
||||
.rooms // Loaded and the summaries have published.
|
||||
} else if hasRooms || isFiltering {
|
||||
.rooms // Loaded and the summaries have published (or filtered down to nothing).
|
||||
} else if state.roomListMode == .skeletons {
|
||||
.skeletons // Loaded but nothing published yet, flipping to .rooms would flash an empty list.
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user