From d7726424d9a7e3b5146caafa9a02a34936137870 Mon Sep 17 00:00:00 2001
From: beyond
Date: Sun, 6 Sep 2026 18:24:13 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D:=20=E6=92=AD=E6=94=BE?=
=?UTF-8?q?=E5=99=A8series=20logo=E8=8E=B7=E5=8F=96=E6=94=B9=E4=B8=BA?=
=?UTF-8?q?=E7=8B=AC=E7=AB=8BLaunchedEffect?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 将series logo获取拆分为独立的LaunchedEffect
- 先加载episode item,再异步获取series logo
- 避免在同一个LaunchedEffect中修改state导致重组问题
Co-Authored-By: Claude Opus 5 (1M context)
---
.../myapplication/navigation/AppNavHost.kt | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/app/src/main/kotlin/com/example/myapplication/navigation/AppNavHost.kt b/app/src/main/kotlin/com/example/myapplication/navigation/AppNavHost.kt
index d44bc0a..2d6ac27 100644
--- a/app/src/main/kotlin/com/example/myapplication/navigation/AppNavHost.kt
+++ b/app/src/main/kotlin/com/example/myapplication/navigation/AppNavHost.kt
@@ -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