Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
1d285aef
Unverified
Commit
1d285aef
authored
Dec 20, 2024
by
Jiachi Liu
Committed by
GitHub
Dec 20, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[metadata] Align prefetch head type with head (#74161)
parent
eff54a38
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
11 deletions
+14
-11
ppr-navigations.ts
...t/src/client/components/router-reducer/ppr-navigations.ts
+10
-7
navigation.ts
...es/next/src/client/components/segment-cache/navigation.ts
+2
-2
app-router-context.shared-runtime.ts
.../next/src/shared/lib/app-router-context.shared-runtime.ts
+2
-2
No files found.
packages/next/src/client/components/router-reducer/ppr-navigations.ts
View file @
1d285aef
...
@@ -71,7 +71,7 @@ export function updateCacheNodeOnNavigation(
...
@@ -71,7 +71,7 @@ export function updateCacheNodeOnNavigation(
oldRouterState
:
FlightRouterState
,
oldRouterState
:
FlightRouterState
,
newRouterState
:
FlightRouterState
,
newRouterState
:
FlightRouterState
,
prefetchData
:
CacheNodeSeedData
|
null
,
prefetchData
:
CacheNodeSeedData
|
null
,
prefetchHead
:
HeadData
,
prefetchHead
:
HeadData
|
null
,
isPrefetchHeadPartial
:
boolean
isPrefetchHeadPartial
:
boolean
):
Task
|
null
{
):
Task
|
null
{
// Diff the old and new trees to reuse the shared layouts.
// Diff the old and new trees to reuse the shared layouts.
...
@@ -286,7 +286,7 @@ export function updateCacheNodeOnNavigation(
...
@@ -286,7 +286,7 @@ export function updateCacheNodeOnNavigation(
function
createCacheNodeOnNavigation
(
function
createCacheNodeOnNavigation
(
routerState
:
FlightRouterState
,
routerState
:
FlightRouterState
,
prefetchData
:
CacheNodeSeedData
|
null
,
prefetchData
:
CacheNodeSeedData
|
null
,
possiblyPartialPrefetchHead
:
HeadData
,
possiblyPartialPrefetchHead
:
HeadData
|
null
,
isPrefetchHeadPartial
:
boolean
isPrefetchHeadPartial
:
boolean
):
Task
{
):
Task
{
// Same traversal as updateCacheNodeNavigation, but we switch to this path
// Same traversal as updateCacheNodeNavigation, but we switch to this path
...
@@ -387,7 +387,10 @@ function createCacheNodeOnNavigation(
...
@@ -387,7 +387,10 @@ function createCacheNodeOnNavigation(
// `prefetchRsc` field.
// `prefetchRsc` field.
rsc
,
rsc
,
prefetchRsc
:
null
,
prefetchRsc
:
null
,
head
:
isLeafSegment
?
possiblyPartialPrefetchHead
:
[
null
,
null
],
head
:
(
isLeafSegment
?
possiblyPartialPrefetchHead
:
null
)
??
[
null
,
null
,
],
prefetchHead
:
null
,
prefetchHead
:
null
,
loading
,
loading
,
parallelRoutes
:
cacheNodeChildren
,
parallelRoutes
:
cacheNodeChildren
,
...
@@ -422,7 +425,7 @@ function patchRouterStateWithNewChildren(
...
@@ -422,7 +425,7 @@ function patchRouterStateWithNewChildren(
function
spawnPendingTask
(
function
spawnPendingTask
(
routerState
:
FlightRouterState
,
routerState
:
FlightRouterState
,
prefetchData
:
CacheNodeSeedData
|
null
,
prefetchData
:
CacheNodeSeedData
|
null
,
prefetchHead
:
React
.
ReactNode
|
null
,
prefetchHead
:
HeadData
|
null
,
isPrefetchHeadPartial
:
boolean
isPrefetchHeadPartial
:
boolean
):
Task
{
):
Task
{
// Create a task that will later be fulfilled by data from the server.
// Create a task that will later be fulfilled by data from the server.
...
@@ -645,7 +648,7 @@ function finishTaskUsingDynamicDataPayload(
...
@@ -645,7 +648,7 @@ function finishTaskUsingDynamicDataPayload(
function
createPendingCacheNode
(
function
createPendingCacheNode
(
routerState
:
FlightRouterState
,
routerState
:
FlightRouterState
,
prefetchData
:
CacheNodeSeedData
|
null
,
prefetchData
:
CacheNodeSeedData
|
null
,
prefetchHead
:
React
.
ReactNode
|
null
,
prefetchHead
:
HeadData
|
null
,
isPrefetchHeadPartial
:
boolean
isPrefetchHeadPartial
:
boolean
):
ReadyCacheNode
{
):
ReadyCacheNode
{
const
routerStateChildren
=
routerState
[
1
]
const
routerStateChildren
=
routerState
[
1
]
...
@@ -685,7 +688,7 @@ function createPendingCacheNode(
...
@@ -685,7 +688,7 @@ function createPendingCacheNode(
parallelRoutes
:
parallelRoutes
,
parallelRoutes
:
parallelRoutes
,
prefetchRsc
:
maybePrefetchRsc
!==
undefined
?
maybePrefetchRsc
:
null
,
prefetchRsc
:
maybePrefetchRsc
!==
undefined
?
maybePrefetchRsc
:
null
,
prefetchHead
:
isLeafSegment
?
prefetchHead
:
null
,
prefetchHead
:
isLeafSegment
?
prefetchHead
:
[
null
,
null
]
,
// TODO: Technically, a loading boundary could contain dynamic data. We must
// TODO: Technically, a loading boundary could contain dynamic data. We must
// have separate `loading` and `prefetchLoading` fields to handle this, like
// have separate `loading` and `prefetchLoading` fields to handle this, like
...
@@ -940,7 +943,7 @@ export function updateCacheNodeOnPopstateRestoration(
...
@@ -940,7 +943,7 @@ export function updateCacheNodeOnPopstateRestoration(
rsc
,
rsc
,
head
:
oldCacheNode
.
head
,
head
:
oldCacheNode
.
head
,
prefetchHead
:
shouldUsePrefetch
?
oldCacheNode
.
prefetchHead
:
null
,
prefetchHead
:
shouldUsePrefetch
?
oldCacheNode
.
prefetchHead
:
[
null
,
null
]
,
prefetchRsc
:
shouldUsePrefetch
?
oldCacheNode
.
prefetchRsc
:
null
,
prefetchRsc
:
shouldUsePrefetch
?
oldCacheNode
.
prefetchRsc
:
null
,
loading
:
oldCacheNode
.
loading
,
loading
:
oldCacheNode
.
loading
,
...
...
packages/next/src/client/components/segment-cache/navigation.ts
View file @
1d285aef
...
@@ -126,7 +126,7 @@ function navigateUsingPrefetchedRouteTree(
...
@@ -126,7 +126,7 @@ function navigateUsingPrefetchedRouteTree(
currentFlightRouterState
:
FlightRouterState
,
currentFlightRouterState
:
FlightRouterState
,
prefetchFlightRouterState
:
FlightRouterState
,
prefetchFlightRouterState
:
FlightRouterState
,
prefetchSeedData
:
CacheNodeSeedData
|
null
,
prefetchSeedData
:
CacheNodeSeedData
|
null
,
prefetchHead
:
HeadData
,
prefetchHead
:
HeadData
|
null
,
isPrefetchHeadPartial
:
boolean
,
isPrefetchHeadPartial
:
boolean
,
canonicalUrl
:
string
canonicalUrl
:
string
):
SuccessfulNavigationResult
|
NoOpNavigationResult
{
):
SuccessfulNavigationResult
|
NoOpNavigationResult
{
...
@@ -302,7 +302,7 @@ async function navigateDynamicallyWithNoPrefetch(
...
@@ -302,7 +302,7 @@ async function navigateDynamicallyWithNoPrefetch(
// In our simulated prefetch payload, we pretend that there's no seed data
// In our simulated prefetch payload, we pretend that there's no seed data
// nor a prefetch head.
// nor a prefetch head.
const
prefetchSeedData
=
null
const
prefetchSeedData
=
null
const
prefetchHead
:
[
null
,
null
]
=
[
null
,
null
]
const
prefetchHead
=
null
const
isPrefetchHeadPartial
=
true
const
isPrefetchHeadPartial
=
true
const
canonicalUrl
=
createCanonicalUrl
(
const
canonicalUrl
=
createCanonicalUrl
(
...
...
packages/next/src/shared/lib/app-router-context.shared-runtime.ts
View file @
1d285aef
...
@@ -56,7 +56,7 @@ export type LazyCacheNode = {
...
@@ -56,7 +56,7 @@ export type LazyCacheNode = {
*/
*/
lazyData
:
Promise
<
FetchServerResponseResult
>
|
null
lazyData
:
Promise
<
FetchServerResponseResult
>
|
null
prefetchHead
:
React
.
ReactNode
prefetchHead
:
HeadData
|
null
head
:
HeadData
head
:
HeadData
...
@@ -99,7 +99,7 @@ export type ReadyCacheNode = {
...
@@ -99,7 +99,7 @@ export type ReadyCacheNode = {
* There should never be a lazy data request in this case.
* There should never be a lazy data request in this case.
*/
*/
lazyData
:
null
lazyData
:
null
prefetchHead
:
React
.
ReactNode
prefetchHead
:
HeadData
|
null
head
:
HeadData
head
:
HeadData
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment