Short answer: Bareship queues offline writes with TanStack Query: a paused mutation is saved to MMKV, so it survives the app being killed, and replays in order when the phone reconnects. Every write gets an Idempotency-Key when the user taps, reused for every attempt, so the server applies it once. Since 0.4.0, each write also records the account that made it and is never sent for anyone else, and a write can cancel the dependent writes queued behind it if the server rejects it.
In the launch post I said Bareship saves a like made offline, keeps it through a
restart and sends it once when the phone reconnects, and promised the next post would show how.
Two readers on dev.to then asked questions I hadn't fully answered. Dave Kurian
asked whose write it is when someone else signs in before it's sent. Odd Eggs Studio
asked what happens to the writes behind one the server rejects. Both answers are now code, released in
0.4.0 .…