Skip to content

Commit

Permalink
fix: self clients slow loading [WPB-9919] (#3175)
Browse files Browse the repository at this point in the history
  • Loading branch information
MohamadJaara authored Jul 9, 2024
1 parent 6306bee commit 7e91bc8
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,18 @@ class SelfDevicesViewModel @Inject constructor(
private val observeUserE2eiCertificates = refreshE2eiCertificates.map { getUserE2eiCertificates(currentAccountId) }

init {
fetchAndObserveClientList()
observeClientList()
updateSelfClientsListFromRemote()
}

private fun fetchAndObserveClientList() {
private fun updateSelfClientsListFromRemote() {
viewModelScope.launch {
fetchSelfClientsFromRemote()
}
}

private fun observeClientList() {
viewModelScope.launch {
fetchSelfClientsFromRemote() // this will cause the list to be refreshed
observeClientList(currentAccountId)
.combine(observeUserE2eiCertificates, ::Pair)
.collect { (result, e2eiCertificates) ->
Expand Down

0 comments on commit 7e91bc8

Please sign in to comment.