Unverified Commit 1931877c authored by Josh Story's avatar Josh Story Committed by GitHub

Remove prefetch from instant config (#92761)

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
parent 3e847dfe
...@@ -19,9 +19,8 @@ const RuntimeSampleSchema = z ...@@ -19,9 +19,8 @@ const RuntimeSampleSchema = z
}) })
.strict() .strict()
const InstantConfigStaticSchema = z const InstantConfigObjectSchema = z
.object({ .object({
prefetch: z.literal('static'),
samples: z.array(RuntimeSampleSchema).min(1).optional(), samples: z.array(RuntimeSampleSchema).min(1).optional(),
from: z.array(z.string()).optional(), from: z.array(z.string()).optional(),
unstable_disableValidation: z.literal(true).optional(), unstable_disableValidation: z.literal(true).optional(),
...@@ -30,22 +29,9 @@ const InstantConfigStaticSchema = z ...@@ -30,22 +29,9 @@ const InstantConfigStaticSchema = z
}) })
.strict() .strict()
const InstantConfigRuntimeSchema = z
.object({
prefetch: z.literal('runtime'),
samples: z.array(RuntimeSampleSchema).min(1),
from: z.array(z.string()).optional(),
unstable_disableValidation: z.literal(true).optional(),
unstable_disableDevValidation: z.literal(true).optional(),
unstable_disableBuildValidation: z.literal(true).optional(),
})
.strict()
const InstantConfigSchema = z.union([ const InstantConfigSchema = z.union([
z.discriminatedUnion('prefetch', [ InstantConfigObjectSchema,
InstantConfigStaticSchema, z.literal(true),
InstantConfigRuntimeSchema,
]),
z.literal(false), z.literal(false),
]) ])
...@@ -56,7 +42,7 @@ const PrefetchSchema = z.enum([ ...@@ -56,7 +42,7 @@ const PrefetchSchema = z.enum([
'force-runtime', 'force-runtime',
]) ])
export type Instant = InstantConfigStatic | InstantConfigRuntime | false export type Instant = InstantConfig | true | false
export type Prefetch = export type Prefetch =
| 'auto' | 'auto'
...@@ -65,14 +51,13 @@ export type Prefetch = ...@@ -65,14 +51,13 @@ export type Prefetch =
| 'force-runtime' | 'force-runtime'
export type InstantConfigForTypeCheckInternal = __GenericInstantConfig | Instant export type InstantConfigForTypeCheckInternal = __GenericInstantConfig | Instant
// the __GenericPrefetch type is used to avoid type widening issues with // the __GenericInstantConfig type is used to avoid type widening issues with
// our choice to make exports the medium for programming a Next.js application // 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 // 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 // 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 // and thus cannot match the discriminated union type. If we figure out a better way we should
// delete the __GenericPrefetch member. // delete the __GenericInstantConfig member.
interface __GenericInstantConfig { interface __GenericInstantConfig {
prefetch: string
samples?: Array<WideInstantSample> samples?: Array<WideInstantSample>
from?: string[] from?: string[]
unstable_disableValidation?: boolean unstable_disableValidation?: boolean
...@@ -80,31 +65,21 @@ interface __GenericInstantConfig { ...@@ -80,31 +65,21 @@ interface __GenericInstantConfig {
unstable_disableBuildValidation?: boolean unstable_disableBuildValidation?: boolean
} }
interface InstantConfigStatic { type WideInstantSample = {
prefetch: 'static' cookies?: InstantSample['cookies']
samples?: Array<InstantSample> headers?: Array<string[]>
from?: string[] params?: InstantSample['params']
unstable_disableValidation?: true searchParams?: InstantSample['searchParams']
unstable_disableDevValidation?: true
unstable_disableBuildValidation?: true
} }
interface InstantConfigRuntime { export interface InstantConfig {
prefetch: 'runtime' samples?: Array<InstantSample>
samples: Array<InstantSample>
from?: string[] from?: string[]
unstable_disableValidation?: true unstable_disableValidation?: true
unstable_disableDevValidation?: true unstable_disableDevValidation?: true
unstable_disableBuildValidation?: true unstable_disableBuildValidation?: true
} }
type WideInstantSample = {
cookies?: InstantSample['cookies']
headers?: Array<string[]>
params?: InstantSample['params']
searchParams?: InstantSample['searchParams']
}
export type InstantSample = { export type InstantSample = {
cookies?: Array<{ cookies?: Array<{
name: string name: string
...@@ -212,7 +187,7 @@ export function parseAppSegmentConfig( ...@@ -212,7 +187,7 @@ export function parseAppSegmentConfig(
case 'unstable_instant': { case 'unstable_instant': {
return { return {
// @TODO replace this link with a link to the docs when they are written // @TODO replace this link with a link to the docs when they are written
message: `Invalid unstable_instant value ${JSON.stringify(ctx.data)} on "${route}", must be an object with \`prefetch: "static"\` or \`prefetch: "runtime"\`, or \`false\`. Read more at https://nextjs.org/docs/messages/invalid-instant-configuration`, message: `Invalid unstable_instant value ${JSON.stringify(ctx.data)} on "${route}", must be \`true\`, \`false\`, or an object. Read more at https://nextjs.org/docs/messages/invalid-instant-configuration`,
} }
} }
case 'unstable_prefetch': { case 'unstable_prefetch': {
......
...@@ -88,7 +88,10 @@ async function createFlightRouterStateFromLoaderTreeImpl( ...@@ -88,7 +88,10 @@ async function createFlightRouterStateFromLoaderTreeImpl(
prefetchHints |= PrefetchHint.IsRootLayout prefetchHints |= PrefetchHint.IsRootLayout
} }
if (instantConfig && typeof instantConfig === 'object') { if (
instantConfig === true ||
(typeof instantConfig === 'object' && instantConfig !== null)
) {
prefetchHints |= PrefetchHint.SubtreeHasInstant prefetchHints |= PrefetchHint.SubtreeHasInstant
} }
......
...@@ -49,10 +49,10 @@ export async function isPageAllowedToBlock(tree: LoaderTree): Promise<boolean> { ...@@ -49,10 +49,10 @@ export async function isPageAllowedToBlock(tree: LoaderTree): Promise<boolean> {
// instant UI, so we should make sure that a static shell exists. // instant UI, so we should make sure that a static shell exists.
// (even if it'd use runtime prefetching for client navs) // (even if it'd use runtime prefetching for client navs)
if (instantConfig !== undefined) { if (instantConfig !== undefined) {
if (typeof instantConfig === 'object') { if (instantConfig === false) {
return false
} else if (instantConfig === false) {
return true return true
} else {
return false
} }
} }
...@@ -84,12 +84,14 @@ async function anySegmentNeedsInstantValidation( ...@@ -84,12 +84,14 @@ async function anySegmentNeedsInstantValidation(
): Promise<boolean> { ): Promise<boolean> {
const segments = await findSegmentsWithInstantConfig(rootTree) const segments = await findSegmentsWithInstantConfig(rootTree)
// Check if there's any configs with `prefetch: 'static'` or `mode: 'instant'`. // Check if there's any non-false configs that need validation.
// (If there's only `false`, there's no need to run validation). // (If there's only `false`, there's no need to run validation).
// If any segment has `unstable_disableValidation`, we skip validation for the whole tree. // If any segment has `unstable_disableValidation`, we skip validation for the whole tree.
let needsValidation = false let needsValidation = false
for (const { config } of segments) { for (const { config } of segments) {
if (typeof config === 'object') { if (config === true) {
needsValidation = true
} else if (typeof config === 'object') {
if ( if (
config.unstable_disableValidation === true || config.unstable_disableValidation === true ||
(mode === 'dev' && config.unstable_disableDevValidation === true) || (mode === 'dev' && config.unstable_disableDevValidation === true) ||
......
...@@ -1155,7 +1155,10 @@ export async function createCombinedPayloadAtDepth( ...@@ -1155,7 +1155,10 @@ export async function createCombinedPayloadAtDepth(
(layoutOrPageMod as AppSegmentConfig).unstable_instant ?? null (layoutOrPageMod as AppSegmentConfig).unstable_instant ?? null
prefetchConfig = prefetchConfig =
(layoutOrPageMod as AppSegmentConfig).unstable_prefetch ?? null (layoutOrPageMod as AppSegmentConfig).unstable_prefetch ?? null
if (instantConfig && typeof instantConfig === 'object') { if (
instantConfig === true ||
(typeof instantConfig === 'object' && instantConfig !== null)
) {
const rawFactory: unknown = (layoutOrPageMod as any) const rawFactory: unknown = (layoutOrPageMod as any)
.__debugCreateInstantConfigStack .__debugCreateInstantConfigStack
localCreateInstantStack = localCreateInstantStack =
...@@ -1243,7 +1246,10 @@ export async function createCombinedPayloadAtDepth( ...@@ -1243,7 +1246,10 @@ export async function createCombinedPayloadAtDepth(
requiresInstantUI = false requiresInstantUI = false
createInstantStack = null createInstantStack = null
configDepth = -1 configDepth = -1
} else if (instantConfig && typeof instantConfig === 'object') { } else if (
instantConfig === true ||
(typeof instantConfig === 'object' && instantConfig !== null)
) {
requiresInstantUI = true requiresInstantUI = true
createInstantStack = localCreateInstantStack createInstantStack = localCreateInstantStack
configDepth = segmentDepth configDepth = segmentDepth
......
...@@ -147,14 +147,14 @@ const API_DOCS: Record< ...@@ -147,14 +147,14 @@ const API_DOCS: Record<
link: 'https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config#maxduration', link: 'https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config#maxduration',
}, },
unstable_instant: { unstable_instant: {
description: `Specifies the default prefetching behavior for this segment. This configuration is currently under development and will change.`, description: `Enables instant navigation validation for this segment. This configuration is currently under development and will change.`,
link: '(docs coming soon)', link: '(docs coming soon)',
type: 'object | false', type: 'true | object | false',
// TODO: ideally, we'd validate the config object somehow, but this is difficult to do // TODO: ideally, we'd validate the config object somehow, but this is difficult to do
// with the way this plugin is currently structured. // 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 // 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. // `getSemanticDiagnosticsForExportVariableStatement` below, and only provide hover a tooltip + autocomplete.
insertText: 'unstable_instant = { prefetch: "static" };', insertText: 'unstable_instant = true;',
}, },
unstable_prefetch: { unstable_prefetch: {
description: `Controls prefetching behavior for this segment. This configuration is currently under development and will change.`, description: `Controls prefetching behavior for this segment. This configuration is currently under development and will change.`,
......
...@@ -3,7 +3,7 @@ import { CachedData } from '../../data-fetching' ...@@ -3,7 +3,7 @@ import { CachedData } from '../../data-fetching'
import { connection } from 'next/server' import { connection } from 'next/server'
import { Suspense } from 'react' import { Suspense } from 'react'
export const unstable_instant = { prefetch: 'runtime', samples: [{}] } export const unstable_instant = true
export const unstable_prefetch = 'force-runtime' export const unstable_prefetch = 'force-runtime'
const CACHE_KEY = __dirname + '/__PAGE__' const CACHE_KEY = __dirname + '/__PAGE__'
......
...@@ -2,7 +2,7 @@ import { Suspense } from 'react' ...@@ -2,7 +2,7 @@ import { Suspense } from 'react'
import { UncachedFetch, CachedData } from '../data-fetching' import { UncachedFetch, CachedData } from '../data-fetching'
import { PrivateCachedData } from './data-fetching' import { PrivateCachedData } from './data-fetching'
export const unstable_instant = { prefetch: 'runtime', samples: [{}] } export const unstable_instant = true
export const unstable_prefetch = 'force-runtime' export const unstable_prefetch = 'force-runtime'
const CACHE_KEY = '/private-cache/__LAYOUT__' const CACHE_KEY = '/private-cache/__LAYOUT__'
......
...@@ -2,7 +2,7 @@ import { Suspense } from 'react' ...@@ -2,7 +2,7 @@ import { Suspense } from 'react'
import { UncachedFetch, CachedData } from '../data-fetching' import { UncachedFetch, CachedData } from '../data-fetching'
import { ShortLivedCache } from './data-fetching' import { ShortLivedCache } from './data-fetching'
export const unstable_instant = { prefetch: 'runtime', samples: [{}] } export const unstable_instant = true
export const unstable_prefetch = 'force-runtime' export const unstable_prefetch = 'force-runtime'
const CACHE_KEY = __dirname + '/__LAYOUT__' const CACHE_KEY = __dirname + '/__LAYOUT__'
......
import { Suspense } from 'react' import { Suspense } from 'react'
import { UncachedFetch, CachedFetch, CachedData } from '../data-fetching' import { UncachedFetch, CachedFetch, CachedData } from '../data-fetching'
export const unstable_instant = { prefetch: 'runtime', samples: [{}] } export const unstable_instant = true
export const unstable_prefetch = 'force-runtime' export const unstable_prefetch = 'force-runtime'
const CACHE_KEY = __dirname + '/__LAYOUT__' const CACHE_KEY = __dirname + '/__LAYOUT__'
......
export const unstable_instant = { prefetch: 'runtime', samples: [{}] } export const unstable_instant = true
export const unstable_prefetch = 'force-runtime' export const unstable_prefetch = 'force-runtime'
export default async function Page() { export default async function Page() {
......
...@@ -2,7 +2,7 @@ import { Suspense } from 'react' ...@@ -2,7 +2,7 @@ import { Suspense } from 'react'
import { CachedData, getCachedData } from '../../data-fetching' import { CachedData, getCachedData } from '../../data-fetching'
import { cookies } from 'next/headers' import { cookies } from 'next/headers'
export const unstable_instant = { prefetch: 'runtime', samples: [{}] } export const unstable_instant = true
export const unstable_prefetch = 'force-runtime' export const unstable_prefetch = 'force-runtime'
const CACHE_KEY = __dirname + '/__PAGE__' const CACHE_KEY = __dirname + '/__PAGE__'
......
import { CachedData, getCachedData } from '../../data-fetching' import { CachedData, getCachedData } from '../../data-fetching'
export const unstable_instant = { prefetch: 'runtime', samples: [{}] } export const unstable_instant = true
export const unstable_prefetch = 'force-runtime' export const unstable_prefetch = 'force-runtime'
const CACHE_KEY = __dirname + '/__PAGE__' const CACHE_KEY = __dirname + '/__PAGE__'
......
import { Suspense } from 'react' import { Suspense } from 'react'
import { Static, Runtime, Dynamic } from '../shared' import { Static, Runtime, Dynamic } from '../shared'
export const unstable_instant = { prefetch: 'runtime', samples: [{}] } export const unstable_instant = true
export const unstable_prefetch = 'force-runtime' export const unstable_prefetch = 'force-runtime'
export default function Root({ children }: { children: React.ReactNode }) { export default function Root({ children }: { children: React.ReactNode }) {
......
...@@ -2,7 +2,6 @@ import { Suspense } from 'react' ...@@ -2,7 +2,6 @@ import { Suspense } from 'react'
import { connection } from 'next/server' import { connection } from 'next/server'
export const unstable_instant = { export const unstable_instant = {
prefetch: 'runtime',
samples: [{ searchParams: { myParam: 'testValue' } }], samples: [{ searchParams: { myParam: 'testValue' } }],
} }
export const unstable_prefetch = 'force-runtime' export const unstable_prefetch = 'force-runtime'
......
...@@ -2,7 +2,6 @@ import { Instant } from 'next' ...@@ -2,7 +2,6 @@ import { Instant } from 'next'
import { ThrowsInClient } from './client' import { ThrowsInClient } from './client'
export const unstable_instant: Instant = { export const unstable_instant: Instant = {
prefetch: 'static',
samples: [{ searchParams: {} }], samples: [{ searchParams: {} }],
} }
......
...@@ -2,7 +2,6 @@ import { Instant } from 'next' ...@@ -2,7 +2,6 @@ import { Instant } from 'next'
import { ThrowsInClient } from './client' import { ThrowsInClient } from './client'
export const unstable_instant: Instant = { export const unstable_instant: Instant = {
prefetch: 'static',
samples: [{ searchParams: {} }], samples: [{ searchParams: {} }],
} }
......
...@@ -2,10 +2,7 @@ import { cookies } from 'next/headers' ...@@ -2,10 +2,7 @@ import { cookies } from 'next/headers'
import { Suspense } from 'react' import { Suspense } from 'react'
import { ensureThrows } from '../../../../ensure-error' import { ensureThrows } from '../../../../ensure-error'
export const unstable_instant = { export const unstable_instant = true
prefetch: 'runtime',
samples: [{ cookies: [] }],
}
export const unstable_prefetch = 'force-runtime' export const unstable_prefetch = 'force-runtime'
export default async function Page() { export default async function Page() {
......
...@@ -2,10 +2,7 @@ import { cookies } from 'next/headers' ...@@ -2,10 +2,7 @@ import { cookies } from 'next/headers'
import { Suspense } from 'react' import { Suspense } from 'react'
import { ensureThrows } from '../../../../ensure-error' import { ensureThrows } from '../../../../ensure-error'
export const unstable_instant = { export const unstable_instant = true
prefetch: 'runtime',
samples: [{ cookies: [] }],
}
export const unstable_prefetch = 'force-runtime' export const unstable_prefetch = 'force-runtime'
export default async function Page() { export default async function Page() {
......
...@@ -2,10 +2,7 @@ import { cookies } from 'next/headers' ...@@ -2,10 +2,7 @@ import { cookies } from 'next/headers'
import { Suspense } from 'react' import { Suspense } from 'react'
import { ensureThrows } from '../../../../ensure-error' import { ensureThrows } from '../../../../ensure-error'
export const unstable_instant = { export const unstable_instant = true
prefetch: 'runtime',
samples: [{ cookies: [] }],
}
export const unstable_prefetch = 'force-runtime' export const unstable_prefetch = 'force-runtime'
export default async function Page() { export default async function Page() {
......
...@@ -5,7 +5,6 @@ import assert from 'node:assert' ...@@ -5,7 +5,6 @@ import assert from 'node:assert'
import { Suspense } from 'react' import { Suspense } from 'react'
export const unstable_instant: Instant = { export const unstable_instant: Instant = {
prefetch: 'runtime',
samples: [ samples: [
{ {
cookies: [ cookies: [
......
...@@ -3,7 +3,6 @@ import { cookies } from 'next/headers' ...@@ -3,7 +3,6 @@ import { cookies } from 'next/headers'
import assert from 'node:assert/strict' import assert from 'node:assert/strict'
export const unstable_instant: Instant = { export const unstable_instant: Instant = {
prefetch: 'runtime',
samples: [ samples: [
{ {
cookies: [{ name: 'testCookie', value: 'testValue' }], cookies: [{ name: 'testCookie', value: 'testValue' }],
......
...@@ -3,7 +3,6 @@ import { cookies } from 'next/headers' ...@@ -3,7 +3,6 @@ import { cookies } from 'next/headers'
import { ClientChild } from './client' import { ClientChild } from './client'
export const unstable_instant: Instant = { export const unstable_instant: Instant = {
prefetch: 'runtime',
samples: [ samples: [
{ {
cookies: [{ name: 'testCookie', value: 'testValue' }], cookies: [{ name: 'testCookie', value: 'testValue' }],
......
...@@ -7,7 +7,6 @@ import { AssertParamsClient } from './client' ...@@ -7,7 +7,6 @@ import { AssertParamsClient } from './client'
// samples use 'hello', but generateStaticParams uses 'foo'/'bar'. // samples use 'hello', but generateStaticParams uses 'foo'/'bar'.
// During validation, the sample params should be used, not the GSP values. // During validation, the sample params should be used, not the GSP values.
export const unstable_instant: Instant = { export const unstable_instant: Instant = {
prefetch: 'runtime',
samples: [ samples: [
{ {
params: { params: {
......
...@@ -2,10 +2,7 @@ import { headers } from 'next/headers' ...@@ -2,10 +2,7 @@ import { headers } from 'next/headers'
import { Suspense } from 'react' import { Suspense } from 'react'
import { ensureThrows } from '../../../../ensure-error' import { ensureThrows } from '../../../../ensure-error'
export const unstable_instant = { export const unstable_instant = { samples: [{ headers: [] }] }
prefetch: 'runtime',
samples: [{ headers: [] }],
}
export const unstable_prefetch = 'force-runtime' export const unstable_prefetch = 'force-runtime'
export default async function Page() { export default async function Page() {
......
...@@ -2,10 +2,7 @@ import { headers } from 'next/headers' ...@@ -2,10 +2,7 @@ import { headers } from 'next/headers'
import { Suspense } from 'react' import { Suspense } from 'react'
import { ensureThrows } from '../../../../ensure-error' import { ensureThrows } from '../../../../ensure-error'
export const unstable_instant = { export const unstable_instant = { samples: [{ headers: [] }] }
prefetch: 'runtime',
samples: [{ headers: [] }],
}
export const unstable_prefetch = 'force-runtime' export const unstable_prefetch = 'force-runtime'
export default async function Page() { export default async function Page() {
......
...@@ -2,10 +2,7 @@ import { headers } from 'next/headers' ...@@ -2,10 +2,7 @@ import { headers } from 'next/headers'
import { Suspense } from 'react' import { Suspense } from 'react'
import { ensureThrows } from '../../../../ensure-error' import { ensureThrows } from '../../../../ensure-error'
export const unstable_instant = { export const unstable_instant = { samples: [{ headers: [] }] }
prefetch: 'runtime',
samples: [{ headers: [] }],
}
export const unstable_prefetch = 'force-runtime' export const unstable_prefetch = 'force-runtime'
export default async function Page() { export default async function Page() {
......
...@@ -5,7 +5,6 @@ import assert from 'node:assert' ...@@ -5,7 +5,6 @@ import assert from 'node:assert'
import { Suspense } from 'react' import { Suspense } from 'react'
export const unstable_instant: Instant = { export const unstable_instant: Instant = {
prefetch: 'runtime',
samples: [ samples: [
{ {
headers: [ headers: [
......
...@@ -3,7 +3,6 @@ import { headers } from 'next/headers' ...@@ -3,7 +3,6 @@ import { headers } from 'next/headers'
import assert from 'node:assert/strict' import assert from 'node:assert/strict'
export const unstable_instant: Instant = { export const unstable_instant: Instant = {
prefetch: 'runtime',
samples: [ samples: [
{ {
headers: [['x-test-header', 'testValue']], headers: [['x-test-header', 'testValue']],
......
...@@ -3,7 +3,6 @@ import { headers } from 'next/headers' ...@@ -3,7 +3,6 @@ import { headers } from 'next/headers'
import { ClientChild } from './client' import { ClientChild } from './client'
export const unstable_instant: Instant = { export const unstable_instant: Instant = {
prefetch: 'runtime',
samples: [ samples: [
{ {
headers: [['x-test-header', 'testValue']], headers: [['x-test-header', 'testValue']],
......
...@@ -2,7 +2,6 @@ import { cookies } from 'next/headers' ...@@ -2,7 +2,6 @@ import { cookies } from 'next/headers'
import { connection } from 'next/server' import { connection } from 'next/server'
export const unstable_instant = { export const unstable_instant = {
prefetch: 'runtime',
samples: [{ cookies: [{ name: 'auth', value: '1' }] }], samples: [{ cookies: [{ name: 'auth', value: '1' }] }],
} }
export const unstable_prefetch = 'force-runtime' export const unstable_prefetch = 'force-runtime'
......
...@@ -3,7 +3,6 @@ import assert from 'node:assert/strict' ...@@ -3,7 +3,6 @@ import assert from 'node:assert/strict'
import { ensureThrows } from '../../../../../../ensure-error' import { ensureThrows } from '../../../../../../ensure-error'
export const unstable_instant: Instant = { export const unstable_instant: Instant = {
prefetch: 'runtime',
samples: [ samples: [
{ {
params: { params: {
......
...@@ -3,7 +3,6 @@ import assert from 'node:assert/strict' ...@@ -3,7 +3,6 @@ import assert from 'node:assert/strict'
import { ensureThrows } from '../../../../../../ensure-error' import { ensureThrows } from '../../../../../../ensure-error'
export const unstable_instant: Instant = { export const unstable_instant: Instant = {
prefetch: 'runtime',
samples: [ samples: [
{ {
params: { params: {
......
...@@ -2,7 +2,6 @@ import type { Instant } from 'next' ...@@ -2,7 +2,6 @@ import type { Instant } from 'next'
import { ParamsReader } from './params-reader' import { ParamsReader } from './params-reader'
export const unstable_instant: Instant = { export const unstable_instant: Instant = {
prefetch: 'static',
samples: [ samples: [
{ {
params: { params: {
......
...@@ -2,7 +2,6 @@ import type { Instant } from 'next' ...@@ -2,7 +2,6 @@ import type { Instant } from 'next'
import { ParamsReader } from './params-reader' import { ParamsReader } from './params-reader'
export const unstable_instant: Instant = { export const unstable_instant: Instant = {
prefetch: 'static',
samples: [ samples: [
{ {
params: { params: {
......
...@@ -2,7 +2,6 @@ import type { Instant } from 'next' ...@@ -2,7 +2,6 @@ import type { Instant } from 'next'
import assert from 'node:assert/strict' import assert from 'node:assert/strict'
export const unstable_instant: Instant = { export const unstable_instant: Instant = {
prefetch: 'runtime',
samples: [ samples: [
{ {
params: { params: {
......
...@@ -2,7 +2,6 @@ import type { Instant } from 'next' ...@@ -2,7 +2,6 @@ import type { Instant } from 'next'
import assert from 'node:assert/strict' import assert from 'node:assert/strict'
export const unstable_instant: Instant = { export const unstable_instant: Instant = {
prefetch: 'runtime',
samples: [{ params: { slug: 'hello' } }], samples: [{ params: { slug: 'hello' } }],
} }
export const unstable_prefetch = 'force-runtime' export const unstable_prefetch = 'force-runtime'
......
...@@ -2,7 +2,6 @@ import type { Instant } from 'next' ...@@ -2,7 +2,6 @@ import type { Instant } from 'next'
import { ClientChild } from './client' import { ClientChild } from './client'
export const unstable_instant: Instant = { export const unstable_instant: Instant = {
prefetch: 'runtime',
samples: [{ params: { slug: 'hello' } }], samples: [{ params: { slug: 'hello' } }],
} }
export const unstable_prefetch = 'force-runtime' export const unstable_prefetch = 'force-runtime'
......
...@@ -2,7 +2,6 @@ import type { Instant } from 'next' ...@@ -2,7 +2,6 @@ import type { Instant } from 'next'
import { ParamsReader } from './params-reader' import { ParamsReader } from './params-reader'
export const unstable_instant: Instant = { export const unstable_instant: Instant = {
prefetch: 'static',
samples: [ samples: [
{ {
params: { params: {
......
...@@ -2,7 +2,6 @@ import type { Instant } from 'next' ...@@ -2,7 +2,6 @@ import type { Instant } from 'next'
import { PathnameReader } from './pathname-reader' import { PathnameReader } from './pathname-reader'
export const unstable_instant: Instant = { export const unstable_instant: Instant = {
prefetch: 'static',
samples: [ samples: [
{ {
params: { params: {
......
...@@ -3,7 +3,6 @@ import { Suspense } from 'react' ...@@ -3,7 +3,6 @@ import { Suspense } from 'react'
import { PathnameReader } from './pathname-reader' import { PathnameReader } from './pathname-reader'
export const unstable_instant: Instant = { export const unstable_instant: Instant = {
prefetch: 'static',
samples: [ samples: [
{ {
params: { params: {
......
import type { Instant } from 'next'
import { Suspense } from 'react' import { Suspense } from 'react'
import { PathnameReader } from './pathname-reader' import { PathnameReader } from './pathname-reader'
export const unstable_instant: Instant = { export const unstable_instant = true
prefetch: 'static',
samples: [{}],
}
export default function Page() { export default function Page() {
return ( return (
......
...@@ -3,7 +3,6 @@ import { Suspense } from 'react' ...@@ -3,7 +3,6 @@ import { Suspense } from 'react'
import { PathnameReader } from './pathname-reader' import { PathnameReader } from './pathname-reader'
export const unstable_instant: Instant = { export const unstable_instant: Instant = {
prefetch: 'static',
samples: [ samples: [
{ {
params: { params: {
......
import type { Instant } from 'next'
import { Suspense } from 'react' import { Suspense } from 'react'
import { PathnameReader } from './pathname-reader' import { PathnameReader } from './pathname-reader'
export const unstable_instant: Instant = { export const unstable_instant = true
prefetch: 'static',
samples: [{}],
}
export default function Page() { export default function Page() {
return ( return (
......
...@@ -3,7 +3,6 @@ import { Suspense } from 'react' ...@@ -3,7 +3,6 @@ import { Suspense } from 'react'
import { PathnameReader } from './pathname-reader' import { PathnameReader } from './pathname-reader'
export const unstable_instant: Instant = { export const unstable_instant: Instant = {
prefetch: 'static',
samples: [ samples: [
{ {
params: { params: {
......
import type { Instant } from 'next' import type { Instant } from 'next'
export const unstable_instant: Instant = { export const unstable_instant: Instant = {
prefetch: 'static',
samples: [ samples: [
{ {
params: { params: {
......
...@@ -3,7 +3,6 @@ import assert from 'node:assert/strict' ...@@ -3,7 +3,6 @@ import assert from 'node:assert/strict'
import { Suspense } from 'react' import { Suspense } from 'react'
export const unstable_instant: Instant = { export const unstable_instant: Instant = {
prefetch: 'static',
samples: [ samples: [
{ {
params: { params: {
......
import { ensureThrows } from '../../../../ensure-error' import { ensureThrows } from '../../../../ensure-error'
export const unstable_instant = { export const unstable_instant = { samples: [{ searchParams: { q: 'test' } }] }
prefetch: 'runtime',
samples: [{ searchParams: { q: 'test' } }],
}
export const unstable_prefetch = 'force-runtime' export const unstable_prefetch = 'force-runtime'
export default async function Page({ export default async function Page({
......
import { ensureThrows } from '../../../../ensure-error' import { ensureThrows } from '../../../../ensure-error'
export const unstable_instant = { export const unstable_instant = { samples: [{ searchParams: { q: 'test' } }] }
prefetch: 'runtime',
samples: [{ searchParams: { q: 'test' } }],
}
export const unstable_prefetch = 'force-runtime' export const unstable_prefetch = 'force-runtime'
export default async function Page({ export default async function Page({
......
...@@ -3,7 +3,6 @@ import { Suspense } from 'react' ...@@ -3,7 +3,6 @@ import { Suspense } from 'react'
import { SearchParamsReader } from './search-params-reader' import { SearchParamsReader } from './search-params-reader'
export const unstable_instant: Instant = { export const unstable_instant: Instant = {
prefetch: 'runtime',
samples: [ samples: [
{ {
searchParams: { searchParams: {
......
...@@ -2,7 +2,6 @@ import type { Instant } from 'next' ...@@ -2,7 +2,6 @@ import type { Instant } from 'next'
import { SearchParamsReader } from './search-params-reader' import { SearchParamsReader } from './search-params-reader'
export const unstable_instant: Instant = { export const unstable_instant: Instant = {
prefetch: 'runtime',
samples: [ samples: [
{ {
searchParams: { searchParams: {
......
...@@ -4,7 +4,6 @@ import assert from 'node:assert/strict' ...@@ -4,7 +4,6 @@ import assert from 'node:assert/strict'
import { Suspense } from 'react' import { Suspense } from 'react'
export const unstable_instant: Instant = { export const unstable_instant: Instant = {
prefetch: 'runtime',
samples: [ samples: [
{ {
searchParams: { searchParams: {
......
...@@ -2,7 +2,6 @@ import type { Instant } from 'next' ...@@ -2,7 +2,6 @@ import type { Instant } from 'next'
import assert from 'node:assert/strict' import assert from 'node:assert/strict'
export const unstable_instant: Instant = { export const unstable_instant: Instant = {
prefetch: 'runtime',
samples: [ samples: [
{ {
searchParams: { searchParams: {
......
...@@ -4,7 +4,6 @@ import assert from 'node:assert/strict' ...@@ -4,7 +4,6 @@ import assert from 'node:assert/strict'
import { ClientChild } from './client' import { ClientChild } from './client'
export const unstable_instant: Instant = { export const unstable_instant: Instant = {
prefetch: 'runtime',
samples: [ samples: [
{ {
searchParams: { searchParams: {
......
...@@ -3,7 +3,6 @@ import { Suspense } from 'react' ...@@ -3,7 +3,6 @@ import { Suspense } from 'react'
import { SearchParamsReader } from './search-params-reader' import { SearchParamsReader } from './search-params-reader'
export const unstable_instant: Instant = { export const unstable_instant: Instant = {
prefetch: 'runtime',
samples: [ samples: [
{ {
searchParams: { searchParams: {
......
import { cookies } from 'next/headers' import { cookies } from 'next/headers'
import { IgnoreServerContent } from './client' import { IgnoreServerContent } from './client'
export const unstable_instant = { export const unstable_instant = true
prefetch: 'runtime',
samples: [{ cookies: [] }],
}
export const unstable_prefetch = 'force-runtime' export const unstable_prefetch = 'force-runtime'
export default function Page() { export default function Page() {
......
import { cookies } from 'next/headers' import { cookies } from 'next/headers'
export const unstable_instant = { export const unstable_instant = true
prefetch: 'runtime',
samples: [{ cookies: [] }],
}
export const unstable_prefetch = 'force-runtime' export const unstable_prefetch = 'force-runtime'
export default function Page() { export default function Page() {
......
import { cookies } from 'next/headers' import { cookies } from 'next/headers'
export const unstable_instant = { export const unstable_instant = true
prefetch: 'runtime',
samples: [{ cookies: [] }],
}
export const unstable_prefetch = 'force-runtime' export const unstable_prefetch = 'force-runtime'
export default function Page() { export default function Page() {
......
import { cookies } from 'next/headers' import { cookies } from 'next/headers'
export const unstable_instant = { export const unstable_instant = true
prefetch: 'runtime',
samples: [{}],
}
export const unstable_prefetch = 'force-runtime' export const unstable_prefetch = 'force-runtime'
export default async function Page() { export default async function Page() {
......
export const unstable_instant = { export const unstable_instant = true
prefetch: 'runtime',
samples: [{}],
}
export const unstable_prefetch = 'force-runtime' export const unstable_prefetch = 'force-runtime'
export default async function Page() { export default async function Page() {
......
import { cookies } from 'next/headers' import { cookies } from 'next/headers'
export const unstable_instant = { export const unstable_instant = true
prefetch: 'runtime',
samples: [{}],
}
export const unstable_prefetch = 'force-runtime' export const unstable_prefetch = 'force-runtime'
export default async function Page() { export default async function Page() {
......
export const unstable_instant = { export const unstable_instant = true
prefetch: 'static',
}
export default async function Page() { export default async function Page() {
await cachedIO() await cachedIO()
......
...@@ -3,7 +3,6 @@ import { connection } from 'next/server' ...@@ -3,7 +3,6 @@ import { connection } from 'next/server'
import { Suspense } from 'react' import { Suspense } from 'react'
export const unstable_instant = { export const unstable_instant = {
prefetch: 'runtime',
samples: [{ cookies: [{ name: 'auth', value: '1' }] }], samples: [{ cookies: [{ name: 'auth', value: '1' }] }],
} }
export const unstable_prefetch = 'force-runtime' export const unstable_prefetch = 'force-runtime'
......
...@@ -4,7 +4,6 @@ import { lang } from 'next/root-params' ...@@ -4,7 +4,6 @@ import { lang } from 'next/root-params'
import { ensureRejects } from '../../../../ensure-error' import { ensureRejects } from '../../../../ensure-error'
export const unstable_instant: Instant = { export const unstable_instant: Instant = {
prefetch: 'runtime',
// no samples // no samples
samples: [{}], samples: [{}],
} }
......
...@@ -4,7 +4,6 @@ import { lang } from 'next/root-params' ...@@ -4,7 +4,6 @@ import { lang } from 'next/root-params'
import { ensureRejects } from '../../../../ensure-error' import { ensureRejects } from '../../../../ensure-error'
export const unstable_instant: Instant = { export const unstable_instant: Instant = {
prefetch: 'runtime',
// no samples // no samples
samples: [{}], samples: [{}],
} }
......
...@@ -4,7 +4,6 @@ import { lang } from 'next/root-params' ...@@ -4,7 +4,6 @@ import { lang } from 'next/root-params'
import assert from 'node:assert/strict' import assert from 'node:assert/strict'
export const unstable_instant: Instant = { export const unstable_instant: Instant = {
prefetch: 'runtime',
samples: [{ params: { lang: 'en-from-samples' } }], samples: [{ params: { lang: 'en-from-samples' } }],
} }
export const unstable_prefetch = 'force-runtime' export const unstable_prefetch = 'force-runtime'
......
...@@ -3,7 +3,6 @@ import { lang } from 'next/root-params' ...@@ -3,7 +3,6 @@ import { lang } from 'next/root-params'
import assert from 'node:assert/strict' import assert from 'node:assert/strict'
export const unstable_instant: Instant = { export const unstable_instant: Instant = {
prefetch: 'static',
samples: [{ params: { lang: 'en' } }], samples: [{ params: { lang: 'en' } }],
} }
......
import { cookies } from 'next/headers' import { cookies } from 'next/headers'
const instant = { prefetch: 'static' } const instant = true
export { instant as unstable_instant } export { instant as unstable_instant }
export default async function Page() { export default async function Page() {
......
import { cookies } from 'next/headers' import { cookies } from 'next/headers'
const _instant = { prefetch: 'static' } const _instant = true
const instant = _instant const instant = _instant
export { instant as unstable_instant } export { instant as unstable_instant }
......
import { cookies } from 'next/headers' import { cookies } from 'next/headers'
const unstable_instant = { prefetch: 'static' } const unstable_instant = true
export { unstable_instant } export { unstable_instant }
export default async function Page() { export default async function Page() {
......
export const unstable_instant = { prefetch: 'static' } export const unstable_instant = true
...@@ -97,7 +97,7 @@ describe('instant validation causes', () => { ...@@ -97,7 +97,7 @@ describe('instant validation causes', () => {
{ {
"label": "Caused by: Instant Validation", "label": "Caused by: Instant Validation",
"source": "app/named-export/page.tsx (3:26) @ unstable_instant "source": "app/named-export/page.tsx (3:26) @ unstable_instant
> 3 | const unstable_instant = { prefetch: 'static' } > 3 | const unstable_instant = true
| ^", | ^",
"stack": [ "stack": [
"unstable_instant app/named-export/page.tsx (3:26)", "unstable_instant app/named-export/page.tsx (3:26)",
...@@ -128,7 +128,7 @@ describe('instant validation causes', () => { ...@@ -128,7 +128,7 @@ describe('instant validation causes', () => {
{ {
"label": "Caused by: Instant Validation", "label": "Caused by: Instant Validation",
"source": "app/aliased-export/page.tsx (3:17) @ unstable_instant "source": "app/aliased-export/page.tsx (3:17) @ unstable_instant
> 3 | const instant = { prefetch: 'static' } > 3 | const instant = true
| ^", | ^",
"stack": [ "stack": [
"unstable_instant app/aliased-export/page.tsx (3:17)", "unstable_instant app/aliased-export/page.tsx (3:17)",
......
...@@ -4,6 +4,4 @@ export default function Page() { ...@@ -4,6 +4,4 @@ export default function Page() {
return <p>hello world</p> return <p>hello world</p>
} }
export const unstable_instant = { export const unstable_instant = true
prefetch: 'static',
}
export const unstable_instant = { prefetch: 'static' } export const unstable_instant = true
export default async function Layout({ children }) { export default async function Layout({ children }) {
return ( return (
......
import { connection } from 'next/server' import { connection } from 'next/server'
import { Suspense } from 'react' import { Suspense } from 'react'
export const unstable_instant = { prefetch: 'static' } export const unstable_instant = true
export default function Page() { export default function Page() {
return ( return (
......
import { Suspense } from 'react' import { Suspense } from 'react'
export const unstable_instant = { prefetch: 'static' } export const unstable_instant = true
export default function StaticLayout({ children }) { export default function StaticLayout({ children }) {
return ( return (
......
import { connection } from 'next/server' import { connection } from 'next/server'
export const unstable_instant = { export const unstable_instant = { unstable_disableBuildValidation: true }
prefetch: 'static',
unstable_disableBuildValidation: true,
}
export default async function Page() { export default async function Page() {
await connection() await connection()
......
import { connection } from 'next/server' import { connection } from 'next/server'
export const unstable_instant = { export const unstable_instant = { unstable_disableDevValidation: true }
prefetch: 'static',
unstable_disableDevValidation: true,
}
export default async function Page() { export default async function Page() {
await connection() await connection()
......
export const unstable_instant = { export const unstable_instant = {
prefetch: 'runtime',
samples: [{ cookies: [] }], samples: [{ cookies: [] }],
unstable_disableValidation: true, unstable_disableValidation: true,
} }
......
export const unstable_instant = { export const unstable_instant = true
prefetch: 'static',
}
export default function Layout({ children }) { export default function Layout({ children }) {
return <>{children}</> return <>{children}</>
......
import { connection } from 'next/server' import { connection } from 'next/server'
export const unstable_instant = { export const unstable_instant = {
prefetch: 'runtime',
samples: [{ cookies: [] }], samples: [{ cookies: [] }],
unstable_disableValidation: true, unstable_disableValidation: true,
} }
......
import { connection } from 'next/server' import { connection } from 'next/server'
export const unstable_instant = { export const unstable_instant = {
prefetch: 'runtime',
samples: [{ cookies: [] }], samples: [{ cookies: [] }],
unstable_disableValidation: true, unstable_disableValidation: true,
} }
......
import { ReactNode, Suspense } from 'react' import { ReactNode, Suspense } from 'react'
export const unstable_instant = { prefetch: 'static' } export const unstable_instant = true
export default function Layout({ children }: { children: ReactNode }) { export default function Layout({ children }: { children: ReactNode }) {
return ( return (
......
...@@ -3,10 +3,7 @@ import { cookies } from 'next/headers' ...@@ -3,10 +3,7 @@ import { cookies } from 'next/headers'
import { connection } from 'next/server' import { connection } from 'next/server'
import { Suspense } from 'react' import { Suspense } from 'react'
export const unstable_instant = { export const unstable_instant = true
prefetch: 'runtime',
samples: [{ cookies: [] }],
}
export const unstable_prefetch = 'force-runtime' export const unstable_prefetch = 'force-runtime'
// Note that we're inside a root layout with suspense, so we skip the static shell // Note that we're inside a root layout with suspense, so we skip the static shell
......
export const unstable_instant = { export const unstable_instant = true
prefetch: 'runtime',
samples: [{ cookies: [] }],
}
export const unstable_prefetch = 'force-runtime' export const unstable_prefetch = 'force-runtime'
export default async function Layout({ children }) { export default async function Layout({ children }) {
......
...@@ -5,10 +5,7 @@ import { cookies } from 'next/headers' ...@@ -5,10 +5,7 @@ import { cookies } from 'next/headers'
// This would be valid if it used a runtime prefetch (because then it wouldn't block navigation), // This would be valid if it used a runtime prefetch (because then it wouldn't block navigation),
// but it's static, so it's invalid. As an extra sanity check, we put a runtime prefetch on the // but it's static, so it's invalid. As an extra sanity check, we put a runtime prefetch on the
// layout above, and that should not make this error go away. // layout above, and that should not make this error go away.
export const unstable_instant = { export const unstable_instant = true
prefetch: 'static',
samples: [{ cookies: [] }],
}
export async function generateViewport(): Promise<Viewport> { export async function generateViewport(): Promise<Viewport> {
await cookies() await cookies()
......
...@@ -3,10 +3,7 @@ import { cookies } from 'next/headers' ...@@ -3,10 +3,7 @@ import { cookies } from 'next/headers'
import { connection } from 'next/server' import { connection } from 'next/server'
import { Suspense } from 'react' import { Suspense } from 'react'
export const unstable_instant = { export const unstable_instant = true
prefetch: 'runtime',
samples: [{ cookies: [] }],
}
export const unstable_prefetch = 'force-runtime' export const unstable_prefetch = 'force-runtime'
export async function generateMetadata(): Promise<Metadata> { export async function generateMetadata(): Promise<Metadata> {
......
...@@ -2,10 +2,7 @@ import { Metadata } from 'next' ...@@ -2,10 +2,7 @@ import { Metadata } from 'next'
import { cookies } from 'next/headers' import { cookies } from 'next/headers'
import { Suspense } from 'react' import { Suspense } from 'react'
export const unstable_instant = { export const unstable_instant = true
prefetch: 'static',
samples: [{ cookies: [] }],
}
export async function generateMetadata(): Promise<Metadata> { export async function generateMetadata(): Promise<Metadata> {
await cookies() await cookies()
......
import type { Viewport } from 'next' import type { Viewport } from 'next'
import { cookies } from 'next/headers' import { cookies } from 'next/headers'
export const unstable_instant = { export const unstable_instant = true
prefetch: 'runtime',
samples: [{ cookies: [] }],
}
export const unstable_prefetch = 'force-runtime' export const unstable_prefetch = 'force-runtime'
export async function generateViewport(): Promise<Viewport> { export async function generateViewport(): Promise<Viewport> {
......
export const unstable_instant = { prefetch: 'static' } export const unstable_instant = true
export default function SlotPage() { export default function SlotPage() {
return ( return (
......
export const unstable_instant = { prefetch: 'static' } export const unstable_instant = true
export default function Page() { export default function Page() {
return ( return (
......
export const unstable_instant = { prefetch: 'static' } export const unstable_instant = true
export default function Page() { export default function Page() {
return ( return (
......
export const unstable_instant = { prefetch: 'static' } export const unstable_instant = true
export default function Page() { export default function Page() {
return <p>show-both/blocked — children page with instant config</p> return <p>show-both/blocked — children page with instant config</p>
} }
export const unstable_instant = { prefetch: 'static' } export const unstable_instant = true
export default function Page() { export default function Page() {
return <p>show-both/unblocked — children page with instant config</p> return <p>show-both/unblocked — children page with instant config</p>
} }
export const unstable_instant = { prefetch: 'static' } export const unstable_instant = true
export default function Page() { export default function Page() {
return ( return (
<p>show-only-breadcrumbs/blocked — children page with instant config</p> <p>show-only-breadcrumbs/blocked — children page with instant config</p>
......
export const unstable_instant = { prefetch: 'static' } export const unstable_instant = true
export default function Page() { export default function Page() {
return ( return (
<p>show-only-breadcrumbs/unblocked — children page with instant config</p> <p>show-only-breadcrumbs/unblocked — children page with instant config</p>
......
export const unstable_instant = { prefetch: 'static' } export const unstable_instant = true
export default function Page() { export default function Page() {
return <p>show-only-children/blocked — children page with instant config</p> return <p>show-only-children/blocked — children page with instant config</p>
} }
export const unstable_instant = { prefetch: 'static' } export const unstable_instant = true
export default function Page() { export default function Page() {
return <p>show-only-children/unblocked — children page with instant config</p> return <p>show-only-children/unblocked — children page with instant config</p>
} }
import { ReactNode } from 'react' import { ReactNode } from 'react'
export const unstable_instant = { prefetch: 'static' } export const unstable_instant = true
export default function Layout({ export default function Layout({
children, children,
......
export const unstable_instant = { prefetch: 'static' } export const unstable_instant = true
export default function SlotPage() { export default function SlotPage() {
return ( return (
......
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