Skip to content
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

Handle local storage quota errors better #488

Open
dabreegster opened this issue Mar 26, 2024 · 1 comment
Open

Handle local storage quota errors better #488

dabreegster opened this issue Mar 26, 2024 · 1 comment

Comments

@dabreegster
Copy link
Contributor

When we setItem, quota could be exceeded. At the very least, have a real error show up. Maybe auto-download the current file and instruct the user how to clear their cache. Or we could have an option to do that for them -- display the list of items in local storage, let them confirm and clear all to free up space.

We could also consider gzipping before storing (with a runtime penalty)

@dabreegster
Copy link
Contributor Author

Ideas:

  • first write a test to mimic running out of storage. Could use playwright to set some massive key slightly less than the limit to start, instead of trying to make up fake scheme data
  • Catch the error with setItem. At absolute minimum, window.alert and explain the problem better
  • If we can reasonably make a Modal appear when the problem happens, then having buttons to clear all local storage data or... even better, list out the keys, show the sizes, and let people delete each one to reclaim space
  • We could also try compressing everything before we put it in local storage. I'd first check the runtime penalty to reading and writing. And then think through the backwards compatibility carefully; would definitely need some thorough tests before going this route

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant