mirror of
https://github.com/hanzoai/next.js.git
synced 2026-10-30 14:46:38 +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
23 lines
628 B
TypeScript
23 lines
628 B
TypeScript
import type { NextRequest } from 'next/server'
|
|
|
|
import { getSentinelValue } from '../../getSentinelValue'
|
|
|
|
export async function GET(request: NextRequest) {
|
|
const messagea = await getCachedMessage('hello cached fast', 0)
|
|
const messageb = await getCachedMessage('hello cached slow', 20)
|
|
return new Response(
|
|
JSON.stringify({
|
|
value: getSentinelValue(),
|
|
message1: messagea,
|
|
message2: messageb,
|
|
})
|
|
)
|
|
}
|
|
|
|
async function getCachedMessage(echo, delay) {
|
|
'use cache'
|
|
const tag = ((Math.random() * 10000) | 0).toString(16)
|
|
await new Promise((r) => setTimeout(r, delay))
|
|
return `${tag}:${echo}`
|
|
}
|