mirror of
https://github.com/hanzoai/next.js.git
synced 2026-10-30 14:46:38 +00:00
This API has experimental modes for build validation but the dev validation is going to be stable in the next release.
33 lines
694 B
TypeScript
33 lines
694 B
TypeScript
import { Metadata } from 'next'
|
|
import { cookies } from 'next/headers'
|
|
import { Suspense } from 'react'
|
|
|
|
export const instant = { level: 'experimental-error' }
|
|
|
|
export async function generateMetadata(): Promise<Metadata> {
|
|
await cookies()
|
|
return {
|
|
title: 'Blocked by cookies',
|
|
}
|
|
}
|
|
|
|
export default function Page() {
|
|
return (
|
|
<main>
|
|
<p>This page has a generateMetadata that accesses cookies.</p>
|
|
<p>
|
|
We also access cookies in the page itself, because a static page with
|
|
non-static metadata is not allowed.
|
|
</p>
|
|
<Suspense>
|
|
<Runtime />
|
|
</Suspense>
|
|
</main>
|
|
)
|
|
}
|
|
|
|
async function Runtime() {
|
|
await cookies()
|
|
return null
|
|
}
|