Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1073,6 +1073,14 @@ function createCacheNodeForSegment(
doesSegmentNeedDynamicRequest = isCachedRscPartial
}

if (isCachedRscPartial) {
// Partial prefetch payloads may include unresolved thenables that never
// resolve during prefetch. We must not render them as initial UI, or a
// Suspense boundary can remain stuck in its fallback indefinitely. Only
// the dynamic response should fulfill missing data.
prefetchRsc = null
}

// If this is a page segment, we need to do the same for the head. This
// follows analogous logic to the segment data above.
// TODO: We don't need to store the head on the page segment's CacheNode; we
Expand All @@ -1082,10 +1090,10 @@ function createCacheNodeForSegment(
let prefetchHead: HeadData | null = null
let head: React.ReactNode | null = null
let doesHeadNeedDynamicRequest: boolean = isPage
let isCachedHeadPartial: boolean = true

if (isPage) {
let cachedHead: HeadData | null = null
let isCachedHeadPartial: boolean = true
if (metadataVaryPath !== null) {
const metadataEntry = readSegmentCacheEntry(now, metadataVaryPath)
if (metadataEntry !== null) {
Expand Down Expand Up @@ -1154,6 +1162,12 @@ function createCacheNodeForSegment(
}
}

if (isPage && isCachedHeadPartial) {
// Same rationale as prefetchRsc: avoid rendering partial head data that may
// contain unresolved thenables.
prefetchHead = null
}

// Now that we're creating a new segment, write its data to the BFCache. A
// subsequent back/forward navigation will reuse this same data, until or
// unless it's cleared by a refresh/revalidation.
Expand Down
Loading