fix(wallet): Update balance loading state on token fetched (#14491)

This commit is contained in:
Cuteivist 2024-04-25 11:08:19 +02:00 committed by GitHub
parent 59cb770ddb
commit 72a081ceca
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 3 deletions

View File

@ -209,6 +209,10 @@ proc notifyModulesOnFilterChanged(self: Module) =
self.allCollectiblesModule.refreshWalletAccounts() self.allCollectiblesModule.refreshWalletAccounts()
self.assetsModule.filterChanged(self.filter.addresses, self.filter.chainIds) self.assetsModule.filterChanged(self.filter.addresses, self.filter.chainIds)
proc notifyModulesBalanceIsLoaded(self: Module) =
self.overviewModule.filterChanged(self.filter.addresses, self.filter.chainIds)
self.accountsModule.filterChanged(self.filter.addresses, self.filter.chainIds)
proc updateViewWithAddressFilterChanged(self: Module) = proc updateViewWithAddressFilterChanged(self: Module) =
if self.overviewModule.getIsAllAccounts(): if self.overviewModule.getIsAllAccounts():
self.view.filterChanged("") self.view.filterChanged("")
@ -271,7 +275,7 @@ method load*(self: Module) =
self.notifyFilterChanged() self.notifyFilterChanged()
self.events.on(SIGNAL_WALLET_ACCOUNT_TOKENS_REBUILT) do(e:Args): self.events.on(SIGNAL_WALLET_ACCOUNT_TOKENS_REBUILT) do(e:Args):
self.setTotalCurrencyBalance() self.setTotalCurrencyBalance()
# self.notifyFilterChanged() self.notifyModulesBalanceIsLoaded()
self.events.on(SIGNAL_TOKENS_PRICES_UPDATED) do(e:Args): self.events.on(SIGNAL_TOKENS_PRICES_UPDATED) do(e:Args):
self.setTotalCurrencyBalance() self.setTotalCurrencyBalance()
self.notifyFilterChanged() self.notifyFilterChanged()

View File

@ -66,8 +66,13 @@ proc getWalletAccoutColors(self: Module, walletAccounts: seq[WalletAccountDto])
method filterChanged*(self: Module, addresses: seq[string], chainIds: seq[int]) = method filterChanged*(self: Module, addresses: seq[string], chainIds: seq[int]) =
let walletAccounts = self.controller.getWalletAccountsByAddresses(addresses) let walletAccounts = self.controller.getWalletAccountsByAddresses(addresses)
let walletAccount = walletAccounts[0] if walletAccounts.len == 0:
let loading = walletAccounts[0].assetsLoading or self.controller.getTokensMarketValuesLoading() return
var loading = self.controller.getTokensMarketValuesLoading()
for account in walletAccounts:
if account.assetsLoading:
loading = true
break
if self.isAllAccounts: if self.isAllAccounts:
let item = initItem( let item = initItem(
"", "",
@ -82,6 +87,7 @@ method filterChanged*(self: Module, addresses: seq[string], chainIds: seq[int])
) )
self.view.setData(item) self.view.setData(item)
else: else:
let walletAccount = walletAccounts[0]
let isWatchOnlyAccount = walletAccount.walletType == "watch" let isWatchOnlyAccount = walletAccount.walletType == "watch"
let item = initItem( let item = initItem(
walletAccount.name, walletAccount.name,