17 ms·
Nice writeup! I did a bunch of work to make one of my hobby projects (https://pitchy.ninja https://pitchy.ninja) work off-line. The trickiest part was data syn
by zeroxfe 7y ago
Nice writeup!
I did a bunch of work to make one of my hobby projects (https://pitchy.ninja https://pitchy.ninja) work off-line. The trickiest part was data synchronization between IndexedDB and the database on the server, managing and resolving conflicts if the app was used on multiple devices offline at the same time (then went online again.)
Although IndexedDB worked pretty well in the end, it is a very finicky database, with a really convoluted API. There's a whole bunch of corner cases that you need to handle, and some of these are non-obvious.
- arendtio 7y agoI wish there was some easy to use library to solve this problem as this seems to be a problem many people come across when building a PWA.
- feistypharit 7y agoCheckout workbox. https://developers.google.com/web/tools/workbox https://developers.google.com/web/tools/workbox
- arendtio 7y agoWorkbox is about service workers. So for very simple stuff like caching assets, it is quite helpful, but I was referring to the more transactional actions like multiple clients writing to the same backend, requiring to resolve conflicts. To my knowledge workbox doesn't help with that.
- rakoo 7y agoThere are DBs for that: CouchDB (https://couchdb.apache.org/ https://couchdb.apache.org/) (with its browser counterpart, PouchDB), Gun (https://github.com/amark/gun https://github.com/amark/gun) and probably others.
- gkfasdfasdf 7y agoGoogle's Firestore API allows data to be persisted locally and synced.
- Raed667 7y agoWhy does your app hijack the back button? (Firefox macOS)
- zeroxfe 7y agoIt's a single-page-app, so it uses the history API to route between paths. Unfortunately, there's a bug in my implementation (which I haven't been able to nail down yet), which causes the back button not to work consistently on all paths.