feat: reset user's preferences when resetting wallet#39973
Merged
chaitanyapotti merged 3 commits intomainfrom Feb 11, 2026
Merged
feat: reset user's preferences when resetting wallet#39973chaitanyapotti merged 3 commits intomainfrom
chaitanyapotti merged 3 commits intomainfrom
Conversation
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. |
Contributor
Builds ready [689465b]
UI Startup Metrics (1373 ± 96 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs
|
Contributor
Builds ready [71fcf80]
UI Startup Metrics (1368 ± 87 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs
|
chaitanyapotti
approved these changes
Feb 11, 2026
tuna1207
approved these changes
Feb 11, 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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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
When a user resets their wallet via the "Forgot Password" flow, certain state was not being fully cleared. Specifically, the PreferencesController state (locale, theme, blockies, advanced gas fees, known method data, etc.) and the AddressBookController state (saved contacts) were persisted across wallet resets, leaking previous wallet configuration into the freshly restored wallet.
This PR:
resetState()method toPreferencesControllerthat resets all preferences back to their default values.addressBookController.clear()during wallet reset to remove saved contacts.preferencesController.resetState()during wallet reset to restore default preferences.resetState()method.Changelog
CHANGELOG entry: Fixed a bug where user preferences and saved contacts were not cleared when resetting the wallet
Related issues
Fixes: #39863
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Medium Risk
Touches the wallet reset flow and preference defaults; mistakes could cause incorrect post-reset configuration or unintended data persistence/clearing.
Overview
Ensures the "Forgot Password" wallet reset flow fully clears user-specific configuration by resetting
PreferencesControllerstate back to defaults and clearing the address book.Adds
PreferencesController.resetState()(overriding a couple of defaults likecurrentLocaletoFALLBACK_LOCALEandautoLockTimeLimittoDEFAULT_AUTO_LOCK_TIME_LIMIT) and wires it intometamask-controller.resetWallet, with a new unit test verifying key preference fields are reset.Written by Cursor Bugbot for commit 71fcf80. This will update automatically on new commits. Configure here.