Avoiding calculations in the UI thread

This commit is contained in:
Vitor Pamplona
2023-01-31 22:11:54 -03:00
parent 4303e6040c
commit 94a4bfc2f3

View File

@@ -50,9 +50,11 @@ class RelayFeedViewModel: ViewModel() {
} }
} ?: emptyList() } ?: emptyList()
val newList = (beingUsed + newRelaysFromRecord).sortedWith(order)
viewModelScope.launch { viewModelScope.launch {
withContext(Dispatchers.Main) { withContext(Dispatchers.Main) {
_feedContent.update { (beingUsed + newRelaysFromRecord).sortedWith(order) } _feedContent.update { newList }
} }
} }
} }