fix: refresh all enabled networks when "All popular networks" is selected#27839
fix: refresh all enabled networks when "All popular networks" is selected#27839
Conversation
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
No NFT-specific smoke tests exist in the available tags. The regression NFT tests (nft-detection-modal.spec.ts, nft-details.spec.ts) are marked as Performance Test Selection: |
|
✅ E2E Fixture Validation — Schema is up to date |
|



Description
WAIT FOR THIS TO BE MERGED
useNftRefreshwas building the list of networks to check ownership status fromtokenNetworkFilterinPreferencesController. That value is never updated when the user selects "All popular networks" — that code path only updatesNetworkEnablementController. So on pull-to-refresh,detectNftscorrectly ran against all enabled networks (viachainIdsToDetectNftsFor), butcheckAndUpdateAllNftsOwnershipStatusonly ran against the last single network the user had selected before switching to "All popular networks".The fix replaces
tokenNetworkFilterwithchainIdsToDetectNftsForsourced fromuseNftDetection, which reads fromNetworkEnablementController— the actual source of truth. As a follow-on,detectNftsandchainIdsToDetectNftsForare now passed intouseNftRefreshfrom the caller, eliminating the previously duplicateuseNftDetection()hook instances inNftGridandNFTsSection(two independent abort controllers was an additional latent bug).Changelog
CHANGELOG entry: fixed NFT pull-to-refresh not checking ownership status across all enabled networks when "All popular networks" is selected
Related issues
Fixes: https://consensyssoftware.atlassian.net/browse/ASSETS-2976
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Medium Risk
Changes NFT pull-to-refresh to derive enabled networks from
useNftDetectionand altersuseNftRefresh’s API, which could affect refresh behavior and network RPC usage across multiple screens.Overview
Fixes NFT pull-to-refresh ownership checks to run across all enabled networks by having
useNftRefreshtakechainIdsToDetectNftsFor(fromuseNftDetection) instead of relying on the stalePreferencesControllertoken network filter.Refactors
NftGridandNFTsSectionto passdetectNfts/chainIdsToDetectNftsForintouseNftRefresh, avoiding duplicateuseNftDetection()instances, and updatesuseNftRefreshtests to match the new options-based signature.Also trims delegated contract-read actions in
nft-controller-messengerby removingAssetsContractController:getERC721OwnerOfandAssetsContractController:getERC1155BalanceOf.Written by Cursor Bugbot for commit 0a6629a. This will update automatically on new commits. Configure here.