-
Notifications
You must be signed in to change notification settings - Fork 48
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
Clear deprecated WAGMI storage via localStorageRecycler
to improve extension boot performance
#1798
Conversation
…nitialization and run if keys exist
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.
Can you fill out the PR description, explaining the rationale and adding a screenshot / video of the logs that you have added showing it's working correctly?
remove await; can happen in parallel with other startup functions. Co-authored-by: Bruno Barbieri <[email protected]>
done! |
localStorageRecycler
to improve extension boot performance
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.
Nice!
Problem / Background
During performance investigations, we discovered that old installations of the browser extension are carrying unnecessary storage weight from deprecated WAGMI data (8-11MB) that was left behind after our migration to Wagmi v2 in May. This legacy data primarily consists of RPC logs and token metadata that is no longer accessed or needed.
While recent installations don't have this overhead, older installations are experiencing slower boot times, potentially exacerbated by Chrome 131's handling of chrome.storage.local bootstrapping. The combination of:
rainbow.wagmi
storage (8-11MB)rainbow.react-query
storage (2-4MB)Is likely contributing to startup performance issues.
Solution
I've implemented a
localStorageRecycler
utility that:rainbow.wagmi
keyScreen recordings / screenshots
To test I just changed the sentry logs to
console.log
statements and tested that way. Prod logs will ingest to Sentry. I did not haverainbow.wagmi
storage on my bx at the time of recording so i pushed some dummy data. In the video below you can see me:Screen.Recording.2025-01-07.at.12.51.13.PM.mov
What to test
This runs on install / startup and can be seen in the service worker logs. To test this whole flow:
logger.x
statements insrc/core/storage/localStorageRecycler.ts
withconsole.log
statementsawait chrome.storage.local.get('rainbow.wagmi')
in your rainbow console to see if you have wagmi storageawait chrome.storage.local.set({ 'rainbow.wagmi': { someTestData: 'test', moreData: { foo: 'bar' } } });