mirror of
https://github.com/mihonapp/mihon.git
synced 2024-10-24 21:12:35 -04:00
Revert "Tweak Preference.collectAsState"
This reverts commit 3bddb55385
.
Fixes #1341
This commit is contained in:
parent
5612ae0149
commit
eb3bea8150
1 changed files with 3 additions and 5 deletions
|
@ -4,12 +4,10 @@ import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.State
|
import androidx.compose.runtime.State
|
||||||
import androidx.compose.runtime.collectAsState
|
import androidx.compose.runtime.collectAsState
|
||||||
import androidx.compose.runtime.remember
|
import androidx.compose.runtime.remember
|
||||||
import androidx.compose.runtime.rememberCoroutineScope
|
|
||||||
import kotlinx.coroutines.CoroutineScope
|
|
||||||
import tachiyomi.core.common.preference.Preference
|
import tachiyomi.core.common.preference.Preference
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun <T> Preference<T>.collectAsState(scope: CoroutineScope = rememberCoroutineScope()): State<T> {
|
fun <T> Preference<T>.collectAsState(): State<T> {
|
||||||
val flow = remember(this) { stateIn(scope) }
|
val flow = remember(this) { changes() }
|
||||||
return flow.collectAsState()
|
return flow.collectAsState(initial = get())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue