Skip to content

fix: Add maxWait to sendUpdate debounce to fix UI sync starvation#40331

Merged
MajorLift merged 6 commits intomainfrom
jongsun/fix/ui-starvation-with-maxWait
Mar 11, 2026
Merged

fix: Add maxWait to sendUpdate debounce to fix UI sync starvation#40331
MajorLift merged 6 commits intomainfrom
jongsun/fix/ui-starvation-with-maxWait

Conversation

@MajorLift
Copy link
Contributor

@MajorLift MajorLift commented Feb 23, 2026

Description

Adds { maxWait: MILLISECOND * 1000 } to the debounce options for sendUpdate in metamask-controller.js, forcing a periodic flush even under continuous state updates. This prevents the background-to-UI state sync from being starved indefinitely during heavy operations (e.g. syncing >100 accounts).

Open in GitHub Codespaces

Changelog

CHANGELOG entry: Fixed background-to-UI state sync starvation that caused UI to become stuck indefinitely during large account syncs.

Related issues

Fixes: https://github.com/MetaMask/MetaMask-planning/issues/6777

Manual testing steps

  1. Load an SRP with >100 accounts
  2. Open the Accounts list
  3. Verify accounts populate and the UI does not get stuck in a permanent "syncing" state

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

Medium Risk
Adjusts background-to-UI state update scheduling; behavioral/timing changes could affect UI freshness and event ordering under heavy state churn. Includes an e2e test change to reduce flakiness, but edge-case timing regressions are still possible.

Overview
Prevents background-to-UI state sync starvation by adding maxWait: SECOND to the sendUpdate debounce in metamask-controller.js, ensuring state updates flush periodically even during continuous updates.

Hardens MetaMetrics user-trait generation in metametrics-controller.ts by making several preferences-derived traits null-safe with defaults, and updates the metrics e2e test to tolerate identify events being split across multiple updates by polling/merging traits before asserting.

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

@github-actions
Copy link
Contributor

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-extension-platform Extension Platform team label Feb 23, 2026
Workaround for the Accounts List "syncing" issue. Forces a periodic
flush even under continuous updates to avoid indefinite background-to-UI
state sync starvation.
The `maxWait` option on `sendUpdate`'s debounce can trigger flushes
during intermediate states where `preferences` hasn't been populated
yet. This causes `_buildUserTraitsObject` to crash on undefined
`preferences` access.

- Early-return null from `_buildUserTraitsObject` when
  `metamaskState.preferences` is undefined (fixes unit test TypeError)
- Make `segment-user-traits` e2e test resilient to intermediate identify
  events by aggregating traits across all events (fixes flaky Firefox
  assertion)
@metamaskbotv2
Copy link
Contributor

metamaskbotv2 bot commented Feb 23, 2026

