Capítulo 67 de 456
Guide for platform/adapter engineers implementing Partial Prerendering (PPR) support: how to store the static shell + postponedState pair, serve them, and trigger the resume protocol to render only the dynamic portions.
postponedState: opaque serialized string produced alongside the shell; must be stored/updated atomically with it and never parsed or modified.postponedState.requestMeta.onCacheEntryV2: adapter hook to observe cache updates (shell + postponedState pairs) and propagate them to storage after revalidation.renderingMode: 'PARTIALLY_STATIC': marker in the adapter build output (outputs.prerenders) identifying PPR routes; read fallback.postponedState from those entries.POST /route
Headers: next-resume: 1
Body: <postponedState blob>
requestMeta: { postponed: postponedState }
next-resume: 1 + body, quando o handler é chamado diretamente (adapter-based), sem round-trip HTTP.| Implementation level | How it works |
|---|---|
| Origin-only | Todas as requisições vão direto ao servidor Next.js; ele lê o shell do cache local e faz stream do dinâmico. Funciona em qualquer plataforma com streaming HTTP. |
| CDN Shell + Origin Compute | CDN serve o shell do edge, envia request de resume para a origem (em paralelo), origem renderiza só o dinâmico, CDN concatena tudo num stream único. |
postponedState antigo (ou vice-versa): produz conteúdo dinâmico incorreto; os dois artefatos precisam ser atualizados atomicamente.postponedState: é opaco por design; qualquer modificação quebra a renderização.next start já implementa o caso "origin-only" automaticamente, sem infraestrutura extra.onBuildComplete.postponedState estiver indisponível ou obsoleto, faça fallback para render completo no servidor (degradação graciosa).x-next-resume-state-length separa o prefixo do postponed state do corpo da action.