cowprotocol / cowswap

🐮 CowSwap: First CoW Protocol UI
https://swap.cow.fi/
GNU General Public License v3.0
108 stars 73 forks source link

fix: clean outdated localStorage stores #4413

Closed shoom3301 closed 2 weeks ago

shoom3301 commented 2 weeks ago

Summary

Follow up of #3809

Reported: https://cowservices.slack.com/archives/C036MD8ADMG/p1715085509788589 https://cowservices.slack.com/archives/C03DVQREAH0/p1715583745060159

In #3881 we have fixed the reason of the issue, be it's not enough, we also have to clean consequences of this problem. In this PR I've added universal solutions for localStorage stores with versioning. The fix is added into emergency.js because this script loads before all (we must to clean localStorage before run the app).

To Test

  1. Block emergency.js request
  2. Flood your localStorage. Create allTokenListsInfoAtom:v2 localStorage record and put a lot of data into it
  3. Reload the page
    • [ ] you should see localStorage exceeded the quota error
  4. Unblock emergency.js request and reload the page
    • [ ] the error should not be displayed
    • [ ] allTokenListsInfoAtom:v2 should be deleted from localStorage
vercel[bot] commented 2 weeks ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
cosmos ✅ Ready (Inspect) Visit Preview May 13, 2024 11:00am
cowfi ✅ Ready (Inspect) Visit Preview May 13, 2024 11:00am
explorer-dev ✅ Ready (Inspect) Visit Preview May 13, 2024 11:00am
swap-dev ✅ Ready (Inspect) Visit Preview May 13, 2024 11:00am
widget-configurator ✅ Ready (Inspect) Visit Preview May 13, 2024 11:00am