Updated on 2026-08-14

This commit is contained in:
Tangem 2023-05-04 15:13:42 +08:00
parent 2c09165a32
commit b0f23e3660
4 changed files with 11 additions and 32 deletions

View file

@ -105,14 +105,12 @@ internal class WalletViewModel @Inject constructor(
private fun bootstrapSelectedWalletStoresChanges(manager: UserWalletsListManager) {
observeWalletStoresUpdatesJob = manager.selectedUserWallet
.map { it.walletId }
.flatMapLatest { selectedUserWalletId ->
walletStoresManager.get(selectedUserWalletId)
}
.flatMapLatest(walletStoresManager::get)
.debounce { walletStores ->
if (walletStores.isNotEmpty()) WALLET_STORES_DEBOUNCE_TIMEOUT else 0
}
.onEach { walletStores ->
store.dispatch(WalletAction.WalletStoresChanged(walletStores))
store.dispatchOnMain(WalletAction.WalletStoresChanged(walletStores))
}
.launchIn(viewModelScope)
}