Skip to content

fix: add fallback for accountIdByAddress#41455

Merged
hmalik88 merged 5 commits intomainfrom
hm/mul-1662
Apr 6, 2026
Merged

fix: add fallback for accountIdByAddress#41455
hmalik88 merged 5 commits intomainfrom
hm/mul-1662

Conversation

@hmalik88
Copy link
Copy Markdown
Contributor

@hmalik88 hmalik88 commented Apr 2, 2026

Description

The bug hasn't been reproducible nor do the sentry errors lead to the reason why accountIdByAddress would be undefined, nonetheless a fallback has been added as a defense mechanism.

Changelog

CHANGELOG entry: null

Related issues

Fixes: #41441

Manual testing steps

N/A

Screenshots/Recordings

N/A

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

Low Risk
Low risk: selector now defensively falls back to an immutable EMPTY_OBJECT when accountIdByAddress is missing, avoiding crashes and unnecessary recomputation; no business logic changes beyond this fallback.

Overview
Adds a defensive fallback in getAccountIdByAddress (ui/selectors/accounts.ts) to return an immutable EMPTY_OBJECT when state.metamask.accountIdByAddress is undefined.

This prevents getInternalAccountByAddress (and other downstream createSelector consumers) from breaking or recomputing due to unstable/undefined references, with a small import cleanup to support the new constant.

Reviewed by Cursor Bugbot for commit 8e8206a. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 2, 2026

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-accounts-framework Accounts team label Apr 2, 2026
Copy link
Copy Markdown

@cursor cursor bot left a comment

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.

@metamaskbotv2
Copy link
Copy Markdown
Contributor

metamaskbotv2 bot commented Apr 2, 2026

Builds ready [f024598]
⚡ Performance Benchmarks (Total: 🟢 18 pass · 🟡 0 warn · 🔴 0 fail)

Baseline (latest main): 5cc482e | Date: 6/24/58222 | Pipeline: 23917468623 | 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_asset_picker: +28%
Startup Benchmarks
Benchmarkchrome-browserifychrome-webpackfirefox-browserifyfirefox-webpack
startupStandardHome🟢 [Show logs]🟢 [Show logs]🟢 [Show logs]🟢 [Show logs]
startupPowerUserHome🟢 [Show logs]🟢 [Show logs]🟢 [Show logs]🟢 [Show logs]

📈 Results compared to the previous 5 runs on main

  • startupStandardHome/initialActions: +11%
  • startupPowerUserHome/setupStore: +13%
  • startupPowerUserHome/numNetworkReqs: -47%
  • startupStandardHome/firstReactRender: -14%
  • startupStandardHome/setupStore: -10%
  • startupPowerUserHome/numNetworkReqs: +42%
  • startupStandardHome/backgroundConnect: +21%
  • startupStandardHome/initialActions: +67%
  • startupStandardHome/setupStore: +29%
  • startupPowerUserHome/setupStore: +40%
  • startupStandardHome/initialActions: +11%
  • startupStandardHome/setupStore: +46%
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: -37%
  • onboardingImportWallet/doneButtonToHomeScreen: -71%
  • onboardingImportWallet/openAccountMenuToAccountListLoaded: +54%
  • onboardingImportWallet/total: -34%
  • onboardingNewWallet/skipBackupToMetricsScreen: +10%
  • onboardingNewWallet/agreeButtonToOnboardingSuccess: +20%
  • onboardingNewWallet/doneButtonToAssetList: -30%
  • onboardingNewWallet/total: -25%
  • assetDetails/assetClickToPriceChart: -71%
  • assetDetails/total: -71%
  • solanaAssetDetails/assetClickToPriceChart: -56%
  • solanaAssetDetails/total: -56%
  • importSrpHome/openAccountMenuAfterLogin: -21%
  • importSrpHome/homeAfterImportWithNewWallet: -36%
  • importSrpHome/total: -31%
  • sendTransactions/openSendPageFromHome: +31%
  • sendTransactions/reviewTransactionToConfirmationPage: +30%
  • sendTransactions/total: +32%
  • swap/openSwapPageFromHome: -81%
  • swap/fetchAndDisplaySwapQuotes: +24%
  • swap/total: +10%
