Skip to content

Conversation

@NidhiKJha
Copy link
Member

@NidhiKJha NidhiKJha commented Jan 6, 2026

This PR ensures that the active tab url is updated correctly when the tabs are changed. This issue is specific to sidepanel since the side panel stays open and relies on browser.tabs.onActivated and browser.tabs.onUpdated listeners to keep appActiveTab updated in real-time. When those listeners didn't properly clear the state for chrome://newtab, the side panel showed stale data from the previous tab.

Changelog

CHANGELOG entry:null

Related issues

Fixes: #38859

Manual testing steps

  1. Open MM on the side panel
  2. Open test dapp
  3. Click on the Connected site icon
  4. See test dapp url
  5. Open a new browser tab
  6. If it's not a dapp, connected site icon won't show up

Screenshots/Recordings

Before

NA

After

Screen.Recording.2026-01-06.at.2.11.18.PM.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

Improves correctness of sidepanel appActiveTab state and reduces stale data.

  • Validate URLs with isWebUrl; clear appActiveTab for non-web/blank and extension pages in tabs.onActivated and tabs.onUpdated
  • Restrict tabs.onUpdated handling to the active tab and only when changeInfo.url is present; use the provided tab object instead of re-querying
  • Add AppStateController.clearAppActiveTab() and expose it via MetamaskController for background usage
  • Continue updating subject metadata when a valid web URL becomes active

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

@metamaskbot metamaskbot added team-core-extension-ux Core Extension UX team INVALID-PR-TEMPLATE PR's body doesn't match template labels Jan 6, 2026
@github-actions github-actions bot added the size-S label Jan 6, 2026
@metamaskbotv2
Copy link

metamaskbotv2 bot commented Jan 6, 2026

