Skip to content

Commit 6460215

Browse files
committed
fix: no hanging _validation outlet if no validation is performed
1 parent 2435776 commit 6460215

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

packages/next/src/server/app-render/app-render.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2670,8 +2670,9 @@ async function renderToStream(
26702670
// We only have a Prerender environment for projects opted into cacheComponents
26712671
cacheComponents
26722672
) {
2673-
const [resolveValidation, validationOutlet] = createValidationOutlet()
2673+
let validationOutlet: Promise<ReactNode> | undefined
26742674
let debugChannel: DebugChannelPair | undefined
2675+
26752676
const getPayload = async (
26762677
// eslint-disable-next-line @typescript-eslint/no-shadow
26772678
requestStore: RequestStore
@@ -2695,7 +2696,7 @@ async function renderToStream(
26952696
payload._bypassCachesInDev = createElement(WarnForBypassCachesInDev, {
26962697
route: workStore.route,
26972698
})
2698-
} else {
2699+
} else if (validationOutlet) {
26992700
// Placing the validation outlet in the payload is safe
27002701
// even if we end up discarding a render and restarting,
27012702
// because we're not going to wait for the stream to complete,
@@ -2714,6 +2715,9 @@ async function renderToStream(
27142715
// "disable cache" in devtools or a hard refresh (cache-control: "no-store")
27152716
!isBypassingCachesInDev(renderOpts, requestStore)
27162717
) {
2718+
const [resolveValidation, _validationOutlet] = createValidationOutlet()
2719+
validationOutlet = _validationOutlet
2720+
27172721
const {
27182722
stream: serverStream,
27192723
staticChunks,

0 commit comments

Comments
 (0)