🌐 Dapp Page Load Benchmarks

Current Commit: f024598 | Date: 4/2/2026

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.03s (±38ms) 🟡 | historical mean value: 1.02s ⬆️ (historical data)
  • domContentLoaded-> current mean value: 708ms (±35ms) 🟢 | historical mean value: 717ms ⬇️ (historical data)
  • firstContentfulPaint-> current mean value: 85ms (±10ms) 🟢 | historical mean value: 85ms ⬇️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.03s 38ms 1.01s 1.30s 1.07s 1.30s
domContentLoaded 708ms 35ms 686ms 967ms 743ms 967ms
firstPaint 85ms 10ms 68ms 164ms 100ms 164ms
firstContentfulPaint 85ms 10ms 68ms 164ms 100ms 164ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs
  • background: 58 Bytes (0%)
  • ui: 5 Bytes (0%)
  • common: 68 Bytes (0%)

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Apr 6, 2026

@metamaskbotv2
Copy link
Copy Markdown
Contributor

metamaskbotv2 bot commented Apr 6, 2026

Builds ready [8e8206a]
⚡ Performance Benchmarks (Total: 🟢 6 pass · 🟡 12 warn · 🔴 0 fail)

Baseline (latest main): f34f804 | Date: 9/10/58222 | Pipeline: 24033863804 | 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_asset_picker: -14%

🌐 Core Web Vitals — 🟢 good · 🟡 needs improvement · 🔴 poor (web.dev thresholds)

  • 🟡 loadNewAccount/FCP: p75 2.6s
  • 🟡 confirmTx/FCP: p75 2.5s
  • 🟡 bridgeUserActions/FCP: p75 2.5s
Startup Benchmarks
Benchmarkchrome-browserifychrome-webpackfirefox-browserifyfirefox-webpack
startupStandardHome🟢 [Show logs]🟢 [Show logs]🟢 [Show logs]🟢 [Show logs]
startupPowerUserHome🟡 [Show logs]🟡 [Show logs]🟡 [Show logs]🟡 [Show logs]

📈 Results compared to the previous 5 runs on main

  • startupStandardHome/load: -11%
  • startupStandardHome/domContentLoaded: -13%
  • startupStandardHome/domInteractive: +14%
  • startupStandardHome/backgroundConnect: +16%
  • startupStandardHome/firstReactRender: -13%
  • startupStandardHome/initialActions: -38%
  • startupStandardHome/loadScripts: -17%
  • startupStandardHome/setupStore: +14%
  • startupStandardHome/numNetworkReqs: -21%
  • startupPowerUserHome/backgroundConnect: +112%
  • startupPowerUserHome/setupStore: +17%
  • startupPowerUserHome/numNetworkReqs: -54%
  • startupStandardHome/uiStartup: -14%
  • startupStandardHome/load: -13%
  • startupStandardHome/domContentLoaded: -13%
  • startupStandardHome/backgroundConnect: -33%
  • startupStandardHome/firstReactRender: -24%
  • startupStandardHome/loadScripts: -13%
  • startupStandardHome/numNetworkReqs: -29%
  • startupPowerUserHome/numNetworkReqs: -44%
  • startupStandardHome/domInteractive: -59%
  • startupStandardHome/initialActions: -38%
  • startupStandardHome/setupStore: +14%
  • startupStandardHome/numNetworkReqs: -18%
  • startupPowerUserHome/load: +10%
  • startupPowerUserHome/domContentLoaded: +10%
  • startupPowerUserHome/backgroundConnect: -25%
  • startupPowerUserHome/loadScripts: +11%
  • startupPowerUserHome/setupStore: +15%
  • startupStandardHome/domInteractive: -21%
  • startupStandardHome/initialActions: +11%
  • startupStandardHome/setupStore: -48%
  • startupPowerUserHome/backgroundConnect: -32%
  • startupPowerUserHome/numNetworkReqs: -13%

