MetaMask / MetaMask/metamask-extension
[Bug]: Account data persists after removal unless Chrome is restarted
- Dominant language
- TypeScript
- Stars
- 13.2k
- Forks
- 5.6k
- Avg merge
- 2d 5h
- Merged PRs (30d)
- 451
Description
### Describe the bug
When an account is removed from MetaMask, the account's data (balance, transaction history, etc.) remains locally cached unless the Chrome browser is restarted. This leads to immediate re-population of account data when the same account is re-added within the same browsing session. However, if the browser is restarted before re-adding the account, it appears that MetaMask correctly re-fetches the account data from the blockchain.
This seems to suggest an in-memory cache issue where account data is not being cleared properly upon account removal. A potential solution could be to ensure the clearing of in-memory cache, at least for the account that was removed.
### Steps to reproduce
1. Open MetaMask extension in Chrome and select an account.
2. Remove the selected account from MetaMask.
3. Close the MetaMask extension (keep Chrome open).
4. Reopen MetaMask and re-add the previously removed account.
5. Observe that the account data is immediately available as if it was never deleted.
6. Now, remove the account again and restart Chrome.
7. Re-add the account.
8. Observe that the account data now needs to be re-fetched, indicating that it had been cleared from cache upon browser restart.
### Error messages or log output
_No response_
### Version
10.34.0
### Build type
None
### Browser
Chrome
### Operating system
MacOS
### Hardware wallet
_No response_
### Additional context
_No response_
Contributor guide
Research direction
Start by reproducing the account-removal and re-add flow in Chrome while the browser remains open, then compare it with the restart case described in the issue. Trace the account-removal path and in-memory account-data cache; done means the removed account's balance and transaction history are not immediately restored from memory and are fetched again when re-added.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100