修复: 播放器series logo获取改为独立LaunchedEffect
- 将series logo获取拆分为独立的LaunchedEffect - 先加载episode item,再异步获取series logo - 避免在同一个LaunchedEffect中修改state导致重组问题 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
fdf14f7dd2
commit
d7726424d9
1 file changed
+10
-6
@@ -438,19 +438,23 @@ private fun PlayerDestination(
|
||||
} catch (_: Exception) {
|
||||
null
|
||||
}
|
||||
// If episode has no logo, fetch the series item to get its logo
|
||||
val currentSeriesId = seriesId ?: item?.seriesId
|
||||
if (item?.logoImageTag == null && !currentSeriesId.isNullOrBlank() && server != null && server.apiKey.isNotBlank()) {
|
||||
itemLoading = false
|
||||
}
|
||||
|
||||
// Fetch series logo if episode has no logo
|
||||
val currentSeriesId = seriesId ?: item?.seriesId
|
||||
LaunchedEffect(server?.id, currentSeriesId, item?.id) {
|
||||
if (item != null && item!!.logoImageTag == null && !currentSeriesId.isNullOrBlank() && server != null && server.apiKey.isNotBlank()) {
|
||||
try {
|
||||
val seriesItem = EmbyRepository.getItem(server, currentSeriesId)
|
||||
if (seriesItem?.logoImageTag != null) {
|
||||
item = item?.copy(
|
||||
imageTags = (item?.imageTags ?: emptyMap()) + mapOf("Logo" to seriesItem.logoImageTag!!)
|
||||
val updated = item!!.copy(
|
||||
imageTags = (item!!.imageTags ?: emptyMap()) + mapOf("Logo" to seriesItem.logoImageTag!!)
|
||||
)
|
||||
item = updated
|
||||
}
|
||||
} catch (_: Exception) { /* ignore */ }
|
||||
}
|
||||
itemLoading = false
|
||||
}
|
||||
|
||||
val effectiveSeriesId = seriesId ?: item?.seriesId
|
||||
|
||||
Reference in new issue
Block a user