🌐 Core Web Vitals — 🟢 good · 🟡 needs improvement · 🔴 poor (web.dev thresholds)

  • 🔴 startupPowerUserHome/INP: p75 736ms
  • 🔴 startupPowerUserHome/INP: p75 688ms
  • 🟡 startupPowerUserHome/LCP: p75 3.8s
  • 🟡 startupPowerUserHome/INP: p75 224ms
  • 🟡 startupPowerUserHome/LCP: p75 3.6s
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/doneButtonToHomeScreen: -77%
  • onboardingImportWallet/openAccountMenuToAccountListLoaded: +34%
  • onboardingImportWallet/total: -40%
  • onboardingNewWallet/agreeButtonToOnboardingSuccess: -25%
  • onboardingNewWallet/doneButtonToAssetList: -31%
  • onboardingNewWallet/total: -25%
  • assetDetails/assetClickToPriceChart: -61%
  • assetDetails/total: -61%
  • solanaAssetDetails/assetClickToPriceChart: -58%
  • solanaAssetDetails/total: -58%
  • importSrpHome/openAccountMenuAfterLogin: -69%
  • importSrpHome/homeAfterImportWithNewWallet: -39%
  • importSrpHome/total: -33%
  • sendTransactions/openSendPageFromHome: +91%
  • sendTransactions/reviewTransactionToConfirmationPage: +10%
  • sendTransactions/total: +11%
  • swap/openSwapPageFromHome: -84%
  • swap/fetchAndDisplaySwapQuotes: +31%
  • swap/total: +14%

🌐 Core Web Vitals — 🟢 good · 🟡 needs improvement · 🔴 poor (web.dev thresholds)

  • 🟡 assetDetails/INP: p75 224ms
  • 🟡 assetDetails/FCP: p75 2.8s
  • 🟡 solanaAssetDetails/FCP: p75 2.4s
  • 🟡 importSrpHome/INP: p75 208ms
  • 🟡 importSrpHome/FCP: p75 2.4s
  • 🟡 sendTransactions/INP: p75 208ms
  • 🟡 sendTransactions/FCP: p75 2.5s
  • 🟡 swap/FCP: p75 2.5s
🌐 Dapp Page Load Benchmarks

Current Commit: 8e8206a | Date: 4/6/2026

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.03s (±38ms) 🟡 | historical mean value: 1.03s ⬇️ (historical data)
  • domContentLoaded-> current mean value: 725ms (±36ms) 🟢 | historical mean value: 727ms ⬇️ (historical data)
  • firstContentfulPaint-> current mean value: 85ms (±9ms) 🟢 | historical mean value: 87ms ⬇️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.03s 38ms 1.01s 1.31s 1.06s 1.31s
domContentLoaded 725ms 36ms 703ms 990ms 746ms 990ms
firstPaint 85ms 9ms 72ms 156ms 92ms 156ms
firstContentfulPaint 85ms 9ms 72ms 156ms 92ms 156ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs
  • background: 58 Bytes (0%)
  • ui: 5 Bytes (0%)
  • common: 68 Bytes (0%)

@hmalik88 hmalik88 added this pull request to the merge queue Apr 6, 2026
Merged via the queue into main with commit dd15b92 Apr 6, 2026
210 checks passed
@hmalik88 hmalik88 deleted the hm/mul-1662 branch April 6, 2026 14:16
@github-actions github-actions bot locked and limited conversation to collaborators Apr 6, 2026
@metamaskbot metamaskbot added the release-13.27.0 Issue or pull request that will be included in release 13.27.0 label Apr 6, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-13.27.0 Issue or pull request that will be included in release 13.27.0 size-XS team-accounts-framework Accounts team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Sentry] TypeError: Cannot read properties of undefined (reading '0x**')

4 participants