Guides
Caching & offline
How the SDK renders instantly and keeps working without a connection.
Stale while revalidate
When cached data exists, the SDK returns it immediately and refreshes it in the background. Your UI gets content on the first frame and updates when newer data arrives.
Cache -> render immediately -> network request -> update cache -> update appCache layers
Memory -> Persistent storage -> NetworkThe memory layer avoids repeated disk reads during a session. The persistent layer survives app restarts.
Offline
If the network is unavailable, the SDK checks the local cache and returns what it has, marked with source: "offline". An empty screen is the last resort, not the default.
const home = await unit.content("home").get()
if (home.meta.source === "offline") {
showOfflineBanner()
}HTTP caching
The API sends Cache-Control, ETag and Last-Modified headers. The SDK uses them for conditional requests, so unchanged content costs a tiny 304 response.