refactor(core/series): improve data loading reliability with concurrent initialization

This commit is contained in:
2026-06-20 12:18:29 +00:00
parent 5a98f3d2e7
commit 8a2702a7cb
4 changed files with 48 additions and 28 deletions

View File

@@ -99,6 +99,7 @@ fun SeriesScreen(
SeriesScreenInternal(
series = seriesData,
selectSeason = viewModel::selectSeason,
seriesDownloadState = seriesDownloadState,
seasonDownloadState = seasonDownloadState,
isSmartDownloadEnabled = isSmartDownloadEnabled,
@@ -113,7 +114,6 @@ fun SeriesScreen(
}
}
},
onLoadSeasonEpisodes = viewModel::loadSeasonEpisodes,
onObserveSeasonDownloadState = viewModel::observeSeasonDownloadState,
onBack = viewModel::onGoHome,
onMarkAsWatched = viewModel::markAsWatched,
@@ -129,11 +129,11 @@ fun SeriesScreen(
@Composable
private fun SeriesScreenInternal(
series: Series,
selectSeason: (UUID, UUID) -> Unit,
seriesDownloadState: DownloadState,
seasonDownloadState: DownloadState,
isSmartDownloadEnabled: Boolean,
onDownloadOptionSelected: (SeriesDownloadOption, Season) -> Unit,
onLoadSeasonEpisodes: (UUID, UUID) -> Unit,
onObserveSeasonDownloadState: (List<Episode>) -> Unit,
onBack: () -> Unit,
onMarkAsWatched: (Boolean) -> Unit = {},
@@ -175,7 +175,7 @@ private fun SeriesScreenInternal(
}
LaunchedEffect(series.id, selectedSeason?.id) {
selectedSeason?.let { onLoadSeasonEpisodes(series.id, it.id) }
selectedSeason?.let { selectSeason(series.id, it.id) }
}
LaunchedEffect(selectedSeason?.id, selectedSeason?.episodes) {