Skip to content

Commit

Permalink
Revert "Tweak Preference.collectAsState"
Browse files Browse the repository at this point in the history
This reverts commit 3bddb5538528c19388e364d21e6a6c16487af759.

Fixes #1341

(cherry picked from commit eb3bea8150ce9bf2320d15c879cbebaa6d51a4c6)
  • Loading branch information
AntsyLich authored and Secozzi committed Oct 31, 2024
1 parent 3ca8619 commit 6f10893
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 <T> Preference<T>.collectAsState(scope: CoroutineScope = rememberCoroutineScope()): State<T> {
val flow = remember(this) { stateIn(scope) }
return flow.collectAsState()
fun <T> Preference<T>.collectAsState(): State<T> {
val flow = remember(this) { changes() }
return flow.collectAsState(initial = get())
}

0 comments on commit 6f10893

Please sign in to comment.