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
36 lines
878 B
TypeScript
36 lines
878 B
TypeScript
import { cookies } from 'next/headers'
|
|
import { connection } from 'next/server'
|
|
import { Suspense } from 'react'
|
|
|
|
export const unstable_instant = {
|
|
samples: [{ cookies: [{ name: 'auth', value: '1' }] }],
|
|
}
|
|
export const unstable_prefetch = 'force-runtime'
|
|
|
|
export default async function Page() {
|
|
return (
|
|
<main>
|
|
<p>
|
|
This page wraps all runtime/dynamic components in Suspense, so it should
|
|
pass validation.
|
|
</p>
|
|
<Suspense fallback={<div>Loading...</div>}>
|
|
<Runtime />
|
|
</Suspense>
|
|
<Suspense fallback={<div>Loading...</div>}>
|
|
<Dynamic />
|
|
</Suspense>
|
|
</main>
|
|
)
|
|
}
|
|
|
|
async function Runtime() {
|
|
const c = await cookies()
|
|
return <div id="runtime-content">cookie: {c.get('auth')?.value}</div>
|
|
}
|
|
|
|
async function Dynamic() {
|
|
await connection()
|
|
return <div id="dynamic-content">Dynamic content</div>
|
|
}
|