Load movie & tv recommendations asynchronously (#183)

Previously all of the rows on the recommended tab for Movies & TV Shows
were loaded sequentially before any results were shown. This is not a
great experience because some of the queries (eg top rated unwatched)
can take a while sometimes.

This PR starts displaying content once the first 1 or 2 rows is loaded
and then shows placeholders while the rest are querying.

Finally the row queries are now mostly independent so if one errors out,
the rest of the rows will still be displayed.

Closes #180
This commit is contained in:
damontecres 2025-11-09 17:40:47 -05:00 committed by GitHub
parent 0fb1a69556
commit 98fc996bd5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 422 additions and 179 deletions

View file

@ -42,3 +42,29 @@ sealed interface RowLoadingState {
listOfNotNull(message, exception?.localizedMessage).joinToString(" - ")
}
}
sealed interface HomeRowLoadingState {
val title: String
data class Pending(
override val title: String,
) : HomeRowLoadingState
data class Loading(
override val title: String,
) : HomeRowLoadingState
data class Success(
override val title: String,
val items: List<BaseItem?>,
) : HomeRowLoadingState
data class Error(
override val title: String,
val message: String? = null,
val exception: Throwable? = null,
) : HomeRowLoadingState {
val localizedMessage: String =
listOfNotNull(message, exception?.localizedMessage).joinToString(" - ")
}
}