Avoid flashing the room list skeletons on launch

On a cold launch the home screen appeared just before the cached rooms
published, briefly showing skeletons that were immediately replaced.

The home screen now starts in a new awaitingCachedRooms mode, keeping
the list blank while a cached room list is about to publish and falling
back to the skeletons after 500ms. Without a cache the skeletons show
straight away as before.
This commit is contained in:
Stefan Ceriu
2026-10-02 10:06:00 +03:00
parent 4b6953e80f
commit a50c80c179
5 changed files with 42 additions and 10 deletions
@@ -53,12 +53,16 @@ enum HomeScreenViewAction {
}
enum HomeScreenRoomListMode: CustomStringConvertible {
/// Shows nothing briefly on launch as the cached rooms usually publish in time to go straight to them.
case awaitingCachedRooms
case skeletons
case empty
case rooms
var description: String {
switch self {
case .awaitingCachedRooms:
return "Awaiting cached rooms"
case .skeletons:
return "Showing placeholders"
case .empty:
@@ -96,7 +100,7 @@ struct HomeScreenViewState: BindableState {
var shouldShowNewSoundBanner = false
var rooms: [HomeScreenRoom] = []
var roomListMode: HomeScreenRoomListMode = .skeletons
var roomListMode: HomeScreenRoomListMode = .awaitingCachedRooms
var hasPendingInvitations = false
@@ -113,7 +117,7 @@ struct HomeScreenViewState: BindableState {
var isRoomListSearchEnabled = true
var visibleRooms: [HomeScreenRoom] {
if roomListMode == .skeletons {
if roomListMode == .skeletons || roomListMode == .awaitingCachedRooms {
return placeholderRooms
}