Skip to content

Commit

Permalink
code clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
simonmcl committed Dec 9, 2024
1 parent a513199 commit fdb9031
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Kukai Mobile/Modules/Home/HomeTabBarController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -458,10 +458,15 @@ public class HomeTabBarController: UITabBarController, UITabBarControllerDelegat
records.append(BalanceService.FetchRequestRecord(address: address, type: refreshType))
}


// If no address is passed in, thats short hand for refreshing the current address. However refreshing the current address will simply trigger an expensive cacheLoad if the data is not stale
// Until we move to middleware, simply add another check here. If its not stale, just skip and avoid the reload
if records.count == 0 {
let currentAddress = DependencyManager.shared.selectedWalletAddress ?? ""
if DependencyManager.shared.balanceService.account.walletAddress == currentAddress, !DependencyManager.shared.balanceService.isCacheStale(forAddress: currentAddress) {
// Do nothing for now
return

} else {
records.append(BalanceService.FetchRequestRecord(address: DependencyManager.shared.selectedWalletAddress ?? "", type: refreshType))
}
Expand Down

0 comments on commit fdb9031

Please sign in to comment.