mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
`prefetch={true}` with `cacheComponents` was opting into runtime
prefetching, with `unstable_forceStale` preserving the old behavior of
fetching the full (stale) data. However we only intended to expose
runtime prefetching via the `export const prefetch` segment config.
This removes `unstable_forceStale` and restores previous
`prefetch={true}` behavior. I've disabled some of the tests that were
relying on the old link behavior for opting into runtime prefetching -
we'll need to refactor those to use the segment opt-in or just remove
them all together.
Fixes #85162
Closes NAR-320
51 lines
1.3 KiB
TypeScript
51 lines
1.3 KiB
TypeScript
import { DebugLinkAccordion } from '../components/link-accordion'
|
|
import { cacheLife } from 'next/cache'
|
|
|
|
export default async function Page() {
|
|
'use cache'
|
|
cacheLife('minutes')
|
|
return (
|
|
<main>
|
|
<h2>shared layout prefetching - layout with cookies and dynamic data</h2>
|
|
<ul>
|
|
<li>
|
|
<DebugLinkAccordion href="/shared-layout/one" prefetch={true} />
|
|
</li>
|
|
</ul>
|
|
<ul>
|
|
<li>
|
|
<DebugLinkAccordion href="/shared-layout/two" prefetch={'auto'} />
|
|
</li>
|
|
<li>
|
|
<DebugLinkAccordion href="/shared-layout/two" prefetch={true} />
|
|
</li>
|
|
</ul>
|
|
<h2>shared layout prefetching - layout with cookies</h2>
|
|
<ul>
|
|
<li>
|
|
<DebugLinkAccordion
|
|
href="/runtime-prefetchable-layout/one"
|
|
prefetch={true}
|
|
/>
|
|
</li>
|
|
<li>
|
|
<DebugLinkAccordion
|
|
href="/runtime-prefetchable-layout/two"
|
|
prefetch={'auto'}
|
|
/>
|
|
</li>
|
|
</ul>
|
|
|
|
<h2>shared layout prefetching - segment config</h2>
|
|
<ul>
|
|
<li>
|
|
This link deliberately doesn't specify a `prefetch` prop, because the
|
|
page has a segment-level prefetch config:
|
|
<br />
|
|
<DebugLinkAccordion href="/segment-config/runtime-prefetchable" />
|
|
</li>
|
|
</ul>
|
|
</main>
|
|
)
|
|
}
|