Builds ready [4dc441a]
⚡ Performance Benchmarks (1336 ± 93 ms)
👆 Interaction Benchmarks
ActionMetricMean (ms)Std Dev (ms)P75 (ms)P95 (ms)
Load New Accountload_new_account33242363378
total33242363378
Confirm Txconfirm_tx61614761936236
total61614761936236
Bridge User Actionsbridge_load_page27629292325
bridge_load_asset_picker33037365381
bridge_search_token7349738746
total13332513431361
🔌 Startup Benchmarks
BuildMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
Chrome Browserify Startup Standard HomeuiStartup1336115116929313651505
load113796714038511611313
domContentLoaded113096313508111591293
domInteractive261597172368
firstPaint165651188163203335
backgroundConnect19818225814203226
firstReactRender18135151924
initialActions107113
loadScripts9497751173829801115
setupStore1262741420
numNetworkReqs312295202584
Chrome Browserify Startup Power User HomeuiStartup20991414614486420733780
load11951060175513912211551
domContentLoaded11741050165713111971483
domInteractive3520137233289
firstPaint211751666217258317
backgroundConnect50126333385563351786
firstReactRender24164362838
initialActions106112
loadScripts96483714351289801271
setupStore1765081936
numNetworkReqs66351382576123
Chrome Webpack Startup Standard HomeuiStartup8406811128908941002
load72160991685782868
domContentLoaded71560491185778863
domInteractive2815130222375
firstPaint1135940764136224
backgroundConnect26174463038
firstReactRender18124472135
initialActions104112
loadScripts71260290384776855
setupStore1163641118
numNetworkReqs312293202588
Chrome Webpack Startup Power User HomeuiStartup1255924258722013591621
load738623106194735981
domContentLoaded727615105594721973
domInteractive37191182336106
firstPaint1436845572151280
backgroundConnect18213596192167305
firstReactRender23173232528
initialActions102011
loadScripts724613104692719964
setupStore1454561620
numNetworkReqs1193923943141212
Firefox Browserify Startup Standard HomeuiStartup16181385316127216042066
load13561160292921213721565
domContentLoaded13551160292321213711564
domInteractive102361098146121154
firstPaint------
backgroundConnect5729239275591
firstReactRender13112121415
initialActions102012
loadScripts13301138290120913481519
setupStore197200311556
numNetworkReqs322098212591
Firefox Browserify Startup Power User HomeuiStartup27962064874686327733570
load16671266660174016162307
domContentLoaded16671266660174016162307
domInteractive15137967152135555
firstPaint------
backgroundConnect2951131354241327885
firstReactRender19156651924
initialActions213122
loadScripts16261241656773715662276
setupStore1539798204186672
numNetworkReqs67271873885145
Firefox Webpack Startup Standard HomeuiStartup17361431350335017412132
load14541197322628814611644
domContentLoaded14541190322528814611644
domInteractive126281902228131208
firstPaint------
backgroundConnect8026173517266150
firstReactRender16126681523
initialActions103122
loadScripts14271179319028514381629
setupStore227171261761
numNetworkReqs311994172778
Firefox Webpack Startup Power User HomeuiStartup26351993406137027653309
load15631351304926016042089
domContentLoaded15621351304926016032088
domInteractive15637830163134507
firstPaint------
backgroundConnect2671051081204266837
firstReactRender20143042327
initialActions203122
loadScripts15271306300625915692068
setupStore1989814225312661
numNetworkReqs66252324282137
🧭 User Journey Benchmarks
BenchmarkMetricMean (ms)Std Dev (ms)P75 (ms)P95 (ms)
Onboarding Import WalletimportWalletToSocialScreen2160216216
srpButtonToSrpForm9319494
confirmSrpToPwForm2102121
pwFormToMetricsScreen1501515
metricsToWalletReadyScreen1601616
doneButtonToHomeScreen976379921016
openAccountMenuToAccountListLoaded699260076227685
total825359589648972
Onboarding New WalletcreateWalletToSocialScreen2190219219
srpButtonToPwForm1072109109
createPwToRecoveryScreen9099
skipBackupToMetricsScreen3603637
agreeButtonToOnboardingSuccess1601617
doneButtonToAssetList94427411131278
total133427215011668
Asset DetailsassetClickToPriceChart52155674
total52155674
Solana Asset DetailsassetClickToPriceChart7427577
total7427577
Import Srp HomeloginToHomeScreen205415620942315
openAccountMenuAfterLogin4504646
homeAfterImportWithNewWallet25084225372559
total464917446694897
Send TransactionsopenSendPageFromHome33164758
selectTokenToSendFormLoaded31113650
reviewTransactionToConfirmationPage8545852862
total93136946991
SwapopenSwapPageFromHome16621182191
fetchAndDisplaySwapQuotes467412446324886
total483413147875059
🌐 Dapp Page Load Benchmarks

Current Commit: 4dc441a | Date: 2/23/2026

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.04s (±63ms) 🟡 | historical mean value: 1.04s ⬇️ (historical data)
  • domContentLoaded-> current mean value: 729ms (±60ms) 🟢 | historical mean value: 728ms ⬆️ (historical data)
  • firstContentfulPaint-> current mean value: 78ms (±13ms) 🟢 | historical mean value: 80ms ⬇️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.04s 63ms 1.01s 1.33s 1.25s 1.33s
domContentLoaded 729ms 60ms 698ms 1.00s 928ms 1.00s
firstPaint 78ms 13ms 60ms 196ms 92ms 196ms
firstContentfulPaint 78ms 13ms 60ms 196ms 92ms 196ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: -136 Bytes (0%)
  • ui: -3 Bytes (0%)
  • common: 3.06 KiB (0.03%)

@MajorLift MajorLift force-pushed the jongsun/fix/ui-starvation-with-maxWait branch from 4dc441a to 0cfebf5 Compare February 23, 2026 15:44
@metamaskbotv2
Copy link
Contributor

metamaskbotv2 bot commented Feb 23, 2026

