← Back to portfolio

React Native · Offline & sync

Making an app trustworthy on a bad connection, not just functional on a good one

Field and warehouse users kept losing edits whenever the network dropped mid-session. The fix wasn’t a retry wrapper around the API client — it was a local mutation queue with explicit revision tracking, so the app could keep working offline and tell the truth when two edits collided on reconnect.

Context

The app was used by field staff and warehouse operators on connections that ranged from solid Wi-Fi to a single bar of signal inside a concrete building. Screens let people edit records — notes, counts, statuses — that a teammate could also be editing elsewhere at roughly the same time. The existing approach treated every write as request/response: if the network wasn’t there when the user hit save, the edit either failed loudly or, worse, sat in a half-submitted state the UI didn’t account for.

Problem

Two problems were tangled together. The first was availability: users needed to keep working with no connection at all, not just tolerate a slow one. The second, harder problem was correctness once they reconnected: if a record changed on the server while a device was offline, naively replaying the device’s queued edit on top would silently discard whatever the other person had written. A sync layer that’s available but occasionally destroys someone’s work is worse than one that just refuses to work offline, because the failure is invisible until someone notices their change is gone.

Approach — queue locally, version explicitly, surface the conflict

Illustrative outcome

Figures below are illustrative, from working through this pattern on a representative sync screen — not a specific client’s production metrics.

What I took from it

Offline support isn’t really about the network being gone — it's about admitting that time passes differently for a device that's offline than for the server, and that the two will disagree about the current state of a record. A revision number per record turns that disagreement into something you can detect cheaply (one integer comparison) instead of something you discover from a support ticket. The expensive part was never the queueing; it was deciding, up front, which kinds of conflicts are safe to resolve automatically and which ones need a human, and building the UI for the second case before the first offline session ever happened in production.

The interactive demo below makes the mechanism visible: go offline, edit notes, let a simulated collaborator edit the same notes on the “server,” then reconnect and watch the queue drain and the conflict get surfaced instead of silently resolved.

Try the offline-first sync demo →