fix(repository): merge existing seasons when updating series with empty seasons

This commit is contained in:
2026-06-25 21:09:43 +02:00
parent 3c46650a63
commit 59315b701d

View File

@@ -79,7 +79,15 @@ class InMemoryLocalMediaRepository @Inject constructor(
return@run return@run
} }
val series = item.toSeries(serverUrl.first()) val series = item.toSeries(serverUrl.first())
seriesState.update { current -> current + (series.id to series) } seriesState.update { current ->
val existing = current[series.id]
val merged = if (existing != null && existing.seasons.isNotEmpty() && series.seasons.isEmpty()) {
series.copy(seasons = existing.seasons)
} else {
series
}
current + (series.id to merged)
}
} }
} catch (error: CancellationException) { } catch (error: CancellationException) {
throw error throw error