Builds ready [0cfebf5]
⚡ Performance Benchmarks (1387 ± 108 ms)
👆 Interaction Benchmarks
ActionMetricMean (ms)Std Dev (ms)P75 (ms)P95 (ms)
Load New Accountload_new_account2706273279
total2706273279
Confirm Txconfirm_tx6045560496050
total6045560496050
Bridge User Actionsbridge_load_page23727245272
bridge_load_asset_picker20731224254
bridge_search_token7385740744
total12251512321245
🔌 Startup Benchmarks
BuildMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
Chrome Browserify Startup Standard HomeuiStartup13871171169510814701561
load1179994141310012511355
domContentLoaded117197914099712451348
domInteractive2716111202482
firstPaint1446335375211293
backgroundConnect20318825613206235
firstReactRender19125052128
initialActions106113
loadScripts98579412179710531163
setupStore1373451521
numNetworkReqs312289202285
Chrome Browserify Startup Power User HomeuiStartup3354154610576226239989574
load12271040162410512831424
domContentLoaded12091028162110112521403
domInteractive3619227263773
firstPaint1968545882264327
backgroundConnect12982617956159820704253
firstReactRender24174562640
initialActions106112
loadScripts100283214299710341191
setupStore1454771726
numNetworkReqs82451231996109
Chrome Webpack Startup Standard HomeuiStartup8596991160999101049
load73560692881800858
domContentLoaded73060192081794852
domInteractive2815114192476
firstPaint1066224944135182
backgroundConnect27198092943
firstReactRender18113861932
initialActions104112
loadScripts72759991680792849
setupStore1163851217
numNetworkReqs322298212586
Chrome Webpack Startup Power User HomeuiStartup1269922247625713541780
load75665513871147521015
domContentLoaded74564913801147401009
domInteractive40191893333137
firstPaint1507058083164281
backgroundConnect17613153266162292
firstReactRender22183232327
initialActions101011
loadScripts74364713711127381000
setupStore1254551619
numNetworkReqs1254923341149185
Firefox Browserify Startup Standard HomeuiStartup16541395248723216682218
load13951157216919814141871
domContentLoaded13941156216819814131871
domInteractive77322794699138
firstPaint------
backgroundConnect63282403865146
firstReactRender14112121417
initialActions102122
loadScripts13661135213518913831719
setupStore167147171538
numNetworkReqs311996202588
Firefox Browserify Startup Power User HomeuiStartup28892180882185329463576
load17061338675572116772161
domContentLoaded17061334675472116772161
domInteractive209561196188259551
firstPaint------
backgroundConnect42011019003345571102
firstReactRender18145851821
initialActions207123
loadScripts16601309671371716202105
setupStore15121666162205506
numNetworkReqs873219238102174
Firefox Webpack Startup Standard HomeuiStartup17991392364837518032250
load15091223307930515141741
domContentLoaded15081222307930515141741
domInteractive952934056130210
firstPaint------
backgroundConnect66273234174138
firstReactRender17126161728
initialActions103122
loadScripts14831203299329614891713
setupStore248193292059
numNetworkReqs311986172779
Firefox Webpack Startup Power User HomeuiStartup28892052795377531123696
load16811335647263616722069
domContentLoaded16811334647263616712069
domInteractive19845709157251595
firstPaint------
backgroundConnect4131211527286550921
firstReactRender21155452331
initialActions203122
loadScripts16441298643363516382029
setupStore14319943166153542
numNetworkReqs84352063790172
🧭 User Journey Benchmarks
BenchmarkMetricMean (ms)Std Dev (ms)P75 (ms)P95 (ms)
Onboarding Import WalletimportWalletToSocialScreen2190219219
srpButtonToSrpForm9219193
confirmSrpToPwForm2212323
pwFormToMetricsScreen1501516
metricsToWalletReadyScreen1711718
doneButtonToHomeScreen11409412061251
openAccountMenuToAccountListLoaded706661272368033
total847045388619007
Onboarding New WalletcreateWalletToSocialScreen2181218218
srpButtonToPwForm1041105106
createPwToRecoveryScreen9099
skipBackupToMetricsScreen3603636
agreeButtonToOnboardingSuccess1601616
doneButtonToAssetList845120926984
total123012213081368
Asset DetailsassetClickToPriceChart56176777
total56176777
Solana Asset DetailsassetClickToPriceChart8018282
total8018282
Import Srp HomeloginToHomeScreen20124420042085
openAccountMenuAfterLogin4324447
homeAfterImportWithNewWallet128299124542537
total3410106045544849
Send TransactionsopenSendPageFromHome2722830
selectTokenToSendFormLoaded40164665
reviewTransactionToConfirmationPage8531854854
total93230942977
SwapopenSwapPageFromHome1683169173
fetchAndDisplaySwapQuotes486919450425044
total503719452085217
🌐 Dapp Page Load Benchmarks

Current Commit: 0cfebf5 | Date: 2/23/2026

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.07s (±63ms) 🟡 | historical mean value: 1.05s ⬆️ (historical data)
  • domContentLoaded-> current mean value: 747ms (±60ms) 🟢 | historical mean value: 729ms ⬆️ (historical data)
  • firstContentfulPaint-> current mean value: 80ms (±10ms) 🟢 | historical mean value: 80ms ⬇️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.07s 63ms 1.02s 1.37s 1.28s 1.37s
domContentLoaded 747ms 60ms 706ms 1.03s 949ms 1.03s
firstPaint 80ms 10ms 64ms 156ms 92ms 156ms
firstContentfulPaint 80ms 10ms 64ms 156ms 92ms 156ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 52.09 KiB (1.2%)
  • ui: -459 Bytes (-0.01%)
  • common: 11.21 KiB (0.1%)

@MajorLift MajorLift changed the title fix: Add maxWait to sendUpdate debounce to fix UI starvation fix: Add maxWait to sendUpdate debounce to fix UI sync starvation Feb 23, 2026
@MajorLift MajorLift self-assigned this Feb 23, 2026
@MajorLift MajorLift marked this pull request as ready for review February 23, 2026 18:33
@metamaskbotv2
Copy link
Contributor

