News for hackers. Stuff that matters.
Re:How to make a web app work offline by zeroxfe on Sunday March 08, 2020 @07:50AM (#22517574)
Nice writeup!

I did a bunch of work to make one of my hobby projects (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.

Re:How to make a web app work offline by rakoo on Sunday March 08, 2020 @08:41AM (#22517735)
There are DBs for that: CouchDB (https://couchdb.apache.org/) (with its browser counterpart, PouchDB), Gun (https://github.com/amark/gun) and probably others.
Re:How to make a web app work offline by arendtio on Sunday March 08, 2020 @08:22AM (#22517675)
I 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.
Re:How to make a web app work offline by feistypharit on Sunday March 08, 2020 @08:27AM (#22517685)
Re:How to make a web app work offline by arendtio on Sunday March 08, 2020 @09:28AM (#22517909)
Workbox 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.

Re:How to make a web app work offline by Raed667 on Sunday March 08, 2020 @10:17AM (#22518124)
Why does your app hijack the back button? (Firefox macOS)
Re:How to make a web app work offline by zeroxfe on Sunday March 08, 2020 @10:49AM (#22518281)
It'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.
Re:How to make a web app work offline by gkfasdfasdf on Sunday March 08, 2020 @08:59AM (#22517795)
Google's Firestore API allows data to be persisted locally and synced.