Skip to content

Sync Modes

Overview

ModeBehavior
autoQueue is flushed silently as soon as connectivity returns
manualonOnlineRestore callback fires — you decide what to show

Auto Mode

tsx
<OfflineProvider config={{
  syncMode: 'auto',
  onSyncAction: myHandler,
}}>

When the device goes back online, all queued actions are synced silently in the background. No user interaction required.

Manual Mode

tsx
<OfflineProvider config={{
  syncMode: 'manual',
  onSyncAction: myHandler,
  onOnlineRestore: ({ pendingCount, syncNow, discardQueue }) => {
    // Your custom UI here
  },
}}>

When the device goes back online, your onOnlineRestore callback is called with:

ParameterTypeDescription
pendingCountnumberNumber of queued items
syncNow() => Promise<void>Call to start syncing
discardQueue() => Promise<void>Call to discard all items

Silent Manual Mode

If you omit onOnlineRestore, nothing happens — you handle sync manually via the useOfflineQueue hook.