Unverified Commit 9931cc0c authored by JJ Kasper's avatar JJ Kasper Committed by GitHub

Fix fallback route params case in app-page handler (#91737)

## Summary
- add production-route-shape fixture coverage for
`/[teamSlug]/[project]/settings/domains`
- add revalidation helpers (API and server action) and browser controls
used by the regression test
- reproduce the failing production sequence by priming, revalidating,
then loading a page with in-view `next/link` and navigating repeatedly

x-ref: https://github.com/vercel/next.js/pull/91627
x-ref: https://github.com/vercel/next.js/pull/91603

## Testing
- `IS_WEBPACK_TEST=1 NEXT_SKIP_ISOLATE=1 NEXT_TEST_MODE=start pnpm
testheadless
test/e2e/app-dir/segment-cache/vary-params-base-dynamic/vary-params-base-dynamic.test.ts
-t "production route shape"` (passes)
- `NEXT_ENABLE_ADAPTER=1 pnpm test-deploy
test/e2e/app-dir/segment-cache/vary-params-base-dynamic/vary-params-base-dynamic.test.ts
-t "production route shape"`
- `NEXT_ENABLE_ADAPTER=1 pnpm test-deploy
test/e2e/app-dir/segment-cache/vary-params-base-dynamic/vary-params-base-dynamic.test.ts`
(fails in the two production-shape cases)

---------
Co-authored-by: 's avatarZack Tanner <1939140+ztanner@users.noreply.github.com>
parent b592e6df
...@@ -31,6 +31,8 @@ import { ...@@ -31,6 +31,8 @@ import {
import { checkIsAppPPREnabled } from '../../server/lib/experimental/ppr' with { 'turbopack-transition': 'next-server-utility' } import { checkIsAppPPREnabled } from '../../server/lib/experimental/ppr' with { 'turbopack-transition': 'next-server-utility' }
import { import {
getFallbackRouteParams, getFallbackRouteParams,
getPlaceholderFallbackRouteParams,
buildDynamicSegmentPlaceholder,
createOpaqueFallbackRouteParams, createOpaqueFallbackRouteParams,
type OpaqueFallbackRouteParams, type OpaqueFallbackRouteParams,
} from '../../server/request/fallback-params' with { 'turbopack-transition': 'next-server-utility' } } from '../../server/request/fallback-params' with { 'turbopack-transition': 'next-server-utility' }
...@@ -116,10 +118,7 @@ import { RedirectStatusCode } from '../../client/components/redirect-status-code ...@@ -116,10 +118,7 @@ import { RedirectStatusCode } from '../../client/components/redirect-status-code
import { InvariantError } from '../../shared/lib/invariant-error' with { 'turbopack-transition': 'next-server-utility' } import { InvariantError } from '../../shared/lib/invariant-error' with { 'turbopack-transition': 'next-server-utility' }
import { scheduleOnNextTick } from '../../lib/scheduler' with { 'turbopack-transition': 'next-server-utility' } import { scheduleOnNextTick } from '../../lib/scheduler' with { 'turbopack-transition': 'next-server-utility' }
import { isInterceptionRouteAppPath } from '../../shared/lib/router/utils/interception-routes' with { 'turbopack-transition': 'next-server-utility' } import { isInterceptionRouteAppPath } from '../../shared/lib/router/utils/interception-routes' with { 'turbopack-transition': 'next-server-utility' }
import { import { getSegmentParam } from '../../shared/lib/router/utils/get-segment-param' with { 'turbopack-transition': 'next-server-utility' }
getParamProperties,
getSegmentParam,
} from '../../shared/lib/router/utils/get-segment-param' with { 'turbopack-transition': 'next-server-utility' }
export * from '../../server/app-render/entry-base' with { 'turbopack-transition': 'next-server-utility' } export * from '../../server/app-render/entry-base' with { 'turbopack-transition': 'next-server-utility' }
...@@ -141,22 +140,6 @@ export const routeModule = new AppPageRouteModule({ ...@@ -141,22 +140,6 @@ export const routeModule = new AppPageRouteModule({
relativeProjectDir: process.env.__NEXT_RELATIVE_PROJECT_DIR || '', relativeProjectDir: process.env.__NEXT_RELATIVE_PROJECT_DIR || '',
}) })
function buildDynamicSegmentPlaceholder(
param: Pick<FallbackRouteParam, 'paramName' | 'paramType'>
): string {
const { repeat, optional } = getParamProperties(param.paramType)
if (optional) {
return `[[...${param.paramName}]]`
}
if (repeat) {
return `[...${param.paramName}]`
}
return `[${param.paramName}]`
}
/** /**
* Builds the cache key for the most complete prerenderable shell we can derive * Builds the cache key for the most complete prerenderable shell we can derive
* from the shell that matched this request. Only params that can still be * from the shell that matched this request. Only params that can still be
...@@ -1339,6 +1322,31 @@ export async function handler( ...@@ -1339,6 +1322,31 @@ export async function handler(
} }
} }
const placeholderFallbackRouteParams =
// When a request carries dynamic placeholder values (e.g. "[slug]"),
// defer only the unresolved subset instead of forcing all fallback
// params to suspend.
!routeModule.isDev &&
pageIsDynamic &&
prerenderInfo?.fallbackRouteParams
? getPlaceholderFallbackRouteParams(
params as
| Record<string, undefined | string | string[]>
| undefined,
prerenderInfo.fallbackRouteParams
)
: null
const fallbackRouteParamsForRender =
placeholderFallbackRouteParams &&
placeholderFallbackRouteParams.length > 0
? placeholderFallbackRouteParams
: prerenderInfo?.fallbackRouteParams
const hasPlaceholderFallbackRouteParams =
placeholderFallbackRouteParams != null &&
placeholderFallbackRouteParams.length > 0
// When route-module.ts resolved partial nxtP* params during // When route-module.ts resolved partial nxtP* params during
// background revalidation, filter fallbackRouteParams to only the // background revalidation, filter fallbackRouteParams to only the
// params that are still unresolved. This lets doRender produce an // params that are still unresolved. This lets doRender produce an
...@@ -1359,9 +1367,10 @@ export async function handler( ...@@ -1359,9 +1367,10 @@ export async function handler(
// non-prerendered URL, use the prerender manifest's fallback route // non-prerendered URL, use the prerender manifest's fallback route
// params which correctly identifies which params are unknown. // params which correctly identifies which params are unknown.
((isProduction && getRequestMeta(req, 'renderFallbackShell')) || ((isProduction && getRequestMeta(req, 'renderFallbackShell')) ||
hasPlaceholderFallbackRouteParams ||
(isDebugStaticShell && !isPrerendered)) && (isDebugStaticShell && !isPrerendered)) &&
prerenderInfo?.fallbackRouteParams fallbackRouteParamsForRender
? createOpaqueFallbackRouteParams(prerenderInfo.fallbackRouteParams) ? createOpaqueFallbackRouteParams(fallbackRouteParamsForRender)
: // For intermediate shells where some params are resolved and : // For intermediate shells where some params are resolved and
// others still have placeholders, use the filtered subset so the // others still have placeholders, use the filtered subset so the
// prerender suspends only for the unresolved params. // prerender suspends only for the unresolved params.
...@@ -1386,7 +1395,7 @@ export async function handler( ...@@ -1386,7 +1395,7 @@ export async function handler(
prerenderInfo?.fallbackRouteParams prerenderInfo?.fallbackRouteParams
) { ) {
const fallbackParams = createOpaqueFallbackRouteParams( const fallbackParams = createOpaqueFallbackRouteParams(
prerenderInfo.fallbackRouteParams fallbackRouteParamsForRender ?? prerenderInfo.fallbackRouteParams
) )
if (fallbackParams) { if (fallbackParams) {
......
import { import {
buildDynamicSegmentPlaceholder,
createOpaqueFallbackRouteParams, createOpaqueFallbackRouteParams,
getFallbackRouteParams, getFallbackRouteParams,
getPlaceholderFallbackRouteParams,
} from './fallback-params' } from './fallback-params'
import type { FallbackRouteParam } from '../../build/static-paths/types' import type { FallbackRouteParam } from '../../build/static-paths/types'
import type AppPageRouteModule from '../route-modules/app-page/module' import type AppPageRouteModule from '../route-modules/app-page/module'
...@@ -72,6 +74,54 @@ describe('createOpaqueFallbackRouteParams', () => { ...@@ -72,6 +74,54 @@ describe('createOpaqueFallbackRouteParams', () => {
}) })
}) })
describe('placeholder fallback route params', () => {
it('builds route placeholders by dynamic param type', () => {
expect(
buildDynamicSegmentPlaceholder({
paramName: 'slug',
paramType: 'dynamic',
})
).toBe('[slug]')
expect(
buildDynamicSegmentPlaceholder({
paramName: 'slug',
paramType: 'catchall',
})
).toBe('[...slug]')
expect(
buildDynamicSegmentPlaceholder({
paramName: 'slug',
paramType: 'optional-catchall',
})
).toBe('[[...slug]]')
})
it('returns only fallback params that are still placeholders', () => {
const fallbackParams: readonly FallbackRouteParam[] = [
{ paramName: 'team', paramType: 'dynamic' },
{ paramName: 'project', paramType: 'dynamic' },
{ paramName: 'slug', paramType: 'catchall' },
{ paramName: 'optional', paramType: 'optional-catchall' },
]
const result = getPlaceholderFallbackRouteParams(
{
team: '[team]',
project: 'dashboard',
slug: ['[...slug]'],
optional: '[[...optional]]',
},
fallbackParams
)
expect(result).toEqual([
{ paramName: 'team', paramType: 'dynamic' },
{ paramName: 'slug', paramType: 'catchall' },
{ paramName: 'optional', paramType: 'optional-catchall' },
])
})
})
describe('getFallbackRouteParams', () => { describe('getFallbackRouteParams', () => {
describe('Regular Routes (children segments)', () => { describe('Regular Routes (children segments)', () => {
it('should extract single dynamic segment from children route', () => { it('should extract single dynamic segment from children route', () => {
......
...@@ -5,6 +5,7 @@ import { dynamicParamTypes } from '../app-render/get-short-dynamic-param-type' ...@@ -5,6 +5,7 @@ import { dynamicParamTypes } from '../app-render/get-short-dynamic-param-type'
import type AppPageRouteModule from '../route-modules/app-page/module' import type AppPageRouteModule from '../route-modules/app-page/module'
import { parseAppRoute } from '../../shared/lib/router/routes/app' import { parseAppRoute } from '../../shared/lib/router/routes/app'
import { extractPathnameRouteParamSegmentsFromLoaderTree } from '../../build/static-paths/app/extract-pathname-route-param-segments-from-loader-tree' import { extractPathnameRouteParamSegmentsFromLoaderTree } from '../../build/static-paths/app/extract-pathname-route-param-segments-from-loader-tree'
import { getParamProperties } from '../../shared/lib/router/utils/get-segment-param'
export type OpaqueFallbackRouteParamValue = [ export type OpaqueFallbackRouteParamValue = [
/** /**
...@@ -74,6 +75,37 @@ export function createOpaqueFallbackRouteParams( ...@@ -74,6 +75,37 @@ export function createOpaqueFallbackRouteParams(
return keys return keys
} }
export function buildDynamicSegmentPlaceholder(
param: Pick<FallbackRouteParam, 'paramName' | 'paramType'>
): string {
const { repeat, optional } = getParamProperties(param.paramType)
if (optional) {
return `[[...${param.paramName}]]`
}
if (repeat) {
return `[...${param.paramName}]`
}
return `[${param.paramName}]`
}
export function getPlaceholderFallbackRouteParams(
params: Record<string, undefined | string | string[]> | undefined,
fallbackRouteParams: readonly FallbackRouteParam[]
): FallbackRouteParam[] {
return fallbackRouteParams.filter((param) => {
const placeholder = buildDynamicSegmentPlaceholder(param)
const value = params?.[param.paramName]
return (
value === placeholder ||
(Array.isArray(value) && value.length === 1 && value[0] === placeholder)
)
})
}
/** /**
* Gets the fallback route params for a given page. This is an expensive * Gets the fallback route params for a given page. This is an expensive
* operation because it requires parsing the loader tree to extract the fallback * operation because it requires parsing the loader tree to extract the fallback
......
export default function ProjectDomainsSettingsLoading() {
return (
<div data-team-project-settings-domains-loading="true">
Loading project domains settings...
</div>
)
}
import { cacheLife } from 'next/cache'
import Link from 'next/link'
import { Suspense } from 'react'
import { LinkAccordion } from '../../../../../../components/link-accordion'
type Params = { teamSlug: string; project: string }
export default function ProjectDomainsSettingsPage({
params,
}: {
params: Promise<Params>
}) {
return (
<div id="team-project-settings-domains-page">
<Suspense
fallback={
<div data-loading="true">
Loading project settings domains page...
</div>
}
>
<ProjectDomainsSettingsContent params={params} />
</Suspense>
<nav data-nav-link-list="true">
<ul>
<li>
<Link
href="/acme/dashboard/settings"
data-nav-link="/acme/dashboard/settings"
>
Navigate: acme/dashboard/settings
</Link>
</li>
<li>
<Link
href="/globex/portal/settings"
data-nav-link="/globex/portal/settings"
>
Navigate: globex/portal/settings
</Link>
</li>
<li>
<Link
href="/acme/dashboard/settings/domains"
data-nav-link="/acme/dashboard/settings/domains"
>
Navigate: acme/dashboard/settings/domains
</Link>
</li>
<li>
<Link
href="/globex/portal/settings/domains"
data-nav-link="/globex/portal/settings/domains"
>
Navigate: globex/portal/settings/domains
</Link>
</li>
</ul>
</nav>
<div data-related-link-list="true">
<LinkAccordion href="/acme/dashboard/settings/domains">
Related route: acme/dashboard/settings/domains
</LinkAccordion>
<LinkAccordion href="/globex/portal/settings/domains">
Related route: globex/portal/settings/domains
</LinkAccordion>
</div>
</div>
)
}
async function ProjectDomainsSettingsContent({
params,
}: {
params: Promise<Params>
}) {
'use cache'
cacheLife({ stale: 0, revalidate: 1, expire: 60 })
const { teamSlug, project } = await params
const marker = Date.now()
return (
<div data-team-project-settings-domains-content="true">
{`Project domains settings content - team: ${teamSlug}, project: ${project}, marker: ${marker}`}
</div>
)
}
import { ReactNode } from 'react'
export default function ProjectSettingsLayout({
children,
}: {
children: ReactNode
}) {
return (
<div data-project-settings-layout="domains-variant">
<h2>Project Settings Layout (domains variant)</h2>
{children}
</div>
)
}
import { cacheLife } from 'next/cache' import { cacheLife } from 'next/cache'
import Link from 'next/link'
import { Suspense } from 'react' import { Suspense } from 'react'
import { LinkAccordion } from '../../../components/link-accordion'
type Params = { teamSlug: string; project: string } type Params = { teamSlug: string; project: string }
...@@ -15,6 +17,71 @@ export default function TeamProjectPage({ ...@@ -15,6 +17,71 @@ export default function TeamProjectPage({
> >
<TeamProjectContent params={params} /> <TeamProjectContent params={params} />
</Suspense> </Suspense>
<nav data-nav-link-list="true">
<ul>
<li>
<Link href="/" data-nav-link="/">
Navigate: home
</Link>
</li>
<li>
<Link href="/acme/dashboard" data-nav-link="/acme/dashboard">
Navigate: acme/dashboard
</Link>
</li>
<li>
<Link href="/globex/portal" data-nav-link="/globex/portal">
Navigate: globex/portal
</Link>
</li>
<li>
<Link
href="/acme/dashboard/settings"
data-nav-link="/acme/dashboard/settings"
>
Navigate: acme/dashboard/settings
</Link>
</li>
<li>
<Link
href="/globex/portal/settings"
data-nav-link="/globex/portal/settings"
>
Navigate: globex/portal/settings
</Link>
</li>
<li>
<Link
href="/acme/dashboard/settings/domains"
data-nav-link="/acme/dashboard/settings/domains"
>
Navigate: acme/dashboard/settings/domains
</Link>
</li>
<li>
<Link
href="/globex/portal/settings/domains"
data-nav-link="/globex/portal/settings/domains"
>
Navigate: globex/portal/settings/domains
</Link>
</li>
</ul>
</nav>
<div data-related-link-list="true">
<LinkAccordion href="/acme/dashboard">
Related route: acme/dashboard
</LinkAccordion>
<LinkAccordion href="/globex/portal">
Related route: globex/portal
</LinkAccordion>
<LinkAccordion href="/acme/dashboard/settings/domains">
Related route: acme/dashboard/settings/domains
</LinkAccordion>
<LinkAccordion href="/globex/portal/settings/domains">
Related route: globex/portal/settings/domains
</LinkAccordion>
</div>
</div> </div>
) )
} }
......
import { ReactNode } from 'react'
export default function ProjectSettingsLayout({
children,
}: {
children: ReactNode
}) {
return (
<div data-project-settings-layout="default">
<h2>Project Settings Layout</h2>
{children}
</div>
)
}
import { cacheLife } from 'next/cache'
import Link from 'next/link'
import { Suspense } from 'react'
import { LinkAccordion } from '../../../../components/link-accordion'
type Params = { teamSlug: string; project: string }
export default function ProjectSettingsPage({
params,
}: {
params: Promise<Params>
}) {
return (
<div id="team-project-settings-page">
<Suspense
fallback={<div data-loading="true">Loading settings page...</div>}
>
<ProjectSettingsContent params={params} />
</Suspense>
<nav data-nav-link-list="true">
<ul>
<li>
<Link href="/" data-nav-link="/">
Navigate: home
</Link>
</li>
<li>
<Link
href="/acme/dashboard/settings/domains"
data-nav-link="/acme/dashboard/settings/domains"
>
Navigate: acme/dashboard/settings/domains
</Link>
</li>
<li>
<Link
href="/globex/portal/settings/domains"
data-nav-link="/globex/portal/settings/domains"
>
Navigate: globex/portal/settings/domains
</Link>
</li>
</ul>
</nav>
<div data-related-link-list="true">
<LinkAccordion href="/acme/dashboard/settings/domains">
Related route: acme/dashboard/settings/domains
</LinkAccordion>
<LinkAccordion href="/globex/portal/settings/domains">
Related route: globex/portal/settings/domains
</LinkAccordion>
</div>
</div>
)
}
async function ProjectSettingsContent({ params }: { params: Promise<Params> }) {
'use cache'
cacheLife({ stale: 0, revalidate: 1, expire: 60 })
const { teamSlug, project } = await params
const marker = Date.now()
return (
<div data-team-project-settings-content="true">
{`Project settings overview content - team: ${teamSlug}, project: ${project}, marker: ${marker}`}
</div>
)
}
import { revalidatePath, revalidateTag } from 'next/cache'
import { NextRequest } from 'next/server'
type RevalidateMode =
| 'tag-layout-expireNow'
| 'tag-layout-max'
| 'tag-layout-legacy'
| 'path-root-layout'
| 'path-team-layout'
| 'path-team-page'
function isRevalidateMode(value: string): value is RevalidateMode {
return (
value === 'tag-layout-expireNow' ||
value === 'tag-layout-max' ||
value === 'tag-layout-legacy' ||
value === 'path-root-layout' ||
value === 'path-team-layout' ||
value === 'path-team-page'
)
}
export async function GET(request: NextRequest) {
const modeQuery = request.nextUrl.searchParams.get('mode')
const mode: RevalidateMode =
modeQuery && isRevalidateMode(modeQuery)
? modeQuery
: 'tag-layout-expireNow'
switch (mode) {
case 'tag-layout-expireNow':
revalidateTag('_N_T_/layout', 'expireNow')
break
case 'tag-layout-max':
revalidateTag('_N_T_/layout', 'max')
break
case 'tag-layout-legacy':
// Intentionally test the deprecated call shape without a profile arg.
// @ts-expect-error
revalidateTag('_N_T_/layout')
break
case 'path-root-layout':
revalidatePath('/', 'layout')
break
case 'path-team-layout':
revalidatePath('/acme/dashboard', 'layout')
break
case 'path-team-page':
revalidatePath('/acme/dashboard')
break
default:
break
}
return Response.json({
revalidated: true,
mode,
})
}
import Link from 'next/link'
import { LinkAccordion } from '../components/link-accordion' import { LinkAccordion } from '../components/link-accordion'
import { RevalidateControls } from '../components/revalidate-controls'
export default function HomePage() { export default function HomePage() {
return ( return (
...@@ -8,6 +10,34 @@ export default function HomePage() { ...@@ -8,6 +10,34 @@ export default function HomePage() {
Prefetch dynamic team/project routes and validate segment payload Prefetch dynamic team/project routes and validate segment payload
params. params.
</p> </p>
<ul data-nav-link-list="true">
<li>
<Link href="/acme/dashboard" data-nav-link="/acme/dashboard">
Navigate: acme/dashboard
</Link>
</li>
<li>
<Link href="/globex/portal" data-nav-link="/globex/portal">
Navigate: globex/portal
</Link>
</li>
<li>
<Link
href="/acme/dashboard/settings/domains"
data-nav-link="/acme/dashboard/settings/domains"
>
Navigate: acme/dashboard/settings/domains
</Link>
</li>
<li>
<Link
href="/globex/portal/settings/domains"
data-nav-link="/globex/portal/settings/domains"
>
Navigate: globex/portal/settings/domains
</Link>
</li>
</ul>
<ul> <ul>
<li> <li>
<LinkAccordion href="/acme/dashboard"> <LinkAccordion href="/acme/dashboard">
...@@ -20,6 +50,7 @@ export default function HomePage() { ...@@ -20,6 +50,7 @@ export default function HomePage() {
</LinkAccordion> </LinkAccordion>
</li> </li>
</ul> </ul>
<RevalidateControls />
</div> </div>
) )
} }
'use server'
import { revalidateTag } from 'next/cache'
export async function revalidateLayoutByTagExpireNowAction() {
revalidateTag('_N_T_/layout', 'expireNow')
return {
mode: 'server-action-tag-layout-expireNow',
revalidated: true,
}
}
export async function revalidateLayoutByTagMaxAction() {
revalidateTag('_N_T_/layout', 'max')
return {
mode: 'server-action-tag-layout-max',
revalidated: true,
}
}
export async function revalidateLayoutByTagLegacyAction() {
// Intentionally test the deprecated call shape without a profile arg.
// @ts-expect-error
revalidateTag('_N_T_/layout')
return {
mode: 'server-action-tag-layout-legacy',
revalidated: true,
}
}
'use client'
import { useState } from 'react'
import {
revalidateLayoutByTagExpireNowAction,
revalidateLayoutByTagLegacyAction,
revalidateLayoutByTagMaxAction,
} from '../app/revalidate-actions'
type ApiRevalidateMode =
| 'tag-layout-expireNow'
| 'tag-layout-max'
| 'tag-layout-legacy'
| 'path-root-layout'
| 'path-team-layout'
| 'path-team-page'
type ServerActionMode =
| 'server-action-tag-layout-expireNow'
| 'server-action-tag-layout-max'
| 'server-action-tag-layout-legacy'
export function RevalidateControls() {
const [result, setResult] = useState('idle')
const [isPending, setIsPending] = useState(false)
const runApiRevalidate = async (mode: ApiRevalidateMode) => {
setIsPending(true)
try {
const response = await fetch(`/api/revalidate-layout?mode=${mode}`, {
method: 'GET',
})
const data = await response.json()
setResult(JSON.stringify(data))
} catch (error) {
setResult(
JSON.stringify({
error: error instanceof Error ? error.message : 'unknown error',
mode,
})
)
} finally {
setIsPending(false)
}
}
const runServerActionRevalidate = async (mode: ServerActionMode) => {
setIsPending(true)
try {
const data =
mode === 'server-action-tag-layout-expireNow'
? await revalidateLayoutByTagExpireNowAction()
: mode === 'server-action-tag-layout-max'
? await revalidateLayoutByTagMaxAction()
: await revalidateLayoutByTagLegacyAction()
setResult(JSON.stringify(data))
} catch (error) {
setResult(
JSON.stringify({
error: error instanceof Error ? error.message : 'unknown error',
mode,
})
)
} finally {
setIsPending(false)
}
}
return (
<div data-revalidate-controls="true">
<button
id="revalidate-in-browser-tag-layout-expireNow"
type="button"
disabled={isPending}
onClick={() => runApiRevalidate('tag-layout-expireNow')}
>
Browser Revalidate Tag Layout (expireNow)
</button>
<button
id="revalidate-in-browser-tag-layout-max"
type="button"
disabled={isPending}
onClick={() => runApiRevalidate('tag-layout-max')}
>
Browser Revalidate Tag Layout (max)
</button>
<button
id="revalidate-in-browser-tag-layout-legacy"
type="button"
disabled={isPending}
onClick={() => runApiRevalidate('tag-layout-legacy')}
>
Browser Revalidate Tag Layout (legacy)
</button>
<button
id="revalidate-in-browser-server-action-tag-layout-expireNow"
type="button"
disabled={isPending}
onClick={() =>
runServerActionRevalidate('server-action-tag-layout-expireNow')
}
>
Server Action Revalidate Tag Layout (expireNow)
</button>
<button
id="revalidate-in-browser-server-action-tag-layout-max"
type="button"
disabled={isPending}
onClick={() =>
runServerActionRevalidate('server-action-tag-layout-max')
}
>
Server Action Revalidate Tag Layout (max)
</button>
<button
id="revalidate-in-browser-server-action-tag-layout-legacy"
type="button"
disabled={isPending}
onClick={() =>
runServerActionRevalidate('server-action-tag-layout-legacy')
}
>
Server Action Revalidate Tag Layout (legacy)
</button>
<div id="revalidate-result" data-revalidate-result={result}>
{result}
</div>
</div>
)
}
...@@ -3,6 +3,13 @@ ...@@ -3,6 +3,13 @@
*/ */
const nextConfig = { const nextConfig = {
cacheComponents: true, cacheComponents: true,
cacheLife: {
expireNow: {
stale: 0,
revalidate: 0,
expire: 0,
},
},
experimental: { experimental: {
optimisticRouting: true, optimisticRouting: true,
varyParams: true, varyParams: true,
......
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