@@ -71,7 +71,7 @@ export function updateCacheNodeOnNavigation(
71
71
oldRouterState : FlightRouterState ,
72
72
newRouterState : FlightRouterState ,
73
73
prefetchData : CacheNodeSeedData | null ,
74
- prefetchHead : HeadData ,
74
+ prefetchHead : HeadData | null ,
75
75
isPrefetchHeadPartial : boolean
76
76
) : Task | null {
77
77
// Diff the old and new trees to reuse the shared layouts.
@@ -286,7 +286,7 @@ export function updateCacheNodeOnNavigation(
286
286
function createCacheNodeOnNavigation (
287
287
routerState : FlightRouterState ,
288
288
prefetchData : CacheNodeSeedData | null ,
289
- possiblyPartialPrefetchHead : HeadData ,
289
+ possiblyPartialPrefetchHead : HeadData | null ,
290
290
isPrefetchHeadPartial : boolean
291
291
) : Task {
292
292
// Same traversal as updateCacheNodeNavigation, but we switch to this path
@@ -387,7 +387,10 @@ function createCacheNodeOnNavigation(
387
387
// `prefetchRsc` field.
388
388
rsc,
389
389
prefetchRsc : null ,
390
- head : isLeafSegment ? possiblyPartialPrefetchHead : [ null , null ] ,
390
+ head : ( isLeafSegment ? possiblyPartialPrefetchHead : null ) ?? [
391
+ null ,
392
+ null ,
393
+ ] ,
391
394
prefetchHead : null ,
392
395
loading,
393
396
parallelRoutes : cacheNodeChildren ,
@@ -422,7 +425,7 @@ function patchRouterStateWithNewChildren(
422
425
function spawnPendingTask (
423
426
routerState : FlightRouterState ,
424
427
prefetchData : CacheNodeSeedData | null ,
425
- prefetchHead : React . ReactNode | null ,
428
+ prefetchHead : HeadData | null ,
426
429
isPrefetchHeadPartial : boolean
427
430
) : Task {
428
431
// Create a task that will later be fulfilled by data from the server.
@@ -645,7 +648,7 @@ function finishTaskUsingDynamicDataPayload(
645
648
function createPendingCacheNode (
646
649
routerState : FlightRouterState ,
647
650
prefetchData : CacheNodeSeedData | null ,
648
- prefetchHead : React . ReactNode | null ,
651
+ prefetchHead : HeadData | null ,
649
652
isPrefetchHeadPartial : boolean
650
653
) : ReadyCacheNode {
651
654
const routerStateChildren = routerState [ 1 ]
@@ -685,7 +688,7 @@ function createPendingCacheNode(
685
688
parallelRoutes : parallelRoutes ,
686
689
687
690
prefetchRsc : maybePrefetchRsc !== undefined ? maybePrefetchRsc : null ,
688
- prefetchHead : isLeafSegment ? prefetchHead : null ,
691
+ prefetchHead : isLeafSegment ? prefetchHead : [ null , null ] ,
689
692
690
693
// TODO: Technically, a loading boundary could contain dynamic data. We must
691
694
// have separate `loading` and `prefetchLoading` fields to handle this, like
@@ -940,7 +943,7 @@ export function updateCacheNodeOnPopstateRestoration(
940
943
rsc,
941
944
head : oldCacheNode . head ,
942
945
943
- prefetchHead : shouldUsePrefetch ? oldCacheNode . prefetchHead : null ,
946
+ prefetchHead : shouldUsePrefetch ? oldCacheNode . prefetchHead : [ null , null ] ,
944
947
prefetchRsc : shouldUsePrefetch ? oldCacheNode . prefetchRsc : null ,
945
948
loading : oldCacheNode . loading ,
946
949
0 commit comments