FSD Frontend System Design

Chapter 9 · Offline Support

Interview drill

5 questions from this chapter. Answer each one out loud first, then open it to compare.

  1. 9.1"You deployed a fix but users still see the broken version. Why?"
    • The old service worker keeps control until every tab using it closes; a refresh doesn't replace it.
    • Either call skipWaiting and clients.claim, or surface an explicit update prompt — silence is what causes this.
    • It's also why a kill-switch SW and cache versioning are mandatory before your first production deploy.

    Review 9.1 Service Workers →

  2. 9.2"When would you build a PWA instead of a native app?"
    • When reach and update speed matter more than deep device integration — content, commerce, tools, internal apps.
    • When install friction is the main funnel problem: a link that becomes an app beats a store listing.
    • Not when you need background location, tight OS integration, or store-based discovery and billing.

    Review 9.2 Progressive Web Applications (PWAs) →

  3. 9.3"The user taps Send twice on a flaky connection. How do you avoid a duplicate message?"
    • The client creates the message ID once, before the first attempt, and every retry reuses it as the idempotency key.
    • The server records keys it has already applied and returns the stored result for a repeat instead of applying it again.
    • The UI renders from the local outbox by that same ID, so the screen shows one message too — clock, then tick.

    Review 9.3 Offline Writes & the Sync Queue →

  4. 9.4"Two devices edit the same note offline. What happens when both reconnect?"
    • Each edit carries the version it was based on, so the second to arrive is visibly stale — a conflict, not a silent overwrite.
    • Fields that don't overlap merge automatically; for the same field, choose per field — last write wins for low stakes, the user decides for content that matters.
    • For genuinely collaborative text, use a CRDT so concurrent edits always converge and there is nothing to resolve.

    Review 9.4 Conflict Resolution →

  5. 9.5"Your offline notes app loses users' unsent notes on iPhone. Why, and what do you do?"
    • Safari has no Background Sync, so the queue only flushes while the app is open — and if the site isn't installed, its storage can be cleared after 7 days of Safari use without the user interacting with it.
    • Flush on open, on online and on visibility change; encourage Add to Home Screen, and call persist() after the first offline save.
    • Show unsent items clearly so nothing disappears silently, and keep the outbox small by collapsing edits (9.3).

    Review 9.5 Background Sync & Storage Limits →