metamaskbotv2 bot commented Feb 23, 2026

Builds ready [50506af]
⚡ Performance Benchmarks (1435 ± 104 ms)
👆 Interaction Benchmarks
ActionMetricMean (ms)Std Dev (ms)P75 (ms)P95 (ms)
Load New Accountload_new_account371105489510
total371105489510
Confirm Txconfirm_tx60711460756088
total60711460756088
Bridge User Actionsbridge_load_page25749303321
bridge_load_asset_picker26050296338
bridge_search_token7419746755
total12583512681320
🔌 Startup Benchmarks
BuildMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
Chrome Browserify Startup Standard HomeuiStartup14351215179410414881627
load1206100614419112541380
domContentLoaded1199100114349012481364
domInteractive291896192689
firstPaint160691095119211269
backgroundConnect21119627115212251
firstReactRender20114962132
initialActions106113
loadScripts100681012499010491172
setupStore1363151521
numNetworkReqs312292202287
Chrome Browserify Startup Power User HomeuiStartup2270136710476155720744822
load11651009159513911931495
domContentLoaded1147991159213411661465
domInteractive3318160233183
firstPaint197781405179249352
backgroundConnect58924947548853762390
firstReactRender25154982941
initialActions1012112
loadScripts94379113961299631265
setupStore1474161525
numNetworkReqs70341492786125
Chrome Webpack Startup Standard HomeuiStartup8526941269978971013
load736610105591795867
domContentLoaded730605105091790862
domInteractive2816108222488
firstPaint1186029355150222
backgroundConnect27196373142
firstReactRender1912166162032
initialActions106112
loadScripts728603104090788858
setupStore1164551118
numNetworkReqs312297202591
Chrome Webpack Startup Power User HomeuiStartup1193841166015712881462
load695602100494698958
domContentLoaded68559499694687950
domInteractive35171542834106
firstPaint1276338168144269
backgroundConnect16512434947158291
firstReactRender22153642428
initialActions104111
loadScripts68359398792685941
setupStore1244451418
numNetworkReqs1183725546137224
Firefox Browserify Startup Standard HomeuiStartup17251455263322417072179
load14591212233819414671783
domContentLoaded14571207233219414651783
domInteractive111341025137135226
firstPaint------
backgroundConnect63341762563115
firstReactRender14124231516
initialActions102012
loadScripts14301188231019014431752
setupStore188183231739
numNetworkReqs311991192784
Firefox Browserify Startup Power User HomeuiStartup27281969408442228503531
load15401328232421116092025
domContentLoaded15391328232421216082025
domInteractive14436828130153395
firstPaint------
backgroundConnect2911171646239290741
firstReactRender201471111948
initialActions103122
loadScripts14971302225719315401874
setupStore1378755183147590
numNetworkReqs75281983789162
Firefox Webpack Startup Standard HomeuiStartup17361429342833617182127
load14571192283025414861663
domContentLoaded14561191283025414841662
domInteractive108301524150129181
firstPaint------
backgroundConnect7820138413972170
firstReactRender16122841726
initialActions102122
loadScripts14321177281525214471639
setupStore206211291659
numNetworkReqs311992182776
Firefox Webpack Startup Power User HomeuiStartup26761998750163128053248
load15801298606552615922003
domContentLoaded15801297606552615922003
domInteractive15531706145148530
firstPaint------
backgroundConnect2961151193236300813
firstReactRender22166072330
initialActions203122
loadScripts15441276601652115631911
setupStore1729697188228566
numNetworkReqs75231973888153
🧭 User Journey Benchmarks
BenchmarkMetricMean (ms)Std Dev (ms)P75 (ms)P95 (ms)
Onboarding Import WalletimportWalletToSocialScreen2172218220
srpButtonToSrpForm9219292
confirmSrpToPwForm2102222
pwFormToMetricsScreen1501515
metricsToWalletReadyScreen1611618
doneButtonToHomeScreen8552169981195
openAccountMenuToAccountListLoaded718441374037836
total840146889568982
Onboarding New WalletcreateWalletToSocialScreen2170217217
srpButtonToPwForm1042105106
createPwToRecoveryScreen8088
skipBackupToMetricsScreen3513535
agreeButtonToOnboardingSuccess1611617
doneButtonToAssetList51093481668
total888938591045
Asset DetailsassetClickToPriceChart7948131145
total7948131145
Solana Asset DetailsassetClickToPriceChart74179093
total74179093
Import Srp HomeloginToHomeScreen20588620562191
openAccountMenuAfterLogin3713838
homeAfterImportWithNewWallet45334497497
total255512327252725
Send TransactionsopenSendPageFromHome2532430
selectTokenToSendFormLoaded3003030
reviewTransactionToConfirmationPage8593862862
total92615947947
SwapopenSwapPageFromHome1781179179
fetchAndDisplaySwapQuotes4565645684575
total47592747754805
🌐 Dapp Page Load Benchmarks

