Quest for Codev2.0.0
/
SIGN IN
next.js/test/e2e/app-dir/instant-validation/app/suspense-in-root/runtime/valid-sync-io-in-generate-metadata-static-page/page.tsx
page.tsx30 lines589 B
import { cookies } from 'next/headers'
import { Suspense } from 'react'

// this page is NOT runtime-prefetchable,
// so Sync IO in generateMetadata should be allowed.
export const unstable_instant = true

export async function generateMetadata() {
  await cookies()
  const now = Date.now()
  return {
    title: `Sync IO in metadata: ${now}`,
  }
}

async function Runtime() {
  await cookies()
  return <p>Runtime content</p>
}

export default function Page() {
  return (
    <main>
      <Suspense fallback={<p>Loading...</p>}>
        <Runtime />
      </Suspense>
    </main>
  )
}