Loading reply from launch and not withContent

This commit is contained in:
Vitor Pamplona
2023-05-28 16:03:15 -04:00
parent 1c381f64f9
commit 6bc1b6b28a
@@ -19,14 +19,14 @@ import com.vitorpamplona.amethyst.R
import com.vitorpamplona.amethyst.model.* import com.vitorpamplona.amethyst.model.*
import com.vitorpamplona.amethyst.ui.components.CreateClickableTextWithEmoji import com.vitorpamplona.amethyst.ui.components.CreateClickableTextWithEmoji
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext import kotlinx.coroutines.launch
@Composable @Composable
fun ReplyInformation(replyTo: List<Note>?, mentions: List<String>, account: Account, nav: (String) -> Unit) { fun ReplyInformation(replyTo: List<Note>?, mentions: List<String>, account: Account, nav: (String) -> Unit) {
var dupMentions by remember { mutableStateOf<List<User>?>(null) } var dupMentions by remember { mutableStateOf<List<User>?>(null) }
LaunchedEffect(Unit) { LaunchedEffect(Unit) {
withContext(Dispatchers.IO) { launch(Dispatchers.IO) {
dupMentions = mentions.mapNotNull { LocalCache.checkGetOrCreateUser(it) } dupMentions = mentions.mapNotNull { LocalCache.checkGetOrCreateUser(it) }
} }
} }
@@ -119,7 +119,7 @@ fun ReplyInformationChannel(replyTo: List<Note>?, mentions: List<String>, channe
var sortedMentions by remember { mutableStateOf<List<User>?>(null) } var sortedMentions by remember { mutableStateOf<List<User>?>(null) }
LaunchedEffect(Unit) { LaunchedEffect(Unit) {
withContext(Dispatchers.IO) { launch(Dispatchers.IO) {
sortedMentions = mentions sortedMentions = mentions
.mapNotNull { LocalCache.checkGetOrCreateUser(it) } .mapNotNull { LocalCache.checkGetOrCreateUser(it) }
.toSet() .toSet()