Unverified Commit d803902d authored by Andrew Clark's avatar Andrew Clark Committed by GitHub

Fix prefetch hints not being loaded during revalidation (#92625)

The prefetch hints manifest was not loaded during revalidation renders,
causing all segments to fall back to PrefetchDisabled — effectively
disabling prefetching for that route until the next full build.

The app-page template handler constructs its own renderOpts from scratch
without including prefetch-hints.json. Normal requests go through the
server's renderOpts (which loads the manifest at startup), but
background revalidation renders go through the template handler, so the
hints were always empty.

Load the manifest in the route module's loadManifests() and pass it
through to renderOpts.

Closes #92255

---------
Co-authored-by: 's avatarZack Tanner <1939140+ztanner@users.noreply.github.com>
parent 46181bc0
...@@ -246,6 +246,7 @@ export async function handler( ...@@ -246,6 +246,7 @@ export async function handler(
clientReferenceManifest, clientReferenceManifest,
subresourceIntegrityManifest, subresourceIntegrityManifest,
prerenderManifest, prerenderManifest,
prefetchHintsManifest,
isDraftMode, isDraftMode,
resolvedPathname, resolvedPathname,
revalidateOnlyGenerated, revalidateOnlyGenerated,
...@@ -856,6 +857,7 @@ export async function handler( ...@@ -856,6 +857,7 @@ export async function handler(
reactMaxHeadersLength: nextConfig.reactMaxHeadersLength, reactMaxHeadersLength: nextConfig.reactMaxHeadersLength,
multiZoneDraftMode, multiZoneDraftMode,
prefetchHints: prefetchHintsManifest,
incrementalCache, incrementalCache,
cacheLifeProfiles: nextConfig.cacheLife, cacheLifeProfiles: nextConfig.cacheLife,
basePath: nextConfig.basePath, basePath: nextConfig.basePath,
......
...@@ -1901,6 +1901,7 @@ async function getRSCPayload( ...@@ -1901,6 +1901,7 @@ async function getRSCPayload(
tree, tree,
hints, hints,
prefetchInliningEnabled, prefetchInliningEnabled,
ctx.renderOpts.cacheComponents,
workStore.isStaticGeneration, workStore.isStaticGeneration,
ctx.renderOpts.isBuildTimePrerendering ?? false, ctx.renderOpts.isBuildTimePrerendering ?? false,
getDynamicParamFromSegment, getDynamicParamFromSegment,
...@@ -2099,6 +2100,7 @@ async function getErrorRSCPayload( ...@@ -2099,6 +2100,7 @@ async function getErrorRSCPayload(
tree, tree,
errorHints, errorHints,
errorPrefetchInliningEnabled, errorPrefetchInliningEnabled,
ctx.renderOpts.cacheComponents,
workStore.isStaticGeneration, workStore.isStaticGeneration,
ctx.renderOpts.isBuildTimePrerendering ?? false, ctx.renderOpts.isBuildTimePrerendering ?? false,
getDynamicParamFromSegment, getDynamicParamFromSegment,
...@@ -8442,21 +8444,26 @@ async function collectSegmentData( ...@@ -8442,21 +8444,26 @@ async function collectSegmentData(
// during ISR/revalidation. // during ISR/revalidation.
const manifestHints = renderOpts.prefetchHints?.[pagePath] const manifestHints = renderOpts.prefetchHints?.[pagePath]
if (manifestHints === undefined) { if (manifestHints === undefined) {
// TODO(#91407): No hints found for this route. This currently if (!renderOpts.cacheComponents) {
// happens for routes with `instant = false` at the root segment, // Without cacheComponents, dynamic pages have no static shell
// which causes the prerender to run per-request and the hints // and therefore no prerender pass to compute hints. This is
// manifest to be unavailable at runtime. // expected — just skip the hint system for this route and let
// // prefetching proceed normally without inlining decisions.
// Fall back to a hint tree that marks everything as unprefetchable. hints = null
// The root gets PrefetchDisabled, and children inherit null hints } else {
// which triggers PrefetchDisabled in createFlightRouterStateFromLoaderTree. // TODO(#91407): No hints found for this route. This currently
// // happens for routes with `instant = false` at the root segment,
// Once the instant:false bug is fixed, this should become an error — // which causes the prerender to run per-request and the hints
// the manifest should always have an entry for every route that // manifest to be unavailable at runtime.
// reaches collectSegmentData. //
hints = { // Fall back to a hint tree that marks everything as
hints: PrefetchHint.PrefetchDisabled, // unprefetchable. Once the instant:false bug is fixed, this
slots: null, // should become an error — the manifest should always have an
// entry for every route that reaches collectSegmentData.
hints = {
hints: PrefetchHint.PrefetchDisabled,
slots: null,
}
} }
} else { } else {
hints = manifestHints hints = manifestHints
......
...@@ -12,6 +12,7 @@ async function createFlightRouterStateFromLoaderTreeImpl( ...@@ -12,6 +12,7 @@ async function createFlightRouterStateFromLoaderTreeImpl(
loaderTree: LoaderTree, loaderTree: LoaderTree,
hintTree: PrefetchHints | null, hintTree: PrefetchHints | null,
prefetchInliningEnabled: boolean, prefetchInliningEnabled: boolean,
cacheComponents: boolean,
isStaticGeneration: boolean, isStaticGeneration: boolean,
isBuildTimePrerendering: boolean, isBuildTimePrerendering: boolean,
getDynamicParamFromSegment: GetDynamicParamFromSegment, getDynamicParamFromSegment: GetDynamicParamFromSegment,
...@@ -65,12 +66,16 @@ async function createFlightRouterStateFromLoaderTreeImpl( ...@@ -65,12 +66,16 @@ async function createFlightRouterStateFromLoaderTreeImpl(
// Once that bug is fixed, this branch should become an error again — // Once that bug is fixed, this branch should become an error again —
// hints should always be available from the manifest during ISR. // hints should always be available from the manifest during ISR.
prefetchHints |= PrefetchHint.PrefetchDisabled prefetchHints |= PrefetchHint.PrefetchDisabled
} else { } else if (cacheComponents) {
// At runtime with no hint tree, this is a fully dynamic route with no // At runtime with no hint tree, this is a fully dynamic route with no
// manifest entry. Treat every segment as unprefetchable. Do NOT set // manifest entry. Treat every segment as unprefetchable. Do NOT set
// InliningHintsStale — that would cause the client to enter an // InliningHintsStale — that would cause the client to enter an
// infinite re-fetch loop trying to get hints that will never exist. // infinite re-fetch loop trying to get hints that will never exist.
prefetchHints |= PrefetchHint.PrefetchDisabled prefetchHints |= PrefetchHint.PrefetchDisabled
} else {
// Without cacheComponents, dynamic pages have no static shell so
// hints are never computed. Don't disable prefetching — just skip
// the inlining hint system and let prefetching proceed normally.
} }
} }
...@@ -104,6 +109,7 @@ async function createFlightRouterStateFromLoaderTreeImpl( ...@@ -104,6 +109,7 @@ async function createFlightRouterStateFromLoaderTreeImpl(
parallelRoutes[parallelRouteKey], parallelRoutes[parallelRouteKey],
childHintNode, childHintNode,
prefetchInliningEnabled, prefetchInliningEnabled,
cacheComponents,
isStaticGeneration, isStaticGeneration,
isBuildTimePrerendering, isBuildTimePrerendering,
getDynamicParamFromSegment, getDynamicParamFromSegment,
...@@ -151,6 +157,7 @@ export async function createFlightRouterStateFromLoaderTree( ...@@ -151,6 +157,7 @@ export async function createFlightRouterStateFromLoaderTree(
loaderTree: LoaderTree, loaderTree: LoaderTree,
hintTree: PrefetchHints | null, hintTree: PrefetchHints | null,
prefetchInliningEnabled: boolean, prefetchInliningEnabled: boolean,
cacheComponents: boolean,
isStaticGeneration: boolean, isStaticGeneration: boolean,
isBuildTimePrerendering: boolean, isBuildTimePrerendering: boolean,
getDynamicParamFromSegment: GetDynamicParamFromSegment, getDynamicParamFromSegment: GetDynamicParamFromSegment,
...@@ -161,6 +168,7 @@ export async function createFlightRouterStateFromLoaderTree( ...@@ -161,6 +168,7 @@ export async function createFlightRouterStateFromLoaderTree(
loaderTree, loaderTree,
hintTree, hintTree,
prefetchInliningEnabled, prefetchInliningEnabled,
cacheComponents,
isStaticGeneration, isStaticGeneration,
isBuildTimePrerendering, isBuildTimePrerendering,
getDynamicParamFromSegment, getDynamicParamFromSegment,
...@@ -173,6 +181,7 @@ export async function createRouteTreePrefetch( ...@@ -173,6 +181,7 @@ export async function createRouteTreePrefetch(
loaderTree: LoaderTree, loaderTree: LoaderTree,
hintTree: PrefetchHints | null, hintTree: PrefetchHints | null,
prefetchInliningEnabled: boolean, prefetchInliningEnabled: boolean,
cacheComponents: boolean,
isStaticGeneration: boolean, isStaticGeneration: boolean,
isBuildTimePrerendering: boolean, isBuildTimePrerendering: boolean,
getDynamicParamFromSegment: GetDynamicParamFromSegment getDynamicParamFromSegment: GetDynamicParamFromSegment
...@@ -186,6 +195,7 @@ export async function createRouteTreePrefetch( ...@@ -186,6 +195,7 @@ export async function createRouteTreePrefetch(
loaderTree, loaderTree,
hintTree, hintTree,
prefetchInliningEnabled, prefetchInliningEnabled,
cacheComponents,
isStaticGeneration, isStaticGeneration,
isBuildTimePrerendering, isBuildTimePrerendering,
getDynamicParamFromSegment, getDynamicParamFromSegment,
......
...@@ -63,6 +63,7 @@ export async function walkTreeWithFlightRouterState({ ...@@ -63,6 +63,7 @@ export async function walkTreeWithFlightRouterState({
workStore, workStore,
} = ctx } = ctx
const prefetchInliningEnabled = Boolean(experimental.prefetchInlining) const prefetchInliningEnabled = Boolean(experimental.prefetchInlining)
const cacheComponents = ctx.renderOpts.cacheComponents
const isStaticGeneration = workStore.isStaticGeneration const isStaticGeneration = workStore.isStaticGeneration
const isBuildTimePrerendering = const isBuildTimePrerendering =
ctx.renderOpts.isBuildTimePrerendering ?? false ctx.renderOpts.isBuildTimePrerendering ?? false
...@@ -161,6 +162,7 @@ export async function walkTreeWithFlightRouterState({ ...@@ -161,6 +162,7 @@ export async function walkTreeWithFlightRouterState({
loaderTreeToFilter, loaderTreeToFilter,
hintTree, hintTree,
prefetchInliningEnabled, prefetchInliningEnabled,
cacheComponents,
isStaticGeneration, isStaticGeneration,
isBuildTimePrerendering, isBuildTimePrerendering,
getDynamicParamFromSegment getDynamicParamFromSegment
...@@ -169,6 +171,7 @@ export async function walkTreeWithFlightRouterState({ ...@@ -169,6 +171,7 @@ export async function walkTreeWithFlightRouterState({
loaderTreeToFilter, loaderTreeToFilter,
hintTree, hintTree,
prefetchInliningEnabled, prefetchInliningEnabled,
cacheComponents,
isStaticGeneration, isStaticGeneration,
isBuildTimePrerendering, isBuildTimePrerendering,
getDynamicParamFromSegment, getDynamicParamFromSegment,
...@@ -199,6 +202,7 @@ export async function walkTreeWithFlightRouterState({ ...@@ -199,6 +202,7 @@ export async function walkTreeWithFlightRouterState({
loaderTreeToFilter, loaderTreeToFilter,
hintTree, hintTree,
prefetchInliningEnabled, prefetchInliningEnabled,
cacheComponents,
isStaticGeneration, isStaticGeneration,
isBuildTimePrerendering, isBuildTimePrerendering,
getDynamicParamFromSegment getDynamicParamFromSegment
...@@ -207,6 +211,7 @@ export async function walkTreeWithFlightRouterState({ ...@@ -207,6 +211,7 @@ export async function walkTreeWithFlightRouterState({
loaderTreeToFilter, loaderTreeToFilter,
hintTree, hintTree,
prefetchInliningEnabled, prefetchInliningEnabled,
cacheComponents,
isStaticGeneration, isStaticGeneration,
isBuildTimePrerendering, isBuildTimePrerendering,
getDynamicParamFromSegment, getDynamicParamFromSegment,
...@@ -238,6 +243,7 @@ export async function walkTreeWithFlightRouterState({ ...@@ -238,6 +243,7 @@ export async function walkTreeWithFlightRouterState({
loaderTreeToFilter, loaderTreeToFilter,
hintTree, hintTree,
prefetchInliningEnabled, prefetchInliningEnabled,
cacheComponents,
isStaticGeneration, isStaticGeneration,
isBuildTimePrerendering, isBuildTimePrerendering,
getDynamicParamFromSegment, getDynamicParamFromSegment,
...@@ -369,6 +375,7 @@ export async function createFullTreeFlightDataForNavigation({ ...@@ -369,6 +375,7 @@ export async function createFullTreeFlightDataForNavigation({
loaderTree, loaderTree,
hintTreeForInitialRender, hintTreeForInitialRender,
Boolean(experimental.prefetchInlining), Boolean(experimental.prefetchInlining),
ctx.renderOpts.cacheComponents,
workStoreForInitialRender.isStaticGeneration, workStoreForInitialRender.isStaticGeneration,
ctx.renderOpts.isBuildTimePrerendering ?? false, ctx.renderOpts.isBuildTimePrerendering ?? false,
getDynamicParamFromSegment, getDynamicParamFromSegment,
......
...@@ -19,6 +19,7 @@ import { ...@@ -19,6 +19,7 @@ import {
CLIENT_REFERENCE_MANIFEST, CLIENT_REFERENCE_MANIFEST,
DYNAMIC_CSS_MANIFEST, DYNAMIC_CSS_MANIFEST,
NEXT_FONT_MANIFEST, NEXT_FONT_MANIFEST,
PREFETCH_HINTS,
PRERENDER_MANIFEST, PRERENDER_MANIFEST,
REACT_LOADABLE_MANIFEST, REACT_LOADABLE_MANIFEST,
ROUTES_MANIFEST, ROUTES_MANIFEST,
...@@ -216,6 +217,7 @@ export abstract class RouteModule< ...@@ -216,6 +217,7 @@ export abstract class RouteModule<
clientReferenceManifest: any clientReferenceManifest: any
serverActionsManifest: any serverActionsManifest: any
dynamicCssManifest: any dynamicCssManifest: any
prefetchHintsManifest: Record<string, any> | undefined
interceptionRoutePatterns: RegExp[] interceptionRoutePatterns: RegExp[]
} { } {
let result let result
...@@ -264,6 +266,9 @@ export abstract class RouteModule< ...@@ -264,6 +266,9 @@ export abstract class RouteModule<
self.__SUBRESOURCE_INTEGRITY_MANIFEST self.__SUBRESOURCE_INTEGRITY_MANIFEST
), ),
dynamicCssManifest: maybeJSONParse(self.__DYNAMIC_CSS_MANIFEST), dynamicCssManifest: maybeJSONParse(self.__DYNAMIC_CSS_MANIFEST),
// Edge pages are always dynamic so prefetch inlining hints
// don't apply. The runtime handles missing hints gracefully.
prefetchHintsManifest: undefined,
interceptionRoutePatterns: ( interceptionRoutePatterns: (
maybeJSONParse(self.__INTERCEPTION_ROUTE_REWRITE_MANIFEST) ?? [] maybeJSONParse(self.__INTERCEPTION_ROUTE_REWRITE_MANIFEST) ?? []
).map((rewrite: any) => new RegExp(rewrite.regex)), ).map((rewrite: any) => new RegExp(rewrite.regex)),
...@@ -295,6 +300,7 @@ export abstract class RouteModule< ...@@ -295,6 +300,7 @@ export abstract class RouteModule<
serverFilesManifest, serverFilesManifest,
buildId, buildId,
dynamicCssManifest, dynamicCssManifest,
prefetchHintsManifest,
] = [ ] = [
loadManifestFromRelativePath<DevRoutesManifest>({ loadManifestFromRelativePath<DevRoutesManifest>({
projectDir, projectDir,
...@@ -388,6 +394,15 @@ export abstract class RouteModule< ...@@ -388,6 +394,15 @@ export abstract class RouteModule<
shouldCache: !this.isDev, shouldCache: !this.isDev,
handleMissing: true, handleMissing: true,
}), }),
router === 'app'
? loadManifestFromRelativePath<Record<string, any>>({
projectDir,
distDir: this.distDir,
manifest: `server/${PREFETCH_HINTS}`,
shouldCache: !this.isDev,
handleMissing: true,
})
: undefined,
] ]
result = { result = {
...@@ -404,6 +419,7 @@ export abstract class RouteModule< ...@@ -404,6 +419,7 @@ export abstract class RouteModule<
serverActionsManifest, serverActionsManifest,
subresourceIntegrityManifest, subresourceIntegrityManifest,
dynamicCssManifest, dynamicCssManifest,
prefetchHintsManifest,
interceptionRoutePatterns: routesManifest.rewrites.beforeFiles interceptionRoutePatterns: routesManifest.rewrites.beforeFiles
.filter(isInterceptionRouteRewrite) .filter(isInterceptionRouteRewrite)
.map((rewrite) => new RegExp(rewrite.regex)), .map((rewrite) => new RegExp(rewrite.regex)),
...@@ -617,6 +633,7 @@ export abstract class RouteModule< ...@@ -617,6 +633,7 @@ export abstract class RouteModule<
clientReferenceManifest?: any clientReferenceManifest?: any
serverActionsManifest?: any serverActionsManifest?: any
dynamicCssManifest?: any dynamicCssManifest?: any
prefetchHintsManifest?: Record<string, any>
subresourceIntegrityManifest?: DeepReadonly<Record<string, string>> subresourceIntegrityManifest?: DeepReadonly<Record<string, string>>
isOnDemandRevalidate: boolean isOnDemandRevalidate: boolean
revalidateOnlyGenerated: boolean revalidateOnlyGenerated: boolean
......
export const runtime = 'edge'
export default function DynamicEdgePage() {
return (
<>
<p id="page-dynamic-edge">Dynamic edge page</p>
<p id="page-dynamic-edge-value">{Math.random()}</p>
</>
)
}
import { cookies } from 'next/headers'
export default async function DynamicPage() {
// Force dynamic rendering by reading cookies
await cookies()
return (
<>
<p id="page-dynamic">Dynamic page</p>
<p id="page-dynamic-value">{Math.random()}</p>
</>
)
}
import { LinkAccordion } from '../components/link-accordion'
export default function RootLayout({
children,
}: {
children: React.ReactNode
}) {
return (
<html>
<body>
<ul>
<li>
<LinkAccordion href="/static-page">Static page</LinkAccordion>
</li>
<li>
<LinkAccordion href="/dynamic-page" prefetch={true}>
Dynamic page
</LinkAccordion>
</li>
<li>
<LinkAccordion href="/dynamic-edge" prefetch={true}>
Dynamic edge
</LinkAccordion>
</li>
</ul>
{children}
</body>
</html>
)
}
export default function Page() {
return <p id="home">Home</p>
}
export default function StaticPage() {
return <p id="page-static">Static page</p>
}
'use client'
import Link, { type LinkProps } from 'next/link'
import { useState } from 'react'
export function LinkAccordion({
href,
prefetch,
children,
}: {
href: LinkProps['href']
prefetch?: boolean
children: React.ReactNode
}) {
const [isVisible, setIsVisible] = useState(false)
return (
<>
<input
type="checkbox"
checked={isVisible}
onChange={() => setIsVisible(!isVisible)}
data-link-accordion={href}
/>
{isVisible ? (
<Link href={href} prefetch={prefetch}>
{children}
</Link>
) : (
`${children} (link is hidden)`
)}
</>
)
}
/**
* @type {import('next').NextConfig}
*/
const nextConfig = {
cacheComponents: false,
experimental: {
prefetchInlining: true,
cachedNavigations: false,
},
}
module.exports = nextConfig
import type * as Playwright from 'playwright'
import { nextTestSetup } from 'e2e-utils'
import { createRouterAct } from 'router-act'
describe('prefetch inlining without cacheComponents', () => {
const { next, isNextDev } = nextTestSetup({
files: __dirname,
})
if (isNextDev) {
it('prefetch hints are only computed during build', () => {})
return
}
it('static page is prefetched with inlining', async () => {
// Static pages always have hints computed during the build, regardless
// of cacheComponents. Inlining should work normally.
let page: Playwright.Page
const browser = await next.browser('/', {
beforePageLoad(p: Playwright.Page) {
page = p
},
})
const act = createRouterAct(page!)
await act(
async () => {
await browser
.elementByCss('input[data-link-accordion="/static-page"]')
.click()
},
{ includes: 'Static page' }
)
await act(async () => {
await browser.elementByCss('a[href="/static-page"]').click()
}, 'no-requests')
expect(await browser.elementByCss('#page-static').text()).toBe(
'Static page'
)
})
it('dynamic page is fully prefetched with prefetch={true}', async () => {
// Without cacheComponents, dynamic pages have no static shell and
// therefore no prerender pass to compute inlining hints. With
// prefetch={true} on the Link, the client should still fully prefetch
// the dynamic page content.
let page: Playwright.Page
const browser = await next.browser('/', {
beforePageLoad(p: Playwright.Page) {
page = p
},
})
const act = createRouterAct(page!)
await act(
async () => {
await browser
.elementByCss('input[data-link-accordion="/dynamic-page"]')
.click()
},
{ includes: 'Dynamic page' }
)
await act(async () => {
await browser.elementByCss('a[href="/dynamic-page"]').click()
}, 'no-requests')
expect(await browser.elementByCss('#page-dynamic').text()).toBe(
'Dynamic page'
)
})
it('dynamic edge page is fully prefetched with prefetch={true}', async () => {
// Edge runtime forces pages to be dynamic. Same as the non-edge
// dynamic case: with prefetch={true}, the page content should be
// fully prefetched before navigation.
let page: Playwright.Page
const browser = await next.browser('/', {
beforePageLoad(p: Playwright.Page) {
page = p
},
})
const act = createRouterAct(page!)
await act(
async () => {
await browser
.elementByCss('input[data-link-accordion="/dynamic-edge"]')
.click()
},
{ includes: 'Dynamic edge page' }
)
await act(async () => {
await browser.elementByCss('a[href="/dynamic-edge"]').click()
}, 'no-requests')
expect(await browser.elementByCss('#page-dynamic-edge').text()).toBe(
'Dynamic edge page'
)
})
})
import { revalidatePath } from 'next/cache'
import { NextRequest, NextResponse } from 'next/server'
export async function GET(req: NextRequest) {
const path = req.nextUrl.searchParams.get('path') || '/'
try {
revalidatePath(path)
return NextResponse.json({ revalidated: true, path })
} catch {
return NextResponse.json({ revalidated: false, path }, { status: 500 })
}
}
import { ReactNode } from 'react'
export default function OnDemandRevalidateLayout({
children,
}: {
children: ReactNode
}) {
return <div>{children}</div>
}
import { cacheLife } from 'next/cache'
async function CachedValue() {
'use cache'
cacheLife({ stale: 120 })
return <p id="page-on-demand-revalidate-value">{Math.random()}</p>
}
export default function OnDemandRevalidatePage() {
return (
<>
<p id="page-on-demand-revalidate">On-demand revalidate page</p>
<CachedValue />
</>
)
}
import type * as Playwright from 'playwright' import type * as Playwright from 'playwright'
import { nextTestSetup } from 'e2e-utils' import { nextTestSetup } from 'e2e-utils'
import { retry } from 'next-test-utils'
import { createRouterAct } from 'router-act' import { createRouterAct } from 'router-act'
// Bit values from PrefetchHint enum (const enum, so we duplicate values here) // Bit values from PrefetchHint enum (const enum, so we duplicate values here)
...@@ -233,6 +234,52 @@ describe('prefetch inlining', () => { ...@@ -233,6 +234,52 @@ describe('prefetch inlining', () => {
) )
}) })
it('preserves prefetch hints after on-demand revalidation', async () => {
const beforeTree = await fetchRouteTreePrefetch(
next,
'/test-on-demand-revalidate'
)
expect(renderInliningTree(beforeTree.tree)).toMatchInlineSnapshot(`
"
⇣ root
⇣ └── "test-on-demand-revalidate"
outlined ■ └── "__PAGE__" (+metadata)
"
`)
const before$ = await next.render$('/test-on-demand-revalidate')
const beforeValue = before$('#page-on-demand-revalidate-value').text()
expect(beforeValue).toMatch(/^0\.\d+$/)
const revalidateRes = await next.fetch(
'/api/revalidate-path?path=/test-on-demand-revalidate'
)
expect(revalidateRes.status).toBe(200)
expect(await revalidateRes.json()).toEqual({
revalidated: true,
path: '/test-on-demand-revalidate',
})
await retry(
async () => {
const $ = await next.render$('/test-on-demand-revalidate')
const afterValue = $('#page-on-demand-revalidate-value').text()
expect(afterValue).toMatch(/^0\.\d+$/)
expect(afterValue).not.toBe(beforeValue)
},
15000,
1000
)
const afterTree = await fetchRouteTreePrefetch(
next,
'/test-on-demand-revalidate'
)
expect(renderInliningTree(afterTree.tree)).toBe(
renderInliningTree(beforeTree.tree)
)
})
it('parallel routes: parent inlines into one slot only', async () => { it('parallel routes: parent inlines into one slot only', async () => {
// Layout with two parallel slots (children + @sidebar), all small. The // Layout with two parallel slots (children + @sidebar), all small. The
// layout can only be inlined into one child — the first slot that // layout can only be inlined into one child — the first slot that
......
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