Builds ready [6f2e6cc]
UI Startup Metrics (1296 ± 134 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyStandard HomeuiStartup12961045174013413631543
load1088863152312611511341
domContentLoaded1082860151812511441335
domInteractive261597192388
firstPaint158631051159187297
backgroundConnect21419324610222234
firstReactRender1493641521
getState351797133959
initialActions1012112
loadScripts87566012891249401125
setupStore1273141320
numNetworkReqs171177161165
BrowserifyPower User HomeuiStartup------
load------
domContentLoaded------
domInteractive------
firstPaint------
backgroundConnect------
firstReactRender------
getState------
initialActions------
loadScripts------
setupStore------
numNetworkReqs------
WebpackStandard HomeuiStartup782647105176819956
load63457591764653773
domContentLoaded63057191264647768
domInteractive2515109192182
firstPaint1056133352133208
backgroundConnect235111203362
firstReactRender15112731722
getState3515131194365
initialActions102112
loadScripts62656890362645760
setupStore1376191437
numNetworkReqs171175171168
WebpackPower User HomeuiStartup------
load------
domContentLoaded------
domInteractive------
firstPaint------
backgroundConnect------
firstReactRender------
getState------
initialActions------
loadScripts------
setupStore------
numNetworkReqs------
FirefoxBrowserifyStandard HomeuiStartup14421133223221515661902
load1148946187315512041410
domContentLoaded1147946187315512041410
domInteractive72312364389157
firstPaint------
backgroundConnect65203065587196
firstReactRender13103441324
getState216553601238
initialActions103122
loadScripts1106932185013611631345
setupStore144164181245
numNetworkReqs19985191474
BrowserifyPower User HomeuiStartup23651384313948927352992
load1650970242646320422265
domContentLoaded1649970242546220422264
domInteractive74334587174262
firstPaint------
backgroundConnect355181118351434996
firstReactRender211180102445
getState110611000124114214
initialActions219126
loadScripts1382951227440618372115
setupStore61699613754186
numNetworkReqs68111833577163
WebpackStandard HomeuiStartup17001379235019918222072
load13931175174213714611672
domContentLoaded13921170174113714611672
domInteractive863027147119147
firstPaint------
backgroundConnect68203455278175
firstReactRender16116461723
getState2262233515109
initialActions103123
loadScripts13491159165511114281578
setupStore2251492916100
numNetworkReqs19982191473
WebpackPower User HomeuiStartup27061667367256931583551
load20031193290152324762744
domContentLoaded20021193290052324752743
domInteractive883089313086252
firstPaint------
backgroundConnect3282911323383851057
firstReactRender19135872128
getState1106037753127216
initialActions207122
loadScripts17651174271445321992639
setupStore464110411748183
numNetworkReqs68251893381149
📊 Page Load Benchmark Results

Current Commit: 6f2e6cc | Date: 1/6/2026

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.04s (±40ms) 🟡 | historical mean value: 1.04s ⬇️ (historical data)
  • domContentLoaded-> current mean value: 727ms (±38ms) 🟢 | historical mean value: 728ms ⬇️ (historical data)
  • firstContentfulPaint-> current mean value: 76ms (±11ms) 🟢 | historical mean value: 77ms ⬇️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.04s 40ms 1.01s 1.33s 1.08s 1.33s
domContentLoaded 727ms 38ms 700ms 1.00s 761ms 1.00s
firstPaint 76ms 11ms 60ms 172ms 88ms 172ms
firstContentfulPaint 76ms 11ms 60ms 172ms 88ms 172ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 362 Bytes (0.01%)
  • ui: 0 Bytes (0%)
  • common: 20 Bytes (0%)

@metamaskbotv2
Copy link

metamaskbotv2 bot commented Jan 6, 2026

Builds ready [f30e045]
UI Startup Metrics (1247 ± 99 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyStandard HomeuiStartup1247102815179913051421
load104586712869211041220
domContentLoaded103885912779110981214
domInteractive2516100192376
firstPaint164621047160192282
backgroundConnect20918926312213232
firstReactRender1382741520
getState351765104055
initialActions104112
loadScripts8356621080929001014
setupStore1263351323
numNetworkReqs171072161167
BrowserifyPower User HomeuiStartup------
load------
domContentLoaded------
domInteractive------
firstPaint------
backgroundConnect------
firstReactRender------
getState------
initialActions------
loadScripts------
setupStore------
numNetworkReqs------
WebpackStandard HomeuiStartup815664103080863979
load65857589267682805
domContentLoaded65357188466675799
domInteractive261698192380
firstPaint1096063877115244
backgroundConnect2361282826105
firstReactRender16103241827
getState3515128174460
initialActions1010112
loadScripts65056987565672790
setupStore1253861325
numNetworkReqs181175181171
WebpackPower User HomeuiStartup------
load------
domContentLoaded------
domInteractive------
firstPaint------
backgroundConnect------
firstReactRender------
getState------
initialActions------
loadScripts------
setupStore------
numNetworkReqs------
FirefoxBrowserifyStandard HomeuiStartup14141060206518315251759
load1125912140911812121336
domContentLoaded1125911140911812121336
domInteractive72323314990179
firstPaint------
backgroundConnect66203266083208
firstReactRender1393031422
getState145138191238
initialActions103122
loadScripts108689713019711651259
setupStore13495131241
numNetworkReqs19990201376
BrowserifyPower User HomeuiStartup26261535411857830123509
load17531004280755422362540
domContentLoaded1753999280755422352540
domInteractive983391211492330
firstPaint------
backgroundConnect3742911653784471103
firstReactRender2312190192654
getState1134991088126179
initialActions208123
loadScripts1478988260145520062276
setupStore666105517254225
numNetworkReqs69211753478162
WebpackStandard HomeuiStartup15711253209617116591903
load13231078174011613881527
domContentLoaded13231078174011713881527
domInteractive852919635118134
firstPaint------
backgroundConnect65193325380166
firstReactRender15113031523
getState166142211451
initialActions103122
loadScripts1283106615869813321504
setupStore184180271495
numNetworkReqs20985201478
WebpackPower User HomeuiStartup27751655379856132143567
load20881182303455025422787
domContentLoaded20871182303455025422787
domInteractive11429132820182413
firstPaint------
backgroundConnect3642411933603961131
firstReactRender19137582028
getState1016427537106173
initialActions207123
loadScripts18111124286248322892602
setupStore48495010747208
numNetworkReqs68231743381157
📊 Page Load Benchmark Results

Current Commit: f30e045 | Date: 1/6/2026

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.04s (±44ms) 🟡 | historical mean value: 1.05s ⬇️ (historical data)
  • domContentLoaded-> current mean value: 722ms (±41ms) 🟢 | historical mean value: 730ms ⬇️ (historical data)
  • firstContentfulPaint-> current mean value: 77ms (±16ms) 🟢 | historical mean value: 78ms ⬇️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.04s 44ms 1.01s 1.38s 1.08s 1.38s
domContentLoaded 722ms 41ms 699ms 1.04s 761ms 1.04s
firstPaint 77ms 16ms 60ms 228ms 88ms 228ms
firstContentfulPaint 77ms 16ms 60ms 228ms 88ms 228ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 362 Bytes (0.01%)
  • ui: 0 Bytes (0%)
  • common: 20 Bytes (0%)

@NidhiKJha NidhiKJha added the DO-NOT-MERGE Pull requests that should not be merged label Jan 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

DO-NOT-MERGE Pull requests that should not be merged INVALID-PR-TEMPLATE PR's body doesn't match template size-S team-core-extension-ux Core Extension UX team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Wallet API / Wallet UX - Side Panel - Connected Site displays my previous tab URL when I've opened a new browser tab

3 participants