Skip to content
Browser internals·Intermediate·Conceptual·1 min read

How would you keep an offline-capable app's API data reasonably fresh without losing offline access to it?

Short interview answer

Use network-first or stale-while-revalidate for those requests rather than cache-first: network-first tries live data and only falls back to the last cached response when offline, while stale-while-revalidate shows the cached response instantly and refreshes it in the background, so the app is never blocked on the network but isn't stuck on indefinitely stale data.

Key takeaway

Explain the underlying mental model clearly, then support it with a concrete example and its trade-offs.

← Back to Service workers, caching, and offline support

Related questions