Skip to content
MyAppBuilder
BetaGuide

Offline behaviour and offline sync

A published MyAppBuilder app keeps working as an app shell when the connection drops, and — in beta — it can keep record changes on the device and sync them when the connection is back . Changes are never silently overwritten: if someone else changed the same record in the meanti

Beta — ready to use, but some details may still change.

A published MyAppBuilder app keeps working as an app shell when the connection drops, and — in beta — it can keep record changes on the device and sync them when the connection is back. Changes are never silently overwritten: if someone else changed the same record in the meantime, the user decides what to keep. This page explains exactly what works offline, what syncs, and what does not.

What works offline

  • Opening the installed app (or a previously visited page) shows the cached shell rather than a browser error.
  • The app's scripts, styles and already-loaded public images are served from the cache. Private files uploaded by app users are never cached on the device: they stay behind the server's permission check.
  • Lists and tables that were already loaded keep showing their rows while the connection is down (they are not refreshed until it is back).
  • Saving record changes (beta): creating, editing and deleting records — from forms, tables, kanban boards, detail views and the Create / Update / Delete record actions of buttons and forms — is kept on the device and sent later. The change shows straight away; the app shows a small "Offline · 2 changes waiting" status in the corner.

What does not work offline

  • Loading data you haven't loaded yet: opening a page whose list was never loaded shows "You're offline". Live data is never cached by the service worker, so users never see someone else's records.
  • Any other server action: sending email, calling an API, running a workflow from a button, generating or attaching a document, uploading a file. These fail with "This needs a connection" and are not queued.
  • Signing in and anything that checks permissions on the spot. Permissions are checked when the change syncs (see below).
  • Workflows: workflows triggered by a record change run on the server when the change syncs, not on the device. An email sent by a "record created" workflow goes out when the record reaches the server.
Example
Connection    Open app     See loaded list    Edit a record        Send email / run workflow
Online        ✓            ✓                  ✓ saved              ✓
Offline       ✓ (shell)    ✓ (last loaded)    ✓ kept, syncs later  ✗ needs a connection

How syncing works

  1. Queued on the device. A change that can't reach the server is stored in the browser's on-device database (IndexedDB) for this app and this signed-in user. If the browser doesn't allow that storage (some private windows), changes are kept only while the tab is open — the status says so.
  2. Sent in order. When the connection is back (or the app is reopened), queued changes are sent one at a time, in the order they were made. A record created offline and then edited is sent as one create; an edit of a record created offline waits for that create, then uses the real record.
  3. Applied once. Every change carries a unique change id. If the connection drops after the server saved a change, sending it again does not save it twice, and its workflows don't run twice.
  4. Checked again. The server re-checks the user's permissions and the record's validation rules when the change arrives — exactly as if the user had saved it online at that moment.

While a change is waiting, the rows it touches carry _sync: "pending" (or "issue") so you can show a badge with a visibility condition on record._sync (see Hide and show).

Sync issues

When the server refuses a queued change it is not dropped: the status shows "1 sync issue". Opening it lists each change with the reason and the choices:

  • Changed by someone else (conflict). Edits and deletes remember the version of the record the user was looking at. If the record changed on the server since, the panel shows your values next to the current ones (fields you can't see stay hidden) and offers:
  • Keep mine — send your change again on top of the server's current version.
  • Use server version — drop your change and keep what's on the server.
  • Discard — drop your change.
  • Not allowed any more (the user's role lost access) or invalid (a required field, a unique value already used, a linked record that no longer exists): Try again after fixing the cause, or Discard.
  • Signed out: the status shows "Sign in again to sync your changes"; nothing is lost.

A change waiting behind an issue on the same record waits too; changes to other records keep syncing. Deleting a record that is already gone counts as done.

Limits (beta)

  • Only live, published apps queue changes — not the builder preview or the staging copy.
  • Only plain record writes are queued. Server actions other than create/update/delete record, file uploads and workflows started from a button need a connection.
  • Tables stored in a connected database (external tables, or managed tables kept in your own database) have no record version to compare, so changes to them are not queued: they need a connection. Tables in the built-in database are always conflict-checked.
  • One device, one user: a queue is never sent for a different signed-in user. Signing out deletes unsynced changes from the device (the app asks first).
  • Two tabs of the same app don't share their queue in real time; each change is still applied at most once.
  • Change ids are remembered by the server for 7 days. A change that waits longer is still sent, but a lost answer can no longer be recognised.
  • Search boxes don't filter rows created offline (list filters do).

Practical advice

  • Tell field staff to watch the status in the corner: "Offline · 3 changes waiting" means the changes are safe on the phone, not yet on the server.
  • Open the app once a day with a connection so changes don't wait for days.
  • Don't sign out with changes waiting on a shared device unless you mean to discard them.

How updates reach installed apps

Each published version gets its own cache. When a new version is published, the next online launch installs it and removes the old cache, so users do not get stuck on an old shell. Live data requests always bypass the cache; queued changes are kept across app updates.

Common mistakes

  • Promising "full offline mode". Only loaded lists and record changes work offline; emails, API calls and new pages need a connection.
  • Ignoring sync issues. A conflict waits until someone chooses — the other person's change is never overwritten automatically.
  • Expecting staging or preview to queue changes. Only the live app does.

Advanced

  • Server: record writes accept x-mab-mutation-id (8–100 characters A-Z a-z 0-9 _ -) and, for updates and deletes, If-Match: "<updated_at>" (the Update/Delete record actions take expectedVersion: { recordId, updatedAt }). A stale version answers 409 with code: "conflict" and details.record — the current record filtered by the user's read and write rules. A repeated mutation id answers with the first result (re-read with the current permissions) and the header x-mab-replayed: 1; a failed attempt does not use up the id. See src/server/data/sync.ts and the sync_mutations table.
  • Client: the pure outbox (src/core/offline/outbox.ts: order, temp-id rewriting, overlay, conflict choices) and the engine and panel in src/renderer/offline/.
  • The service worker (/sw.js, cache mab-<projectId>-v<version>) pre-caches the shell, caches /_next/static/ and public /api/files/ objects, and never touches /api/runtime/ requests or signed (private) file links. See serviceWorkerResponse() in src/server/pwa.ts.
  • The whole feature can be switched off for a deployment with NEXT_PUBLIC_FLAG_OFFLINE_SYNC=off (the app then behaves as before: saving offline fails with an error).

Related

Was this helpful?