Background Sync Not Running

SymptomLikely causeFix
registration.sync is undefinedBrowser does not support Background SyncUse foreground retry fallback
Sync registered but does not fireBrowser heuristics, power, network, or engagement throttlingRetry when app opens and when online event fires
Periodic sync never runsExperimental and browser-controlledDo not use for critical behavior
Queue replays duplicatesMissing idempotency keyUse client mutation IDs and server idempotency
Queue gets stuckFailed item blocks later itemsAdd attempts, error state, and manual resolve path
User thinks work is doneUI hides pending stateShow pending, failed, and synced status clearly

Fallback Pattern

window.addEventListener('online', () => {
  void replayOutboxInForeground();
});

document.addEventListener('visibilitychange', () => {
  if (document.visibilityState === 'visible') {
    void replayOutboxInForeground();
  }
});