Current Commit: 50506af | Date: 2/23/2026

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.04s (±48ms) 🟡 | historical mean value: 1.06s ⬇️ (historical data)
  • domContentLoaded-> current mean value: 724ms (±41ms) 🟢 | historical mean value: 736ms ⬇️ (historical data)
  • firstContentfulPaint-> current mean value: 77ms (±13ms) 🟢 | historical mean value: 80ms ⬇️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.04s 48ms 1.01s 1.37s 1.06s 1.37s
domContentLoaded 724ms 41ms 701ms 1.03s 738ms 1.03s
firstPaint 77ms 13ms 60ms 192ms 88ms 192ms
firstContentfulPaint 77ms 13ms 60ms 192ms 88ms 192ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs
  • background: 126 Bytes (0%)
  • ui: 5 Bytes (0%)
  • common: 20 Bytes (0%)

…buildUserTraitsObject`

Replaces the blanket null-guard that silently dropped all trait updates
(including non-`preferences`-derived traits like `is_metrics_opted_in`)
when `preferences` was missing during intermediate state flushes.

Replaces hard `driver.delay(2000)` in segment-user-traits e2e test with
`driver.wait` polling for the expected trait values, eliminating
timing-dependent flakiness.
@MajorLift MajorLift force-pushed the jongsun/fix/ui-starvation-with-maxWait branch from 50506af to 16efaaf Compare February 23, 2026 21:03
@metamaskbotv2
Copy link
Contributor

metamaskbotv2 bot commented Feb 23, 2026

Builds ready [16efaaf]
⚡ Performance Benchmarks (1376 ± 109 ms)
👆 Interaction Benchmarks
ActionMetricMean (ms)Std Dev (ms)P75 (ms)P95 (ms)
Load New Accountload_new_account2657266276
total2657266276
Confirm Txconfirm_tx60151260266030
total60151260266030
Bridge User Actionsbridge_load_page22431241266
bridge_load_asset_picker24228261286
bridge_search_token7352737737
total1207512091213
🔌 Startup Benchmarks
BuildMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
Chrome Browserify Startup Standard HomeuiStartup13761158182610914081558
load116197615559811931328
domContentLoaded115496115479711861312
domInteractive271698192381
firstPaint184661234219203333
backgroundConnect20418625414207235
firstReactRender18125351923
initialActions108113
loadScripts96877613559710001131
setupStore1264861520
numNetworkReqs312295202385
Chrome Browserify Startup Power User HomeuiStartup276014519305159437375543
load11661039161111211841409
domContentLoaded11521029159811011771357
domInteractive3419219283278
firstPaint211811456220263334
backgroundConnect810246422490910613059
firstReactRender25175572839
initialActions106114
loadScripts95083213911069741155
setupStore1564271732
numNetworkReqs71391432285112
Chrome Webpack Startup Standard HomeuiStartup83567011601048741031
load71259190890770881
domContentLoaded70758790189766874
domInteractive2716114222289
firstPaint1185839469142258
backgroundConnect26174983142
firstReactRender19125382334
initialActions105112
loadScripts70458589388764867
setupStore1152741218
numNetworkReqs3122111212587
Chrome Webpack Startup Power User HomeuiStartup1212928269623012941604
load7226141232115716982
domContentLoaded7106091217113702977
domInteractive38171903333118
firstPaint1396346982153301
backgroundConnect1801281382130160291
firstReactRender21173632227
initialActions101011
loadScripts7086071206111700968
setupStore1244361420
numNetworkReqs1263925745153193
Firefox Browserify Startup Standard HomeuiStartup16441403272224116422069
load13911180251022214061704
domContentLoaded13891174251022214041703
domInteractive9432132015587170
firstPaint------
backgroundConnect5828172206089
firstReactRender13112521415
initialActions102112
loadScripts13641157249321913801649
setupStore187146211646
numNetworkReqs311998202689
Firefox Browserify Startup Power User HomeuiStartup28412039752785729113484
load16741310563473215991997
domContentLoaded16731306563473215991997
domInteractive15141574123161430
firstPaint------
backgroundConnect38511112943065761063
firstReactRender201471111939
initialActions208123
loadScripts16331269551472515691887
setupStore12510842157146493
numNetworkReqs773117334101151
Firefox Webpack Startup Standard HomeuiStartup17451479321327017502019
load14741196277724314851641
domContentLoaded14731196277624314831641
domInteractive110281442144131183
firstPaint------
backgroundConnect8030146014572153
firstReactRender16123541523
initialActions103122
loadScripts14361178275420414551589
setupStore226173301769
numNetworkReqs311995172779
Firefox Webpack Startup Power User HomeuiStartup27752032905578129393219
load16671329733069416812175
domContentLoaded16661328732969416812175
domInteractive18045796163219548
firstPaint------
backgroundConnect3891141012254573839
firstReactRender21166172230
initialActions207122
loadScripts16291309728969316192157
setupStore11515526106149318
numNetworkReqs81302284485194
🧭 User Journey Benchmarks
BenchmarkMetricMean (ms)Std Dev (ms)P75 (ms)P95 (ms)
Onboarding Import WalletimportWalletToSocialScreen2182218220
srpButtonToSrpForm8909090
confirmSrpToPwForm2102121
pwFormToMetricsScreen1501515
metricsToWalletReadyScreen1501616
doneButtonToHomeScreen9369710281030
openAccountMenuToAccountListLoaded714438474447643
total850342688278896
Onboarding New WalletcreateWalletToSocialScreen2190220220
srpButtonToPwForm1095114116
createPwToRecoveryScreen8089
skipBackupToMetricsScreen3513638
agreeButtonToOnboardingSuccess1601616
doneButtonToAssetList50792499655
total896908941040
Asset DetailsassetClickToPriceChart4054247
total4054247
Solana Asset DetailsassetClickToPriceChart73138088
total73138088
Import Srp HomeloginToHomeScreen18409518921962
openAccountMenuAfterLogin3933944
homeAfterImportWithNewWallet1250100424642496
total3220117144624827
Send TransactionsopenSendPageFromHome2322227
selectTokenToSendFormLoaded3163441
reviewTransactionToConfirmationPage83093909927
total8901039561021
SwapopenSwapPageFromHome17325194211
fetchAndDisplaySwapQuotes46061246134621
total47862348004815
🌐 Dapp Page Load Benchmarks

Current Commit: 16efaaf | Date: 2/23/2026

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.03s (±37ms) 🟡 | historical mean value: 1.06s ⬇️ (historical data)
  • domContentLoaded-> current mean value: 716ms (±36ms) 🟢 | historical mean value: 736ms ⬇️ (historical data)
  • firstContentfulPaint-> current mean value: 75ms (±11ms) 🟢 | historical mean value: 80ms ⬇️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.03s 37ms 1.01s 1.31s 1.04s 1.31s
domContentLoaded 716ms 36ms 695ms 987ms 732ms 987ms
firstPaint 75ms 11ms 56ms 164ms 84ms 164ms
firstContentfulPaint 75ms 11ms 56ms 164ms 84ms 164ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 52.18 KiB (1.2%)
  • ui: 2.65 KiB (0.03%)
  • common: 11.28 KiB (0.1%)

Copy link

@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.

@metamaskbotv2
Copy link
Contributor

metamaskbotv2 bot commented Feb 24, 2026

Builds ready [e1a1c8f]
⚡ Performance Benchmarks (1434 ± 105 ms)
👆 Interaction Benchmarks
ActionMetricMean (ms)Std Dev (ms)P75 (ms)P95 (ms)
Load New Accountload_new_account2561256257
total2561256257
Confirm Txconfirm_tx60401160466058
total60401160466058
Bridge User Actionsbridge_load_page20416212232
bridge_load_asset_picker1899192206
bridge_search_token6976701702
total10902311001129
🔌 Startup Benchmarks
BuildMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
Chrome Browserify Startup Standard HomeuiStartup14341238192710514651638
load1203102416659912371391
domContentLoaded1196102016599612321371
domInteractive3017147232583
firstPaint160671210136214354
backgroundConnect21219228614215236
firstReactRender19114042128
initialActions106113
loadScripts100282414599510341173
setupStore1465171727
numNetworkReqs312289192283
Chrome Browserify Startup Power User HomeuiStartup16231345217615016691887
load1069966168013210541440
domContentLoaded1053954165613110341430
domInteractive3316154263089
firstPaint184671039117240294
backgroundConnect28524445132290347
firstReactRender22156982437
initialActions104112
loadScripts85776514321268401205
setupStore1473771530
numNetworkReqs58381622658128
Chrome Webpack Startup Standard HomeuiStartup83766612341169081073
load7135851013105785910
domContentLoaded7075811008104777902
domInteractive2715121232286
firstPaint1215774987158250
backgroundConnect25185772937
firstReactRender18114672035
initialActions107113
loadScripts7055791006103775900
setupStore1162841118
numNetworkReqs3122100212592
Chrome Webpack Startup Power User HomeuiStartup1210837188918912951587
load6825981069103669965
domContentLoaded6735921057103660951
domInteractive34181773131121
firstPaint1365939876177295
backgroundConnect17614035148174316
firstReactRender23174442530
initialActions104111
loadScripts6705901048101658942
setupStore1244061316
numNetworkReqs1033627153131247
Firefox Browserify Startup Standard HomeuiStartup16201359253320316611937
load13731155221917914221640
domContentLoaded13721154221917914221639
domInteractive803323246110159
firstPaint------
backgroundConnect5628185235885
firstReactRender13112421316
initialActions103012
loadScripts13461131219217513971533
setupStore157135151430
numNetworkReqs311996192582
Firefox Browserify Startup Power User HomeuiStartup24762050331123925482834
load14641205209917715361799
domContentLoaded14631205209817715361798
domInteractive12037621109110321
firstPaint------
backgroundConnect202102804135200473
firstReactRender17136971720
initialActions102122
loadScripts14271183206216814701715
setupStore1198678160110513
numNetworkReqs64221663683141
Firefox Webpack Startup Standard HomeuiStartup17381426318131517482086
load14781198281329714771629
domContentLoaded14771194281329714771629
domInteractive105301349133130175
firstPaint------
backgroundConnect61263183966128
firstReactRender15122731519
initialActions102112
loadScripts14531171279229614521562
setupStore197168231454
numNetworkReqs312095182780
Firefox Webpack Startup Power User HomeuiStartup25611915411537827383352
load15191299225421316161988
domContentLoaded15191299225321316151988
domInteractive14741846161127578
firstPaint------
backgroundConnect2451111368218234774
firstReactRender21155162328
initialActions213122
loadScripts14881278222620615871960
setupStore18491080217306611
numNetworkReqs64291713684133
🧭 User Journey Benchmarks
BenchmarkMetricMean (ms)Std Dev (ms)P75 (ms)P95 (ms)
Onboarding Import WalletimportWalletToSocialScreen2202220222
srpButtonToSrpForm9209292
confirmSrpToPwForm2202222
pwFormToMetricsScreen1501516
metricsToWalletReadyScreen1611717
doneButtonToHomeScreen97828812811321
openAccountMenuToAccountListLoaded749229776657850
total884110988889008
Onboarding New WalletcreateWalletToSocialScreen2192221221
srpButtonToPwForm1042105107
createPwToRecoveryScreen8088
skipBackupToMetricsScreen3513535
agreeButtonToOnboardingSuccess1601616
doneButtonToAssetList68023694705
total10622310741090
Asset DetailsassetClickToPriceChart4374852
total4374852
Solana Asset DetailsassetClickToPriceChart58167275
total58167275
Import Srp HomeloginToHomeScreen204616922812281
openAccountMenuAfterLogin7737129129
homeAfterImportWithNewWallet1097100625192519
total322189144664466
Send TransactionsopenSendPageFromHome33154555
selectTokenToSendFormLoaded2883140
reviewTransactionToConfirmationPage8597863868
total91926942958
SwapopenSwapPageFromHome1591160160
fetchAndDisplaySwapQuotes46057345664731
total47687247404892
🌐 Dapp Page Load Benchmarks

Current Commit: e1a1c8f | Date: 2/24/2026

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.03s (±42ms) 🟡 | historical mean value: 1.05s ⬇️ (historical data)
  • domContentLoaded-> current mean value: 723ms (±59ms) 🟢 | historical mean value: 732ms ⬇️ (historical data)
  • firstContentfulPaint-> current mean value: 89ms (±125ms) 🟢 | historical mean value: 81ms ⬆️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.03s 42ms 1.01s 1.36s 1.06s 1.36s
domContentLoaded 723ms 59ms 699ms 1.26s 735ms 1.26s
firstPaint 89ms 125ms 56ms 1.33s 88ms 1.33s
firstContentfulPaint 89ms 125ms 56ms 1.33s 88ms 1.33s
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs [🚀 Bundle size reduced!]
  • background: 7.26 KiB (0.17%)
  • ui: 2.63 KiB (0.03%)
  • common: -35.05 KiB (-0.31%)

@github-project-automation github-project-automation bot moved this to Needs dev review in PR review queue Mar 4, 2026
@sonarqubecloud
Copy link

sonarqubecloud bot commented Mar 4, 2026

@metamaskbotv2
Copy link
Contributor

metamaskbotv2 bot commented Mar 4, 2026

Builds ready [c512fb6]
⚡ Performance Benchmarks
👆 Interaction Benchmarks
BenchmarkMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P75 (ms)P95 (ms)
Load New Accountload_new_account2762712803278280
total2762712803278280
Confirm Txconfirm_tx6043602560691660416069
total6043602560691660416069
Bridge User Actionsbridge_load_page25122431335264313
bridge_load_asset_picker25423627816265278
bridge_search_token78572985451833854
total1290122913986813431398
🔌 Startup Benchmarks
BenchmarkMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P75 (ms)P95 (ms)
Standard HomeuiStartup14161196196311514561618
load1191100716749812361348
domContentLoaded118499916629812271340
domInteractive2917146222484
firstPaint1616551383222272
backgroundConnect21119233417217237
firstReactRender20125462135
initialActions107124
loadScripts99079814579610211151
setupStore1465071726
numNetworkReqs312291192983
Power User HomeuiStartup242613948102110526274559
load12041062171613612381545
domContentLoaded11871048163313012091510
domInteractive3319133193377
firstPaint2017651498270352
backgroundConnect68026939016806192187
firstReactRender24165172537
initialActions107112
loadScripts972840141012410001276
setupStore1665091834
numNetworkReqs72281612682125
🧭 User Journey Benchmarks
BenchmarkMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P75 (ms)P95 (ms)
Onboarding Import WalletimportWalletToSocialScreen2212202242222224
srpButtonToSrpForm96939929899
confirmSrpToPwForm23222512425
pwFormToMetricsScreen16161601616
metricsToWalletReadyScreen17161811718
doneButtonToHomeScreen64360167531670675
openAccountMenuToAccountListLoaded30082905314711431463147
total3926388339763339253976
Onboarding New WalletcreateWalletToSocialScreen2172172180218218
srpButtonToPwForm1051031071105107
createPwToRecoveryScreen888088
skipBackupToMetricsScreen34323513535
agreeButtonToOnboardingSuccess15151601616
doneButtonToAssetList62551970567666705
total101193410835610451083
Asset DetailsassetClickToPriceChart674190208390
total674190208390
Solana Asset DetailsassetClickToPriceChart1301201418132141
total1301201418132141
Import Srp HomeloginToHomeScreen20891928234516622242345
openAccountMenuAfterLogin563970126870
homeAfterImportWithNewWallet5175055249524524
total26692521285512927872855
Send TransactionsopenSendPageFromHome29253742837
selectTokenToSendFormLoaded35284464044
reviewTransactionToConfirmationPage1132109911713211561171
total1199116012553712091255
SwapopenSwapPageFromHome18815923026202230
fetchAndDisplaySwapQuotes289328912899328922899
total3086305131423230933142
🌐 Dapp Page Load Benchmarks

Current Commit: c512fb6 | Date: 3/4/2026

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.06s (±42ms) 🟡 | historical mean value: 1.05s ⬆️ (historical data)
  • domContentLoaded-> current mean value: 745ms (±40ms) 🟢 | historical mean value: 740ms ⬆️ (historical data)
  • firstContentfulPaint-> current mean value: 83ms (±11ms) 🟢 | historical mean value: 82ms ⬆️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.06s 42ms 1.03s 1.36s 1.08s 1.36s
domContentLoaded 745ms 40ms 722ms 1.04s 765ms 1.04s
firstPaint 83ms 11ms 64ms 172ms 92ms 172ms
firstContentfulPaint 83ms 11ms 64ms 172ms 92ms 172ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 1.01 MiB (23.78%)
  • ui: 24.88 KiB (0.3%)
  • common: -19.83 KiB (-0.18%)

@MajorLift MajorLift moved this from Needs dev review to Review in progress in PR review queue Mar 11, 2026
Copy link
Contributor Author

@MajorLift MajorLift left a comment

Choose a reason for hiding this comment

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

Notes for reviewers:

this.sendUpdate = debounce(
this.privateSendUpdate.bind(this),
MILLISECOND * 200,
{ maxWait: SECOND }, // Force flush to avoid indefinite sync starvation
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Core change

metamaskState.useTokenDetection,
[MetaMetricsUserTrait.ShowNativeTokenAsMainBalance]:
metamaskState.preferences.showNativeTokenAsMainBalance,
metamaskState.preferences?.showNativeTokenAsMainBalance ?? false,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The nullish fallback values in this file are based on getDefaultPreferencesControllerState

Comment on lines -168 to +172
events = await getEventPayloads(driver, mockedEndpoints);
assert.equal(events.length, 1);
assert.deepStrictEqual(events[0].traits.is_metrics_opted_in, true);
assert.deepStrictEqual(events[0].traits.has_marketing_consent, true);
// maxWait on sendUpdate debounce may split the two toggles into
// separate identify events. Poll until the expected traits arrive.
await driver.wait(async () => {
try {
events = await getEventPayloads(driver, mockedEndpoints, false);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

  • Added polling logic for metametrics segment traits test.
  • Handles edge case where toggle state updates are not batched together due to maxWait.

@MajorLift MajorLift moved this from Review in progress to Has approvals, needs CODEOWNER in PR review queue Mar 11, 2026
@github-project-automation github-project-automation bot moved this from Has approvals, needs CODEOWNER to Review finalised - Ready to be merged in PR review queue Mar 11, 2026
@MajorLift MajorLift added this pull request to the merge queue Mar 11, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 11, 2026
@MajorLift MajorLift added this pull request to the merge queue Mar 11, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 11, 2026
@MajorLift MajorLift added this pull request to the merge queue Mar 11, 2026
Merged via the queue into main with commit 7bb7623 Mar 11, 2026
338 of 342 checks passed
@MajorLift MajorLift deleted the jongsun/fix/ui-starvation-with-maxWait branch March 11, 2026 19:27
@github-project-automation github-project-automation bot moved this from Review finalised - Ready to be merged to Merged, Closed or Archived in PR review queue Mar 11, 2026
@github-actions github-actions bot locked and limited conversation to collaborators Mar 11, 2026
@metamaskbot metamaskbot added the release-13.23.0 Issue or pull request that will be included in release 13.23.0 label Mar 11, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-13.23.0 Issue or pull request that will be included in release 13.23.0 size-S team-extension-platform Extension Platform team

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants