Commit 8f64c82c authored by Zack Tanner's avatar Zack Tanner Committed by JJ Kasper

fix: pages router metadata bugs with React 19 (#81733)

When we updated `experimental.strictNextHead` to be true in #65418, we
did not update all spots that would default to true in the case where
the value was omitted entirely.

This led to the default value not being correctly applied in pages
router, which resulted in duplicate metadata w/ React 19.

Since we made the flag the default, we can also probably clean up this
flag all together, but that can be done separately.

Fixes #81655
Fixes #81689
parent 529f14c3
......@@ -289,9 +289,8 @@ export async function handler(
reactLoadableManifest,
assetPrefix: nextConfig.assetPrefix,
strictNextHead: Boolean(
nextConfig.experimental.strictNextHead
),
strictNextHead:
nextConfig.experimental.strictNextHead ?? true,
previewProps: prerenderManifest.preview,
images: nextConfig.images as any,
nextConfigOutput: nextConfig.output,
......
......@@ -1500,6 +1500,7 @@ export const defaultConfig = {
devtoolSegmentExplorer: process.env.__NEXT_DEVTOOL_NEW_PANEL_UI === 'true',
browserDebugInfoInTerminal: false,
optimizeRouterScrolling: false,
strictNextHead: true,
},
htmlLimitedBots: undefined,
bundlePagesRouterDependencies: false,
......
......@@ -4,9 +4,12 @@ module.exports = {
// Make sure entries are not getting disposed.
maxInactiveAge: 1000 * 60 * 60,
},
experimental: {
strictNextHead: process.env.TEST_STRICT_NEXT_HEAD !== 'false',
},
experimental:
process.env.TEST_STRICT_NEXT_HEAD !== undefined
? {
strictNextHead: process.env.TEST_STRICT_NEXT_HEAD === 'true',
}
: {},
// scroll position can be finicky with the
// indicators showing so hide by default
devIndicators: false,
......
import Head from 'next/head'
export default function Page() {
return (
<div>
<Head>
<title>Title Page</title>
<meta property="og:title" content="Title Content" />
<meta name="description" content="Description Content" />
</Head>
<p>This is a page!</p>
</div>
)
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment