diff --git a/packages/next/src/client/components/app-router.tsx b/packages/next/src/client/components/app-router.tsx
index d92dd93b6178d..45204a0e00a0b 100644
--- a/packages/next/src/client/components/app-router.tsx
+++ b/packages/next/src/client/components/app-router.tsx
@@ -145,7 +145,7 @@ export function createEmptyCacheNode(): CacheNode {
lazyData: null,
rsc: null,
prefetchRsc: null,
- head: [null, null],
+ head: null,
prefetchHead: null,
parallelRoutes: new Map(),
loading: null,
diff --git a/packages/next/src/client/components/layout-router.tsx b/packages/next/src/client/components/layout-router.tsx
index d458bc57efcda..5e206a56e892d 100644
--- a/packages/next/src/client/components/layout-router.tsx
+++ b/packages/next/src/client/components/layout-router.tsx
@@ -549,7 +549,7 @@ export default function OuterLayoutRouter({
lazyData: null,
rsc: null,
prefetchRsc: null,
- head: [null, null],
+ head: null,
prefetchHead: null,
parallelRoutes: new Map(),
loading: null,
diff --git a/packages/next/src/client/components/router-reducer/aliased-prefetch-navigations.ts b/packages/next/src/client/components/router-reducer/aliased-prefetch-navigations.ts
index 71508d91f1dad..10e9dd3f8cc74 100644
--- a/packages/next/src/client/components/router-reducer/aliased-prefetch-navigations.ts
+++ b/packages/next/src/client/components/router-reducer/aliased-prefetch-navigations.ts
@@ -172,7 +172,7 @@ function fillNewTreeWithOnlyLoadingSegments(
// copy the layout but null the page segment as that's not meant to be used
rsc: segmentForParallelRoute.includes(PAGE_SEGMENT_KEY) ? null : rsc,
prefetchRsc: null,
- head: [null, null],
+ head: null,
prefetchHead: null,
parallelRoutes: new Map(),
loading,
@@ -184,7 +184,7 @@ function fillNewTreeWithOnlyLoadingSegments(
lazyData: null,
rsc: null,
prefetchRsc: null,
- head: [null, null],
+ head: null,
prefetchHead: null,
parallelRoutes: new Map(),
loading: null,
diff --git a/packages/next/src/client/components/router-reducer/clear-cache-node-data-for-segment-path.test.tsx b/packages/next/src/client/components/router-reducer/clear-cache-node-data-for-segment-path.test.tsx
index 58209269c89ba..c8f314d8664bf 100644
--- a/packages/next/src/client/components/router-reducer/clear-cache-node-data-for-segment-path.test.tsx
+++ b/packages/next/src/client/components/router-reducer/clear-cache-node-data-for-segment-path.test.tsx
@@ -16,7 +16,7 @@ describe('clearCacheNodeDataForSegmentPath', () => {
lazyData: null,
rsc: null,
prefetchRsc: null,
- head: [null, null],
+ head: null,
prefetchHead: null,
parallelRoutes: new Map(),
loading: null,
@@ -25,7 +25,7 @@ describe('clearCacheNodeDataForSegmentPath', () => {
lazyData: null,
rsc: <>Root layout>,
prefetchRsc: null,
- head: [null, null],
+ head: null,
prefetchHead: null,
loading: null,
parallelRoutes: new Map([
@@ -38,7 +38,7 @@ describe('clearCacheNodeDataForSegmentPath', () => {
lazyData: null,
rsc: <>Linking>,
prefetchRsc: null,
- head: [null, null],
+ head: null,
prefetchHead: null,
loading: null,
parallelRoutes: new Map([
@@ -51,7 +51,7 @@ describe('clearCacheNodeDataForSegmentPath', () => {
lazyData: null,
rsc: <>Page>,
prefetchRsc: null,
- head: [null, null],
+ head: null,
prefetchHead: null,
parallelRoutes: new Map(),
loading: null,
@@ -71,28 +71,19 @@ describe('clearCacheNodeDataForSegmentPath', () => {
expect(cache).toMatchInlineSnapshot(`
{
- "head": [
- null,
- null,
- ],
+ "head": null,
"lazyData": null,
"loading": null,
"parallelRoutes": Map {
"children" => Map {
"linking" => {
- "head": [
- null,
- null,
- ],
+ "head": null,
"lazyData": null,
"loading": null,
"parallelRoutes": Map {
"children" => Map {
"" => {
- "head": [
- null,
- null,
- ],
+ "head": null,
"lazyData": null,
"loading": null,
"parallelRoutes": Map {},
@@ -111,10 +102,7 @@ describe('clearCacheNodeDataForSegmentPath', () => {
,
},
"dashboard" => {
- "head": [
- null,
- null,
- ],
+ "head": null,
"lazyData": null,
"loading": null,
"parallelRoutes": Map {},
diff --git a/packages/next/src/client/components/router-reducer/clear-cache-node-data-for-segment-path.ts b/packages/next/src/client/components/router-reducer/clear-cache-node-data-for-segment-path.ts
index d873ba9183be5..4457d3b3d11e4 100644
--- a/packages/next/src/client/components/router-reducer/clear-cache-node-data-for-segment-path.ts
+++ b/packages/next/src/client/components/router-reducer/clear-cache-node-data-for-segment-path.ts
@@ -40,7 +40,7 @@ export function clearCacheNodeDataForSegmentPath(
lazyData: null,
rsc: null,
prefetchRsc: null,
- head: [null, null],
+ head: null,
prefetchHead: null,
parallelRoutes: new Map(),
loading: null,
@@ -56,7 +56,7 @@ export function clearCacheNodeDataForSegmentPath(
lazyData: null,
rsc: null,
prefetchRsc: null,
- head: [null, null],
+ head: null,
prefetchHead: null,
parallelRoutes: new Map(),
loading: null,
diff --git a/packages/next/src/client/components/router-reducer/create-initial-router-state.test.tsx b/packages/next/src/client/components/router-reducer/create-initial-router-state.test.tsx
index 6e64d7e5d8ede..4a0e5e6804eb0 100644
--- a/packages/next/src/client/components/router-reducer/create-initial-router-state.test.tsx
+++ b/packages/next/src/client/components/router-reducer/create-initial-router-state.test.tsx
@@ -32,9 +32,7 @@ describe('createInitialRouterState', () => {
const initialParallelRoutes: CacheNode['parallelRoutes'] = new Map()
const state = createInitialRouterState({
- initialFlightData: [
- [initialTree, ['', children, {}, null],
Test],
- ],
+ initialFlightData: [[initialTree, ['', children, {}, null]]],
initialCanonicalUrlParts: initialCanonicalUrl.split('/'),
initialParallelRoutes,
location: new URL('/linking', 'https://localhost') as any,
@@ -44,9 +42,7 @@ describe('createInitialRouterState', () => {
})
const state2 = createInitialRouterState({
- initialFlightData: [
- [initialTree, ['', children, {}, null], Test],
- ],
+ initialFlightData: [[initialTree, ['', children, {}, null]]],
initialCanonicalUrlParts: initialCanonicalUrl.split('/'),
initialParallelRoutes,
location: new URL('/linking', 'https://localhost') as any,
@@ -59,7 +55,7 @@ describe('createInitialRouterState', () => {
lazyData: null,
rsc: children,
prefetchRsc: null,
- head: [null, null],
+ head: null,
prefetchHead: null,
loading: null,
parallelRoutes: new Map([
@@ -81,7 +77,7 @@ describe('createInitialRouterState', () => {
prefetchRsc: null,
parallelRoutes: new Map(),
loading: null,
- head: [null, Test],
+ head: null,
prefetchHead: null,
},
],
@@ -91,7 +87,7 @@ describe('createInitialRouterState', () => {
lazyData: null,
rsc: null,
prefetchRsc: null,
- head: [null, null],
+ head: null,
prefetchHead: null,
loading: null,
},
diff --git a/packages/next/src/client/components/router-reducer/create-initial-router-state.ts b/packages/next/src/client/components/router-reducer/create-initial-router-state.ts
index 5aa9de82262e6..bcbe767e39a40 100644
--- a/packages/next/src/client/components/router-reducer/create-initial-router-state.ts
+++ b/packages/next/src/client/components/router-reducer/create-initial-router-state.ts
@@ -48,7 +48,7 @@ export function createInitialRouterState({
lazyData: null,
rsc,
prefetchRsc: null,
- head: [null, null],
+ head: null,
prefetchHead: null,
// The cache gets seeded during the first render. `initialParallelRoutes` ensures the cache from the first render is there during the second render.
parallelRoutes: isServer ? new Map() : initialParallelRoutes,
diff --git a/packages/next/src/client/components/router-reducer/fill-cache-with-new-subtree-data.test.tsx b/packages/next/src/client/components/router-reducer/fill-cache-with-new-subtree-data.test.tsx
index cb08fb9acbda3..252579f147217 100644
--- a/packages/next/src/client/components/router-reducer/fill-cache-with-new-subtree-data.test.tsx
+++ b/packages/next/src/client/components/router-reducer/fill-cache-with-new-subtree-data.test.tsx
@@ -10,7 +10,7 @@ const getFlightData = (): NormalizedFlightData[] => {
segment: 'about',
tree: ['about', { children: ['', {}] }],
seedData: ['about', SubTreeData Injected!
, {}, null, false],
- head: [null, 'Head Injected!'],
+ head: null,
isHeadPartial: false,
isRootRender: false,
},
@@ -23,7 +23,7 @@ describe('fillCacheWithNewSubtreeData', () => {
lazyData: null,
rsc: null,
prefetchRsc: null,
- head: [null, null],
+ head: null,
prefetchHead: null,
loading: null,
parallelRoutes: new Map(),
@@ -32,7 +32,7 @@ describe('fillCacheWithNewSubtreeData', () => {
lazyData: null,
rsc: <>Root layout>,
prefetchRsc: null,
- head: [null, null],
+ head: null,
prefetchHead: null,
loading: null,
parallelRoutes: new Map([
@@ -45,7 +45,7 @@ describe('fillCacheWithNewSubtreeData', () => {
lazyData: null,
rsc: <>Linking>,
prefetchRsc: null,
- head: [null, null],
+ head: null,
prefetchHead: null,
loading: null,
parallelRoutes: new Map([
@@ -58,7 +58,7 @@ describe('fillCacheWithNewSubtreeData', () => {
lazyData: null,
rsc: <>Page>,
prefetchRsc: null,
- head: [null, null],
+ head: null,
prefetchHead: null,
loading: null,
parallelRoutes: new Map(),
@@ -89,7 +89,7 @@ describe('fillCacheWithNewSubtreeData', () => {
lazyData: null,
rsc: null,
prefetchRsc: null,
- head: [null, null],
+ head: null,
prefetchHead: null,
loading: null,
parallelRoutes: new Map([
@@ -102,7 +102,7 @@ describe('fillCacheWithNewSubtreeData', () => {
lazyData: null,
rsc: <>Linking>,
prefetchRsc: null,
- head: [null, null],
+ head: null,
prefetchHead: null,
loading: null,
parallelRoutes: new Map([
@@ -116,7 +116,7 @@ describe('fillCacheWithNewSubtreeData', () => {
lazyData: null,
rsc: <>Page>,
prefetchRsc: null,
- head: [null, null],
+ head: null,
prefetchHead: null,
loading: null,
parallelRoutes: new Map(),
@@ -126,7 +126,7 @@ describe('fillCacheWithNewSubtreeData', () => {
'about',
{
lazyData: null,
- head: [null, null],
+ head: null,
prefetchHead: null,
loading: null,
parallelRoutes: new Map([
@@ -142,12 +142,7 @@ describe('fillCacheWithNewSubtreeData', () => {
parallelRoutes: new Map(),
prefetchHead: null,
loading: null,
- head: [
- null,
- <>
- Head Injected!
- >,
- ],
+ head: null,
},
],
]),
diff --git a/packages/next/src/client/components/router-reducer/fill-cache-with-new-subtree-data.ts b/packages/next/src/client/components/router-reducer/fill-cache-with-new-subtree-data.ts
index 7b3fab128f9ed..79b67fb0c8257 100644
--- a/packages/next/src/client/components/router-reducer/fill-cache-with-new-subtree-data.ts
+++ b/packages/next/src/client/components/router-reducer/fill-cache-with-new-subtree-data.ts
@@ -71,7 +71,7 @@ function fillCacheHelper(
rsc:
fillLazyItems || incomingSegment !== PAGE_SEGMENT_KEY ? rsc : null,
prefetchRsc: null,
- head: [null, null],
+ head: null,
prefetchHead: null,
loading,
parallelRoutes:
diff --git a/packages/next/src/client/components/router-reducer/fill-lazy-items-till-leaf-with-head.test.tsx b/packages/next/src/client/components/router-reducer/fill-lazy-items-till-leaf-with-head.test.tsx
index 1051a41691bdc..75cf1e6fb5e7e 100644
--- a/packages/next/src/client/components/router-reducer/fill-lazy-items-till-leaf-with-head.test.tsx
+++ b/packages/next/src/client/components/router-reducer/fill-lazy-items-till-leaf-with-head.test.tsx
@@ -39,7 +39,7 @@ describe('fillLazyItemsTillLeafWithHead', () => {
lazyData: null,
rsc: null,
prefetchRsc: null,
- head: [null, null],
+ head: null,
prefetchHead: null,
parallelRoutes: new Map(),
loading: null,
@@ -48,7 +48,7 @@ describe('fillLazyItemsTillLeafWithHead', () => {
lazyData: null,
rsc: <>Root layout>,
prefetchRsc: null,
- head: [null, null],
+ head: null,
prefetchHead: null,
loading: null,
parallelRoutes: new Map([
@@ -61,7 +61,7 @@ describe('fillLazyItemsTillLeafWithHead', () => {
lazyData: null,
rsc: <>Linking>,
prefetchRsc: null,
- head: [null, null],
+ head: null,
prefetchHead: null,
loading: null,
parallelRoutes: new Map([
@@ -74,7 +74,7 @@ describe('fillLazyItemsTillLeafWithHead', () => {
lazyData: null,
rsc: <>Page>,
prefetchRsc: null,
- head: [null, null],
+ head: null,
prefetchHead: null,
loading: null,
parallelRoutes: new Map(),
@@ -114,7 +114,7 @@ describe('fillLazyItemsTillLeafWithHead', () => {
lazyData: null,
rsc: null,
prefetchRsc: null,
- head: [null, null],
+ head: null,
prefetchHead: null,
loading: null,
parallelRoutes: new Map([
@@ -127,7 +127,7 @@ describe('fillLazyItemsTillLeafWithHead', () => {
lazyData: null,
rsc: null,
prefetchRsc: null,
- head: [null, null],
+ head: null,
prefetchHead: null,
loading: null,
parallelRoutes: new Map([
@@ -152,12 +152,7 @@ describe('fillLazyItemsTillLeafWithHead', () => {
prefetchHead: null,
loading: null,
parallelRoutes: new Map(),
- head: [
- null,
- <>
- About page!
- >,
- ],
+ head: null,
},
],
]),
@@ -165,7 +160,7 @@ describe('fillLazyItemsTillLeafWithHead', () => {
]),
rsc: null,
prefetchRsc: null,
- head: [null, null],
+ head: null,
prefetchHead: null,
},
],
@@ -175,7 +170,7 @@ describe('fillLazyItemsTillLeafWithHead', () => {
lazyData: null,
rsc: <>Page>,
prefetchRsc: null,
- head: [null, null],
+ head: null,
prefetchHead: null,
loading: null,
parallelRoutes: new Map(),
diff --git a/packages/next/src/client/components/router-reducer/fill-lazy-items-till-leaf-with-head.ts b/packages/next/src/client/components/router-reducer/fill-lazy-items-till-leaf-with-head.ts
index 7ea472353a467..4b55287e50ccf 100644
--- a/packages/next/src/client/components/router-reducer/fill-lazy-items-till-leaf-with-head.ts
+++ b/packages/next/src/client/components/router-reducer/fill-lazy-items-till-leaf-with-head.ts
@@ -1,7 +1,4 @@
-import type {
- CacheNode,
- HeadData,
-} from '../../../shared/lib/app-router-context.shared-runtime'
+import type { CacheNode } from '../../../shared/lib/app-router-context.shared-runtime'
import type {
FlightRouterState,
CacheNodeSeedData,
@@ -17,7 +14,7 @@ export function fillLazyItemsTillLeafWithHead(
existingCache: CacheNode | undefined,
routerState: FlightRouterState,
cacheNodeSeedData: CacheNodeSeedData | null,
- head: HeadData,
+ head: React.ReactNode,
prefetchEntry: PrefetchCacheEntry | undefined
): void {
const isLastSegment = Object.keys(routerState[1]).length === 0
@@ -69,7 +66,7 @@ export function fillLazyItemsTillLeafWithHead(
// `prefetchRsc`. As an incremental step, we'll just de-opt to the
// old behavior — no PPR value.
prefetchRsc: null,
- head: [null, null],
+ head: null,
prefetchHead: null,
loading,
parallelRoutes: new Map(existingCacheNode?.parallelRoutes),
@@ -96,7 +93,7 @@ export function fillLazyItemsTillLeafWithHead(
lazyData: null,
rsc: null,
prefetchRsc: null,
- head: [null, null],
+ head: null,
prefetchHead: null,
parallelRoutes: new Map(existingCacheNode?.parallelRoutes),
loading: null,
@@ -129,7 +126,7 @@ export function fillLazyItemsTillLeafWithHead(
lazyData: null,
rsc: seedNode,
prefetchRsc: null,
- head: [null, null],
+ head: null,
prefetchHead: null,
parallelRoutes: new Map(),
loading,
@@ -141,7 +138,7 @@ export function fillLazyItemsTillLeafWithHead(
lazyData: null,
rsc: null,
prefetchRsc: null,
- head: [null, null],
+ head: null,
prefetchHead: null,
parallelRoutes: new Map(),
loading: null,
diff --git a/packages/next/src/client/components/router-reducer/invalidate-cache-below-flight-segmentpath.test.tsx b/packages/next/src/client/components/router-reducer/invalidate-cache-below-flight-segmentpath.test.tsx
index 557517254a27e..daebf2cad1417 100644
--- a/packages/next/src/client/components/router-reducer/invalidate-cache-below-flight-segmentpath.test.tsx
+++ b/packages/next/src/client/components/router-reducer/invalidate-cache-below-flight-segmentpath.test.tsx
@@ -12,7 +12,7 @@ const getFlightData = (): NormalizedFlightData[] => {
segment: 'about',
tree: ['about', { children: ['', {}] }],
seedData: ['about', About Page!
, {}, null, false],
- head: [null, 'About page!'],
+ head: null,
isHeadPartial: false,
isRootRender: false,
},
@@ -25,7 +25,7 @@ describe('invalidateCacheBelowFlightSegmentPath', () => {
lazyData: null,
rsc: null,
prefetchRsc: null,
- head: [null, null],
+ head: null,
prefetchHead: null,
loading: null,
parallelRoutes: new Map(),
@@ -34,7 +34,7 @@ describe('invalidateCacheBelowFlightSegmentPath', () => {
lazyData: null,
rsc: <>Root layout>,
prefetchRsc: null,
- head: [null, null],
+ head: null,
prefetchHead: null,
loading: null,
parallelRoutes: new Map([
@@ -47,7 +47,7 @@ describe('invalidateCacheBelowFlightSegmentPath', () => {
lazyData: null,
rsc: <>Linking>,
prefetchRsc: null,
- head: [null, null],
+ head: null,
prefetchHead: null,
loading: null,
parallelRoutes: new Map([
@@ -60,7 +60,7 @@ describe('invalidateCacheBelowFlightSegmentPath', () => {
lazyData: null,
rsc: <>Page>,
prefetchRsc: null,
- head: [null, null],
+ head: null,
prefetchHead: null,
loading: null,
parallelRoutes: new Map(),
@@ -100,7 +100,7 @@ describe('invalidateCacheBelowFlightSegmentPath', () => {
const expectedCache: CacheNode = {
lazyData: null,
- head: [null, null],
+ head: null,
prefetchHead: null,
loading: null,
parallelRoutes: new Map([
@@ -111,7 +111,7 @@ describe('invalidateCacheBelowFlightSegmentPath', () => {
'linking',
{
lazyData: null,
- head: [null, null],
+ head: null,
prefetchHead: null,
loading: null,
parallelRoutes: new Map([
@@ -126,7 +126,7 @@ describe('invalidateCacheBelowFlightSegmentPath', () => {
parallelRoutes: new Map(),
rsc: Page,
prefetchRsc: null,
- head: [null, null],
+ head: null,
prefetchHead: null,
},
],
diff --git a/packages/next/src/client/components/router-reducer/invalidate-cache-by-router-state.test.tsx b/packages/next/src/client/components/router-reducer/invalidate-cache-by-router-state.test.tsx
index 79bd4de69b5ba..a8b63f95650d4 100644
--- a/packages/next/src/client/components/router-reducer/invalidate-cache-by-router-state.test.tsx
+++ b/packages/next/src/client/components/router-reducer/invalidate-cache-by-router-state.test.tsx
@@ -8,7 +8,7 @@ describe('invalidateCacheByRouterState', () => {
lazyData: null,
rsc: null,
prefetchRsc: null,
- head: [null, null],
+ head: null,
prefetchHead: null,
loading: null,
parallelRoutes: new Map(),
@@ -17,7 +17,7 @@ describe('invalidateCacheByRouterState', () => {
lazyData: null,
rsc: <>Root layout>,
prefetchRsc: null,
- head: [null, null],
+ head: null,
prefetchHead: null,
loading: null,
parallelRoutes: new Map([
@@ -30,7 +30,7 @@ describe('invalidateCacheByRouterState', () => {
lazyData: null,
rsc: <>Linking>,
prefetchRsc: null,
- head: [null, null],
+ head: null,
prefetchHead: null,
loading: null,
parallelRoutes: new Map([
@@ -43,7 +43,7 @@ describe('invalidateCacheByRouterState', () => {
lazyData: null,
rsc: <>Page>,
prefetchRsc: null,
- head: [null, null],
+ head: null,
prefetchHead: null,
loading: null,
parallelRoutes: new Map(),
@@ -85,7 +85,7 @@ describe('invalidateCacheByRouterState', () => {
lazyData: null,
rsc: null,
prefetchRsc: null,
- head: [null, null],
+ head: null,
prefetchHead: null,
loading: null,
parallelRoutes: new Map([['children', new Map()]]),
diff --git a/packages/next/src/client/components/router-reducer/ppr-navigations.ts b/packages/next/src/client/components/router-reducer/ppr-navigations.ts
index 8040663bb30be..b6c2da8b9488a 100644
--- a/packages/next/src/client/components/router-reducer/ppr-navigations.ts
+++ b/packages/next/src/client/components/router-reducer/ppr-navigations.ts
@@ -387,10 +387,7 @@ function createCacheNodeOnNavigation(
// `prefetchRsc` field.
rsc,
prefetchRsc: null,
- head: (isLeafSegment ? possiblyPartialPrefetchHead : null) ?? [
- null,
- null,
- ],
+ head: isLeafSegment ? possiblyPartialPrefetchHead : null,
prefetchHead: null,
loading,
parallelRoutes: cacheNodeChildren,
@@ -698,14 +695,7 @@ function createPendingCacheNode(
// Create a deferred promise. This will be fulfilled once the dynamic
// response is received from the server.
rsc: createDeferredRsc() as React.ReactNode,
- head: isLeafSegment
- ? [
- // TODO: change head back to ReactNode when metadata
- // is stably rendered in body
- createDeferredRsc() as React.ReactNode,
- null,
- ]
- : [null, null],
+ head: isLeafSegment ? (createDeferredRsc() as React.ReactNode) : null,
}
}
@@ -810,8 +800,8 @@ function finishPendingCacheNode(
// TODO: change head back to ReactNode when metadata
// is stably rendered in body
// Handle head[0] - viewport
- if (isDeferredRsc(head[0])) {
- head[0].resolve(dynamicHead[0])
+ if (isDeferredRsc(head)) {
+ head.resolve(dynamicHead)
}
}
diff --git a/packages/next/src/client/components/router-reducer/reducers/find-head-in-cache.test.tsx b/packages/next/src/client/components/router-reducer/reducers/find-head-in-cache.test.tsx
index 1d7b9fd8b8554..a9de82097ce99 100644
--- a/packages/next/src/client/components/router-reducer/reducers/find-head-in-cache.test.tsx
+++ b/packages/next/src/client/components/router-reducer/reducers/find-head-in-cache.test.tsx
@@ -1,4 +1,3 @@
-import React from 'react'
import type { FlightRouterState } from '../../../../server/app-render/types'
import type { CacheNode } from '../../../../shared/lib/app-router-context.shared-runtime'
import { findHeadInCache } from './find-head-in-cache'
@@ -29,7 +28,7 @@ describe('findHeadInCache', () => {
lazyData: null,
rsc: null,
prefetchRsc: null,
- head: [null, null],
+ head: null,
prefetchHead: null,
loading: null,
parallelRoutes: new Map([
@@ -42,7 +41,7 @@ describe('findHeadInCache', () => {
lazyData: null,
rsc: null,
prefetchRsc: null,
- head: [null, null],
+ head: null,
prefetchHead: null,
loading: null,
parallelRoutes: new Map([
@@ -53,7 +52,7 @@ describe('findHeadInCache', () => {
'about',
{
lazyData: null,
- head: [null, null],
+ head: null,
prefetchHead: null,
loading: null,
parallelRoutes: new Map([
@@ -69,12 +68,7 @@ describe('findHeadInCache', () => {
prefetchHead: null,
loading: null,
parallelRoutes: new Map(),
- head: [
- null,
- <>
- About page!
- >,
- ],
+ head: null,
},
],
]),
@@ -108,12 +102,7 @@ describe('findHeadInCache', () => {
expect(result).not.toBeNull()
const [cacheNode, key] = result!
- expect(cacheNode.head[0]).toBe(null)
- expect(cacheNode.head[1]).toMatchObject(
- <>
- About page!
- >
- )
+ expect(cacheNode.head).toBe(null)
expect(key).toBe('/linking/about/')
})
})
diff --git a/packages/next/src/client/components/segment-cache/cache.ts b/packages/next/src/client/components/segment-cache/cache.ts
index 9ad326824c015..0b27156d8e818 100644
--- a/packages/next/src/client/components/segment-cache/cache.ts
+++ b/packages/next/src/client/components/segment-cache/cache.ts
@@ -313,7 +313,7 @@ export function readOrCreateRouteCacheEntry(
status: EntryStatus.Empty,
blockedTasks: null,
tree: null,
- head: [null, null],
+ head: null,
isHeadPartial: true,
// Since this is an empty entry, there's no reason to ever evict it. It will
// be updated when the data is populated.
diff --git a/packages/next/src/client/flight-data-helpers.ts b/packages/next/src/client/flight-data-helpers.ts
index 5146fa246200b..e9f7045e3868d 100644
--- a/packages/next/src/client/flight-data-helpers.ts
+++ b/packages/next/src/client/flight-data-helpers.ts
@@ -32,7 +32,7 @@ export type NormalizedFlightData = {
export function getFlightDataPartsFromPath(
flightDataPath: FlightDataPath
): NormalizedFlightData {
- // Pick the last 4 items from the `FlightDataPath` to get the [tree, seedData, [viewport, metadata], isHeadPartial].
+ // Pick the last 4 items from the `FlightDataPath` to get the [tree, seedData, viewport, isHeadPartial].
const flightDataPathLength = 4
// tree, seedData, and head are *always* the last three items in the `FlightDataPath`.
const [tree, seedData, head, isHeadPartial] =
diff --git a/packages/next/src/server/app-render/types.ts b/packages/next/src/server/app-render/types.ts
index a79910edbb398..d91d27c8b5d68 100644
--- a/packages/next/src/server/app-render/types.ts
+++ b/packages/next/src/server/app-render/types.ts
@@ -6,7 +6,10 @@ import type { NextFontManifest } from '../../build/webpack/plugins/next-font-man
import type { ParsedUrlQuery } from 'querystring'
import type { AppPageModule } from '../route-modules/app-page/module'
import type { ExpireTime } from '../lib/revalidate'
-import type { LoadingModuleData } from '../../shared/lib/app-router-context.shared-runtime'
+import type {
+ HeadData,
+ LoadingModuleData,
+} from '../../shared/lib/app-router-context.shared-runtime'
import type { DeepReadonly } from '../../shared/lib/deep-readonly'
import type { __ApiPreviewProps } from '../api-utils'
@@ -131,7 +134,7 @@ export type FlightDataSegment = [
/* segment of the rendered slice: */ Segment,
/* treePatch */ FlightRouterState,
/* cacheNodeSeedData */ CacheNodeSeedData | null, // Can be null during prefetch if there's no loading component
- /* head: [viewport, metadata] */ [React.ReactNode, React.ReactNode],
+ /* head: viewport */ HeadData,
/* isHeadPartial */ boolean,
]
diff --git a/packages/next/src/shared/lib/app-router-context.shared-runtime.ts b/packages/next/src/shared/lib/app-router-context.shared-runtime.ts
index 41fd7533421e0..ff273f669bbc4 100644
--- a/packages/next/src/shared/lib/app-router-context.shared-runtime.ts
+++ b/packages/next/src/shared/lib/app-router-context.shared-runtime.ts
@@ -23,8 +23,8 @@ export type LoadingModuleData =
| [React.JSX.Element, React.ReactNode, React.ReactNode]
| null
-/** metadata cache nodes: [viewport, metadata] */
-export type HeadData = [React.ReactNode, React.ReactNode]
+/** viewport metadata node */
+export type HeadData = React.ReactNode
export type LazyCacheNode = {
/**