Skip to content

Commit a44bc74

Browse files
committed
fix: prefer undefined for prefetch route
1 parent 724ba03 commit a44bc74

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

packages/next/src/build/index.ts

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2791,12 +2791,9 @@ export default async function build(
27912791
}
27922792

27932793
let prefetchDataRoute: string | null | undefined
2794-
if (isRouteHandler) {
2795-
prefetchDataRoute = null
2796-
}
27972794
// We write the `.prefetch.rsc` when the app has PPR enabled, so
27982795
// always add the prefetch data route to the manifest.
2799-
else if (experimentalPPR) {
2796+
if (!isRouteHandler && experimentalPPR) {
28002797
prefetchDataRoute = path.posix.join(
28012798
`${normalizedRoute}${RSC_PREFETCH_SUFFIX}`
28022799
)
@@ -2866,13 +2863,11 @@ export default async function build(
28662863
dataRoute = path.posix.join(`${normalizedRoute}${RSC_SUFFIX}`)
28672864
}
28682865

2869-
let prefetchDataRoute: string | null | undefined
2870-
if (isRouteHandler) {
2871-
prefetchDataRoute = null
2872-
}
2866+
let prefetchDataRoute: string | undefined
2867+
28732868
// We write the `.prefetch.rsc` when the app has PPR enabled, so
28742869
// always add the prefetch data route to the manifest.
2875-
else if (isAppPPREnabled) {
2870+
if (!isRouteHandler && isAppPPREnabled) {
28762871
prefetchDataRoute = path.posix.join(
28772872
`${normalizedRoute}${RSC_PREFETCH_SUFFIX}`
28782873
)

0 commit comments

Comments
 (0)