Cache Components and Partial Prerendering
App Router
How to test: log in, then reload. The cached panel keeps its timestamp, the session panel updates every time.
Cached, shared by everyone
Cache entry filled at 2026-08-30T23:30:07.113Z
Reload the page: this does not change. It is the same HTML for every visitor.
Protected page → redirects back here unless you are logged in, checked in the Data Access Layer.
How it works
cacheComponents: trueis set innext.config.js, so a page can mix prerendered, cached and per-request content.- The static shell and the
use cachepanel are prerendered. Neither one may callcookies(), so neither one may read a session. - The session panel calls
getIronSession(await cookies(), ...), which makes it dynamic. It has to sit inside<Suspense>, otherwise the build fails rather than shipping one visitor's session to everybody. - The login form uses
useActionState, so a rejected username comes back as a message instead of an exception. proxy.tsrefresheslastSeenon every request throughnextProxyCookies, and the panel below shows the value written by that same request.