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
38 lines
790 B
TypeScript
38 lines
790 B
TypeScript
import { Suspense } from 'react'
|
|
|
|
export async function generateStaticParams() {
|
|
const set = new Set()
|
|
set.add(await fetchRandom('a'))
|
|
set.add(await fetchRandom('a'))
|
|
|
|
return Array.from(set).map((value) => {
|
|
return {
|
|
slug: ('' + value).slice(2),
|
|
}
|
|
})
|
|
}
|
|
|
|
export default async function Layout({ children, params }) {
|
|
return (
|
|
<Suspense fallback="loading">
|
|
<Inner params={params}>{children}</Inner>
|
|
</Suspense>
|
|
)
|
|
}
|
|
|
|
async function Inner({ children, params }) {
|
|
return (
|
|
<>
|
|
<h1>{(await params).slug}</h1>
|
|
<section>{children}</section>
|
|
</>
|
|
)
|
|
}
|
|
|
|
const fetchRandom = async (entropy: string) => {
|
|
const response = await fetch(
|
|
'https://next-data-api-endpoint.vercel.app/api/random?b=' + entropy
|
|
)
|
|
return response.text()
|
|
}
|