Skip to content

feat: show skeleton when loading NFT images#27413

Merged
juanmigdr merged 6 commits into
mainfrom
feat/show-skeleton-loading-nft-images
Mar 16, 2026
Merged

feat: show skeleton when loading NFT images#27413
juanmigdr merged 6 commits into
mainfrom
feat/show-skeleton-loading-nft-images

Conversation

@juanmigdr

@juanmigdr juanmigdr commented Mar 12, 2026

Copy link
Copy Markdown
Member

Description

NFT images in the grid had no loading indicator — the cell would appear empty until the image finished loading. This PR adds a skeleton overlay that shows immediately when an NFT item has an image URL, then disappears once the image loads or fails.

Changes:

  • NftGridItem: Tracks a local isImageLoading state (true when item.image or item.imageOriginal is set). Renders a Skeleton overlay on the image cell until onLoad fires. Resets correctly when the item changes.
  • CollectibleMedia + CollectibleMedia.types: Adds an onLoad prop wired through to RemoteImage. Also calls it in the error fallback so the skeleton always clears even when an image fails to load.
  • RemoteImage: Adds an onLoad prop called from the internal onImageLoad handler. Adds recyclingKey={uri} to expo-image Image components so cached images are reused correctly when URIs change.
  • NftGrid: Improves keyExtractor from an array-index key to a stable ${chainId}-${address}-${tokenId} key, preventing unnecessary re-renders when the list updates.

Changelog

CHANGELOG entry: Added skeleton loading indicator to NFT grid items while images are loading

Related issues

Fixes: https://consensyssoftware.atlassian.net/browse/ASSETS-2903

Manual testing steps

Feature: NFT grid skeleton loading

  Scenario: user views the NFT grid while images load
    Given the user has NFTs in their wallet
    When the user navigates to the NFT grid
    Then a skeleton placeholder is visible on each NFT cell while the image loads
    And the skeleton disappears once the image finishes loading

  Scenario: user views an NFT whose image fails to load
    Given the user has an NFT with an unreachable image URL
    When the NFT grid renders that item
    Then the skeleton disappears even though no image is shown

Screenshots/Recordings

Before

Screen.Recording.2026-03-16.at.12.50.36.mov

After

Screen.Recording.2026-03-16.at.12.37.24.mov

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

Note

Medium Risk
Touches NFT grid rendering by adding loading state/skeleton overlays and changing list keys, which can affect perceived UI behavior and item reuse. Also propagates new onLoad callbacks through image components, so regressions would mainly be around image lifecycle events and re-rendering.

Overview
Adds a skeleton loading overlay to NftGridItem that shows when an NFT has an image (and media display is enabled) and hides when the underlying media reports onLoad.

Threads a new onLoad callback through CollectibleMediaRemoteImage, and ensures the callback also fires on image error fallback so the skeleton clears even when an image fails. RemoteImage now sets recyclingKey={uri} on expo-image instances and invokes the new onLoad prop from its internal load handler.

Updates NftGrid to use a stable keyExtractor (chainId-address-tokenId) instead of index keys, and adds/updates unit tests covering the new onLoad behavior and skeleton visibility.

Written by Cursor Bugbot for commit e382cc8. This will update automatically on new commits. Configure here.

@juanmigdr juanmigdr requested a review from a team as a code owner March 12, 2026 10:29
Comment thread app/components/UI/CollectibleMedia/CollectibleMedia.tsx
@github-actions github-actions Bot added size-M and removed size-S labels Mar 16, 2026
Comment thread app/components/UI/CollectibleMedia/CollectibleMedia.test.tsx
Comment thread app/components/UI/NftGrid/NftGrid.tsx
@juanmigdr juanmigdr enabled auto-merge March 16, 2026 11:54

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Comment thread app/components/UI/NftGrid/NftGridItem.tsx Outdated
@juanmigdr juanmigdr added this pull request to the merge queue Mar 16, 2026
@juanmigdr juanmigdr removed this pull request from the merge queue due to a manual request Mar 16, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeWalletPlatform
  • Selected Performance tags: @PerformanceAssetLoading
  • Risk Level: medium
  • AI Confidence: 88%
click to see 🤖 AI reasoning details

E2E Test Selection:
The changes are isolated to NFT-related UI components: RemoteImage, CollectibleMedia, NftGrid, and NftGridItem. These components are responsible for rendering NFT media and grid layouts in the wallet. This directly impacts the NFT gallery and asset display within the main wallet experience.

Although no core Engine, Controller, or network logic was modified, these components are part of the wallet’s primary asset display surface. Rendering issues, broken media loading, or layout regressions could affect the wallet home and asset views, which are covered under SmokeWalletPlatform (core wallet platform features and asset display).

There are no changes affecting:

  • Account management (SmokeAccounts)
  • Identity/sync (SmokeIdentity)
  • Network management (SmokeNetworkAbstractions / SmokeNetworkExpansion)
  • Confirmations or transactions (SmokeConfirmations)
  • Trade, Perps, Predictions, Card, Ramps, or Snaps

Thus, only SmokeWalletPlatform is required for safe validation.

Performance Test Selection:
Changes affect NFT grid rendering and media loading components (NftGrid, NftGridItem, CollectibleMedia, RemoteImage). The @PerformanceAssetLoading suite explicitly covers NFT gallery loading and asset rendering performance. Since these components directly impact how NFTs are rendered and images are loaded, performance regression risk exists in list rendering and media loading behavior.

View GitHub Actions results

@juanmigdr juanmigdr enabled auto-merge March 16, 2026 12:50
@sonarqubecloud

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown
Contributor

E2E Fixture Validation — Schema is up to date
17 value mismatches detected (expected — fixture represents an existing user).
View details

@juanmigdr juanmigdr added this pull request to the merge queue Mar 16, 2026
Merged via the queue into main with commit 8024253 Mar 16, 2026
98 checks passed
@juanmigdr juanmigdr deleted the feat/show-skeleton-loading-nft-images branch March 16, 2026 14:08
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 16, 2026
@metamaskbot metamaskbot added the release-7.71.0 Issue or pull request that will be included in release 7.71.0 label Mar 16, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.71.0 Issue or pull request that will be included in release 7.71.0 size-M team-assets

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants