Fixes running new events on the main thread.

This commit is contained in:
Vitor Pamplona
2025-02-17 11:17:38 -05:00
parent 08dd634eae
commit 41e47fa71d
@@ -193,6 +193,7 @@ import kotlinx.coroutines.flow.collectLatest
import kotlinx.coroutines.flow.debounce import kotlinx.coroutines.flow.debounce
import kotlinx.coroutines.flow.receiveAsFlow import kotlinx.coroutines.flow.receiveAsFlow
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import java.lang.Math.round import java.lang.Math.round
@OptIn(ExperimentalMaterial3Api::class, FlowPreview::class) @OptIn(ExperimentalMaterial3Api::class, FlowPreview::class)
@@ -325,8 +326,10 @@ fun NewPostScreen(
CloseButton( CloseButton(
onPress = { onPress = {
scope.launch { scope.launch {
withContext(Dispatchers.IO) {
postViewModel.sendDraftSync(relayList = relayList) postViewModel.sendDraftSync(relayList = relayList)
postViewModel.cancel() postViewModel.cancel()
}
delay(100) delay(100)
nav.popBack() nav.popBack()
} }