Skip to content

Conversation

@sophieqgu
Copy link
Contributor

@sophieqgu sophieqgu commented Nov 14, 2025

Description

https://consensyssoftware.atlassian.net/browse/RWDS-268
Part 3 of #36827 pertaining to ui state and selectors

Open in GitHub Codespaces

Changelog

CHANGELOG entry: null

Related issues

Fixes:

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

Introduces a new rewards UI state slice with selectors and background-thunk actions, integrates it into the root reducer, and adds comprehensive tests plus minor config updates.

  • State (Redux):
    • Add ui/ducks/rewards/ slice (index.ts) defining onboarding, geo, subscription/season status, feature flag, and error toast state with actions (e.g., setOnboardingModalOpen, setRewardsGeoMetadata, setSeasonStatus).
    • Integrate reducer in ui/ducks/index.js as rewards.
  • Selectors:
    • Add ui/ducks/rewards/selectors.ts (e.g., selectRewardsEnabled with version-gated flag support, and basic state selectors).
  • Async actions (background thunks):
    • Extend ui/store/actions.ts with rewards-related thunks: validateRewardsReferralCode, getRewardsGeoMetadata, rewardsOptIn, rewardsIsOptInSupported, rewardsGetOptInStatus, rewardsLinkAccountsToSubscriptionCandidate, getRewardsSeasonStatus, getRewardsSeasonMetadata, estimateRewardsPoints.
    • Add updateMetaMetricsTraits helper.
  • Tests:
    • Add unit tests for rewards reducer/actions (ui/ducks/rewards/index.test.ts), selectors (ui/ducks/rewards/selectors.test.ts), and store actions (ui/store/actions.test.js).
  • Configs/fixtures:
    • Update E2E UI state snapshot to include rewards.
    • Tweak circular deps tracking and .madgerc allowed globs.

Written by Cursor Bugbot for commit bd27c29. 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-rewards Rewards team label Nov 14, 2025
@sophieqgu sophieqgu changed the title react state and selectors feat: react state and selectors Nov 14, 2025
@sophieqgu sophieqgu changed the title feat: react state and selectors feat: rewards state and selectors Nov 14, 2025
@sophieqgu sophieqgu requested review from a team, HowardBraham and dbrans as code owners November 14, 2025 19:32
@metamaskbot
Copy link
Collaborator

✨ Files requiring CODEOWNER review ✨

🔒 @MetaMask/extension-security-team (1 files, +4 -97)
  • 📁 development/
    • 📄 circular-deps.jsonc +4 -97

👨‍🔧 @dbrans (1 files, +4 -97)
  • 📁 development/
    • 📄 circular-deps.jsonc +4 -97

👨‍🔧 @HowardBraham (1 files, +4 -97)
  • 📁 development/
    • 📄 circular-deps.jsonc +4 -97

@sophieqgu sophieqgu force-pushed the onboarding-tour-ui-state-and-reducers branch from 132b4e7 to 593f27b Compare November 14, 2025 19:54
@sophieqgu sophieqgu enabled auto-merge November 14, 2025 20:18
@metamaskbot
Copy link
Collaborator

