mirror of
https://github.com/hanzoai/next.js.git
synced 2026-10-30 14:46:38 +00:00
Viewport blocks the root while Metadata no longer does. However Metadata requires the reading of dynamic params for things like icon loading and other features that require the path whereas viewport does not. Reading the path in fallback prerenders is considered dynamic when DIO is enabled which means that any dynamic route with a file based metadata such as an icon will trigger dynamic at the root. To Address this we simply resolve viewport separately from metadata.
20 lines
500 B
TypeScript
20 lines
500 B
TypeScript
async function format({ params, searchParams }) {
|
|
const { slug } = await params
|
|
const { q } = await searchParams
|
|
return `params - ${slug}${q ? ` query - ${q}` : ''}`
|
|
}
|
|
|
|
export default async function page(props) {
|
|
return <p>{await format(props)}</p>
|
|
}
|
|
|
|
export async function generateMetadata(props, parent) {
|
|
const parentMetadata = await parent
|
|
/* mutating */
|
|
return {
|
|
...parentMetadata,
|
|
title: await format(props),
|
|
keywords: parentMetadata.keywords.concat(['child']),
|
|
}
|
|
}
|