Unverified Commit 13b59c9e authored by Janka Uryga's avatar Janka Uryga Committed by GitHub

Stabilize `ensureStatic` (#99513)

Closes NAR-933

Drop the `unstable_` prefix from `ensureStatic`, because we're
reasonably confident that the API shape won't change.
parent 07d0c905
...@@ -102,7 +102,7 @@ pub struct NextSegmentConfig { ...@@ -102,7 +102,7 @@ pub struct NextSegmentConfig {
pub prefetch: Option<Span>, pub prefetch: Option<Span>,
#[turbo_tasks(unsafe_ignore)] #[turbo_tasks(unsafe_ignore)]
#[bincode(with_serde)] #[bincode(with_serde)]
pub unstable_ensure_static: Option<Span>, pub ensure_static: Option<Span>,
} }
#[turbo_tasks::value_impl] #[turbo_tasks::value_impl]
...@@ -530,7 +530,7 @@ pub async fn parse_segment_config_from_source( ...@@ -530,7 +530,7 @@ pub async fn parse_segment_config_from_source(
let server_only_route_configs = [ let server_only_route_configs = [
("instant", config.instant), ("instant", config.instant),
("prefetch", config.prefetch), ("prefetch", config.prefetch),
("unstable_ensureStatic", config.unstable_ensure_static), ("ensureStatic", config.ensure_static),
]; ];
for (config_name, usage) in server_only_route_configs { for (config_name, usage) in server_only_route_configs {
if let Some(span) = usage { if let Some(span) = usage {
...@@ -978,8 +978,8 @@ async fn parse_config_value( ...@@ -978,8 +978,8 @@ async fn parse_config_value(
"prefetch" => { "prefetch" => {
config.prefetch = Some(span); config.prefetch = Some(span);
} }
"unstable_ensureStatic" => { "ensureStatic" => {
config.unstable_ensure_static = Some(span); config.ensure_static = Some(span);
} }
_ => {} _ => {}
} }
......
...@@ -692,11 +692,7 @@ export async function getAppPageStaticInfo({ ...@@ -692,11 +692,7 @@ export async function getAppPageStaticInfo({
) )
} }
for (const exportName of [ for (const exportName of ['instant', 'prefetch', 'ensureStatic'] as const) {
'instant',
'prefetch',
'unstable_ensureStatic',
] as const) {
if (exportName in config) { if (exportName in config) {
if (directives?.has('client')) { if (directives?.has('client')) {
throw new Error( throw new Error(
......
...@@ -2665,7 +2665,7 @@ export default async function build( ...@@ -2665,7 +2665,7 @@ export default async function build(
workerResult.appConfig workerResult.appConfig
) { ) {
isEnsureStaticPage = isEnsureStaticPage =
workerResult.appConfig.unstable_ensureStatic === workerResult.appConfig.ensureStatic ===
'navigation' 'navigation'
} }
} }
......
...@@ -147,7 +147,7 @@ const AppSegmentConfigSchema = z.object({ ...@@ -147,7 +147,7 @@ const AppSegmentConfigSchema = z.object({
/** /**
* Controls which rendering phases require static output for this segment. * Controls which rendering phases require static output for this segment.
*/ */
unstable_ensureStatic: EnsureStaticSchema.optional(), ensureStatic: EnsureStaticSchema.optional(),
/** /**
* The stale time for dynamic responses in seconds. * The stale time for dynamic responses in seconds.
...@@ -204,9 +204,9 @@ export function parseAppSegmentConfig( ...@@ -204,9 +204,9 @@ export function parseAppSegmentConfig(
message: `Invalid prefetch value ${JSON.stringify(ctx.data)} on "${route}", must be "auto", "partial", or "force-disabled".`, message: `Invalid prefetch value ${JSON.stringify(ctx.data)} on "${route}", must be "auto", "partial", or "force-disabled".`,
} }
} }
case 'unstable_ensureStatic': { case 'ensureStatic': {
return { return {
message: `Invalid unstable_ensureStatic value ${JSON.stringify(ctx.data)} on "${route}", must be "auto", "shell", "prefetch", "navigation", or false.`, message: `Invalid ensureStatic value ${JSON.stringify(ctx.data)} on "${route}", must be "auto", "shell", "prefetch", "navigation", or false.`,
} }
} }
case 'unstable_dynamicStaleTime': { case 'unstable_dynamicStaleTime': {
...@@ -281,7 +281,7 @@ export type AppSegmentConfig = { ...@@ -281,7 +281,7 @@ export type AppSegmentConfig = {
/** /**
* Controls which rendering phases require static output for this segment. * Controls which rendering phases require static output for this segment.
*/ */
unstable_ensureStatic?: EnsureStatic ensureStatic?: EnsureStatic
/** /**
* The stale time for dynamic responses in seconds. * The stale time for dynamic responses in seconds.
......
...@@ -132,7 +132,7 @@ async function collectAppPageSegments( ...@@ -132,7 +132,7 @@ async function collectAppPageSegments(
if (segment.config) { if (segment.config) {
segment.config.prefetch = prefetchConfig segment.config.prefetch = prefetchConfig
segment.config.unstable_ensureStatic = ensureStatic segment.config.ensureStatic = ensureStatic
} }
} }
......
...@@ -878,7 +878,7 @@ export async function isPageStatic({ ...@@ -878,7 +878,7 @@ export async function isPageStatic({
const isEnsureStaticPage = const isEnsureStaticPage =
cacheComponents && cacheComponents &&
isRoutePPREnabled && isRoutePPREnabled &&
appConfig.unstable_ensureStatic === 'navigation' appConfig.ensureStatic === 'navigation'
// If force dynamic was set and we don't have PPR enabled, then set the // If force dynamic was set and we don't have PPR enabled, then set the
// revalidate to 0. // revalidate to 0.
...@@ -1031,7 +1031,7 @@ type ReducedAppConfig = Pick< ...@@ -1031,7 +1031,7 @@ type ReducedAppConfig = Pick<
| 'runtime' | 'runtime'
| 'maxDuration' | 'maxDuration'
| 'prefetch' | 'prefetch'
| 'unstable_ensureStatic' | 'ensureStatic'
> >
/** /**
...@@ -1055,7 +1055,7 @@ export function reduceAppConfig( ...@@ -1055,7 +1055,7 @@ export function reduceAppConfig(
runtime, runtime,
maxDuration, maxDuration,
prefetch, prefetch,
unstable_ensureStatic, ensureStatic,
} = segment.config || {} } = segment.config || {}
// TODO: should conflicting configs here throw an error // TODO: should conflicting configs here throw an error
...@@ -1099,8 +1099,8 @@ export function reduceAppConfig( ...@@ -1099,8 +1099,8 @@ export function reduceAppConfig(
if (typeof prefetch !== 'undefined') { if (typeof prefetch !== 'undefined') {
config.prefetch = prefetch config.prefetch = prefetch
} }
if (typeof unstable_ensureStatic !== 'undefined') { if (typeof ensureStatic !== 'undefined') {
config.unstable_ensureStatic = unstable_ensureStatic config.ensureStatic = ensureStatic
} }
} }
......
...@@ -73,7 +73,7 @@ checkFields<Diff<{ ...@@ -73,7 +73,7 @@ checkFields<Diff<{
generateStaticParams?: Function generateStaticParams?: Function
instant?: InstantConfigForTypeCheckInternal instant?: InstantConfigForTypeCheckInternal
prefetch?: Prefetch prefetch?: Prefetch
unstable_ensureStatic?: EnsureStatic ensureStatic?: EnsureStatic
unstable_dynamicStaleTime?: number unstable_dynamicStaleTime?: number
revalidate?: RevalidateRange<TEntry> | false revalidate?: RevalidateRange<TEntry> | false
dynamic?: 'auto' | 'force-dynamic' | 'error' | 'force-static' dynamic?: 'auto' | 'force-dynamic' | 'error' | 'force-static'
......
...@@ -156,7 +156,7 @@ async function resolveEnsureStaticConfigImpl( ...@@ -156,7 +156,7 @@ async function resolveEnsureStaticConfigImpl(
case Comparison.LessConstrained: case Comparison.LessConstrained:
case Comparison.MoreConstrained: { case Comparison.MoreConstrained: {
throw new Error( throw new Error(
`Parallel slots cannot have incompatible \`unstable_ensureStatic\`.` + `Parallel slots cannot have incompatible \`ensureStatic\`.` +
`\n ${formatParallelSlot(slotResultKey!)}: ` + `\n ${formatParallelSlot(slotResultKey!)}: ` +
`\n ${formatEnsureStaticExport(slotsResult.config)}` + `\n ${formatEnsureStaticExport(slotsResult.config)}` +
`\n (from: ${slotsResult.filePath})` + `\n (from: ${slotsResult.filePath})` +
...@@ -166,8 +166,8 @@ async function resolveEnsureStaticConfigImpl( ...@@ -166,8 +166,8 @@ async function resolveEnsureStaticConfigImpl(
`\n (from: ${childResult.filePath})` + `\n (from: ${childResult.filePath})` +
`\n` + `\n` +
`\n Possible fixes:` + `\n Possible fixes:` +
`\n - Remove one of the \`unstable_ensureStatic\` exports` + `\n - Remove one of the \`ensureStatic\` exports` +
`\n - Change one of the \`unstable_ensureStatic\` exports to match the other` `\n - Change one of the \`ensureStatic\` exports to match the other`
) )
} }
} }
...@@ -200,8 +200,8 @@ async function resolveEnsureStaticConfigImpl( ...@@ -200,8 +200,8 @@ async function resolveEnsureStaticConfigImpl(
case Comparison.Incompatible: { case Comparison.Incompatible: {
throw new Error( throw new Error(
(comparison === Comparison.LessConstrained (comparison === Comparison.LessConstrained
? `A child segment cannot override a parent segment with a less-constrained \`unstable_ensureStatic\`.` ? `A child segment cannot override a parent segment with a less-constrained \`ensureStatic\`.`
: `A child segment cannot override a parent segment with an incompatible \`unstable_ensureStatic\`.`) + : `A child segment cannot override a parent segment with an incompatible \`ensureStatic\`.`) +
`\n Parent has: ` + `\n Parent has: ` +
`\n ${formatEnsureStaticExport(parentResult.config)}` + `\n ${formatEnsureStaticExport(parentResult.config)}` +
`\n (from: ${parentResult.filePath})` + `\n (from: ${parentResult.filePath})` +
...@@ -210,8 +210,8 @@ async function resolveEnsureStaticConfigImpl( ...@@ -210,8 +210,8 @@ async function resolveEnsureStaticConfigImpl(
`\n (from: ${slotsResult.filePath})` + `\n (from: ${slotsResult.filePath})` +
`\n` + `\n` +
`\n Possible fixes:` + `\n Possible fixes:` +
`\n - Remove one of the \`unstable_ensureStatic\` exports` + `\n - Remove one of the \`ensureStatic\` exports` +
`\n - Change one of the \`unstable_ensureStatic\` exports to match the other` `\n - Change one of the \`ensureStatic\` exports to match the other`
) )
} }
} }
...@@ -223,7 +223,7 @@ function formatParallelSlot(slot: string) { ...@@ -223,7 +223,7 @@ function formatParallelSlot(slot: string) {
} }
function formatEnsureStaticExport(config: EnsureStatic) { function formatEnsureStaticExport(config: EnsureStatic) {
return `export const unstable_ensureStatic = ${JSON.stringify(config)}` return `export const ensureStatic = ${JSON.stringify(config)}`
} }
enum Comparison { enum Comparison {
...@@ -269,8 +269,5 @@ function compareEnsureStatic( ...@@ -269,8 +269,5 @@ function compareEnsureStatic(
function getEnsureStaticConfigForModule( function getEnsureStaticConfigForModule(
mod: Record<string, any> | undefined mod: Record<string, any> | undefined
): EnsureStatic { ): EnsureStatic {
return ( return (mod ? (mod as AppSegmentConfig).ensureStatic : undefined) ?? 'auto'
(mod ? (mod as AppSegmentConfig).unstable_ensureStatic : undefined) ??
'auto'
)
} }
...@@ -137,9 +137,7 @@ export async function loadStaticPaths({ ...@@ -137,9 +137,7 @@ export async function loadStaticPaths({
const isEnsureStaticPage = const isEnsureStaticPage =
config.cacheComponents && config.cacheComponents &&
isRoutePPREnabled && isRoutePPREnabled &&
segments.some( segments.some((segment) => segment.config?.ensureStatic === 'navigation')
(segment) => segment.config?.unstable_ensureStatic === 'navigation'
)
const rootParamKeys = collectRootParamKeys(routeModule) const rootParamKeys = collectRootParamKeys(routeModule)
......
...@@ -171,7 +171,7 @@ const API_DOCS: Record< ...@@ -171,7 +171,7 @@ const API_DOCS: Record<
}, },
insertText: `prefetch = 'partial';`, insertText: `prefetch = 'partial';`,
}, },
unstable_ensureStatic: { ensureStatic: {
description: `Controls which rendering phases require static output for this segment. This option is experimental and may change.`, description: `Controls which rendering phases require static output for this segment. This option is experimental and may change.`,
link: '(docs coming soon)', link: '(docs coming soon)',
type: `"auto" | "shell" | "prefetch" | "navigation" | false`, type: `"auto" | "shell" | "prefetch" | "navigation" | false`,
...@@ -184,10 +184,8 @@ const API_DOCS: Record< ...@@ -184,10 +184,8 @@ const API_DOCS: Record<
'"navigation"': 'Require the route to be fully static.', '"navigation"': 'Require the route to be fully static.',
false: false:
'Indicate that this segment must use the default behavior and should not have `ensureStatic = "shell" | "prefetch" | "navigation"` applied to it by another segment. Errors if another segment on the route uses `ensureStatic` with those values.', 'Indicate that this segment must use the default behavior and should not have `ensureStatic = "shell" | "prefetch" | "navigation"` applied to it by another segment. Errors if another segment on the route uses `ensureStatic` with those values.',
} satisfies DocsOptionsObject< } satisfies DocsOptionsObject<FullAppSegmentConfig['ensureStatic']>,
FullAppSegmentConfig['unstable_ensureStatic'] insertText: `ensureStatic = 'shell';`,
>,
insertText: `unstable_ensureStatic = 'shell';`,
isValid: (value) => { isValid: (value) => {
try { try {
const parsed: unknown = JSON.parse(value) const parsed: unknown = JSON.parse(value)
......
...@@ -10,7 +10,7 @@ export const prefetch = process.env.__NEXT_PARTIAL_PREFETCHING ...@@ -10,7 +10,7 @@ export const prefetch = process.env.__NEXT_PARTIAL_PREFETCHING
? 'auto' ? 'auto'
: 'partial' : 'partial'
export const unstable_ensureStatic = 'shell' export const ensureStatic = 'shell'
async function SessionData() { async function SessionData() {
await cookies() await cookies()
......
export const unstable_ensureStatic = 'auto' export const ensureStatic = 'auto'
export default function Page() { export default function Page() {
return <main>Page</main> return <main>Page</main>
......
export const unstable_ensureStatic = false export const ensureStatic = false
export default function Page() { export default function Page() {
return <main>Page</main> return <main>Page</main>
......
export const unstable_ensureStatic = 'navigation' export const ensureStatic = 'navigation'
export default function Page() { export default function Page() {
return <main>Page</main> return <main>Page</main>
......
export const unstable_ensureStatic = 'prefetch' export const ensureStatic = 'prefetch'
export default function Page() { export default function Page() {
return <main>Page</main> return <main>Page</main>
......
export const unstable_ensureStatic = 'shell' export const ensureStatic = 'shell'
export default function Page() { export default function Page() {
return <main>Page</main> return <main>Page</main>
......
// Deliberately no export // Deliberately no export
// export const unstable_ensureStatic = ... // export const ensureStatic = ...
export default function Page() { export default function Page() {
return <main>Page</main> return <main>Page</main>
......
import { ReactNode } from 'react' import { ReactNode } from 'react'
export const unstable_ensureStatic = 'auto' export const ensureStatic = 'auto'
export default function Layout({ children }: { children: ReactNode }) { export default function Layout({ children }: { children: ReactNode }) {
return children return children
......
export const unstable_ensureStatic = 'auto' export const ensureStatic = 'auto'
export default function Page() { export default function Page() {
return <main>Page</main> return <main>Page</main>
......
export const unstable_ensureStatic = false export const ensureStatic = false
export default function Page() { export default function Page() {
return <main>Page</main> return <main>Page</main>
......
export const unstable_ensureStatic = 'navigation' export const ensureStatic = 'navigation'
export default function Page() { export default function Page() {
return <main>Page</main> return <main>Page</main>
......
export const unstable_ensureStatic = 'prefetch' export const ensureStatic = 'prefetch'
export default function Page() { export default function Page() {
return <main>Page</main> return <main>Page</main>
......
export const unstable_ensureStatic = 'shell' export const ensureStatic = 'shell'
export default function Page() { export default function Page() {
return <main>Page</main> return <main>Page</main>
......
// Deliberately no export // Deliberately no export
// export const unstable_ensureStatic = ... // export const ensureStatic = ...
export default function Page() { export default function Page() {
return <main>Page</main> return <main>Page</main>
......
import { ReactNode } from 'react' import { ReactNode } from 'react'
export const unstable_ensureStatic = false export const ensureStatic = false
export default function Layout({ children }: { children: ReactNode }) { export default function Layout({ children }: { children: ReactNode }) {
return children return children
......
export const unstable_ensureStatic = 'auto' export const ensureStatic = 'auto'
export default function Page() { export default function Page() {
return <main>Page</main> return <main>Page</main>
......
export const unstable_ensureStatic = false export const ensureStatic = false
export default function Page() { export default function Page() {
return <main>Page</main> return <main>Page</main>
......
export const unstable_ensureStatic = 'navigation' export const ensureStatic = 'navigation'
export default function Page() { export default function Page() {
return <main>Page</main> return <main>Page</main>
......
export const unstable_ensureStatic = 'prefetch' export const ensureStatic = 'prefetch'
export default function Page() { export default function Page() {
return <main>Page</main> return <main>Page</main>
......
export const unstable_ensureStatic = 'shell' export const ensureStatic = 'shell'
export default function Page() { export default function Page() {
return <main>Page</main> return <main>Page</main>
......
// Deliberately no export // Deliberately no export
// export const unstable_ensureStatic = ... // export const ensureStatic = ...
export default function Page() { export default function Page() {
return <main>Page</main> return <main>Page</main>
......
import { ReactNode } from 'react' import { ReactNode } from 'react'
export const unstable_ensureStatic = 'navigation' export const ensureStatic = 'navigation'
export default function Layout({ children }: { children: ReactNode }) { export default function Layout({ children }: { children: ReactNode }) {
return children return children
......
export const unstable_ensureStatic = 'auto' export const ensureStatic = 'auto'
export default function Page() { export default function Page() {
return <main>Page</main> return <main>Page</main>
......
export const unstable_ensureStatic = false export const ensureStatic = false
export default function Page() { export default function Page() {
return <main>Page</main> return <main>Page</main>
......
export const unstable_ensureStatic = 'navigation' export const ensureStatic = 'navigation'
export default function Page() { export default function Page() {
return <main>Page</main> return <main>Page</main>
......
export const unstable_ensureStatic = 'prefetch' export const ensureStatic = 'prefetch'
export default function Page() { export default function Page() {
return <main>Page</main> return <main>Page</main>
......
export const unstable_ensureStatic = 'shell' export const ensureStatic = 'shell'
export default function Page() { export default function Page() {
return <main>Page</main> return <main>Page</main>
......
// Deliberately no export // Deliberately no export
// export const unstable_ensureStatic = ... // export const ensureStatic = ...
export default function Page() { export default function Page() {
return <main>Page</main> return <main>Page</main>
......
import { ReactNode } from 'react' import { ReactNode } from 'react'
export const unstable_ensureStatic = 'prefetch' export const ensureStatic = 'prefetch'
export default function Layout({ children }: { children: ReactNode }) { export default function Layout({ children }: { children: ReactNode }) {
return children return children
......
export const unstable_ensureStatic = 'auto' export const ensureStatic = 'auto'
export default function Page() { export default function Page() {
return <main>Page</main> return <main>Page</main>
......
export const unstable_ensureStatic = false export const ensureStatic = false
export default function Page() { export default function Page() {
return <main>Page</main> return <main>Page</main>
......
export const unstable_ensureStatic = 'navigation' export const ensureStatic = 'navigation'
export default function Page() { export default function Page() {
return <main>Page</main> return <main>Page</main>
......
export const unstable_ensureStatic = 'prefetch' export const ensureStatic = 'prefetch'
export default function Page() { export default function Page() {
return <main>Page</main> return <main>Page</main>
......
export const unstable_ensureStatic = 'shell' export const ensureStatic = 'shell'
export default function Page() { export default function Page() {
return <main>Page</main> return <main>Page</main>
......
// Deliberately no export // Deliberately no export
// export const unstable_ensureStatic = ... // export const ensureStatic = ...
export default function Page() { export default function Page() {
return <main>Page</main> return <main>Page</main>
......
import { ReactNode } from 'react' import { ReactNode } from 'react'
export const unstable_ensureStatic = 'shell' export const ensureStatic = 'shell'
export default function Layout({ children }: { children: ReactNode }) { export default function Layout({ children }: { children: ReactNode }) {
return children return children
......
export const unstable_ensureStatic = 'auto' export const ensureStatic = 'auto'
export default function Page() { export default function Page() {
return <main>Page</main> return <main>Page</main>
......
export const unstable_ensureStatic = false export const ensureStatic = false
export default function Page() { export default function Page() {
return <main>Page</main> return <main>Page</main>
......
export const unstable_ensureStatic = 'navigation' export const ensureStatic = 'navigation'
export default function Page() { export default function Page() {
return <main>Page</main> return <main>Page</main>
......
export const unstable_ensureStatic = 'prefetch' export const ensureStatic = 'prefetch'
export default function Page() { export default function Page() {
return <main>Page</main> return <main>Page</main>
......
export const unstable_ensureStatic = 'shell' export const ensureStatic = 'shell'
export default function Page() { export default function Page() {
return <main>Page</main> return <main>Page</main>
......
// Deliberately no export // Deliberately no export
// export const unstable_ensureStatic = ... // export const ensureStatic = ...
export default function Page() { export default function Page() {
return <main>Page</main> return <main>Page</main>
......
import { ReactNode } from 'react' import { ReactNode } from 'react'
// Deliberately no export // Deliberately no export
// export const unstable_ensureStatic = ... // export const ensureStatic = ...
export default function Layout({ children }: { children: ReactNode }) { export default function Layout({ children }: { children: ReactNode }) {
return children return children
......
export const unstable_ensureStatic = 'auto' export const ensureStatic = 'auto'
export default function Page() { export default function Page() {
return <main>Page</main> return <main>Page</main>
......
export const unstable_ensureStatic = 'prefetch' export const ensureStatic = 'prefetch'
export default function Page() { export default function Page() {
return <main>Page</main> return <main>Page</main>
......
export const unstable_ensureStatic = false export const ensureStatic = false
export default function Page() { export default function Page() {
return <main>Page</main> return <main>Page</main>
......
export const unstable_ensureStatic = false export const ensureStatic = false
export default function Page() { export default function Page() {
return <main>Page</main> return <main>Page</main>
......
export const unstable_ensureStatic = 'prefetch' export const ensureStatic = 'prefetch'
export default function Page() { export default function Page() {
return <main>Page</main> return <main>Page</main>
......
export const unstable_ensureStatic = false export const ensureStatic = false
export default function Page() { export default function Page() {
return <main>Page</main> return <main>Page</main>
......
export const unstable_ensureStatic = 'prefetch' export const ensureStatic = 'prefetch'
export default function Page() { export default function Page() {
return <main>Page</main> return <main>Page</main>
......
export const unstable_ensureStatic = 'prefetch' export const ensureStatic = 'prefetch'
export default function Page() { export default function Page() {
return <main>Page</main> return <main>Page</main>
......
export const unstable_ensureStatic = 'prefetch' export const ensureStatic = 'prefetch'
export default function Page() { export default function Page() {
return <main>Page</main> return <main>Page</main>
......
export const unstable_ensureStatic = 'shell' export const ensureStatic = 'shell'
export default function Page() { export default function Page() {
return <main>Page</main> return <main>Page</main>
......
export const unstable_ensureStatic = 'shell' export const ensureStatic = 'shell'
export default function Page() { export default function Page() {
return <main>Page</main> return <main>Page</main>
......
export const unstable_ensureStatic = 'prefetch' export const ensureStatic = 'prefetch'
export default function Page() { export default function Page() {
return <main>Page</main> return <main>Page</main>
......
// Deliberately no export // Deliberately no export
// export const unstable_ensureStatic = ... // export const ensureStatic = ...
export default function Page() { export default function Page() {
return <main>Page</main> return <main>Page</main>
......
export const unstable_ensureStatic = 'prefetch' export const ensureStatic = 'prefetch'
export default function Page() { export default function Page() {
return <main>Page</main> return <main>Page</main>
......
...@@ -14,7 +14,7 @@ import { ...@@ -14,7 +14,7 @@ import {
// Cannot prerender individual pages in deploy mode // Cannot prerender individual pages in deploy mode
// @force-gate !deploy // @force-gate !deploy
describe('unstable_ensureStatic config validation', () => { describe('ensureStatic config validation', () => {
const { next } = nextTestSetup({ const { next } = nextTestSetup({
files: __dirname, files: __dirname,
skipStart: !isNextDev, skipStart: !isNextDev,
...@@ -53,7 +53,7 @@ describe('unstable_ensureStatic config validation', () => { ...@@ -53,7 +53,7 @@ describe('unstable_ensureStatic config validation', () => {
// just to determine whether a redbox is shown makes it take a long time. // just to determine whether a redbox is shown makes it take a long time.
const REDBOX_WAIT_OPTS = { waitInMs: 1000 } const REDBOX_WAIT_OPTS = { waitInMs: 1000 }
describe('nesting unstable_ensureStatic', () => { describe('nesting ensureStatic', () => {
const ALWAYS_ALLOWED_NESTINGS = [ const ALWAYS_ALLOWED_NESTINGS = [
[undefined, true], [undefined, true],
['auto', true], ['auto', true],
...@@ -141,8 +141,8 @@ describe('unstable_ensureStatic config validation', () => { ...@@ -141,8 +141,8 @@ describe('unstable_ensureStatic config validation', () => {
const INVALID_CONFIG_MESSAGE = // `false` has a dedicated error message. const INVALID_CONFIG_MESSAGE = // `false` has a dedicated error message.
parent === false || child === false parent === false || child === false
? `A child segment cannot override a parent segment with an incompatible \`unstable_ensureStatic\`.` ? `A child segment cannot override a parent segment with an incompatible \`ensureStatic\`.`
: `A child segment cannot override a parent segment with a less-constrained \`unstable_ensureStatic\`.` : `A child segment cannot override a parent segment with a less-constrained \`ensureStatic\`.`
if (isNextDev) { if (isNextDev) {
const browser = await next.browser(route) const browser = await next.browser(route)
...@@ -176,7 +176,7 @@ describe('unstable_ensureStatic config validation', () => { ...@@ -176,7 +176,7 @@ describe('unstable_ensureStatic config validation', () => {
}) })
}) })
describe('unstable_ensureStatic in sibling slots', () => { describe('ensureStatic in sibling slots', () => {
it.each<{ it.each<{
left: EnsureStatic | undefined left: EnsureStatic | undefined
right: EnsureStatic | undefined right: EnsureStatic | undefined
...@@ -196,7 +196,7 @@ describe('unstable_ensureStatic config validation', () => { ...@@ -196,7 +196,7 @@ describe('unstable_ensureStatic config validation', () => {
async ({ left, right, isValid }) => { async ({ left, right, isValid }) => {
const route = `/sibling-slots/left-${left}-right-${right}` const route = `/sibling-slots/left-${left}-right-${right}`
const INVALID_CONFIG_MESSAGE = `Parallel slots cannot have incompatible \`unstable_ensureStatic\`.` const INVALID_CONFIG_MESSAGE = `Parallel slots cannot have incompatible \`ensureStatic\`.`
if (isNextDev) { if (isNextDev) {
const browser = await next.browser(route) const browser = await next.browser(route)
......
...@@ -2,7 +2,7 @@ import { Suspense } from 'react' ...@@ -2,7 +2,7 @@ import { Suspense } from 'react'
import { Timestamp } from '../../../components/timestamp' import { Timestamp } from '../../../components/timestamp'
import { BrowserOnly } from './client' import { BrowserOnly } from './client'
export const unstable_ensureStatic = 'navigation' export const ensureStatic = 'navigation'
export default function Page() { export default function Page() {
return ( return (
......
...@@ -2,7 +2,7 @@ import { Suspense } from 'react' ...@@ -2,7 +2,7 @@ import { Suspense } from 'react'
import { Timestamp } from '../../../components/timestamp' import { Timestamp } from '../../../components/timestamp'
import { ClientIO } from './client' import { ClientIO } from './client'
export const unstable_ensureStatic = 'navigation' export const ensureStatic = 'navigation'
export default function Page() { export default function Page() {
return ( return (
......
import { Timestamp } from '../../../components/timestamp' import { Timestamp } from '../../../components/timestamp'
export const unstable_ensureStatic = 'navigation' export const ensureStatic = 'navigation'
export default function Page() { export default function Page() {
return ( return (
......
...@@ -5,7 +5,7 @@ export async function generateStaticParams() { ...@@ -5,7 +5,7 @@ export async function generateStaticParams() {
return [{ slug: 'prerendered-1' }, { slug: 'prerendered-2' }] return [{ slug: 'prerendered-1' }, { slug: 'prerendered-2' }]
} }
export const unstable_ensureStatic = 'navigation' export const ensureStatic = 'navigation'
type Params = { slug: string } type Params = { slug: string }
......
import { lang } from 'next/root-params' import { lang } from 'next/root-params'
export const unstable_ensureStatic = 'navigation' export const ensureStatic = 'navigation'
export default async function Page() { export default async function Page() {
const currentLang = await lang() const currentLang = await lang()
......
import type { Instant } from 'next' import type { Instant } from 'next'
import { ClientIO } from './client' import { ClientIO } from './client'
export const unstable_ensureStatic = 'navigation' export const ensureStatic = 'navigation'
export const instant: Instant = { export const instant: Instant = {
// We don't care about Instant Validation here, // We don't care about Instant Validation here,
......
import { connection } from 'next/server' import { connection } from 'next/server'
import { Suspense } from 'react' import { Suspense } from 'react'
export const unstable_ensureStatic = 'navigation' export const ensureStatic = 'navigation'
export default function Page() { export default function Page() {
return ( return (
......
...@@ -2,7 +2,7 @@ import { Suspense } from 'react' ...@@ -2,7 +2,7 @@ import { Suspense } from 'react'
import { UserServerDataOnlyInBrowser } from './client' import { UserServerDataOnlyInBrowser } from './client'
import { connection } from 'next/server' import { connection } from 'next/server'
export const unstable_ensureStatic = 'navigation' export const ensureStatic = 'navigation'
export default function Page() { export default function Page() {
return ( return (
......
...@@ -2,7 +2,7 @@ import { Suspense } from 'react' ...@@ -2,7 +2,7 @@ import { Suspense } from 'react'
import { UseServerData } from './client' import { UseServerData } from './client'
import { connection } from 'next/server' import { connection } from 'next/server'
export const unstable_ensureStatic = 'navigation' export const ensureStatic = 'navigation'
export default function Page() { export default function Page() {
return ( return (
......
import type { Metadata } from 'next' import type { Metadata } from 'next'
import { connection } from 'next/server' import { connection } from 'next/server'
export const unstable_ensureStatic = 'navigation' export const ensureStatic = 'navigation'
export async function generateMetadata(): Promise<Metadata> { export async function generateMetadata(): Promise<Metadata> {
await connection() await connection()
......
import type { Viewport } from 'next' import type { Viewport } from 'next'
import { connection } from 'next/server' import { connection } from 'next/server'
export const unstable_ensureStatic = 'navigation' export const ensureStatic = 'navigation'
export async function generateViewport(): Promise<Viewport> { export async function generateViewport(): Promise<Viewport> {
await connection() await connection()
......
import { cacheLife } from 'next/cache' import { cacheLife } from 'next/cache'
import { Suspense } from 'react' import { Suspense } from 'react'
export const unstable_ensureStatic = 'navigation' export const ensureStatic = 'navigation'
export default function Page() { export default function Page() {
return ( return (
......
import { cacheLife } from 'next/cache' import { cacheLife } from 'next/cache'
import { Suspense } from 'react' import { Suspense } from 'react'
export const unstable_ensureStatic = 'navigation' export const ensureStatic = 'navigation'
export default function Page() { export default function Page() {
return ( return (
......
import { ReactNode } from 'react' import { ReactNode } from 'react'
// Can't set this in client modules, so we do it in a parent layout instead // Can't set this in client modules, so we do it in a parent layout instead
export const unstable_ensureStatic = 'navigation' export const ensureStatic = 'navigation'
export default function Layout({ children }: { children: ReactNode }) { export default function Layout({ children }: { children: ReactNode }) {
return children return children
......
import { Suspense } from 'react' import { Suspense } from 'react'
import { SlugClient } from './client' import { SlugClient } from './client'
export const unstable_ensureStatic = 'navigation' export const ensureStatic = 'navigation'
type Params = { slug: string } type Params = { slug: string }
......
import { Suspense } from 'react' import { Suspense } from 'react'
export const unstable_ensureStatic = 'navigation' export const ensureStatic = 'navigation'
type Params = { slug: string } type Params = { slug: string }
......
import { connection } from 'next/server' import { connection } from 'next/server'
export const unstable_ensureStatic = 'navigation' export const ensureStatic = 'navigation'
export default function Page() { export default function Page() {
return ( return (
......
import { BrowserOnly } from './client' import { BrowserOnly } from './client'
export const unstable_ensureStatic = 'navigation' export const ensureStatic = 'navigation'
export default function Page() { export default function Page() {
return ( return (
......
...@@ -2,7 +2,7 @@ import { connection } from 'next/server' ...@@ -2,7 +2,7 @@ import { connection } from 'next/server'
import { Suspense } from 'react' import { Suspense } from 'react'
import { BrowserOnly } from './client' import { BrowserOnly } from './client'
export const unstable_ensureStatic = 'navigation' export const ensureStatic = 'navigation'
export default function Page() { export default function Page() {
return ( return (
......
...@@ -2,7 +2,7 @@ import { connection } from 'next/server' ...@@ -2,7 +2,7 @@ import { connection } from 'next/server'
import { Suspense } from 'react' import { Suspense } from 'react'
import { ClientIO } from './client' import { ClientIO } from './client'
export const unstable_ensureStatic = 'navigation' export const ensureStatic = 'navigation'
export default function Page() { export default function Page() {
return ( return (
......
...@@ -2,7 +2,7 @@ import { connection } from 'next/server' ...@@ -2,7 +2,7 @@ import { connection } from 'next/server'
import { Suspense } from 'react' import { Suspense } from 'react'
import { ClientSearchQuery } from './client' import { ClientSearchQuery } from './client'
export const unstable_ensureStatic = 'navigation' export const ensureStatic = 'navigation'
export default function Page() { export default function Page() {
return ( return (
......
...@@ -2,7 +2,7 @@ export async function generateStaticParams() { ...@@ -2,7 +2,7 @@ export async function generateStaticParams() {
return [{ slug: '123' }] return [{ slug: '123' }]
} }
export const unstable_ensureStatic = 'navigation' export const ensureStatic = 'navigation'
// The page awaits `params` without Suspense, which blocks the app shell, // The page awaits `params` without Suspense, which blocks the app shell,
// and would fail Instant Validation in Partial Prefetching. // and would fail Instant Validation in Partial Prefetching.
......
...@@ -4,7 +4,7 @@ export async function generateStaticParams() { ...@@ -4,7 +4,7 @@ export async function generateStaticParams() {
return [] return []
} }
export const unstable_ensureStatic = 'navigation' export const ensureStatic = 'navigation'
type Params = { slug: string } type Params = { slug: string }
......
...@@ -2,7 +2,7 @@ export async function generateStaticParams() { ...@@ -2,7 +2,7 @@ export async function generateStaticParams() {
return [{ slug: '123' }] return [{ slug: '123' }]
} }
export const unstable_ensureStatic = 'navigation' export const ensureStatic = 'navigation'
type Params = { slug: string; snail: string } type Params = { slug: string; snail: string }
......
...@@ -4,7 +4,7 @@ export async function generateStaticParams() { ...@@ -4,7 +4,7 @@ export async function generateStaticParams() {
return [{ slug: '123' }] return [{ slug: '123' }]
} }
export const unstable_ensureStatic = 'navigation' export const ensureStatic = 'navigation'
type Params = { slug: string; snail: string } type Params = { slug: string; snail: string }
......
...@@ -4,7 +4,7 @@ export async function generateStaticParams() { ...@@ -4,7 +4,7 @@ export async function generateStaticParams() {
return [{ slug: '123' }] return [{ slug: '123' }]
} }
export const unstable_ensureStatic = 'navigation' export const ensureStatic = 'navigation'
type Params = { slug: string } type Params = { slug: string }
......
import { Suspense } from 'react' import { Suspense } from 'react'
export const unstable_ensureStatic = 'navigation' export const ensureStatic = 'navigation'
export default function Page() { export default function Page() {
return ( return (
......
import { Suspense } from 'react' import { Suspense } from 'react'
import { BrowserOnly } from './client' import { BrowserOnly } from './client'
export const unstable_ensureStatic = 'navigation' export const ensureStatic = 'navigation'
export default function Page() { export default function Page() {
return ( return (
......
import { Suspense } from 'react' import { Suspense } from 'react'
import { ClientIO } from './client' import { ClientIO } from './client'
export const unstable_ensureStatic = 'navigation' export const ensureStatic = 'navigation'
export default function Page() { export default function Page() {
return ( return (
......
import { connection } from 'next/server' import { connection } from 'next/server'
export const unstable_ensureStatic = 'navigation' export const ensureStatic = 'navigation'
export default function Page() { export default function Page() {
return ( return (
......
import { BrowserOnly } from './client' import { BrowserOnly } from './client'
export const unstable_ensureStatic = 'navigation' export const ensureStatic = 'navigation'
export default function Page() { export default function Page() {
return ( return (
......
import { lang } from 'next/root-params' import { lang } from 'next/root-params'
export const unstable_ensureStatic = 'navigation' export const ensureStatic = 'navigation'
export default async function Page() { export default async function Page() {
const currentLang = await lang() const currentLang = await lang()
......
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