Skip to content

refactor(snap-keyring): migrate IconName import to @metamask/design-system-react#41445

Open
gantunesr wants to merge 1 commit intomainfrom
refactor/accounts-snap-keyring-iconname-dsr
Open

refactor(snap-keyring): migrate IconName import to @metamask/design-system-react#41445
gantunesr wants to merge 1 commit intomainfrom
refactor/accounts-snap-keyring-iconname-dsr

Conversation

@gantunesr
Copy link
Copy Markdown
Member

@gantunesr gantunesr commented Apr 2, 2026

Description

IconName was imported from the deprecated ui/components/component-library/icon into two background-script files in app/scripts/lib/snap-keyring/. This was a restricted cross-layer import (background → UI) that required an eslint-disable comment to suppress the import-x/no-restricted-paths rule, along with a TODO to remove it.

@metamask/design-system-react exports the same IconName enum (including UserCircleAdd and UserCircleRemove used here), so we can import it from the shared package directly — removing the cross-layer violation entirely.

  1. Why: ui/components/component-library/icon is deprecated and importing UI code into background scripts is a restricted pattern.
  2. Solution: Replace both imports with IconName from @metamask/design-system-react and remove the associated eslint-disable and TODO comments.

Changelog

CHANGELOG entry: null

Related issues

Fixes:

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.

Made with Cursor


Note

Low Risk
Low risk refactor that only changes where IconName is imported from, removing a background→UI cross-layer dependency. Runtime behavior should be unchanged aside from any potential enum mismatch/regression if the design-system export diverges.

Overview
Updates the snap-keyring background code to import IconName from @metamask/design-system-react instead of the deprecated UI component library, and removes the associated eslint-disable/TODO comments.

This eliminates a restricted cross-layer (background → UI) import in snap-keyring.ts and utils/showResult.ts without changing the surrounding snap account flow logic.

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

…ystem-react

Replace the restricted cross-layer import of IconName from the deprecated
ui/components/component-library/icon with the equivalent from
@metamask/design-system-react. Removes the eslint-disable and TODO comments
that were needed to suppress the no-restricted-paths rule.

Made-with: Cursor
@metamaskbotv2
Copy link
Copy Markdown
Contributor

metamaskbotv2 bot commented Apr 2, 2026

✨ Files requiring CODEOWNER review ✨

🔑 @MetaMask/accounts-engineers (2 files, +2 -6)
  • 📁 app/
    • 📁 scripts/
      • 📁 lib/
        • 📁 snap-keyring/
          • 📁 utils/
            • 📄 showResult.ts +1 -3
            • 📄 snap-keyring.ts +1 -3

@metamaskbotv2
Copy link
Copy Markdown
Contributor

metamaskbotv2 bot commented Apr 2, 2026

Builds ready [6efcb63]
⚡ Performance Benchmarks (Total: 🟢 17 pass · 🟡 1 warn · 🔴 0 fail)

Baseline (latest main): 7e59505 | Date: 11/14/58221 | Pipeline: 23902707109 | Baseline logs

Interaction Benchmarks
Benchmarkchrome-browserify
loadNewAccount🟢 [Show logs]
confirmTx🟢 [Show logs]
bridgeUserActions🟢 [Show logs]

📈 Results compared to the previous 5 runs on main

  • bridgeUserActions/bridge_load_page: -28%
  • bridgeUserActions/bridge_load_asset_picker: -16%
  • bridgeUserActions/bridge_search_token: -12%
  • bridgeUserActions/total: -21%
Startup Benchmarks
Benchmarkchrome-browserifychrome-webpackfirefox-browserifyfirefox-webpack
startupStandardHome🟢 [Show logs]🟢 [Show logs]🟢 [Show logs]🟢 [Show logs]
startupPowerUserHome🟢 [Show logs]🟢 [Show logs]
🟡 loadScripts
[Show logs]
🟢 [Show logs]

📈 Results compared to the previous 5 runs on main

  • startupStandardHome/initialActions: +67%
  • startupStandardHome/domInteractive: -11%
  • startupStandardHome/firstPaint: -10%
  • startupPowerUserHome/domInteractive: +10%
  • startupPowerUserHome/firstPaint: +16%
  • startupPowerUserHome/setupStore: +18%
  • startupStandardHome/domInteractive: +17%
  • startupStandardHome/initialActions: -29%
  • startupStandardHome/setupStore: -19%
  • startupPowerUserHome/backgroundConnect: +25%
  • startupPowerUserHome/setupStore: -17%
  • startupStandardHome/initialActions: +43%
  • startupStandardHome/setupStore: +100%
  • startupPowerUserHome/domInteractive: -13%
User Journey Benchmarks
Benchmarkchrome-browserify
onboardingImportWallet🟢 [Show logs]
onboardingNewWallet🟢 [Show logs]
assetDetails🟢 [Show logs]
solanaAssetDetails🟢 [Show logs]
importSrpHome🟢 [Show logs]
sendTransactions🟢 [Show logs]
swap🟢 [Show logs]

📈 Results compared to the previous 5 runs on main

  • onboardingImportWallet/metricsToWalletReadyScreen: -17%
  • onboardingImportWallet/doneButtonToHomeScreen: -77%
  • onboardingImportWallet/openAccountMenuToAccountListLoaded: +99%
  • onboardingImportWallet/total: -36%
  • onboardingNewWallet/skipBackupToMetricsScreen: -19%
  • onboardingNewWallet/agreeButtonToOnboardingSuccess: -19%
  • onboardingNewWallet/doneButtonToAssetList: -37%
  • onboardingNewWallet/total: -30%
  • assetDetails/assetClickToPriceChart: -50%
  • assetDetails/total: -50%
  • solanaAssetDetails/assetClickToPriceChart: -46%
  • solanaAssetDetails/total: -46%
  • importSrpHome/loginToHomeScreen: +18%
  • importSrpHome/homeAfterImportWithNewWallet: -41%
  • importSrpHome/total: -34%
  • swap/openSwapPageFromHome: -86%
  • swap/fetchAndDisplaySwapQuotes: +28%
🌐 Dapp Page Load Benchmarks

Current Commit: 6efcb63 | Date: 4/2/2026

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.04s (±39ms) 🟡 | historical mean value: 1.03s ⬆️ (historical data)
  • domContentLoaded-> current mean value: 736ms (±36ms) 🟢 | historical mean value: 727ms ⬆️ (historical data)
  • firstContentfulPaint-> current mean value: 87ms (±11ms) 🟢 | historical mean value: 85ms ⬆️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.04s 39ms 1.02s 1.33s 1.10s 1.33s
domContentLoaded 736ms 36ms 713ms 1.00s 784ms 1.00s
firstPaint 87ms 11ms 64ms 176ms 100ms 176ms
firstContentfulPaint 87ms 11ms 64ms 176ms 100ms 176ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs
  • background: 20 Bytes (0%)
  • ui: 33 Bytes (0%)
  • common: 163 Bytes (0%)

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Apr 2, 2026

@gantunesr gantunesr marked this pull request as ready for review April 2, 2026 15:16
@gantunesr gantunesr requested a review from a team as a code owner April 2, 2026 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants