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

Support actual offline mode on web #310

Open
th0rgall opened this issue Feb 17, 2023 · 0 comments
Open

Support actual offline mode on web #310

th0rgall opened this issue Feb 17, 2023 · 0 comments

Comments

@th0rgall
Copy link
Contributor

See this commit e750fb3

The intention was that every GET the app sends via fetch would be cached, that includes SvelteKit routes, several Firebase calls, Mapbox tiles, ... but to prevent stale cache problems, these caches would only be used in case of a fetch error on assumed network loss.

The problem is that they're useless for now when the network is down. Nothing loads. The app depends largely on Firebase to be able to initialize and operate, and Firebase presumably uses a WebSocket for transportation (https://stackoverflow.com/questions/49156783/transport-protocols-firebase-realtime-database-uses) which can't be cached by the SW (https://stackoverflow.com/a/39602235/4973029)

So we were storing up to hundreds of MBs on user's browsers without providing any offline functionality for it.

It is possible though, and could be useful for:

  • viewing your existing chat messages while offline
  • browsing the static rules/information while offline
  • ability to navigate to different pages in the app when the internet connection is bad or intermittent, without seeing errors.

But much more thought needs to go into this:

  • https://firebase.google.com/docs/firestore/manage-data/enable-offline is important, and can be used on the web. We need to consider what a user might want to access while offline, and preload that data, e.g. chats, gardens.
  • Support SvelteKit server-side rendering #309 would also be helpful, because static pages like the rules page or homepage that don't critically depend on Firebase being logged/in should überhaupt not be blocked to load offline by Firebase support. They could easily be cached by a service worker when SSR is enabled.
  • Map tiles could be cached by a service worker, but we need to understand what to cache. Care needs to be taken that these should caches also expire at some point.
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