Unverified Commit 4f392ad7 authored by Janka Uryga's avatar Janka Uryga Committed by GitHub

fix: stale usages of unstable_ensureStatic (#99540)

#97393 was a stale merge. we've renamed `unstable_ensureStatic` to
`ensureStatic` in the meantime.
parent d5d747e9
...@@ -1010,7 +1010,7 @@ export async function buildAppStaticPaths({ ...@@ -1010,7 +1010,7 @@ export async function buildAppStaticPaths({
for (const [paramName, mode] of Object.entries(paramMatching)) { for (const [paramName, mode] of Object.entries(paramMatching)) {
if (mode === 'fallback' || mode === 'dynamic') { if (mode === 'fallback' || mode === 'dynamic') {
throw new Error( throw new Error(
`Route "${page}" cannot configure parameter "${paramName}" as "${mode}" with \`unstable_ensureStatic = "navigation"\`. Use "blocking" or "not-found" parameter matching, or remove the navigation constraint.` `Route "${page}" cannot configure parameter "${paramName}" as "${mode}" with \`ensureStatic = "navigation"\`. Use "blocking" or "not-found" parameter matching, or remove the navigation constraint.`
) )
} }
} }
......
export const unstable_ensureStatic = 'navigation' export const ensureStatic = 'navigation'
export const unstable_paramMatching = { slug: 'dynamic' } export const unstable_paramMatching = { slug: 'dynamic' }
export default function Page() { export default function Page() {
......
export const unstable_ensureStatic = 'navigation' export const ensureStatic = 'navigation'
export default function Layout({ children }: { children: React.ReactNode }) { export default function Layout({ children }: { children: React.ReactNode }) {
return children return children
......
export const unstable_ensureStatic = 'navigation' export const ensureStatic = 'navigation'
export const unstable_paramMatching = { bottom: 'blocking' } export const unstable_paramMatching = { bottom: 'blocking' }
export function generateStaticParams() { export function generateStaticParams() {
......
export const unstable_ensureStatic = 'navigation' export const ensureStatic = 'navigation'
export function generateStaticParams() { export function generateStaticParams() {
return [{ slug: 'seed' }] return [{ slug: 'seed' }]
......
export const unstable_ensureStatic = 'navigation' export const ensureStatic = 'navigation'
export const instant = false export const instant = false
export const unstable_paramMatching = { slug: 'fallback' } export const unstable_paramMatching = { slug: 'fallback' }
......
export const unstable_ensureStatic = 'navigation' export const ensureStatic = 'navigation'
export const unstable_paramMatching = { slug: 'blocking' } export const unstable_paramMatching = { slug: 'blocking' }
export default async function Page({ export default async function Page({
......
export const unstable_ensureStatic = 'navigation' export const ensureStatic = 'navigation'
export function generateStaticParams() { export function generateStaticParams() {
return [{ slug: 'seed' }] return [{ slug: 'seed' }]
......
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 const instant = false export const instant = false
export const unstable_paramMatching = { slug: 'blocking' } export const unstable_paramMatching = { slug: 'blocking' }
......
export const unstable_ensureStatic = 'navigation' export const ensureStatic = 'navigation'
export const unstable_paramMatching = { slug: 'fallback' } export const unstable_paramMatching = { slug: 'fallback' }
export function generateStaticParams() { export function generateStaticParams() {
......
...@@ -59,7 +59,7 @@ describe('param-matching-ensure-static-errors', () => { ...@@ -59,7 +59,7 @@ describe('param-matching-ensure-static-errors', () => {
await expectError( await expectError(
route, route,
`/${route}/seed`, `/${route}/seed`,
`Route "/${route}/[slug]" cannot configure parameter "slug" as "${mode}" with \`unstable_ensureStatic = "navigation"\`. Use "blocking" or "not-found" parameter matching, or remove the navigation constraint.` `Route "/${route}/[slug]" cannot configure parameter "slug" as "${mode}" with \`ensureStatic = "navigation"\`. Use "blocking" or "not-found" parameter matching, or remove the navigation constraint.`
) )
} }
) )
...@@ -68,7 +68,7 @@ describe('param-matching-ensure-static-errors', () => { ...@@ -68,7 +68,7 @@ describe('param-matching-ensure-static-errors', () => {
await expectError( await expectError(
'missing', 'missing',
'/missing/seed', '/missing/seed',
'Page "/missing/[slug]" is missing `generateStaticParams()`' '`ensureStatic = "navigation"` requires an exported `generateStaticParams()` function'
) )
}) })
...@@ -76,7 +76,7 @@ describe('param-matching-ensure-static-errors', () => { ...@@ -76,7 +76,7 @@ describe('param-matching-ensure-static-errors', () => {
await expectError( await expectError(
'incomplete', 'incomplete',
'/incomplete/t1/b1', '/incomplete/t1/b1',
'Every params object must include all dynamic route parameters. Missing: "bottom".' 'Routes using `ensureStatic = "navigation"` must return every dynamic route parameter. Missing: "bottom"'
) )
}) })
......
export { default } from '../../../param-page' export { default } from '../../../param-page'
export const unstable_ensureStatic = 'navigation' export const ensureStatic = 'navigation'
export const unstable_paramMatching = { top: 'blocking', bottom: 'blocking' } export const unstable_paramMatching = { top: 'blocking', bottom: 'blocking' }
export function generateStaticParams() { export function generateStaticParams() {
......
export { default } from '../../../param-page' export { default } from '../../../param-page'
export const unstable_ensureStatic = 'navigation' export const ensureStatic = 'navigation'
export const unstable_paramMatching = { top: 'not-found' } export const unstable_paramMatching = { top: 'not-found' }
export function generateStaticParams() { export function generateStaticParams() {
......
export { default } from '../../../param-page' export { default } from '../../../param-page'
export const unstable_ensureStatic = 'navigation' export const ensureStatic = 'navigation'
export const unstable_paramMatching = { top: 'not-found', bottom: 'blocking' } export const unstable_paramMatching = { top: 'not-found', bottom: 'blocking' }
export function generateStaticParams() { export function generateStaticParams() {
......
export { default } from '../../../param-page' export { default } from '../../../param-page'
export const unstable_ensureStatic = 'navigation' export const ensureStatic = 'navigation'
export const unstable_paramMatching = { top: 'not-found', bottom: 'not-found' } export const unstable_paramMatching = { top: 'not-found', bottom: 'not-found' }
export function generateStaticParams() { export function generateStaticParams() {
......
export { default } from '../../../param-page' export { default } from '../../../param-page'
export const unstable_ensureStatic = 'navigation' export const ensureStatic = 'navigation'
export function generateStaticParams() { export function generateStaticParams() {
return [{ top: 't1', bottom: 'b1' }] return [{ top: 't1', bottom: 'b1' }]
......
export { default } from '../../param-page' export { default } from '../../param-page'
export const unstable_ensureStatic = 'navigation' export const ensureStatic = 'navigation'
export async function unstable_generateParamMatching() { export async function unstable_generateParamMatching() {
return { top: 'blocking' } return { top: 'blocking' }
......
export { default } from '../../param-page' export { default } from '../../param-page'
export const unstable_ensureStatic = 'prefetch' export const ensureStatic = 'prefetch'
export const unstable_paramMatching = { top: 'fallback' } export const unstable_paramMatching = { top: 'fallback' }
export function generateStaticParams() { export function generateStaticParams() {
......
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