-
Notifications
You must be signed in to change notification settings - Fork 5.2k
fix: dapp receiving two accountsChanged and wallet_sessionChanged events when adding and removing accounts/chainIds in the same edit action #33082
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
jiexi
wants to merge
11
commits into
main
Choose a base branch
from
jl/fix-add-remove-permitted-accounts
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+430
−120
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
✨ Files requiring CODEOWNER review ✨🖥️ @MetaMask/wallet-ux
|
Builds ready [f13682f]
UI Startup Metrics (1225 ± 63 ms)
Benchmark value 40 exceeds gate value 32 for chrome webpack home mean setupStore Benchmark value 2465 exceeds gate value 2454 for chrome webpack home p95 uiStartup Benchmark value 297 exceeds gate value 65 for chrome webpack home p95 setupStore Benchmark value 27 exceeds gate value 24 for firefox browserify home p95 getState Benchmark value 32 exceeds gate value 28 for firefox webpack home p95 setupStore Sum of mean exceeds: 8ms | Sum of p95 exceeds: 253ms Sum of all benchmark exceeds: 261ms |
adonesky1
reviewed
May 20, 2025
adonesky1
reviewed
May 20, 2025
adonesky1
previously approved these changes
May 20, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good and tested and it works great 🙏
Builds ready [33e02a3]
UI Startup Metrics (1220 ± 78 ms)
Benchmark value 1383 exceeds gate value 1365 for chrome browserify home p95 uiStartup Benchmark value 1220 exceeds gate value 1190 for chrome browserify home p95 load Benchmark value 1212 exceeds gate value 1180 for chrome browserify home p95 domContentLoaded Benchmark value 24 exceeds gate value 18 for chrome browserify home p95 backgroundConnect Benchmark value 966 exceeds gate value 940 for chrome browserify home p95 loadScripts Benchmark value 9 exceeds gate value 7 for chrome webpack home mean initialActions Benchmark value 33 exceeds gate value 32 for chrome webpack home mean setupStore Benchmark value 275 exceeds gate value 65 for chrome webpack home p95 setupStore Benchmark value 32 exceeds gate value 27 for firefox browserify home p95 setupStore Sum of mean exceeds: 4ms | Sum of p95 exceeds: 327ms Sum of all benchmark exceeds: 331ms Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
ffmcgee725
previously approved these changes
May 21, 2025
vinnyhoward
previously approved these changes
May 21, 2025
Builds ready [dec7d0f]
UI Startup Metrics (1192 ± 66 ms)
Benchmark value 23 exceeds gate value 18 for chrome browserify home p95 backgroundConnect Benchmark value 2492 exceeds gate value 2454 for chrome webpack home p95 uiStartup Benchmark value 155 exceeds gate value 65 for chrome webpack home p95 setupStore Benchmark value 1384 exceeds gate value 1380 for firefox webpack home mean load Benchmark value 1384 exceeds gate value 1380 for firefox webpack home mean domContentLoaded Benchmark value 39 exceeds gate value 38 for firefox webpack home mean firstReactRender Benchmark value 1364 exceeds gate value 1360 for firefox webpack home mean loadScripts Benchmark value 2014 exceeds gate value 1935 for firefox webpack home p95 uiStartup Benchmark value 1820 exceeds gate value 1660 for firefox webpack home p95 load Benchmark value 1820 exceeds gate value 1660 for firefox webpack home p95 domContentLoaded Benchmark value 1802 exceeds gate value 1630 for firefox webpack home p95 loadScripts Sum of mean exceeds: 13ms | Sum of p95 exceeds: 704ms Sum of all benchmark exceeds: 717ms Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
…unts' into jl/fix-add-remove-permitted-accounts
cf2e2e9
adonesky1
previously approved these changes
May 22, 2025
Builds ready [cf2e2e9]
UI Startup Metrics (1271 ± 87 ms)
Benchmark value 1272 exceeds gate value 1234 for chrome browserify home mean uiStartup Benchmark value 1096 exceeds gate value 1070 for chrome browserify home mean load Benchmark value 1088 exceeds gate value 1061 for chrome browserify home mean domContentLoaded Benchmark value 844 exceeds gate value 830 for chrome browserify home mean loadScripts Benchmark value 1409 exceeds gate value 1365 for chrome browserify home p95 uiStartup Benchmark value 1225 exceeds gate value 1190 for chrome browserify home p95 load Benchmark value 1219 exceeds gate value 1180 for chrome browserify home p95 domContentLoaded Benchmark value 1214 exceeds gate value 1180 for chrome browserify home p95 firstPaint Benchmark value 23 exceeds gate value 18 for chrome browserify home p95 backgroundConnect Benchmark value 971 exceeds gate value 940 for chrome browserify home p95 loadScripts Benchmark value 2461 exceeds gate value 2454 for chrome webpack home p95 uiStartup Benchmark value 246 exceeds gate value 65 for chrome webpack home p95 setupStore Benchmark value 1708 exceeds gate value 1660 for firefox browserify home p95 uiStartup Benchmark value 1549 exceeds gate value 1495 for firefox browserify home p95 load Benchmark value 1548 exceeds gate value 1495 for firefox browserify home p95 domContentLoaded Benchmark value 1527 exceeds gate value 1475 for firefox browserify home p95 loadScripts Benchmark value 39 exceeds gate value 38 for firefox webpack home mean firstReactRender Sum of mean exceeds: 106ms | Sum of p95 exceeds: 583ms Sum of all benchmark exceeds: 689ms Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Builds ready [d678edc]
UI Startup Metrics (1259 ± 80 ms)
Benchmark value 1088 exceeds gate value 1070 for chrome browserify home mean load Benchmark value 1081 exceeds gate value 1061 for chrome browserify home mean domContentLoaded Benchmark value 841 exceeds gate value 800 for chrome browserify home mean firstPaint Benchmark value 836 exceeds gate value 830 for chrome browserify home mean loadScripts Benchmark value 1452 exceeds gate value 1365 for chrome browserify home p95 uiStartup Benchmark value 1240 exceeds gate value 1190 for chrome browserify home p95 load Benchmark value 1233 exceeds gate value 1180 for chrome browserify home p95 domContentLoaded Benchmark value 1242 exceeds gate value 1180 for chrome browserify home p95 firstPaint Benchmark value 975 exceeds gate value 940 for chrome browserify home p95 loadScripts Benchmark value 38 exceeds gate value 32 for chrome webpack home mean setupStore Benchmark value 2457 exceeds gate value 2454 for chrome webpack home p95 uiStartup Benchmark value 305 exceeds gate value 65 for chrome webpack home p95 setupStore Benchmark value 26 exceeds gate value 25 for firefox browserify home mean firstReactRender Benchmark value 39 exceeds gate value 38 for firefox webpack home mean firstReactRender Sum of mean exceeds: 119ms | Sum of p95 exceeds: 530ms Sum of all benchmark exceeds: 649ms Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR adds and uses
setPermittedChains
andsetPermittedAccounts
helpers in theReviewPermissionsPage
, replacing usage ofaddPermittedAccounts
,removePermittedAccount
,addPermittedChains
, andremovePermittedChain
.This is necessary because the previous implementation broke up account and chain permission updates into separate add and remove mutations to state. This resulted in two accountsChanged and wallet_sessionChanged events being fired whenever the user added and removed an account / chainId in a single edit action.
Related issues
Fixes:
Manual testing steps
window.ethereum.on("accountsChanged", console.log)
into consoleScreenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist