mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
## What? Rename `experimental.dynamicIO` to `experimental.cacheComponents` across the Next.js codebase. ## Why? We're going to be merging the functionality of the `ppr`, `dynamicIO` and `useCache` experimental flags into the singular `cacheComponents` flag to reduce complexity of the codebase and simplify adoption for users wanting to experiment with experimental features. ## How? - Renamed the configuration option from `experimental.dynamicIO` to `experimental.cacheComponents` - Added deprecation handling with automatic migration for the old option name - Updated all documentation, tests, and internal references - Updated Rust code in SWC transforms and Turbopack - Maintained backward compatibility with deprecation warnings NAR-158
41 lines
1.0 KiB
TypeScript
41 lines
1.0 KiB
TypeScript
import { getSentinelValue } from '../../getSentinelValue'
|
|
|
|
export default async function Page() {
|
|
await 1
|
|
return (
|
|
<>
|
|
<p>
|
|
This page renders two components each performing one or more cached
|
|
fetches. There is no uncached IO in this example
|
|
</p>
|
|
<p>Niether component is wrapped in a Suspense boundary.</p>
|
|
<p>With PPR this page should be entirely static.</p>
|
|
<p>Without PPR this page should be static.</p>
|
|
<ComponentOne />
|
|
<ComponentTwo />
|
|
<div id="page">{getSentinelValue()}</div>
|
|
</>
|
|
)
|
|
}
|
|
|
|
async function ComponentOne() {
|
|
return <div>message 1: {await fetchRandomCached('a')}</div>
|
|
}
|
|
|
|
async function ComponentTwo() {
|
|
return (
|
|
<>
|
|
<div>message 2: {await fetchRandomCached('b')}</div>
|
|
<div>message 2: {await fetchRandomCached('c')}</div>
|
|
</>
|
|
)
|
|
}
|
|
|
|
const fetchRandomCached = async (entropy: string) => {
|
|
const response = await fetch(
|
|
'https://next-data-api-endpoint.vercel.app/api/random?b=' + entropy,
|
|
{ cache: 'force-cache' }
|
|
)
|
|
return response.text()
|
|
}
|