App: Allow the app to work without storage in extreme cases where it fails completely

Problem

There are documented cases where IndexedDB appears to completely fail to spin up space for the app to use. The app won’t work at all when this happens. Most recently this happened to @davidcardoza here (sorry, internal).

The error we saw in the JS console was :

Internal error opening backing store for indexedDB.open

We then get stuck in a spot where since the IndexedDB store doesn’t work basically nothing works.

Solution

While we aim to have the app work offline and provide a good return experience with some data and request persistence. If the app can’t save anything to storage at all it should still work. If we run into a serious error like this - we should gracefully degrade the experience.

Bonus quest

Actually, figure out why exactly all the IndexedDB errors happen…

About this issue

  • Original URL
  • State: closed
  • Created 9 months ago
  • Comments: 65 (35 by maintainers)

Most upvoted comments

I think you’re right! I’ll close it out.

Left a few comments. Seeing as this issue has been unresolved for a while - I would love to maybe revisit a high level analysis of the “problem” (as experienced by users) that we are trying to solve and then a proposal on how it will be fixed (or what other changes to expect) so we can maybe all agree on what we are doing here before spending time on additional reviews?

The ultimate idea - and the reason for this new design - is to completely replace OnyxCache with this new MemoryOnlyProvider as the first/top-priority storage.

While having the cache replaced by a “provider” could be interesting, it doesn’t seem to significantly improve the current situation. Too much complexity could also make the code less accessible. So, I’d encourage us to just focus on addressing the issue without assuming that we may need more than that.

That said, if the rest of the team is on board, I don’t want to create a roadblock here. Just wanted to share my reservations as I’m still having trouble fully supporting the extra changes.

Here’s what I’d do:

  • Create a provider that does nothing - basically like a mock provider, but without an internal cache
  • Leave the cache as it is
  • When storage fails in a way where it can’t be recovered switch the storage provider to the provider that noops
  • Don’t chain providers together in an array. Just switch them out when a unrecoverable error happens.

Yes, you can assign me! 👍