Edge Rendering — Series 3

Preview — 3 of 10 questions

On an initial request to an App Router page, the server does more than one render pass before HTML reaches the browser. What is the pipeline?

AOne pass: components render straight to an HTML string
BPass 1 renders the React tree to the RSC payload (a serialized description of Server Component output plus references to Client Component modules and their props). Pass 2 (the SSR render) consumes that payload, renders the Client Components to HTML, and produces the final document. The same RSC payload is also embedded/streamed so the client can reconcile without a second data fetch
CThe client does all rendering; the server only sends JSON
DTwo identical React renders run for redundancy

What do stale, revalidate, and expire mean in a cacheLife profile?

javascript
// next.config.ts
const nextConfig = {
  experimental: {
    cacheLife: {
      catalog: { stale: 60, revalidate: 300, expire: 3600 },
    },
  },
};
AThey are three names for the same TTL
Bstale = server cache TTL; revalidate = browser cache TTL; expire = CDN TTL
Cstale is a delay before the first fetch; revalidate retries on error; expire is a hard timeout on the query
Dstale = how long a client may use a cached value before checking with the server; revalidate = how often the server refreshes the cached entry in the background; expire = the maximum age after which the value must not be served stale and a blocking refresh happens

What is the risk, and the mitigation?

javascript
User loads the app at 10:00 (deployment A). Leaves the tab open.
10:05  you ship deployment B.
10:10  the user submits a form whose Server Action ID was minted by deployment A.
AThe action ID is a stable hash of the action's module + name. If deployment B changed that action (or removed it), the old ID may not resolve on B's servers, causing the call to fail. Setting a consistent deploymentId (and/or skew protection that routes stale clients to the matching deployment) mitigates version skew
BNothing — action IDs are random per request and always valid
CThe action runs twice, once on each deployment
DThe browser automatically reloads to the new deployment before submitting

Sign up free to play

Answer all 10 questions (7 more), see explanations for every answer, and track your score.