Skip to content
This repository was archived by the owner on Mar 2, 2026. It is now read-only.

1164-task-refactor-all-the-nft-screens-and-move-to-data-cache#1203

Draft
tombeckenham wants to merge 4 commits into
devfrom
1164-task-refactor-all-the-nft-screens-and-move-to-data-cache
Draft

1164-task-refactor-all-the-nft-screens-and-move-to-data-cache#1203
tombeckenham wants to merge 4 commits into
devfrom
1164-task-refactor-all-the-nft-screens-and-move-to-data-cache

Conversation

@tombeckenham

Copy link
Copy Markdown
Contributor

Closes #1164

Related Issue

Closes #

Summary of Changes

Need Regression Testing

  • Yes
  • No

Risk Assessment

  • Low
  • Medium
  • High

Additional Notes

Screenshots (if applicable)

- 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
@tombeckenham tombeckenham linked an issue Jul 22, 2025 that may be closed by this pull request
@github-actions

github-actions Bot commented Jul 22, 2025

Copy link
Copy Markdown

PR Summary

Refactored 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

File Summary
.cursor/rules/use-git-mv-for-moves.mdc Added new documentation file explaining the importance of using git mv for file operations to preserve Git history and ensure Timeline features work correctly.
apps/extension/src/background/controller/provider/rpcFlow.ts Added params to console logging in flow context to improve debugging capabilities.
apps/extension/src/background/controller/wallet.ts Refactored NFT-related types and methods, replacing legacy types with new ones (NFTCollectionDataCollectionNftItems). Updated methods for handling NFT collections and cache keys.
apps/extension/src/core/service/nft-evm.ts Completely refactored EVM NFT service with new pagination support, collection details fetching, and improved error handling. Added methods for loading entire collections and individual pages.
apps/extension/src/core/service/nft.ts Updated NFT service with improved collection loading, better type definitions, and added documentation for child account NFT handling. Introduced new methods for loading entire Cadence NFT collections.
apps/extension/src/data-model/cache-data-keys.ts Introduced new cache keys and types for NFT collections, added pagination constants, and updated store types for both EVM and Cadence NFTs. Added refresh triggers for collection updates.
apps/extension/src/ui/components/NFTs/collection-card.tsx Added new reusable collection card component with support for accessible/inaccessible states, collection details display, and navigation handling.
apps/extension/src/ui/hooks/useNftHook.ts Major refactor of NFT hook to support both EVM and Cadence collections, added proper pagination handling, and improved error handling. Added new hooks for single collection access.
apps/extension/src/ui/hooks/useNetworkHook.ts Refactored network hook to use shared data hooks, removed redundant state management, and improved developer mode handling.
apps/extension/src/ui/views/Dashboard/wallet-tab.tsx Removed separate EVM NFT view and unified NFT display under single tab component.

autogenerated by presubmit.ai

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 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 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

  • 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"

Comment on lines 38 to 46
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;
};

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 Pull request needs attention.

Review Summary

Commits Considered (1)

Closes #1164

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"

Comment on lines +98 to +108
// 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
);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[TASK] Refactor all the NFT screens and move to data cache

1 participant