1164-task-refactor-all-the-nft-screens-and-move-to-data-cache#1203
1164-task-refactor-all-the-nft-screens-and-move-to-data-cache#1203tombeckenham wants to merge 4 commits into
Conversation
- Introduced `triggerNftCollectionRefresh` function to refresh NFT collections. - Added `useSingleCollection` hook for fetching single NFT collections. - Removed unused `EditNFTAddress` component files. - Adjusted styles in `CollectionCard` and `NFTTab` components for better layout. - Updated `CollectionDetail` to utilize new refresh functionality. Closes #1164
PR SummaryRefactored NFT-related components and services to improve data caching and UI components. Introduced new collection card component, unified NFT tab view, and enhanced data fetching with pagination support. Improved type definitions and network state handling across components. Changes
autogenerated by presubmit.ai |
There was a problem hiding this comment.
🚨 Pull request needs attention.
Review Summary
Commits Considered (3)
- cae9c65: Supported loading the network
Closes #1164
-
f249e7e: Add NFT collection refresh functionality and clean up UI components
-
Introduced
triggerNftCollectionRefreshfunction to refresh NFT collections. -
Added
useSingleCollectionhook for fetching single NFT collections. -
Removed unused
EditNFTAddresscomponent files. -
Adjusted styles in
CollectionCardandNFTTabcomponents for better layout. -
Updated
CollectionDetailto utilize new refresh functionality.
Closes #1164
- d025d5f: Refactored Cadence NFT List view
Closes #1164
Files Processed (30)
- apps/extension/src/background/controller/provider/rpcFlow.ts (1 hunk)
- apps/extension/src/background/controller/wallet.ts (4 hunks)
- apps/extension/src/core/service/nft-evm.ts (3 hunks)
- apps/extension/src/core/service/nft.ts (5 hunks)
- apps/extension/src/core/service/openapi.ts (2 hunks)
- apps/extension/src/data-model/cache-data-keys.ts (5 hunks)
- apps/extension/src/data-model/user-data-keys.ts (1 hunk)
- apps/extension/src/ui/components/NFTs/EmptyStatus.tsx (from apps/extension/src/ui/views/EmptyStatus.tsx) (0 hunks)
- apps/extension/src/ui/components/NFTs/collection-card.tsx (1 hunk)
- apps/extension/src/ui/components/NetworkIndicator.tsx (1 hunk)
- apps/extension/src/ui/components/StorageUsageCard.tsx (1 hunk)
- apps/extension/src/ui/components/TokenLists/AddCustomEvmToken.tsx (1 hunk)
- apps/extension/src/ui/components/account-menu/MenuDrawer.tsx (2 hunks)
- apps/extension/src/ui/components/account/stories/account-listing.stories.tsx (2 hunks)
- apps/extension/src/ui/components/header/index.tsx (1 hunk)
- apps/extension/src/ui/components/news/NewsView.tsx (1 hunk)
- apps/extension/src/ui/hooks/use-account-hooks.ts (2 hunks)
- apps/extension/src/ui/hooks/use-coin-hooks.ts (2 hunks)
- apps/extension/src/ui/hooks/useCoinHook.ts (1 hunk)
- apps/extension/src/ui/hooks/useNetworkHook.ts (1 hunk)
- apps/extension/src/ui/hooks/useNftHook.ts (4 hunks)
- apps/extension/src/ui/views/Approval/components/Confirmation.tsx (1 hunk)
- apps/extension/src/ui/views/Approval/components/Connect.tsx (2 hunks)
- apps/extension/src/ui/views/Approval/components/EthApproval/EthConfirm/DefaultBlock.tsx (1 hunk)
- apps/extension/src/ui/views/Approval/components/EthApproval/EthSuggest/index.tsx (1 hunk)
- apps/extension/src/ui/views/Approval/components/SignMessage.tsx (1 hunk)
- apps/extension/src/ui/views/Dashboard/dashboard-total.tsx (2 hunks)
- apps/extension/src/ui/views/Dashboard/wallet-tab.tsx (2 hunks)
- apps/extension/src/ui/views/Deposit/deposit.stories.tsx (3 hunks)
- apps/extension/src/ui/views/NFT/CollectionDetail.tsx (3 hunks)
Actionable Comments (1)
-
apps/extension/src/ui/views/Approval/components/EthApproval/EthConfirm/DefaultBlock.tsx [38-46]
possible bug: "Potential bug in UTF-8 text decoding logic"
Skipped Comments (2)
-
apps/extension/src/ui/views/NFT/CollectionDetail.tsx [79-88]
best practice: "Missing error handling in collection refresh operation"
-
apps/extension/src/ui/components/NFTs/collection-card.tsx [28-30]
possible issue: "Potential state mutation in navigation"
| const decoder = new TextDecoder('utf-8', { fatal: true }); | ||
| let decodedText = ''; | ||
| try { | ||
| return decoder.decode(bytes); | ||
| decodedText = decoder.decode(bytes); | ||
| } catch (e) { | ||
| return hexString; | ||
| } | ||
| return decodedText; | ||
| }; |
There was a problem hiding this comment.
The UTF-8 decoding logic has a potential issue where decodedText is returned even if the decoding fails. The try-catch block should either return hexString immediately after successful decoding or move the return statement inside the try block. Current implementation could return an uninitialized decodedText variable.
Closes #1164
There was a problem hiding this comment.
🚨 Pull request needs attention.
Review Summary
Files Processed (28)
- .cursor/rules/use-git-mv-for-moves.mdc (1 hunk)
- apps/extension/src/background/controller/provider/rpcFlow.ts (1 hunk)
- apps/extension/src/background/controller/wallet.ts (6 hunks)
- apps/extension/src/core/service/nft-evm.ts (2 hunks)
- apps/extension/src/core/service/nft.ts (8 hunks)
- apps/extension/src/core/service/openapi.ts (4 hunks)
- apps/extension/src/data-model/cache-data-keys.ts (4 hunks)
- apps/extension/src/data-model/user-data-keys.ts (1 hunk)
- apps/extension/src/ui/components/NFTs/collection-card.tsx (1 hunk)
- apps/extension/src/ui/components/NetworkIndicator.tsx (1 hunk)
- apps/extension/src/ui/components/StorageUsageCard.tsx (1 hunk)
- apps/extension/src/ui/components/TokenLists/AddCustomEvmToken.tsx (1 hunk)
- apps/extension/src/ui/components/account-menu/MenuDrawer.tsx (2 hunks)
- apps/extension/src/ui/components/account/stories/account-listing.stories.tsx (2 hunks)
- apps/extension/src/ui/components/header/index.tsx (2 hunks)
- apps/extension/src/ui/hooks/use-account-hooks.ts (2 hunks)
- apps/extension/src/ui/hooks/use-coin-hooks.ts (2 hunks)
- apps/extension/src/ui/hooks/use-data.ts (1 hunk)
- apps/extension/src/ui/hooks/useCoinHook.ts (1 hunk)
- apps/extension/src/ui/hooks/useNetworkHook.ts (1 hunk)
- apps/extension/src/ui/hooks/useNftHook.ts (12 hunks)
- apps/extension/src/ui/views/Approval/components/Confirmation.tsx (1 hunk)
- apps/extension/src/ui/views/Approval/components/Connect.tsx (2 hunks)
- apps/extension/src/ui/views/Approval/components/EthApproval/EthConfirm/DefaultBlock.tsx (1 hunk)
- apps/extension/src/ui/views/Approval/components/EthApproval/EthSuggest/index.tsx (1 hunk)
- apps/extension/src/ui/views/Approval/components/SignMessage.tsx (1 hunk)
- apps/extension/src/ui/views/Dashboard/dashboard-total.tsx (2 hunks)
- apps/extension/src/ui/views/Dashboard/wallet-tab.tsx (2 hunks)
Actionable Comments (1)
-
apps/extension/src/core/service/nft-evm.ts [98-108]
possible issue: "Potential infinite loop in NFT collection loading"
Skipped Comments (3)
-
apps/extension/src/ui/hooks/useNftHook.ts [205-208]
possible issue: "Loading state could get stuck in edge cases"
-
apps/extension/src/ui/hooks/useNftHook.ts [213-219]
best practice: "Missing error handling and loading state cleanup"
-
apps/extension/src/core/service/nft.ts [181-184]
maintainability: "Missing return type annotation in function signature"
| // We can't run this in parallel as we don't know the total number of pages | ||
| // So we need to run it sequentially | ||
| let entireEvmCollectionNftItemList: EntireEvmCollectionNftItemsStore | undefined = undefined; | ||
| let offset = ''; | ||
| do { | ||
| const evmNftCollectionListPage = await this.loadEvmCollectionNftItemListPage( | ||
| network, | ||
| address, | ||
| collectionIdentifier, | ||
| offset | ||
| ); |
There was a problem hiding this comment.
Consider adding a timeout or maximum retry limit for the do-while loop. If the API keeps returning valid offsets but no actual NFTs, this could potentially run indefinitely.
Closes #1164
Related Issue
Closes #
Summary of Changes
Need Regression Testing
Risk Assessment
Additional Notes
Screenshots (if applicable)