Files
Janka UrygaandGitHub 63f14c6c90 fix: cache miss in App Shell for cached pages with gSP (#95665)
If we're prerendering an App Shell, then url data is excluded (i.e. we
don't advance beyond the `ShellRuntime` stage). however the prospective
prerender was still letting params/searchParams resolve, so if those
ended up being inputs to a page, they wouldn't be hanging inputs, and
we'd get a cache miss for them in the final prerender.

closes NAR-883

---------

Co-authored-by: Hendrik Liebau <[email protected]>
2026-07-22 17:54:10 +02:00

25 lines
764 B
TypeScript

import { Suspense } from 'react'
import { cookies } from 'next/headers'
// Reading a cookie makes the shell depend on session data, so a prefetch
// renders a runtime App Shell. This is what exercises the prospective/final
// runtime prerender where params are a hanging input in a cached page.
async function SessionData() {
const cookieStore = await cookies()
const value = cookieStore.get('testCookie')?.value ?? 'none'
return <p id="cookie-value">{`Cookie: ${value}`}</p>
}
export default async function Layout({ children }: LayoutProps<'/'>) {
return (
<html>
<body>
<Suspense fallback={<p id="cookie-loading">Loading cookie...</p>}>
<SessionData />
</Suspense>
{children}
</body>
</html>
)
}