mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
With `cacheComponents` + `partialPrefetching`, navigating to an already-prefetched route with a dynamic `generateMetadata` left `document.title` permanently empty until a hard reload. The prefetch cached the head as complete using the server's `isHeadPartial` flag, which is unreliable under Cache Components. Derive the head's partiality from `isResponsePartial` instead, as segment data already does, so a dynamic head is fetched and applied on navigation while a fully static head stays complete. Fixing the flag exposed a latent issue in the prefetch scheduler: during a speculative prefetch, the head was unconditionally runtime-prefetched, which previously went unnoticed because the head was mismarked as complete. The head is now runtime-prefetched only when a segment in the new part of the tree is a candidate for runtime prefetching — it rides along with that request rather than spawning a standalone one. If nothing in the new part of the tree is a runtime prefetch candidate, the head is fetched during the navigation instead. This makes the scheduler's metadata-only request path dead code, so it's removed. Fixes #95268. <!-- NEXT_JS_LLM_PR -->
20 lines
437 B
TypeScript
20 lines
437 B
TypeScript
import { LinkAccordion } from './link-accordion'
|
|
|
|
export default function Home() {
|
|
return (
|
|
<main>
|
|
<h1 id="home">Home</h1>
|
|
<ul>
|
|
<li>
|
|
<LinkAccordion href="/slow">slow (dynamic metadata)</LinkAccordion>
|
|
</li>
|
|
<li>
|
|
<LinkAccordion href="/static-meta">
|
|
static-meta (static metadata, dynamic body)
|
|
</LinkAccordion>
|
|
</li>
|
|
</ul>
|
|
</main>
|
|
)
|
|
}
|