(Note · · 6 min read)

Making a web app usable with no signal

An installable web app that fails the moment the connection drops has the appearance of an app and none of the behaviour. The valuable part is not the icon on the home screen — it is that someone can open it on a train, enter something, and have it still be there when the signal returns.

By Md. Habibur Rahman Shohel, full-stack & AI product engineer in Dhaka

Decide what has to work offline

Not everything should. Pick the few things that matter when there is no connection: usually viewing recent data and recording something new. Those two cover most of the value.

For a shared money-tracking app, that is seeing recent entries and adding one. Someone paying for something in a shop with no signal needs to record it now, because the alternative is remembering to do it later, which is the habit the product exists to replace.

Cache by type of resource

Different resources want different strategies, and applying one policy to everything is what produces either a stale app or an app that needs the network anyway.

  • Application shell and assets: serve from cache, update in the background, which makes launch instant.
  • Reference data that rarely changes: cache with a long expiry and revalidate occasionally.
  • The user's own recent data: keep a local copy, show it immediately, refresh when online.
  • Anything authoritative — balances, availability, prices — fetch fresh, and say so when you cannot.

Show the age of what is displayed whenever it came from cache. A figure presented without qualification, which is in fact from yesterday, is worse than an honest note that it could not be refreshed.

Queue writes, do not fail them

An action taken offline should be accepted, stored locally, shown as pending, and sent when a connection returns. The user's work is never lost and never silently discarded.

Each queued action needs its own identifier, generated on the device, used as an idempotency key when it is finally sent. Retries and a double-tap then cannot create two records, which is the failure this design otherwise invites.

Reconciliation is the actual difficulty

Offline edits conflict: the same record changed on two devices, or something edited locally that was deleted on the server. There is no general solution, so decide per type of data.

New records almost never conflict, which is why recording something new is the safest offline capability. Edits to shared records are the hard case, and a shared book edited by two people is exactly where it arises. Where a conflict cannot be resolved automatically, keep both versions and ask — losing someone's entry silently is the one outcome to avoid.

Updates need handling, visibly

A cache-first app can run an old version indefinitely. Check for a new one, and tell the user rather than swapping underneath them mid-task — a page that reloads while someone is typing is a worse bug than being out of date.

Version your local storage format too, and migrate it. A new release expecting a different local shape will otherwise fail in a way the user cannot recover from without clearing data, which also discards their queued actions.

Test it offline, on a real device

Turn the connection off and use the app. Then test the worse case — a connection that is present and extremely slow, where requests hang rather than fail. That is the state that exposes missing timeouts.

Test installing, closing and reopening, reconnecting with a queue of pending actions, and the local storage being cleared. Each of those has a user-visible outcome, and only two of them are obvious.

Common questions

What should a PWA do offline?

Pick a few things rather than everything: viewing recent data and recording something new cover most of the value. A new record is also the safest offline action, because new records almost never conflict.

How should offline actions be handled?

Accept them, store locally, show as pending, and send when the connection returns. Give each queued action a device-generated identifier used as an idempotency key, so retries and double-taps cannot create duplicates.

What is the hardest part of offline support?

Reconciliation. The same record edited on two devices, or edited locally and deleted on the server, has no general solution — decide per data type, and where a conflict cannot be resolved automatically keep both versions and ask rather than discarding someone's entry.

How should cached data be presented?

With its age, whenever it came from cache. Application shell from cache for instant launch, reference data with a long expiry, the user's own recent data shown immediately then refreshed — but authoritative figures fetched fresh, and said plainly when they cannot be.

Need something like this built?