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

View File

@ -193,6 +193,7 @@ import kotlinx.coroutines.flow.collectLatest
import kotlinx.coroutines.flow.debounce
import kotlinx.coroutines.flow.receiveAsFlow
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import java.lang.Math.round
@OptIn(ExperimentalMaterial3Api::class, FlowPreview::class)
@ -325,8 +326,10 @@ fun NewPostScreen(
CloseButton(
onPress = {
scope.launch {
postViewModel.sendDraftSync(relayList = relayList)
postViewModel.cancel()
withContext(Dispatchers.IO) {
postViewModel.sendDraftSync(relayList = relayList)
postViewModel.cancel()
}
delay(100)
nav.popBack()
}