metamask-extension icon indicating copy to clipboard operation
metamask-extension copied to clipboard

refactor: unapproved transaction count selector

Open n3ps opened this issue 4 weeks ago • 3 comments

Description

Optimize the getNumberOfAllUnapprovedTransactionsAndMessages selector

Open in GitHub Codespaces

Changelog

CHANGELOG entry: null

Related issues

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

Manual testing steps

  1. Go to this page...

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] Rewrites getNumberOfAllUnapprovedTransactionsAndMessages as a memoized selector using specific unapproved message selectors and sums their counts.

  • Selectors:
    • Refactor getNumberOfAllUnapprovedTransactionsAndMessages to a memoized createDeepEqualSelector composing getAllUnapprovedTransactions, unapprovedDecryptMsgsSelector, unapprovedPersonalMsgsSelector, unapprovedEncryptionPublicKeyMsgsSelector, and unapprovedTypedMessagesSelector; returns summed counts with safe fallbacks.
    • Add imports for the new unapproved message selectors in ui/selectors/selectors.js.

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

n3ps avatar Dec 09 '25 17:12 n3ps

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.

github-actions[bot] avatar Dec 09 '25 17:12 github-actions[bot]

Builds ready [860c158]
UI Startup Metrics (1239 ± 120 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyStandard HomeuiStartup1239986168612013061429
load1016837140310310671173
domContentLoaded1010832139610210611165
domInteractive2514104192179
firstPaint4717911843869801135
backgroundConnect20918926012214234
firstReactRender443187134877
getState3718140174064
initialActions103112
loadScripts807637116096860964
setupStore1173551322
numNetworkReqs1468521675
BrowserifyPower User HomeuiStartup19191588230015520242224
load1091917138311611771287
domContentLoaded1081909137411611631281
domInteractive3117156232795
firstPaint580103140242710681260
backgroundConnect25020157982241517
firstReactRender50417365262
getState214149752118203671
initialActions103112
loadScripts86570011551149451071
setupStore1685681536
numNetworkReqs73582142268128
WebpackStandard HomeuiStartup8396861110898921026
load67358189179725814
domContentLoaded66857588478721808
domInteractive2716103192385
firstPaint26086851199235767
backgroundConnect1256491231
firstReactRender54341923158125
getState291587133854
initialActions104112
loadScripts66457388277719806
setupStore1263561429
numNetworkReqs1468620671
WebpackPower User HomeuiStartup14131061201521215741816
load720590985104816914
domContentLoaded712583977104809904
domInteractive3017135252597
firstPaint27993910203284729
backgroundConnect105767618591590
firstReactRender50407155265
getState1808433233187248
initialActions103112
loadScripts709581974103801902
setupStore1573981436
numNetworkReqs72592272467128
FirefoxBrowserifyStandard HomeuiStartup13291067256921814331730
load1068904225315511171239
domContentLoaded1067904225315511111239
domInteractive7031114711578170
firstPaint------
backgroundConnect53202995052169
firstReactRender39316994162
getState12796101125
initialActions102022
loadScripts1039883214614110891204
setupStore195216351259
numNetworkReqs1668922880
BrowserifyPower User HomeuiStartup26751647376055731383476
load1657998263650921032380
domContentLoaded1657998263650921032380
domInteractive1203398317396425
firstPaint------
backgroundConnect230251162252251975
firstReactRender5738182186188
getState1405736151161242
initialActions40639232
loadScripts1554981247747120012282
setupStore535104111459225
numNetworkReqs76561372468131
WebpackStandard HomeuiStartup16711311229118817812023
load13541126178211814251611
domContentLoaded13531126178111814251611
domInteractive822819041115163
firstPaint------
backgroundConnect63171874180157
firstReactRender4432112104858
getState227190321776
initialActions103122
loadScripts13211110175110913891509
setupStore206129241874
numNetworkReqs1669222878
WebpackPower User HomeuiStartup26771798403951831263439
load18931198267148723362574
domContentLoaded18921198267048723352574
domInteractive191291033302114987
firstPaint------
backgroundConnect16024978196204922
firstReactRender58381271762114
getState1297426646161228
initialActions417310232
loadScripts17991168261947022372469
setupStore395101410635154
numNetworkReqs76581342269127
📊 Page Load Benchmark Results

Current Commit: 860c158 | Date: 12/9/2025

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.05s (±53ms) 🟡 | historical mean value: 1.05s ⬆️ (historical data)
  • domContentLoaded-> current mean value: 733ms (±50ms) 🟢 | historical mean value: 733ms ⬇️ (historical data)
  • firstContentfulPaint-> current mean value: 77ms (±13ms) 🟢 | historical mean value: 83ms ⬇️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.05s 53ms 1.02s 1.45s 1.07s 1.45s
domContentLoaded 733ms 50ms 708ms 1.12s 748ms 1.12s
firstPaint 77ms 13ms 60ms 196ms 84ms 196ms
firstContentfulPaint 77ms 13ms 60ms 196ms 84ms 196ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 58 Bytes (0%)
  • ui: 0 Bytes (0%)
  • common: 160 Bytes (0%)

metamaskbot avatar Dec 09 '25 18:12 metamaskbot

Builds ready [181d210]
UI Startup Metrics (1349 ± 100 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyStandard HomeuiStartup13491139171310014151484
load109589113778811571235
domContentLoaded108988413728811501228
domInteractive2915112222494
firstPaint52180128541110551180
backgroundConnect22720827413236256
firstReactRender5433146216297
getState4017171264574
initialActions1011112
loadScripts8686701118859201024
setupStore1373351327
numNetworkReqs1368220672
BrowserifyPower User HomeuiStartup19111632265018619992221
load1069871147212411651276
domContentLoaded1059866145512311571255
domInteractive30171442526102
firstPaint5619814714219931255
backgroundConnect249195825111228609
firstReactRender48398964959
getState19614868774198268
initialActions102011
loadScripts84966812401199501040
setupStore1574571434
numNetworkReqs72582032267129
WebpackStandard HomeuiStartup798652106082845932
load64355380373695786
domContentLoaded63654779772688779
domInteractive251490192180
firstPaint31474814224570744
backgroundConnect1253361528
firstReactRender50311752753130
getState271262113547
initialActions103112
loadScripts63354579371686775
setupStore1154261227
numNetworkReqs1467820674
WebpackPower User HomeuiStartup14101061201320015961712
load7355791034112842906
domContentLoaded7275741023110834896
domInteractive31171282427110
firstPaint36389951260650886
backgroundConnect62756912938541
firstReactRender51427865362
getState20514966862235299
initialActions104112
loadScripts7245721021110831893
setupStore1584391337
numNetworkReqs72592172667142
FirefoxBrowserifyStandard HomeuiStartup13321076219018014131675
load1076910197513011281269
domContentLoaded1075910197513011271269
domInteractive7731100010091157
firstPaint------
backgroundConnect44201783049112
firstReactRender38317484060
getState126144141127
initialActions102012
loadScripts1050895195612510991252
setupStore146127181141
numNetworkReqs1568422877
BrowserifyPower User HomeuiStartup26291638362154530673395
load16251041256649720992373
domContentLoaded16251041256649720992373
domInteractive14433117125190952
firstPaint------
backgroundConnect2442411312792601026
firstReactRender5636104106073
getState1427739754172224
initialActions3051627
loadScripts14901002237545519282288
setupStore4754697646239
numNetworkReqs74581322268127
WebpackStandard HomeuiStartup17091427237217018012063
load13851184167010714651597
domContentLoaded13851184166910714651597
domInteractive843017939118145
firstPaint------
backgroundConnect64202894376147
firstReactRender46368175058
getState2472163717124
initialActions103122
loadScripts1350116415989814221537
setupStore16791131450
numNetworkReqs1568021875
WebpackPower User HomeuiStartup27341759355152432143427
load18521121284951523392533
domContentLoaded18511120284851523382532
domInteractive25629999358251983
firstPaint------
backgroundConnect155261000174189495
firstReactRender5437119126068
getState1308224943161218
initialActions3041625
loadScripts17901106282149522502506
setupStore494108312039232
numNetworkReqs71471312467124
📊 Page Load Benchmark Results

Current Commit: 181d210 | Date: 12/10/2025

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.03s (±140ms) 🟡 | historical mean value: 1.03s ⬆️ (historical data)
  • domContentLoaded-> current mean value: 725ms (±145ms) 🟢 | historical mean value: 718ms ⬆️ (historical data)
  • firstContentfulPaint-> current mean value: 95ms (±212ms) 🟢 | historical mean value: 77ms ⬆️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.03s 140ms 1.00s 2.39s 1.03s 2.39s
domContentLoaded 725ms 145ms 692ms 2.14s 720ms 2.14s
firstPaint 95ms 212ms 56ms 2.20s 84ms 2.20s
firstContentfulPaint 95ms 212ms 56ms 2.20s 84ms 2.20s
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs [🚀 Bundle size reduced!]
  • background: 137 Bytes (0%)
  • ui: 4.2 KiB (0.05%)
  • common: -236 Bytes (0%)

metamaskbot avatar Dec 10 '25 15:12 metamaskbot