Reduce allocation
This commit is contained in:
1 parent
d855858543
commit
9b3595e45f
1 file changed
+3
-4
@@ -248,10 +248,9 @@ object DownloadManager : OnSpiderListener {
|
||||
|
||||
@Stable
|
||||
@Composable
|
||||
fun collectDownloadState(gid: Long): State<Int> {
|
||||
val flow = remember { stateFlow(gid).map { getDownloadState(it) } }
|
||||
return flow.collectAsState(getDownloadState(gid))
|
||||
}
|
||||
fun collectDownloadState(gid: Long): State<Int> = remember {
|
||||
notifyFlow.transform { if (it.gid == gid) emit(getDownloadState(gid)) }
|
||||
}.collectAsState(getDownloadState(gid))
|
||||
|
||||
@Stable
|
||||
@Composable
|
||||
|
||||
Reference in new issue
Block a user