Builds ready [593f27b]
UI Startup Metrics (1226 ± 84 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyStandard HomeuiStartup1226107514818412861384
load105790812848011161186
domContentLoaded104990312788111081181
domInteractive221482161970
firstPaint65894122641710691165
backgroundConnect23622131915237258
firstReactRender29195373145
getState2195782435
initialActions102112
loadScripts821676103080878947
setupStore1142741220
numNetworkReqs1367620672
BrowserifyPower User HomeuiStartup21061864284423622482844
load1128987159120014051591
domContentLoaded1111969158020313981580
domInteractive56182165998216
firstPaint703258158443010081584
backgroundConnect2462322649251264
firstReactRender74501031688103
getState22416730042259300
initialActions104124
loadScripts883748133920011681339
setupStore29164473744
numNetworkReqs1219518129158181
WebpackStandard HomeuiStartup834700139199859990
load588516113982587744
domContentLoaded580512112679578726
domInteractive1912164191554
firstPaint214571133218187730
backgroundConnect291476153271
firstReactRender3520232273842
getState1172431318
initialActions103112
loadScripts577510111877576718
setupStore1262141417
numNetworkReqs1467620872
WebpackPower User HomeuiStartup1069890168626412121686
load658566956146804956
domContentLoaded643555916137787916
domInteractive31121023275102
firstPaint33673919278567919
backgroundConnect581718361107183
firstReactRender38354113941
getState1346315527150155
initialActions102112
loadScripts639553905133777905
setupStore1262682426
numNetworkReqs826413126118131
FirefoxBrowserifyStandard HomeuiStartup14571319203112114901725
load1229113015338512711421
domContentLoaded1229113015328512701421
domInteractive53333234250153
firstPaint------
backgroundConnect4025145174579
firstReactRender27215562843
getState1177271123
initialActions203122
loadScripts1205111314438112451390
setupStore1375491330
numNetworkReqs1265915757
BrowserifyPower User HomeuiStartup33352618501566335755015
load15681334217623517912176
domContentLoaded15671334217623617912176
domInteractive25484682178412682
firstPaint------
backgroundConnect676137159542810301595
firstReactRender86621061399106
getState1888932360215323
initialActions51399339
loadScripts15101298214324016942143
setupStore77371202292120
numNetworkReqs1278023758210237
WebpackStandard HomeuiStartup16881493227715916962137
load14301263180811414571685
domContentLoaded14291263180711414571685
domInteractive57301963064130
firstPaint------
backgroundConnect5226244315891
firstReactRender352694123661
getState147101121227
initialActions204122
loadScripts13991243171511014281654
setupStore187242271357
numNetworkReqs1366817766
WebpackPower User HomeuiStartup31712513422851235324228
load16241415192418618331924
domContentLoaded16241415192418618331924
domInteractive23666554164375554
firstPaint------
backgroundConnect40211810093057791009
firstReactRender88501432295143
getState17710932451208324
initialActions218128
loadScripts15771374190118218001901
setupStore12824514145148514
numNetworkReqs1267222353194223
📊 Page Load Benchmark Results

Current Commit: 593f27b | Date: 11/14/2025

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.06s (±48ms) 🟡 | historical mean value: 1.03s ⬆️ (historical data)
  • domContentLoaded-> current mean value: 737ms (±44ms) 🟢 | historical mean value: 718ms ⬆️ (historical data)
  • firstContentfulPaint-> current mean value: 79ms (±15ms) 🟢 | historical mean value: 77ms ⬆️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.06s 48ms 1.03s 1.45s 1.08s 1.45s
domContentLoaded 737ms 44ms 708ms 1.10s 751ms 1.10s
firstPaint 79ms 15ms 64ms 220ms 92ms 220ms
firstContentfulPaint 79ms 15ms 64ms 220ms 92ms 220ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 58 Bytes (0%)
  • ui: 3.27 KiB (0.04%)
  • common: 913 Bytes (0.01%)

Update circular-deps.jsonc

Update .madgerc

Fix return type

Fix bug
@sophieqgu sophieqgu force-pushed the onboarding-tour-ui-state-and-reducers branch from 593f27b to bd27c29 Compare November 17, 2025 15:50
@metamaskbot
Copy link
Collaborator

Builds ready [bd27c29]
UI Startup Metrics (1218 ± 96 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyStandard HomeuiStartup1218106815319612711386
load105492213188711161211
domContentLoaded104891713128711091200
domInteractive231486172073
firstPaint680150127940410611195
backgroundConnect2322202828236243
firstReactRender27195162841
getState2087082436
initialActions103111
loadScripts821683108786886975
setupStore1062021115
numNetworkReqs1367619671
BrowserifyPower User HomeuiStartup22061905358940423483589
load11951017191425314351914
domContentLoaded11751003189625714261896
domInteractive612017855127178
firstPaint562245158138310281581
backgroundConnect2552402759262275
firstReactRender725096118096
getState22518041159228411
initialActions103123
loadScripts940777163925211831639
setupStore29165093250
numNetworkReqs1229619531160195
WebpackStandard HomeuiStartup8407261172878411130
load61656593978611859
domContentLoaded60956092275605842
domInteractive181267131558
firstPaint18858925207172768
backgroundConnect251172132454
firstReactRender31205373639
getState1152331315
initialActions107111
loadScripts60555891172603831
setupStore1154051315
numNetworkReqs1367519871
WebpackPower User HomeuiStartup1141939179128014461791
load70058110201538481020
domContentLoaded680569972138802972
domInteractive39141604483160
firstPaint37588975306605975
backgroundConnect641129883119298
firstReactRender43384824548
getState14610017926162179
initialActions101011
loadScripts675567961135791961
setupStore1373182431
numNetworkReqs856613827127138
FirefoxBrowserifyStandard HomeuiStartup15481369194912616021828
load1301117615438613551475
domContentLoaded1301117615428613551475
domInteractive59352023363149
firstPaint------
backgroundConnect4422125205183
firstReactRender30236783048
getState1387991225
initialActions203123
loadScripts1275115415078113311437
setupStore177213261244
numNetworkReqs1266515854
BrowserifyPower User HomeuiStartup33612475464371142474643
load15241351201521317662015
domContentLoaded15241350201521317652015
domInteractive23491599155374599
firstPaint------
backgroundConnect63212913934319631393
firstReactRender90691331995133
getState19611234558229345
initialActions213133
loadScripts14681317194719517321947
setupStore1253242892161428
numNetworkReqs1327424563227245
WebpackStandard HomeuiStartup16611416232719916552276
load13981228189612714071707
domContentLoaded13981228189512714071707
domInteractive58313413963126
firstPaint------
backgroundConnect52251613154147
firstReactRender33268583543
getState158161211146
initialActions103122
loadScripts13671212180611513831627
setupStore197217281569
numNetworkReqs1366918767
WebpackPower User HomeuiStartup31272499390148737413901
load16881384213524219692135
domContentLoaded16881383213524219692135
domInteractive25986724200480724
firstPaint------
backgroundConnect34499776208586776
firstReactRender924513122106131
getState198104536116212536
initialActions217127
loadScripts16331343206323218892063
setupStore11947529113117529
numNetworkReqs1318023354206233
📊 Page Load Benchmark Results

Current Commit: bd27c29 | Date: 11/17/2025

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.05s (±99ms) 🟡 | historical mean value: 1.04s ⬆️ (historical data)
  • domContentLoaded-> current mean value: 739ms (±124ms) 🟢 | historical mean value: 729ms ⬆️ (historical data)
  • firstContentfulPaint-> current mean value: 87ms (±107ms) 🟢 | historical mean value: 78ms ⬆️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.05s 99ms 1.01s 2.00s 1.08s 2.00s
domContentLoaded 739ms 124ms 697ms 1.95s 754ms 1.95s
firstPaint 87ms 107ms 60ms 1.15s 92ms 1.15s
firstContentfulPaint 87ms 107ms 60ms 1.15s 92ms 1.15s
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 53 Bytes (0%)
  • ui: 3.27 KiB (0.04%)
  • common: 915 Bytes (0.01%)

@sophieqgu sophieqgu added this pull request to the merge queue Nov 17, 2025
Merged via the queue into main with commit 05c5a3f Nov 17, 2025
173 of 174 checks passed
@sophieqgu sophieqgu deleted the onboarding-tour-ui-state-and-reducers branch November 17, 2025 17:07
@github-actions github-actions bot locked and limited conversation to collaborators Nov 17, 2025
@metamaskbot metamaskbot added the release-13.11.0 Issue or pull request that will be included in release 13.11.0 label Nov 17, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-13.11.0 Issue or pull request that will be included in release 13.11.0 size-XL team-rewards Rewards team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants