mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 12:07:28 +00:00
Always use the latest... fix.
This commit is contained in:
committed by
Benoit Marty
parent
3ced570b3c
commit
eb51b49aef
+5
-2
@@ -18,6 +18,8 @@ package io.element.android.libraries.designsystem.components.async
|
||||
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.rememberUpdatedState
|
||||
import androidx.compose.ui.tooling.preview.PreviewParameter
|
||||
import io.element.android.libraries.architecture.AsyncAction
|
||||
import io.element.android.libraries.designsystem.components.ProgressDialog
|
||||
@@ -67,8 +69,9 @@ fun <T> AsyncActionView(
|
||||
}
|
||||
}
|
||||
is AsyncAction.Success -> {
|
||||
LaunchedEffect(async, onSuccess) {
|
||||
onSuccess(async.data)
|
||||
val latestOnSuccess by rememberUpdatedState(onSuccess)
|
||||
LaunchedEffect(async) {
|
||||
latestOnSuccess(async.data)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+3
-2
@@ -43,8 +43,9 @@ internal fun <T> SoftKeyboardEffect(
|
||||
) {
|
||||
val view = LocalView.current
|
||||
val latestOnRequestFocus by rememberUpdatedState(onRequestFocus)
|
||||
LaunchedEffect(key, predicate) {
|
||||
if (predicate(key)) {
|
||||
val latestPredicate by rememberUpdatedState(predicate)
|
||||
LaunchedEffect(key) {
|
||||
if (latestPredicate(key)) {
|
||||
// Await window focus in case returning from a dialog
|
||||
view.awaitWindowFocus()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user