mirror of
https://github.com/hanzoai/next.js.git
synced 2026-10-30 14:46:38 +00:00
prefetching is now controlled with the prefetch export and this option is inert on the instant export. this removes the prefetch option as a valid property on the instant config type. also updates the ts plugin for this export and adds the definition for the previously landed prefetch export
33 lines
827 B
TypeScript
33 lines
827 B
TypeScript
import { Suspense } from 'react'
|
|
import { cookies } from 'next/headers'
|
|
import { connection } from 'next/server'
|
|
|
|
export const unstable_instant = {
|
|
samples: [{ cookies: [{ name: 'test', value: null }] }],
|
|
}
|
|
export const unstable_prefetch = 'force-runtime'
|
|
|
|
export default async function Page() {
|
|
return (
|
|
<main>
|
|
<Suspense fallback={<div>Loading cached...</div>}>
|
|
<Cached />
|
|
</Suspense>
|
|
<Suspense fallback={<div>Loading dynamic...</div>}>
|
|
<Dynamic />
|
|
</Suspense>
|
|
</main>
|
|
)
|
|
}
|
|
|
|
async function Cached() {
|
|
const cookieStore = await cookies()
|
|
const value = cookieStore.get('test')?.value ?? 'default'
|
|
return <div id="cached-content">Cached content: {value}</div>
|
|
}
|
|
|
|
async function Dynamic() {
|
|
await connection()
|
|
return <div id="dynamic-content">Dynamic content</div>
|
|
}
|