Skip to content

Conversation

@ameliejyc
Copy link
Contributor

@ameliejyc ameliejyc commented Dec 9, 2025

Description

This PR improves the Import NFT modal by requiring users to select a network before importing an NFT. Previously, the Import button validation only checked for a valid address and token ID, but did not enforce network selection, which lead to the button being enabled when it shouldn't have.

Changes:

  1. Refactored the disabled state management to use a computed isFormDisabled value instead of manually syncing state across multiple validation functions
  2. Added network selection as a required validation criterion for enabling the Import button
  3. Renamed selectedNetworkClientId to selectedNetworkClientIdForCustomImport for clarity
  4. Removed unnecessary await keywords from dispatch() calls that don't need to be awaited

Open in GitHub Codespaces

Changelog

CHANGELOG entry: Fixed Import NFT modal to require network selection before enabling button

Related issues

Fixes: #35531

Manual testing steps

  1. Open MetaMask extension
  2. Navigate to the NFTs tab
  3. Click "Import NFT"
  4. Verify the Import button is disabled initially
  5. Enter a valid NFT address and token ID without selecting a network
  6. Verify the Import button remains disabled
  7. Select a network from the network selector
  8. Verify the Import button is now enabled
  9. Click Import and verify the NFT is added successfully

Screenshots/Recordings

Before

After

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

Require network selection to enable Import in the NFT modal, refactor validation to a computed isFormDisabled, and update tests accordingly.

  • UI (Import NFTs Modal):
    • Compute isFormDisabled (requires selected network, valid nftAddress, numeric tokenId, and no validation errors) and use it for the Import button.
    • Remove manual disabled state; simplify validators to only set errors/values.
    • Introduce selectedNetworkClientIdForCustomImport and pass it to addNftVerifyOwnership; reset inputs on network change.
    • Dispatch ignoreTokens without await and keep success/error messaging and navigation flow.
  • Tests:
    • Require network selection for enabling Import; add test for "no network selected" case.
    • Update validity tests and error handling; verify large tokenId handling and correct networkClientId passed (using last call for robustness).
    • Confirm routing on cancel/close and dropdown state updates.

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

@ameliejyc ameliejyc requested a review from a team as a code owner December 9, 2025 14:42
@github-actions
Copy link
Contributor

github-actions bot commented Dec 9, 2025

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@metamaskbot metamaskbot added the team-core-extension-ux Core Extension UX team label Dec 9, 2025
@metamaskbot
Copy link
Collaborator

metamaskbot commented Dec 9, 2025

✨ Files requiring CODEOWNER review ✨

👨‍🔧 @MetaMask/core-extension-ux (2 files, +82 -24)
  • 📁 ui/
    • 📁 components/
      • 📁 multichain/
        • 📁 import-nfts-modal/
          • 📄 import-nfts-modal.js +19 -15
          • 📄 import-nfts-modal.test.js +63 -9

@github-actions github-actions bot added size-M and removed size-S labels Dec 9, 2025
@metamaskbot
Copy link
Collaborator

Builds ready [44b0a9d]
UI Startup Metrics (1196 ± 113 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyStandard HomeuiStartup1196957163011312771375
load98079813499510391158
domContentLoaded97379313429310331138
domInteractive2414103182177
firstPaint67292120138910251097
backgroundConnect19317523813199220
firstReactRender402975104762
getState331095143858
initialActions107112
loadScripts787622111588848939
setupStore1163751223
numNetworkReqs1468521678
BrowserifyPower User HomeuiStartup19021558229816419922193
load1052890143512111401300
domContentLoaded1043885142912011341290
domInteractive3017124242792
firstPaint55182130541310081229
backgroundConnect25220160794237537
firstReactRender47387874862
getState20115074393199260
initialActions102112
loadScripts83268211941209201084
setupStore1573661434
numNetworkReqs72581492071127
WebpackStandard HomeuiStartup8617181064909161043
load65657587477695826
domContentLoaded65157186677690818
domInteractive2716137232294
firstPaint23974872186226702
backgroundConnect1167991229
firstReactRender52331522760132
getState29984123749
initialActions104112
loadScripts64856986476687812
setupStore1162941420
numNetworkReqs1468220674
WebpackPower User HomeuiStartup14971222213117715721850
load71859492188798890
domContentLoaded71158690987790879
domInteractive30161522725108
firstPaint34181922244630841
backgroundConnect84866115763581
firstReactRender49407355057
getState18714373164186270
initialActions104112
loadScripts70858490786788876
setupStore1573881436
numNetworkReqs72592162367126
FirefoxBrowserifyStandard HomeuiStartup15651293239719716361983
load12231046173610512741398
domContentLoaded12221046173610612741398
domInteractive923433956110206
firstPaint------
backgroundConnect752325655104209
firstReactRender46347994867
getState217212291690
initialActions103122
loadScripts1183102315809512311349
setupStore187138211546
numNetworkReqs1568721974
BrowserifyPower User HomeuiStartup25591595391553029583326
load1552979298649020082320
domContentLoaded1552979298649020082320
domInteractive16031169828195956
firstPaint------
backgroundConnect2382611833082081016
firstReactRender5936183226292
getState1306843546156186
initialActions2034325
loadScripts1448960297145518722297
setupStore3643145639181
numNetworkReqs75571302270123
WebpackStandard HomeuiStartup15771316226916816741902
load12751094180311513241507
domContentLoaded12751094180211513241507
domInteractive68272203790131
firstPaint------
backgroundConnect58222164259154
firstReactRender423190104356
getState1365791427
initialActions104123
loadScripts12441078164210212901419
setupStore16682161646
numNetworkReqs1668822880
WebpackPower User HomeuiStartup28591820414356832703704
load19191165286351923622680
domContentLoaded19181165286351923612680
domInteractive22329990326194972
firstPaint------
backgroundConnect167281006206202922
firstReactRender5535101116071
getState1347728147164246
initialActions207126
loadScripts18201139274649622802569
setupStore4354598129315
numNetworkReqs75521302268123
📊 Page Load Benchmark Results

Current Commit: 44b0a9d | Date: 12/9/2025

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.05s (±88ms) 🟡 | historical mean value: 1.05s ⬇️ (historical data)
  • domContentLoaded-> current mean value: 734ms (±86ms) 🟢 | historical mean value: 736ms ⬇️ (historical data)
  • firstContentfulPaint-> current mean value: 82ms (±65ms) 🟢 | historical mean value: 80ms ⬆️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.05s 88ms 1.01s 1.88s 1.07s 1.88s
domContentLoaded 734ms 86ms 702ms 1.55s 749ms 1.55s
firstPaint 82ms 65ms 60ms 724ms 84ms 724ms
firstContentfulPaint 82ms 65ms 60ms 724ms 84ms 724ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 58 Bytes (0%)
  • ui: 403 Bytes (0.01%)
  • common: 20 Bytes (0%)

@ameliejyc ameliejyc added this pull request to the merge queue Dec 10, 2025
Merged via the queue into main with commit 2384c5a Dec 10, 2025
489 of 494 checks passed
@ameliejyc ameliejyc deleted the fix-import-nft-bug branch December 10, 2025 12:30
@github-actions github-actions bot locked and limited conversation to collaborators Dec 10, 2025
@metamaskbot metamaskbot added the release-13.14.0 Issue or pull request that will be included in release 13.14.0 label Dec 10, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

quality-sprint-dec-2025 release-13.14.0 Issue or pull request that will be included in release 13.14.0 size-M team-core-extension-ux Core Extension UX team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: GNS - The Import token button is enabled when I input an address and an id, without selecting any network

5 participants