Files
Jiachi LiuandGitHub 5e8119da9f [metadata] remove the default segement check for metadata rendering (#77119)
### 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.
2025-03-15 17:47:15 +01:00

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()}`,
}
}