mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
### What Remove the default segment checks for metadata rendering. When the `default.js` is rendered, it should still have the metadata. It was a condition added due to possible of duplicated metadata, but it's resolved by other conditions such as only rendering in child slot, and hoisting metadata into rsc head for navigation.
31 lines
773 B
TypeScript
31 lines
773 B
TypeScript
import { cookies } from 'next/headers'
|
|
import { Suspense } from 'react'
|
|
import Link from 'next/link'
|
|
import { connection } from 'next/server'
|
|
export default function Home() {
|
|
return (
|
|
<div>
|
|
<h1>Hello World</h1>
|
|
<Suspense fallback={<div>Loading...</div>}>
|
|
<SubComponent />
|
|
</Suspense>
|
|
<Link href="/">Home</Link>
|
|
</div>
|
|
)
|
|
}
|
|
|
|
async function SubComponent() {
|
|
const cookieStore = await cookies()
|
|
await new Promise((resolve) => setTimeout(resolve, 500))
|
|
const cookie = await cookieStore.get('test')
|
|
return <div>Cookie: {cookie?.value}</div>
|
|
}
|
|
|
|
export async function generateMetadata() {
|
|
await connection()
|
|
await new Promise((resolve) => setTimeout(resolve, 800))
|
|
return {
|
|
title: `Dynamic api ${Math.random()}`,
|
|
}
|
|
}
|