fix: conditionally display delete account confirmation cp-13.20.1#40502
Open
fix: conditionally display delete account confirmation cp-13.20.1#40502
Conversation
Contributor
✨ Files requiring CODEOWNER review ✨🔑 @MetaMask/accounts-engineers (3 files, +294 -7)
|
Member
Author
|
@metamaskbot update-policies |
…thub.com/MetaMask/metamask-extension into gar/fix/delete-snap-account-confirmation
Contributor
Builds ready [2ba2ee6]
⚡ Performance Benchmarks
🌐 Dapp Page Load BenchmarksCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs
|
|
Contributor
Builds ready [bf840c9]
⚡ Performance Benchmarks
🌐 Dapp Page Load BenchmarksCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
danroc
approved these changes
Mar 2, 2026
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
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
As part of a solution for the #38464, the
resyncAccountsmethod now requests the snaps to delete any un-synced account that have created a state discrepancy between the snap and wallet state. This action triggers a confirmation out of nowhere that requires user approval to proceed, and without any context, the user will most likely dismiss this confirmation and keep the inconsistent state.The solution introduce in this PR is to ignore the confirmation dialog for all accounts that are not part of a snap wallet. This way we avoid any confirmation trigger as a result of the execution of
resyncAccounts.Changelog
CHANGELOG entry: conditionally display delete account confirmation
Related issues
Fixes: None
Manual testing steps
Create Account, copy the ID of each of this accountsRemove Accountand try to remove the newly created accountsScreenshots/Recordings
Before
After
Screen.Recording.2026-02-27.at.5.34.32.PM.mov
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Medium Risk
Changes the snap account removal flow to bypass user confirmation based on
AccountTreeControllerstate, which could affect when users are prompted during account deletion. Risk is moderate because it touches account-removal UX and state persistence logic but is scoped and covered by new tests.Overview
Prevents unexpected “delete snap account” confirmation prompts by only showing the removal confirmation dialog when the target account is actually in a
Snapwallet perAccountTreeControllerstate; otherwise removal proceeds immediately.This adds
AccountTreeController:getStateto the snap keyring messenger/type allowlists, refactors removal into a shared helper (#performAccountRemoval) plus a wallet-type check, exportsSnapKeyringImplfor testing, and adds unit tests covering snap-vs-non-snap wallet removal behavior (including deny/error paths).Written by Cursor Bugbot for commit bf840c9. This will update automatically on new commits. Configure here.