From 78240349c80c6ee421d0117a0a1022cd914b67ad Mon Sep 17 00:00:00 2001 From: Nuo Xu Date: Thu, 23 Nov 2023 06:35:21 -0800 Subject: [PATCH] Fix #8463: Only display NFTs after user updates any NFT's visibility status (#8470) after NFT status chanegd, the re-computation needs to apply on only NFTs. --- Sources/BraveWallet/Crypto/Stores/NFTStore.swift | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Sources/BraveWallet/Crypto/Stores/NFTStore.swift b/Sources/BraveWallet/Crypto/Stores/NFTStore.swift index b8d48837ce3..277a893fbbe 100644 --- a/Sources/BraveWallet/Crypto/Stores/NFTStore.swift +++ b/Sources/BraveWallet/Crypto/Stores/NFTStore.swift @@ -590,7 +590,21 @@ public class NFTStore: ObservableObject, WalletObserverStore { let selectedAccounts = self.filters.accounts.filter(\.isSelected).map(\.model) let selectedNetworks = self.filters.networks.filter(\.isSelected).map(\.model) let userVisibleAssets = self.assetManager.getAllUserAssetsInNetworkAssetsByVisibility(networks: selectedNetworks, visible: true) + .map { networkAssets in + NetworkAssets( + network: networkAssets.network, + tokens: networkAssets.tokens.filter { $0.isNft || $0.isErc721 }, + sortOrder: networkAssets.sortOrder + ) + } let userHiddenAssets = self.assetManager.getAllUserAssetsInNetworkAssetsByVisibility(networks: selectedNetworks, visible: false) + .map { networkAssets in + NetworkAssets( + network: networkAssets.network, + tokens: networkAssets.tokens.filter { $0.isNft || $0.isErc721 }, + sortOrder: networkAssets.sortOrder + ) + } let unionedSpamNFTs = computeSpamNFTs( selectedNetworks: selectedNetworks, selectedAccounts: selectedAccounts,