To keep user work safe when an offline device reconnects, give every change three things. A stable operation ID makes retries harmless. The record version the user saw exposes edits based on stale data. A written merge rule for each kind of data decides what merges and what waits for a person.
These four terms recur below.
- Operation ID (idempotency key): a unique ID the device creates for each change, so the server can recognize a retry.
- Version or ETag: a value the server changes on every update, so it can tell which copy of a record a change was based on.
- Tombstone: a marker the server keeps for a deleted record, so a late edit from another device finds it.
needs_attention: the state of a change that hit a conflict and waits in the conflict inbox for a person.
Offline synchronization conflicts begin when two devices hold different temporary truths about the same record. Reconnecting cannot be reduced to uploading the newest-looking JSON or trusting device clocks. The server needs the user’s intent, the version they observed, the fields or operation changed, and a domain policy for merge, rejection, or review.
This guide focuses on conflict decisions and recovery UX. The offline-first PWA patterns guide covers local storage, queues, and service-worker lifecycle; here the subject is versions, commands, merges, deletion, and review across web or mobile clients.
Choose the synchronization unit
Decide whether the client submits whole records, field patches, or semantic commands such as “complete job” and “add quantity.” Commands often preserve intent better than a complete stale snapshot and let the server reapply current business rules.
Every operation needs a unique ID, payload version, actor, tenant, local creation time, ordering, dependencies, and observed server version. Device time can help display context but is not a trustworthy global ordering mechanism.
Use versions and preconditions
Send a version, ETag, or comparable precondition representing what the client read. The server accepts an update only when the expected version still applies or returns a conflict representation with the minimum authorized context.
Update version transactionally with the record and prevent client tampering. Test two simultaneous requests against the same version: one should follow the accepted rule and the other should enter conflict handling.
Separate duplicate delivery from conflict
The same operation retried after a timeout is a duplicate and should return its previous result without repeating work. Two different operations based on the same old version can be a true conflict. Use operation identity for idempotency and record version for concurrency.
Confusing them creates conflict dialogs after routine retry or duplicate side effects. Reject reuse of an operation ID with different content and retain results under a defined policy.
Classify fields by merge safety
Some changes are additive, some are sets, some are exclusive values, and some carry financial, inventory, appointment, or approval risk. Write policies by domain type, not by screen. A note may still be unsafe to merge automatically when meaning or authorship matters.
Last-write-wins is a real policy only if the product accepts loss of the earlier update and can explain it. It is rarely a safe default for money, scarce capacity, or state transitions.
Design transformable commands
“Consume two units in operation X” may reapply safely to current stock where “set stock to eight” cannot. “Complete checklist item Y” is more precise than replacing the entire checklist. The right form follows domain rules.
Version commands as clients evolve. A device offline for a week may submit an old payload. Migrate it when semantics are preserved; otherwise hold it for review rather than dropping user work.
Make server authority explicit
The server owns current authorization, global constraints, balances, and shared reservations. The client can persist intent but cannot promise that a slot, amount, or payment will be accepted. Distinguish “saved on this device” from “accepted by the system.”
Reauthorize at synchronization because membership or role can change while offline. Return stable error codes and only the fields needed to explain resolution. Never expose another user’s private record as conflict evidence.
Build a conflict inbox
Store local operation, permitted current state, differing fields, available actions, creation time, and decision owner. A 409 should move the operation to needs_attention, not delete it from the queue.
Order conflicts by impact and age. A technician may resolve a harmless note while a supervisor owns a financial change. The resolution command must carry a fresh precondition because the record can change again while the dialog is open.
Design understandable resolution UI
Show “your change” and “current state” with domain labels, not raw JSON. Highlight changed facts and server time. Offer only allowed choices: retain current, apply selected change, merge, or create a separate record.
Avoid a generic Overwrite action for money and appointments. Test Arabic RTL, long values, keyboard use, and screen readers. Preserve a support reference without copying sensitive payload into logs.
Treat deletion as a state
A device may modify a record deleted or archived on the server. Retain a tombstone or deletion version long enough for the supported offline window. Decide whether the operation is rejected, restored under authority, or becomes a new record.
An offline client must not resurrect data removed for access or retention reasons. Test account revocation and devices that reconnect later. Deletion permissions should be rechecked like any other command.
Preserve dependency order
Creating a local record, attaching media, and completing it are dependent operations. Use client-stable IDs and a mapping to server IDs. Record dependencies so completion cannot run before creation and children enter a clear state if the parent is rejected.
Persist the queue across application termination. Process independent operations without letting one failure block the world, while preserving order where it changes meaning.
Avoid trusting clocks
Device time can be inaccurate or deliberately changed. Use server receipt time plus record versions or sequences for authoritative order. Preserve original device time for context and timezone display without rewriting it to now.
For out-of-order state events, enforce allowed transitions. A late “started” event should not reopen a completed job. Retain rejected transitions where operational review matters.
Protect local data
Store the minimum required for offline work, isolate accounts and tenants, and lock or clear records after logout or revocation when the device reconnects. Do not promise remote deletion from a device that never returns.
Avoid long-lived credentials and sensitive payloads in diagnostic logs. Encryption helps but does not replace device access and minimization. Test shared devices and successive users. The guide to offline-first patterns helps choose which workflows justify this exposure.
Test a conflict matrix
Cover two devices changing the same field and separate fields, duplicate retry, different operations from one version, delete versus edit, changed permission, expired session, old application version, schema upgrade with backlog, storage exhaustion, and interrupted processing.
Use slow and flapping networks and terminate the application mid-sync. The interface must not say synced before server acknowledgement. Monitor lost operations, prevented duplicates, oldest queue age, and conflicts by type without logging their sensitive content.
Images, files, and a worked example from GymTek
Offline edits to images and files follow the same rules as edits to records, with two extra risks. The file and the record that points to it travel separately, and the browser may delete what it stored before the device reconnects.
Images and files edited offline: how they sync and resolve conflicts
- Store each file on the device under a stable local ID. Show its upload state apart from the record's state: On this device, Uploading, Received, or Upload failed.
- Upload the file first. Send the command that attaches it to the record only after the server confirms receipt. A record then never points to a file the server lacks.
- Give every file a version. When two devices change the same image, keep both versions and put the pair in the conflict inbox. Binary files have no safe automatic merge.
- Treat browser storage as removable. By default, browsers keep site data on a "best-effort" basis and, under storage pressure, delete all of the least recently used site's data at once. Safari goes further when cross-site tracking prevention is on. It deletes script-created data for any site the user has not interacted with in the last seven days of browser use (MDN, storage quotas and eviction criteria, updated 5 January 2026).
- While unsent files wait, request persistent storage with
navigator.storage.persist()and check space withnavigator.storage.estimate(). OnQuotaExceededError, ask the user to reconnect so the files can upload.
Worked example: offline check-ins at a gym entrance
GymTek, a gym management system we build and run, puts a check-in screen on a tablet at the entrance. It admits members through a short network drop only while its eligibility list is no more than 15 minutes old by default, and the list loads when the screen opens. This is how it works in our code as of 4 November 2026:
- The tablet loads member eligibility when the check-in screen opens and treats it as fresh for 15 minutes by default. It admits members offline only from a list within that window. Past it, the screen shows Can't reach the system and sends the member to the front desk.
- With no network, the screen shows No connection and queues each scan locally under a unique ID the tablet generates. It also shows the backlog, such as 1 check-in waiting to sync.
- When the connection returns, the tablet sends the queue to the server.
- The server looks up each ID first. A known ID with the same content returns the recorded result and creates no second row. The same ID with different content gets a 409. That is the HTTP status for a request that conflicts with the current state of the resource (RFC 9110, IETF, June 2022, section 15.5.10).
- The server recomputes the decision for the scan time the tablet recorded, against the membership as it stands. If its decision differs from what the tablet showed at the entrance, the server keeps its own decision and flags the event for review. People who manage access devices see both marks under a row's Details on the staff Check-ins page. Every offline admission reads Offline attendance reported, not confirmed, and a flagged one also reads See the front desk. The system never reverses an admission on its own.
- If an online scan reached the server but the reply was lost, the tablet queues it again under the same ID. The server keeps its first decision.
Designing offline entry or check-in for your own product? Send us a project brief with three realistic conflict cases, the people who decide them, and what must stay on the device.
A conflict matrix to copy
| Case | How to trigger it | Expected result |
|---|---|---|
| Same field, two devices | Edit one field on two offline devices, then reconnect both | First change accepted; second goes to the inbox or follows the field's rule |
| Different fields, two devices | Edit a different field on each device | Both changes merge where the rule allows |
| Duplicate delivery | Drop the network after the request arrives and before the reply | One result, one row |
| Reused ID, new content | Resend an operation ID with a changed payload | Rejected with 409 |
| Delete versus edit | Delete on one device, edit on the other | Deletion rule applies; the record stays deleted |
| Permission changed | Remove the user's role while the device is offline | Operation rejected with a stable error code after sync |
| Session expired | Let the session lapse with a full queue | Queue survives and sends after sign-in |
| Old app version | Send a previous command format | Migrated safely or held for review |
| Schema upgrade with backlog | Upgrade the app while operations wait | Every operation kept and migrated where needed |
| Storage full | Fill storage until QuotaExceededError | Clear message; earlier saved work kept |
| App closed mid-sync | Close the app after half the queue is sent | Queue resumes without duplicates |
| Same image, two devices | Edit one image on two devices | Both versions in the conflict inbox |
Give support recovery tools
Assign each operation a searchable reference and safe state history. Support should know whether it remained local, arrived, failed, or awaits a decision. Provide controlled diagnostic export where needed and do not make “clear app data” the first response.
bilingual corporate website development can own the implementation boundary, but product and domain owners decide merge policy. Start with one valuable offline journey, not a claim that the entire system works without connectivity.
Conclusion: preserve intent before choosing a winner
Reliable conflict resolution distinguishes retry from competing change, detects versions, applies domain policy, and retains work until an authorized decision. The last timestamp is not automatically truth. Request an offline conflict design workshop with three realistic cases, decision roles, and local-data boundaries.




