next.js
808253ef - Distinguish seeded and rendered fallback entry lifetimes

Commit
94 days ago
Distinguish seeded and rendered fallback entry lifetimes A fallback prerender output feeds two kinds of cache entries with different correct lifetimes. The entry seeded from the fallback file is a placeholder that exists to be replaced: its staleness is what drives the regeneration that specializes it, so it must stay short-lived. Content produced by an actual render, by contrast, stays fresh according to the cache lifetimes the route collected, and treating it as short-lived re-renders and rewrites it on nearly every request. Conflating the two in either direction breaks something. Stamping the collected lifetime onto the seeded entry serves the placeholder indefinitely and App Shells for non-prerendered root params never arrive; leaving rendered content on the seeded entry's short default amplifies into millions of cache writes per hour on sites with dynamic routes and default viewport prefetching. The build now records the collected lifetime separately. The prerender manifest gains fallbackRenderRevalidate/fallbackRenderExpire, recorded for every PPR route — including blocking routes (fallback: null), whose fallback prerender runs even though its HTML is never served. Adapter fallback outputs gain renderRevalidate/renderExpiration carrying the same values; initialRevalidate is unchanged, so the seeded-entry behavior is identical until a platform adopts the new fields for entries written by real renders. Concrete prerenders don't carry the field: their file is itself a render, so initialRevalidate already is the rendered-content lifetime. The self-hosted incremental cache reads the new manifest fields when fallbackRevalidate is absent, so blocking routes' entries go stale according to their content's lifetimes instead of a 1-second default.
Author
Parents
Loading