mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
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]>
25 lines
764 B
TypeScript
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>
|
|
)
|
|
}
|