Offline reads are easy. Durable offline writes are the hard part.
Offline reads are relatively straightforward. Put data in SQLite, query it locally, and render the result. Offline writes are where things get uncomfortable. What happens when two devices edit the same row while one is on a plane? What if the server applies a write but its response disappears? What happens to three days of pending work when the user loses access to a project? Can an old outbox…
Offline reads are relatively straightforward, as they involve storing data in SQLite, querying it locally, and rendering the result. However, offline writes present significant challenges. The main issues arise when two devices edit the same row while one is offline, or when the server processes a write but its response is lost.
Additionally, pending writes may be lost when a user loses access to a project, and an old outbox may become incompatible with a schema upgrade. These challenges necessitate a more robust approach to durable offline writes, encompassing aspects such as authorization, recovery, schema evolution, and debugging.
Brief written by urgent.news from Dev.to's own syndicated text. Machine-written — may contain errors; check the original before relying on it.
