Urgent.News

What's breaking now, across thousands of outlets.

Tech

An offline edit queue that can undo itself: rollback payloads, a lock, and the rule we had to delete

The app keeps a person's notes and lists on a server, and the server is the only source of truth. The phone holds a read-only mirror, refreshed on every successful fetch and served only when the network fails. That rule is easy to keep for reads. It gets uncomfortable the first time someone ticks an item on a list in a shop with no signal: the screen has to obey now, the server hears about it…

The app stores users' notes and lists on a server, serving as the sole source of truth. A read-only mirror resides on the phone, updated after each successful fetch and served only when a network connection fails. This rule is straightforward for reads but becomes challenging when a user modifies an item without a signal. The phone must display the updated state immediately, while the server processes the change later. During this period, the phone presents a state that hasn't been accepted by anyone.

The write side of this design involves a durable queue of edits made without a network connection. These edits are replayed by two triggers and can undo themselves when the server denies the changes. React Native 0.81 and a Kotlin module form the core of this implementation.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

I Built Kafka From Scratch to Understand how it actually works

But Why?? I had used Kafka enough to know the terminology: topics, partitions, producers, consumers, replication. But knowing the pieces is different from understanding why they fit together the way…

  • Author builds Kafka-like message broker named kafka-lite from scratch
  • Development process broken into five stages focusing on log storage layer
  • Emphasizes importance of understanding storage layer implementation

More from Tuesday 1 September →