Unverified Commit 812996cc authored by Janka Uryga's avatar Janka Uryga Committed by GitHub

[CC] Rename "unstable_prefetch" to "unstable_instant" (#89448)

Mostly mechanical rename.

Also changes the error page to `errors/invalid-instant-configuration`.
I'm not really worried about dangling links here because this is a new
API and we don't expect anyone to be using it yet.
parent 12f85450
---
title: Invalid Prefetch Configuration
title: Invalid Instant Configuration
---
## Why This Message Occurred
You provided an invalid configuration for `export const unstable_prefetch` in a Layout or Page file.
You provided an invalid configuration for `export const unstable_instant` in a Layout or Page file.
### Example of Correct Usage
#### Static Prefetching
```tsx filename="app/.../layout.tsx"
export const unstable_prefetch = {
mode: 'static',
export const unstable_instant = {
prefetch: 'static',
}
```
#### Runtime Prefetching
```tsx filename="app/[slug]/page.tsx"
export const unstable_prefetch = {
mode: 'runtime',
export const unstable_instant = {
prefetch: 'runtime',
samples: [
{
cookies: [{ name: 'experiment', value: 'A' }],
......
......@@ -19,8 +19,8 @@ If you are generating a token to talk to a database that itself should be cached
Before:
```jsx filename="app/page.js"
export const unstable_prefetch = {
mode: 'runtime',
export const unstable_instant = {
prefetch: 'runtime',
samples: [...],
}
......@@ -40,8 +40,8 @@ export default async function Page({ params }) {
After:
```jsx filename="app/page.js"
export const unstable_prefetch = {
mode: 'runtime',
export const unstable_instant = {
prefetch: 'runtime',
samples: [...],
}
......@@ -65,8 +65,8 @@ If you require this random value to be unique per Request and an async version o
Before:
```jsx filename="app/page.js"
export const unstable_prefetch = {
mode: 'runtime',
export const unstable_instant = {
prefetch: 'runtime',
samples: [...],
}
......@@ -84,8 +84,8 @@ export default async function Page({ params }) {
After:
```jsx filename="app/page.js"
export const unstable_prefetch = {
mode: 'runtime',
export const unstable_instant = {
prefetch: 'runtime',
samples: [...],
}
......@@ -107,8 +107,8 @@ If you require this random value to be unique per Request and an async version o
Before:
```jsx filename="app/page.js"
export const unstable_prefetch = {
mode: 'runtime',
export const unstable_instant = {
prefetch: 'runtime',
samples: [...],
}
......@@ -122,8 +122,8 @@ export default async function Page({ params }) {
After:
```jsx filename="app/page.js"
export const unstable_prefetch = {
mode: 'runtime',
export const unstable_instant = {
prefetch: 'runtime',
samples: [...],
}
......
......@@ -23,8 +23,8 @@ If you are using the current time for performance tracking with elapsed time use
Before:
```jsx filename="app/page.js"
export const unstable_prefetch = {
mode: 'runtime',
export const unstable_instant = {
prefetch: 'runtime',
samples: [...],
}
......@@ -42,8 +42,8 @@ export default async function Page({ params }) {
After:
```jsx filename="app/page.js"
export const unstable_prefetch = {
mode: 'runtime',
export const unstable_instant = {
prefetch: 'runtime',
samples: [...],
}
......@@ -67,8 +67,8 @@ If you want to read the time when some cache entry is created (such as when a Ne
Before:
```jsx filename="app/page.js"
export const unstable_prefetch = {
mode: 'runtime',
export const unstable_instant = {
prefetch: 'runtime',
samples: [...],
}
......@@ -96,8 +96,8 @@ export default async function Page({ params }) {
After:
```jsx filename="app/page.js"
export const unstable_prefetch = {
mode: 'runtime',
export const unstable_instant = {
prefetch: 'runtime',
samples: [...],
}
......@@ -136,8 +136,8 @@ If you go with this approach you will need to ensure the Client Component which
Before:
```jsx filename="app/page.js"
export const unstable_prefetch = {
mode: 'runtime',
export const unstable_instant = {
prefetch: 'runtime',
samples: [...],
}
......@@ -193,8 +193,8 @@ export function RelativeTime({ when }) {
```
```jsx filename="app/page.js"
export const unstable_prefetch = {
mode: 'runtime',
export const unstable_instant = {
prefetch: 'runtime',
samples: [...],
}
......@@ -230,8 +230,8 @@ Next.js enforces that it can always produce at least a partially static initial
Before:
```jsx filename="app/page.js"
export const unstable_prefetch = {
mode: 'runtime',
export const unstable_instant = {
prefetch: 'runtime',
samples: [...],
}
......@@ -249,8 +249,8 @@ export default async function Page() {
After:
```jsx filename="app/page.js"
export const unstable_prefetch = {
mode: 'runtime',
export const unstable_instant = {
prefetch: 'runtime',
samples: [...],
}
......
......@@ -23,8 +23,8 @@ If your random value is cacheable, move the `Math.random()` call to a `"use cach
Before:
```jsx filename="app/page.js"
export const unstable_prefetch = {
mode: 'runtime',
export const unstable_instant = {
prefetch: 'runtime',
samples: [...],
}
......@@ -40,8 +40,8 @@ export default async function Page({ params }) {
After:
```jsx filename="app/page.js"
export const unstable_prefetch = {
mode: 'runtime',
export const unstable_instant = {
prefetch: 'runtime',
samples: [...],
}
......@@ -68,8 +68,8 @@ If you want the random value to be evaluated on each Request precede it with `aw
Before:
```jsx filename="app/page.js"
export const unstable_prefetch = {
mode: 'runtime',
export const unstable_instant = {
prefetch: 'runtime',
samples: [...],
}
......@@ -85,8 +85,8 @@ export default async function Page({ params }) {
After:
```jsx filename="app/page.js"
export const unstable_prefetch = {
mode: 'runtime',
export const unstable_instant = {
prefetch: 'runtime',
samples: [...],
}
......
......@@ -987,5 +987,6 @@
"986": "Server Action arguments list is too long (%s). Maximum allowed is %s.",
"987": "Invalid \\`deploymentId\\` configuration: must be a string. See https://nextjs.org/docs/messages/deploymentid-not-a-string",
"988": "Invalid \\`deploymentId\\` configuration: contains invalid characters. Only alphanumeric characters, hyphens, and underscores are allowed. See https://nextjs.org/docs/messages/deploymentid-invalid-characters",
"989": "Loaded static props were from an outdated deployment, forcing a hard reload"
"989": "Loaded static props were from an outdated deployment, forcing a hard reload",
"990": "Page \"%s\" cannot use \\`export const unstable_instant = ...\\` without enabling \\`cacheComponents\\`."
}
......@@ -684,9 +684,9 @@ export async function getAppPageStaticInfo({
)
}
if ('unstable_prefetch' in config && !nextConfig.cacheComponents) {
if ('unstable_instant' in config && !nextConfig.cacheComponents) {
throw new Error(
`Page "${page}" cannot use \`export const unstable_prefetch = ...\` without enabling \`cacheComponents\`.`
`Page "${page}" cannot use \`export const unstable_instant = ...\` without enabling \`cacheComponents\`.`
)
}
......
......@@ -21,59 +21,65 @@ const RuntimeSampleSchema = z
})
.strict()
const StaticPrefetchSchema = z
const InstantConfigStaticSchema = z
.object({
mode: z.literal('static'),
prefetch: z.literal('static'),
from: z.array(z.string()).optional(),
expectUnableToVerify: z.boolean().optional(),
})
.strict()
const RuntimePrefetchSchema = z
const InstantConfigRuntimeSchema = z
.object({
mode: z.literal('runtime'),
prefetch: z.literal('runtime'),
samples: z.array(RuntimeSampleSchema).min(1),
from: z.array(z.string()).optional(),
expectUnableToVerify: z.boolean().optional(),
})
.strict()
const PrefetchSchema = z.discriminatedUnion('mode', [
StaticPrefetchSchema,
RuntimePrefetchSchema,
const InstantConfigSchema = z.discriminatedUnion('prefetch', [
InstantConfigStaticSchema,
InstantConfigRuntimeSchema,
])
export type Prefetch = StaticPrefetch | RuntimePrefetch
export type PrefetchForTypeCheckInternal = __GenericPrefetch | Prefetch
export type InstantConfig = InstantConfigStatic | InstantConfigRuntime
export type InstantConfigForTypeCheckInternal =
| __GenericInstantConfig
| InstantConfig
// the __GenericPrefetch type is used to avoid type widening issues with
// our choice to make exports the medium for programming a Next.js application
// With exports the type is controlled by the module and all we can do is assert on it
// from a consumer. However with string literals in objects these are by default typed widely
// and thus cannot match the discriminated union type. If we figure out a better way we should
// delete the __GenericPrefetch member.
interface __GenericPrefetch {
mode: string
interface __GenericInstantConfig {
prefetch: string
samples?: Array<WideRuntimeSample>
from?: string[]
expectUnableToVerify?: boolean
}
interface StaticPrefetch {
mode: 'static'
interface InstantConfigStatic {
prefetch: 'static'
from?: string[]
expectUnableToVerify?: boolean
}
interface RuntimePrefetch {
mode: 'runtime'
interface InstantConfigRuntime {
prefetch: 'runtime'
samples: Array<RuntimeSample>
from?: string[]
expectUnableToVerify?: boolean
}
type WideRuntimeSample = {
cookies?: RuntimeSample['cookies']
headers?: Array<string[]>
params?: RuntimeSample['params']
searchParams?: RuntimeSample['searchParams']
}
type RuntimeSample = {
cookies?: Array<{
name: string
......@@ -127,7 +133,7 @@ const AppSegmentConfigSchema = z.object({
/**
* How this segment should be prefetched.
*/
unstable_prefetch: PrefetchSchema.optional(),
unstable_instant: InstantConfigSchema.optional(),
/**
* The preferred region for the page.
......@@ -166,10 +172,10 @@ export function parseAppSegmentConfig(
)} on "${route}", must be a non-negative number or false`,
}
}
case 'unstable_prefetch': {
case 'unstable_instant': {
return {
// @TODO replace this link with a link to the docs when they are written
message: `Invalid unstable_prefetch value ${JSON.stringify(ctx.data)} on "${route}", must be an object with a mode of "static" or "runtime". Read more at https://nextjs.org/docs/messages/invalid-prefetch-configuration`,
message: `Invalid unstable_instant value ${JSON.stringify(ctx.data)} on "${route}", must be an object with \`prefetch: "static"\` or \`prefetch: "runtime"\`. Read more at https://nextjs.org/docs/messages/invalid-instant-configuration`,
}
}
default:
......@@ -224,7 +230,7 @@ export type AppSegmentConfig = {
/**
* How this segment should be prefetched.
*/
unstable_prefetch?: Prefetch
unstable_instant?: InstantConfig
/**
* The preferred region for the page.
......
......@@ -54,7 +54,7 @@ ${
: `import type { ResolvingMetadata, ResolvingViewport } from 'next/dist/lib/metadata/types/metadata-interface.js'`
}
import type { PrefetchForTypeCheckInternal } from 'next/dist/build/segment-config/app/app-segment-config.js'
import type { InstantConfigForTypeCheckInternal } from 'next/dist/build/segment-config/app/app-segment-config.js'
type TEntry = typeof import('${relativePath}.js')
......@@ -71,7 +71,7 @@ checkFields<Diff<{
}
config?: {}
generateStaticParams?: Function
unstable_prefetch?: PrefetchForTypeCheckInternal
unstable_instant?: InstantConfigForTypeCheckInternal
revalidate?: RevalidateRange<TEntry> | false
dynamic?: 'auto' | 'force-dynamic' | 'error' | 'force-static'
dynamicParams?: boolean
......
......@@ -225,11 +225,11 @@ async function createComponentTreeInternal(
})
: []
const prefetchConfig = layoutOrPageMod
? (layoutOrPageMod as AppSegmentConfig).unstable_prefetch
const instantConfig = layoutOrPageMod
? (layoutOrPageMod as AppSegmentConfig).unstable_instant
: undefined
/** Whether this segment should use a runtime prefetch instead of a static prefetch. */
const hasRuntimePrefetch = prefetchConfig?.mode === 'runtime'
const hasRuntimePrefetch = instantConfig?.prefetch === 'runtime'
const [Forbidden, forbiddenStyles] =
authInterrupts && forbidden
......
......@@ -9,11 +9,11 @@ export async function anySegmentHasRuntimePrefetchEnabled(
const { mod: layoutOrPageMod } = await getLayoutOrPageModule(tree)
// TODO(restart-on-cache-miss): Does this work correctly for client page/layout modules?
const prefetchConfig = layoutOrPageMod
? (layoutOrPageMod as AppSegmentConfig).unstable_prefetch
const instantConfig = layoutOrPageMod
? (layoutOrPageMod as AppSegmentConfig).unstable_instant
: undefined
/** Whether this segment should use a runtime prefetch instead of a static prefetch. */
const hasRuntimePrefetch = prefetchConfig?.mode === 'runtime'
const hasRuntimePrefetch = instantConfig?.prefetch === 'runtime'
if (hasRuntimePrefetch) {
return true
}
......
......@@ -146,7 +146,7 @@ const API_DOCS: Record<
'`maxDuration` allows you to set max default execution time for your function. If it is not specified, the default value is dependent on your deployment platform and plan.',
link: 'https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config#maxduration',
},
unstable_prefetch: {
unstable_instant: {
description: `Specifies the default prefetching behavior for this segment. This configuration is currently under development and will change.`,
link: '(docs coming soon)',
type: 'object',
......@@ -154,7 +154,7 @@ const API_DOCS: Record<
// with the way this plugin is currently structured.
// For now, since we don't provide an `options` here, we won't do any validation in
// `getSemanticDiagnosticsForExportVariableStatement` below, and only provide hover a tooltip + autocomplete.
insertText: 'unstable_prefetch = { mode: "static" };',
insertText: 'unstable_instant = { mode: "static" };',
},
}
......
......@@ -3,7 +3,7 @@ import { CachedData } from '../../data-fetching'
import { connection } from 'next/server'
import { Suspense } from 'react'
export const unstable_prefetch = { mode: 'runtime', samples: [{}] }
export const unstable_instant = { prefetch: 'runtime', samples: [{}] }
const CACHE_KEY = __dirname + '/__PAGE__'
......
......@@ -2,7 +2,7 @@ import { Suspense } from 'react'
import { UncachedFetch, CachedData } from '../data-fetching'
import { PrivateCachedData } from './data-fetching'
export const unstable_prefetch = { mode: 'runtime', samples: [{}] }
export const unstable_instant = { prefetch: 'runtime', samples: [{}] }
const CACHE_KEY = '/private-cache/__LAYOUT__'
......
......@@ -2,7 +2,7 @@ import { Suspense } from 'react'
import { UncachedFetch, CachedData } from '../data-fetching'
import { ShortLivedCache } from './data-fetching'
export const unstable_prefetch = { mode: 'runtime', samples: [{}] }
export const unstable_instant = { prefetch: 'runtime', samples: [{}] }
const CACHE_KEY = __dirname + '/__LAYOUT__'
......
import { Suspense } from 'react'
import { UncachedFetch, CachedFetch, CachedData } from '../data-fetching'
export const unstable_prefetch = { mode: 'runtime', samples: [{}] }
export const unstable_instant = { prefetch: 'runtime', samples: [{}] }
const CACHE_KEY = __dirname + '/__LAYOUT__'
......
export const unstable_prefetch = { mode: 'runtime', samples: [{}] }
export const unstable_instant = { prefetch: 'runtime', samples: [{}] }
export default async function Page() {
return (
......
......@@ -2,7 +2,7 @@ import { Suspense } from 'react'
import { CachedData, getCachedData } from '../../data-fetching'
import { cookies } from 'next/headers'
export const unstable_prefetch = { mode: 'runtime', samples: [{}] }
export const unstable_instant = { prefetch: 'runtime', samples: [{}] }
const CACHE_KEY = __dirname + '/__PAGE__'
......
import { CachedData, getCachedData } from '../../data-fetching'
export const unstable_prefetch = { mode: 'runtime', samples: [{}] }
export const unstable_instant = { prefetch: 'runtime', samples: [{}] }
const CACHE_KEY = __dirname + '/__PAGE__'
......
import { Suspense } from 'react'
import { Static, Runtime, Dynamic } from '../shared'
export const unstable_prefetch = { mode: 'runtime', samples: [{}] }
export const unstable_instant = { prefetch: 'runtime', samples: [{}] }
export default function Root({ children }: { children: React.ReactNode }) {
return (
......
import { Suspense } from 'react'
import { connection } from 'next/server'
export const unstable_prefetch = {
mode: 'runtime',
export const unstable_instant = {
prefetch: 'runtime',
samples: [{ searchParams: { myParam: 'testValue' } }],
}
......
......@@ -2,7 +2,7 @@ import { cookies } from 'next/headers'
import { Suspense } from 'react'
import { DebugRenderKind } from '../../../shared'
// No `export const unstable_prefetch = ...` is needed, we default to static
// No `export const unstable_instant = ...` is needed, we default to static
export default async function SubLayout({ children }) {
return (
......
import { cookies } from 'next/headers'
import { Suspense } from 'react'
export const unstable_prefetch = {
mode: 'runtime',
export const unstable_instant = {
prefetch: 'runtime',
samples: [{ cookies: [] }],
}
......
......@@ -2,10 +2,10 @@ import { cookies } from 'next/headers'
import { connection } from 'next/server'
import { Suspense } from 'react'
// Technically, no `export const unstable_prefetch = ...` is needed, because we default to static,
// Technically, no `export const unstable_instant = ...` is needed, because we default to static,
// this is just to make sure that we excercise the codepaths for it
export const unstable_prefetch = {
mode: 'static',
export const unstable_instant = {
prefetch: 'static',
}
export default function Page() {
return (
......
// No `export const unstable_prefetch = ...` is needed, we default to static
// No `export const unstable_instant = ...` is needed, we default to static
export default function Page() {
return (
......
......@@ -2,8 +2,8 @@ import { cookies } from 'next/headers'
import { Suspense } from 'react'
import { DebugRenderKind } from '../../shared'
export const unstable_prefetch = {
mode: 'runtime',
export const unstable_instant = {
prefetch: 'runtime',
samples: [{ cookies: [] }],
}
export default async function Layout({ children }) {
......
......@@ -2,7 +2,7 @@ import { cookies } from 'next/headers'
import { DebugLinkAccordion } from '../../../components/link-accordion'
import { Suspense } from 'react'
// No `export const unstable_prefetch = ...` is needed, we default to static
// No `export const unstable_instant = ...` is needed, we default to static
// (but see page description for more on the actual behavior)
export default function Page() {
......
......@@ -17,7 +17,7 @@ describe('layout sharing in non-static prefetches', () => {
// - A "full prefetch" is `<Link prefetch="true">`
// It includes cached and uncached IO.
// - A "runtime prefetch" is the new `unstable_prefetch` segment config (only available in cacheComponents mode).
// - A "runtime prefetch" is the new `unstable_instant` segment config (only available in cacheComponents mode).
// It includes cached IO, and allows access to cookies/params/searchParams/"use cache: private", but excludes uncached IO.
// TODO (runtime-prefetching): link-level opt-in has been removed. These tests need to be updated to use the segment configuration.
......
......@@ -2,8 +2,8 @@ import { Suspense } from 'react'
import { cachedDelay, DebugRenderKind } from '../../../shared'
import { cacheLife } from 'next/cache'
export const unstable_prefetch = {
mode: 'runtime',
export const unstable_instant = {
prefetch: 'runtime',
samples: [{ cookies: [] }],
}
......
......@@ -2,8 +2,8 @@ import { Suspense } from 'react'
import { cachedDelay, DebugRenderKind } from '../../../shared'
import { cacheLife } from 'next/cache'
export const unstable_prefetch = {
mode: 'runtime',
export const unstable_instant = {
prefetch: 'runtime',
samples: [{ cookies: [] }],
}
......
......@@ -2,8 +2,8 @@ import { Suspense } from 'react'
import { cachedDelay, DebugRenderKind } from '../../../shared'
import { cacheLife } from 'next/cache'
export const unstable_prefetch = {
mode: 'runtime',
export const unstable_instant = {
prefetch: 'runtime',
samples: [{ cookies: [] }],
}
......
......@@ -2,8 +2,8 @@ import { Suspense } from 'react'
import { cachedDelay, DebugRenderKind } from '../../../shared'
import { cacheLife } from 'next/cache'
export const unstable_prefetch = {
mode: 'runtime',
export const unstable_instant = {
prefetch: 'runtime',
samples: [{ cookies: [] }],
}
......
......@@ -2,8 +2,8 @@ import { Suspense } from 'react'
import { cachedDelay, DebugRenderKind } from '../../../shared'
import { cacheLife } from 'next/cache'
export const unstable_prefetch = {
mode: 'runtime',
export const unstable_instant = {
prefetch: 'runtime',
samples: [{ cookies: [] }],
}
......
......@@ -3,8 +3,8 @@ import { Suspense } from 'react'
import { cachedDelay, DebugRenderKind } from '../../../shared'
import { ErrorBoundary } from '../../../../components/error-boundary'
export const unstable_prefetch = {
mode: 'runtime',
export const unstable_instant = {
prefetch: 'runtime',
samples: [{ cookies: [] }],
}
......
......@@ -2,8 +2,8 @@ import { cookies } from 'next/headers'
import { Suspense } from 'react'
import { DebugRenderKind } from '../../../../shared'
export const unstable_prefetch = {
mode: 'runtime',
export const unstable_instant = {
prefetch: 'runtime',
samples: [{ cookies: [] }],
}
......
......@@ -3,8 +3,8 @@ import { DebugRenderKind } from '../../../../../shared'
type Params = { id: string }
export const unstable_prefetch = {
mode: 'runtime',
export const unstable_instant = {
prefetch: 'runtime',
samples: [{ cookies: [] }],
}
......
......@@ -2,8 +2,8 @@ import { headers } from 'next/headers'
import { Suspense } from 'react'
import { DebugRenderKind } from '../../../../shared'
export const unstable_prefetch = {
mode: 'runtime',
export const unstable_instant = {
prefetch: 'runtime',
samples: [{ cookies: [] }],
}
......
import { Suspense } from 'react'
import { cachedDelay, DebugRenderKind } from '../../../../shared'
export const unstable_prefetch = {
mode: 'runtime',
export const unstable_instant = {
prefetch: 'runtime',
samples: [{ cookies: [] }],
}
......
......@@ -2,8 +2,8 @@ import { Suspense } from 'react'
import { cachedDelay, DebugRenderKind } from '../../../../shared'
import { cacheLife } from 'next/cache'
export const unstable_prefetch = {
mode: 'runtime',
export const unstable_instant = {
prefetch: 'runtime',
samples: [{ cookies: [] }],
}
......
......@@ -3,8 +3,8 @@ import { DebugRenderKind } from '../../../../shared'
type AnySearchParams = { [key: string]: string | string[] | undefined }
export const unstable_prefetch = {
mode: 'runtime',
export const unstable_instant = {
prefetch: 'runtime',
samples: [{ cookies: [] }],
}
......
......@@ -3,8 +3,8 @@
// but it's useful to exercise this codepath.
// In the future, this test can be used to check whether we correctly
// *skip* a runtime prefetch if a page was prerendered as static.
export const unstable_prefetch = {
mode: 'runtime',
export const unstable_instant = {
prefetch: 'runtime',
samples: [{ cookies: [] }],
}
......
......@@ -2,8 +2,8 @@ import { cookies } from 'next/headers'
import { Suspense } from 'react'
import { cachedDelay, DebugRenderKind } from '../../../shared'
export const unstable_prefetch = {
mode: 'runtime',
export const unstable_instant = {
prefetch: 'runtime',
samples: [{ cookies: [{ name: 'testCookie', value: 'testValue' }] }],
}
......
......@@ -3,8 +3,8 @@ import { Suspense } from 'react'
import { cachedDelay, DebugRenderKind, uncachedIO } from '../../../shared'
import { connection } from 'next/server'
export const unstable_prefetch = {
mode: 'runtime',
export const unstable_instant = {
prefetch: 'runtime',
samples: [{ cookies: [{ name: 'testCookie', value: 'testValue' }] }],
}
......
......@@ -2,8 +2,8 @@ import { Suspense } from 'react'
import { cachedDelay, DebugRenderKind, uncachedIO } from '../../../../shared'
import { connection } from 'next/server'
export const unstable_prefetch = {
mode: 'runtime',
export const unstable_instant = {
prefetch: 'runtime',
samples: [{ params: { id: 'test' } }],
}
......
......@@ -3,8 +3,8 @@ import { Suspense } from 'react'
import { cachedDelay, DebugRenderKind, uncachedIO } from '../../../shared'
import { connection } from 'next/server'
export const unstable_prefetch = {
mode: 'runtime',
export const unstable_instant = {
prefetch: 'runtime',
samples: [{ headers: [['host', 'test-host']] }],
}
......
......@@ -2,8 +2,8 @@ import { Suspense } from 'react'
import { cachedDelay, DebugRenderKind, uncachedIO } from '../../../shared'
import { connection } from 'next/server'
export const unstable_prefetch = {
mode: 'runtime',
export const unstable_instant = {
prefetch: 'runtime',
samples: [{ searchParams: { key: 'value' } }],
}
......
......@@ -2,8 +2,8 @@ import { cookies } from 'next/headers'
import { Suspense } from 'react'
import { cachedDelay, DebugRenderKind } from '../../../shared'
export const unstable_prefetch = {
mode: 'runtime',
export const unstable_instant = {
prefetch: 'runtime',
samples: [{ cookies: [{ name: 'testCookie', value: 'testValue' }] }],
}
......
......@@ -3,8 +3,8 @@ import { Suspense } from 'react'
import { cachedDelay, DebugRenderKind, uncachedIO } from '../../../shared'
import { connection } from 'next/server'
export const unstable_prefetch = {
mode: 'runtime',
export const unstable_instant = {
prefetch: 'runtime',
samples: [{ cookies: [{ name: 'testCookie', value: 'testValue' }] }],
}
......
......@@ -2,8 +2,8 @@ import { Suspense } from 'react'
import { cachedDelay, DebugRenderKind, uncachedIO } from '../../../shared'
import { connection } from 'next/server'
export const unstable_prefetch = {
mode: 'runtime',
export const unstable_instant = {
prefetch: 'runtime',
samples: [{ cookies: [] }],
}
......
......@@ -2,8 +2,8 @@ import { Suspense } from 'react'
import { cachedDelay, DebugRenderKind, uncachedIO } from '../../../../shared'
import { connection } from 'next/server'
export const unstable_prefetch = {
mode: 'runtime',
export const unstable_instant = {
prefetch: 'runtime',
samples: [{ params: { id: 'test' } }],
}
......
......@@ -3,8 +3,8 @@ import { Suspense } from 'react'
import { cachedDelay, DebugRenderKind, uncachedIO } from '../../../shared'
import { connection } from 'next/server'
export const unstable_prefetch = {
mode: 'runtime',
export const unstable_instant = {
prefetch: 'runtime',
samples: [{ headers: [['host', 'test-host']] }],
}
......
......@@ -2,8 +2,8 @@ import { Suspense } from 'react'
import { cachedDelay, DebugRenderKind, uncachedIO } from '../../../shared'
import { connection } from 'next/server'
export const unstable_prefetch = {
mode: 'runtime',
export const unstable_instant = {
prefetch: 'runtime',
samples: [{ searchParams: { key: 'value' } }],
}
......
......@@ -2,8 +2,8 @@ import { cookies } from 'next/headers'
import { Suspense } from 'react'
import { cachedDelay, DebugRenderKind } from '../../../shared'
export const unstable_prefetch = {
mode: 'runtime',
export const unstable_instant = {
prefetch: 'runtime',
samples: [{ cookies: [{ name: 'testCookie', value: 'testValue' }] }],
}
......
......@@ -3,8 +3,8 @@ import { Suspense } from 'react'
import { cachedDelay, DebugRenderKind } from '../../../shared'
import { connection } from 'next/server'
export const unstable_prefetch = {
mode: 'runtime',
export const unstable_instant = {
prefetch: 'runtime',
samples: [{ cookies: [{ name: 'testCookie', value: 'testValue' }] }],
}
......
......@@ -3,8 +3,8 @@ import { cachedDelay, DebugRenderKind } from '../../../../shared'
import { connection } from 'next/server'
import { cookies } from 'next/headers'
export const unstable_prefetch = {
mode: 'runtime',
export const unstable_instant = {
prefetch: 'runtime',
samples: [{ params: { id: 'test' } }],
}
......
......@@ -3,8 +3,8 @@ import { Suspense } from 'react'
import { cachedDelay, DebugRenderKind } from '../../../shared'
import { connection } from 'next/server'
export const unstable_prefetch = {
mode: 'runtime',
export const unstable_instant = {
prefetch: 'runtime',
samples: [{ headers: [['host', 'test-host']] }],
}
......
......@@ -3,8 +3,8 @@ import { cachedDelay, DebugRenderKind } from '../../../shared'
import { connection } from 'next/server'
import { cookies } from 'next/headers'
export const unstable_prefetch = {
mode: 'runtime',
export const unstable_instant = {
prefetch: 'runtime',
samples: [{ searchParams: { key: 'value' } }],
}
......
......@@ -4,8 +4,8 @@ import { connection } from 'next/server'
import { lang } from 'next/root-params'
import { cookies } from 'next/headers'
export const unstable_prefetch = {
mode: 'runtime',
export const unstable_instant = {
prefetch: 'runtime',
samples: [{ params: { lang: 'en' } }],
}
......
......@@ -3,8 +3,8 @@ import { cachedDelay, DebugRenderKind, uncachedIO } from '../../../../shared'
import { connection } from 'next/server'
import { lang } from 'next/root-params'
export const unstable_prefetch = {
mode: 'runtime',
export const unstable_instant = {
prefetch: 'runtime',
samples: [{ params: { lang: 'en' } }],
}
......
......@@ -3,8 +3,8 @@ import { cachedDelay, DebugRenderKind, uncachedIO } from '../../../../shared'
import { connection } from 'next/server'
import { lang } from 'next/root-params'
export const unstable_prefetch = {
mode: 'runtime',
export const unstable_instant = {
prefetch: 'runtime',
samples: [{ params: { lang: 'en' } }],
}
......
......@@ -2,7 +2,7 @@ import { Suspense } from 'react'
import { cacheLife } from 'next/cache'
import { cookies } from 'next/headers'
export const unstable_prefetch = { mode: 'runtime', samples: [{}] }
export const unstable_instant = { prefetch: 'runtime', samples: [{}] }
export default function Page() {
return (
......
......@@ -2,7 +2,7 @@ import { Suspense } from 'react'
import { cacheLife } from 'next/cache'
import { cookies } from 'next/headers'
export const unstable_prefetch = { mode: 'runtime', samples: [{}] }
export const unstable_instant = { prefetch: 'runtime', samples: [{}] }
export default function Page() {
return (
......
......@@ -11,11 +11,11 @@ import { connection } from 'next/server'
* This allows cache reuse across different itemId values (same category),
* providing instant loading feedback when navigating.
*/
export const unstable_prefetch: {
mode: 'runtime'
export const unstable_instant: {
prefetch: 'runtime'
samples: Array<{ params: { category: string; itemId: string } }>
} = {
mode: 'runtime',
prefetch: 'runtime',
samples: [
{ params: { category: 'electronics', itemId: 'phone' } },
{ params: { category: 'clothing', itemId: 'shirt' } },
......
......@@ -14,8 +14,8 @@ import { Suspense } from 'react'
* - Prefetching /target?foo=1 fetches the segment with foo=1 content
* - Prefetching /target?foo=2 fetches the segment AGAIN (no cache hit)
*/
export const unstable_prefetch = {
mode: 'runtime',
export const unstable_instant = {
prefetch: 'runtime',
samples: [{ searchParams: { foo: '1' } }],
}
......
......@@ -24267,7 +24267,7 @@ Read more: https://nextjs.org/docs/messages/failed-to-find-server-action`),
injectedJS: Q,
})
: [],
ev = 'unstable_runtime' === (ef ? ef.unstable_prefetch : void 0),
ev = 'unstable_runtime' === (ef ? ef.unstable_instant : void 0),
[eb, e_] =
m && J
? await rg({
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment