From eb3bea8150ce9bf2320d15c879cbebaa6d51a4c6 Mon Sep 17 00:00:00 2001 From: AntsyLich <59261191+AntsyLich@users.noreply.github.com> Date: Sat, 19 Oct 2024 19:53:06 +0600 Subject: [PATCH] Revert "Tweak Preference.collectAsState" This reverts commit 3bddb5538528c19388e364d21e6a6c16487af759. Fixes #1341 --- .../java/tachiyomi/presentation/core/util/Preference.kt | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/presentation-core/src/main/java/tachiyomi/presentation/core/util/Preference.kt b/presentation-core/src/main/java/tachiyomi/presentation/core/util/Preference.kt index 492ae688e..4b7a5018a 100644 --- a/presentation-core/src/main/java/tachiyomi/presentation/core/util/Preference.kt +++ b/presentation-core/src/main/java/tachiyomi/presentation/core/util/Preference.kt @@ -4,12 +4,10 @@ import androidx.compose.runtime.Composable import androidx.compose.runtime.State import androidx.compose.runtime.collectAsState import androidx.compose.runtime.remember -import androidx.compose.runtime.rememberCoroutineScope -import kotlinx.coroutines.CoroutineScope import tachiyomi.core.common.preference.Preference @Composable -fun Preference.collectAsState(scope: CoroutineScope = rememberCoroutineScope()): State { - val flow = remember(this) { stateIn(scope) } - return flow.collectAsState() +fun Preference.collectAsState(): State { + val flow = remember(this) { changes() } + return flow.collectAsState(initial = get()) }