Workaround ComposeView in RVView

This commit is contained in:
tarsin committed 2023-07-03 20:35:04 +08:00
1 parent 6e65afa7e2
commit 23366c8ea1
1 file changed
+3 -1
@@ -111,7 +111,9 @@ fun GalleryInfoListItem(
bottom.linkTo(if (showFav) favRef.top else postedRef.top)
},
) {
val download by produceState(DownloadManager.containDownloadInfo(info.gid)) {
val download by produceState(DownloadManager.containDownloadInfo(info.gid), info.gid) {
// Workaround ComposeView in RecyclerView, since view is reused, remembered value will not update when setContent with similar @Composable lambda, since composer group key is the same
value = DownloadManager.containDownloadInfo(info.gid)
DownloadManager.stateFlow(info.gid).collect {
value = DownloadManager.containDownloadInfo(info.gid)
}