Unverified Commit 856e2b19 authored by Andrew Clark's avatar Andrew Clark Committed by GitHub

[Segment Cache] Implement scroll-to-new-page (#76170)

This implements Next's scroll-to-new-page behavior in the Segment Cache.

The LayoutRouter expects an array of segment paths that represents every
page in the new route tree. In the old implementation, this is generated
by the `generateSegmentsFromPatch` function. In the new implementation,
I've chosen to generate this array during the main tree traversal that
happens in `startPPRNavigation`.

As a future improvement, we should use the same segment path type that
we use to access Segment Cache entries; there's no reason to have two
representations of the same concept.
parent aeaa006b
...@@ -91,8 +91,10 @@ export function startPPRNavigation( ...@@ -91,8 +91,10 @@ export function startPPRNavigation(
newRouterState: FlightRouterState, newRouterState: FlightRouterState,
prefetchData: CacheNodeSeedData | null, prefetchData: CacheNodeSeedData | null,
prefetchHead: HeadData | null, prefetchHead: HeadData | null,
isPrefetchHeadPartial: boolean isPrefetchHeadPartial: boolean,
scrollableSegmentsResult: Array<FlightSegmentPath>
): Task | null { ): Task | null {
const segmentPath: Array<FlightSegmentPath> = []
return updateCacheNodeOnNavigation( return updateCacheNodeOnNavigation(
oldCacheNode, oldCacheNode,
oldRouterState, oldRouterState,
...@@ -100,7 +102,9 @@ export function startPPRNavigation( ...@@ -100,7 +102,9 @@ export function startPPRNavigation(
false, false,
prefetchData, prefetchData,
prefetchHead, prefetchHead,
isPrefetchHeadPartial isPrefetchHeadPartial,
segmentPath,
scrollableSegmentsResult
) )
} }
...@@ -111,7 +115,9 @@ function updateCacheNodeOnNavigation( ...@@ -111,7 +115,9 @@ function updateCacheNodeOnNavigation(
didFindRootLayout: boolean, didFindRootLayout: boolean,
prefetchData: CacheNodeSeedData | null, prefetchData: CacheNodeSeedData | null,
prefetchHead: HeadData | null, prefetchHead: HeadData | null,
isPrefetchHeadPartial: boolean isPrefetchHeadPartial: boolean,
segmentPath: FlightSegmentPath,
scrollableSegmentsResult: Array<FlightSegmentPath>
): 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.
const oldRouterStateChildren = oldRouterState[1] const oldRouterStateChildren = oldRouterState[1]
...@@ -187,6 +193,10 @@ function updateCacheNodeOnNavigation( ...@@ -187,6 +193,10 @@ function updateCacheNodeOnNavigation(
: null : null
const newSegmentChild = newRouterStateChild[0] const newSegmentChild = newRouterStateChild[0]
const newSegmentPathChild = segmentPath.concat([
parallelRouteKey,
newSegmentChild,
])
const newSegmentKeyChild = createRouterCacheKey(newSegmentChild) const newSegmentKeyChild = createRouterCacheKey(newSegmentChild)
const oldSegmentChild = const oldSegmentChild =
...@@ -219,7 +229,9 @@ function updateCacheNodeOnNavigation( ...@@ -219,7 +229,9 @@ function updateCacheNodeOnNavigation(
didFindRootLayout, didFindRootLayout,
prefetchDataChild !== undefined ? prefetchDataChild : null, prefetchDataChild !== undefined ? prefetchDataChild : null,
prefetchHead, prefetchHead,
isPrefetchHeadPartial isPrefetchHeadPartial,
newSegmentPathChild,
scrollableSegmentsResult
) )
} }
} else if ( } else if (
...@@ -240,7 +252,9 @@ function updateCacheNodeOnNavigation( ...@@ -240,7 +252,9 @@ function updateCacheNodeOnNavigation(
didFindRootLayout, didFindRootLayout,
prefetchDataChild, prefetchDataChild,
prefetchHead, prefetchHead,
isPrefetchHeadPartial isPrefetchHeadPartial,
newSegmentPathChild,
scrollableSegmentsResult
) )
} else { } else {
// There's no existing Cache Node for this segment. Switch to the // There's no existing Cache Node for this segment. Switch to the
...@@ -251,7 +265,9 @@ function updateCacheNodeOnNavigation( ...@@ -251,7 +265,9 @@ function updateCacheNodeOnNavigation(
didFindRootLayout, didFindRootLayout,
prefetchDataChild !== undefined ? prefetchDataChild : null, prefetchDataChild !== undefined ? prefetchDataChild : null,
prefetchHead, prefetchHead,
isPrefetchHeadPartial isPrefetchHeadPartial,
newSegmentPathChild,
scrollableSegmentsResult
) )
} }
} else { } else {
...@@ -262,7 +278,9 @@ function updateCacheNodeOnNavigation( ...@@ -262,7 +278,9 @@ function updateCacheNodeOnNavigation(
didFindRootLayout, didFindRootLayout,
prefetchDataChild !== undefined ? prefetchDataChild : null, prefetchDataChild !== undefined ? prefetchDataChild : null,
prefetchHead, prefetchHead,
isPrefetchHeadPartial isPrefetchHeadPartial,
newSegmentPathChild,
scrollableSegmentsResult
) )
} }
...@@ -353,7 +371,9 @@ function beginRenderingNewRouteTree( ...@@ -353,7 +371,9 @@ function beginRenderingNewRouteTree(
didFindRootLayout: boolean, didFindRootLayout: boolean,
prefetchData: CacheNodeSeedData | null, prefetchData: CacheNodeSeedData | null,
possiblyPartialPrefetchHead: HeadData | null, possiblyPartialPrefetchHead: HeadData | null,
isPrefetchHeadPartial: boolean isPrefetchHeadPartial: boolean,
segmentPath: FlightSegmentPath,
scrollableSegmentsResult: Array<FlightSegmentPath>
): Task { ): Task {
if (!didFindRootLayout) { if (!didFindRootLayout) {
// The route tree changed before we reached a layout. (The highest-level // The route tree changed before we reached a layout. (The highest-level
...@@ -387,7 +407,9 @@ function beginRenderingNewRouteTree( ...@@ -387,7 +407,9 @@ function beginRenderingNewRouteTree(
newRouterState, newRouterState,
prefetchData, prefetchData,
possiblyPartialPrefetchHead, possiblyPartialPrefetchHead,
isPrefetchHeadPartial isPrefetchHeadPartial,
segmentPath,
scrollableSegmentsResult
) )
} }
...@@ -395,7 +417,9 @@ function createCacheNodeOnNavigation( ...@@ -395,7 +417,9 @@ function createCacheNodeOnNavigation(
routerState: FlightRouterState, routerState: FlightRouterState,
prefetchData: CacheNodeSeedData | null, prefetchData: CacheNodeSeedData | null,
possiblyPartialPrefetchHead: HeadData | null, possiblyPartialPrefetchHead: HeadData | null,
isPrefetchHeadPartial: boolean isPrefetchHeadPartial: boolean,
segmentPath: FlightSegmentPath,
scrollableSegmentsResult: Array<FlightSegmentPath>
): SPANavigationTask { ): SPANavigationTask {
// Same traversal as updateCacheNodeNavigation, but we switch to this path // Same traversal as updateCacheNodeNavigation, but we switch to this path
// once we reach the part of the tree that was not in the previous route. We // once we reach the part of the tree that was not in the previous route. We
...@@ -409,7 +433,9 @@ function createCacheNodeOnNavigation( ...@@ -409,7 +433,9 @@ function createCacheNodeOnNavigation(
routerState, routerState,
null, null,
possiblyPartialPrefetchHead, possiblyPartialPrefetchHead,
isPrefetchHeadPartial isPrefetchHeadPartial,
segmentPath,
scrollableSegmentsResult
) )
} }
...@@ -435,7 +461,9 @@ function createCacheNodeOnNavigation( ...@@ -435,7 +461,9 @@ function createCacheNodeOnNavigation(
routerState, routerState,
prefetchData, prefetchData,
possiblyPartialPrefetchHead, possiblyPartialPrefetchHead,
isPrefetchHeadPartial isPrefetchHeadPartial,
segmentPath,
scrollableSegmentsResult
) )
} }
...@@ -449,6 +477,15 @@ function createCacheNodeOnNavigation( ...@@ -449,6 +477,15 @@ function createCacheNodeOnNavigation(
[parallelRouteKey: string]: FlightRouterState [parallelRouteKey: string]: FlightRouterState
} = {} } = {}
let needsDynamicRequest = false let needsDynamicRequest = false
if (isLeafSegment) {
// The segment path of every leaf segment (i.e. page) is collected into
// a result array. This is used by the LayoutRouter to scroll to ensure that
// new pages are visible after a navigation.
// TODO: We should use a string to represent the segment path instead of
// an array. We already use a string representation for the path when
// accessing the Segment Cache, so we can use the same one.
scrollableSegmentsResult.push(segmentPath)
} else {
for (let parallelRouteKey in routerStateChildren) { for (let parallelRouteKey in routerStateChildren) {
const routerStateChild: FlightRouterState = const routerStateChild: FlightRouterState =
routerStateChildren[parallelRouteKey] routerStateChildren[parallelRouteKey]
...@@ -457,12 +494,18 @@ function createCacheNodeOnNavigation( ...@@ -457,12 +494,18 @@ function createCacheNodeOnNavigation(
? prefetchDataChildren[parallelRouteKey] ? prefetchDataChildren[parallelRouteKey]
: null : null
const segmentChild = routerStateChild[0] const segmentChild = routerStateChild[0]
const segmentPathChild = segmentPath.concat([
parallelRouteKey,
segmentChild,
])
const segmentKeyChild = createRouterCacheKey(segmentChild) const segmentKeyChild = createRouterCacheKey(segmentChild)
const taskChild = createCacheNodeOnNavigation( const taskChild = createCacheNodeOnNavigation(
routerStateChild, routerStateChild,
prefetchDataChild, prefetchDataChild,
possiblyPartialPrefetchHead, possiblyPartialPrefetchHead,
isPrefetchHeadPartial isPrefetchHeadPartial,
segmentPathChild,
scrollableSegmentsResult
) )
taskChildren.set(parallelRouteKey, taskChild) taskChildren.set(parallelRouteKey, taskChild)
const dynamicRequestTreeChild = taskChild.dynamicRequestTree const dynamicRequestTreeChild = taskChild.dynamicRequestTree
...@@ -480,6 +523,7 @@ function createCacheNodeOnNavigation( ...@@ -480,6 +523,7 @@ function createCacheNodeOnNavigation(
cacheNodeChildren.set(parallelRouteKey, newSegmentMapChild) cacheNodeChildren.set(parallelRouteKey, newSegmentMapChild)
} }
} }
}
const rsc = prefetchData[1] const rsc = prefetchData[1]
const loading = prefetchData[3] const loading = prefetchData[3]
...@@ -531,7 +575,9 @@ function spawnPendingTask( ...@@ -531,7 +575,9 @@ function spawnPendingTask(
routerState: FlightRouterState, routerState: FlightRouterState,
prefetchData: CacheNodeSeedData | null, prefetchData: CacheNodeSeedData | null,
prefetchHead: HeadData | null, prefetchHead: HeadData | null,
isPrefetchHeadPartial: boolean isPrefetchHeadPartial: boolean,
segmentPath: FlightSegmentPath,
scrollableSegmentsResult: Array<FlightSegmentPath>
): SPANavigationTask { ): SPANavigationTask {
// 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.
...@@ -551,7 +597,9 @@ function spawnPendingTask( ...@@ -551,7 +597,9 @@ function spawnPendingTask(
routerState, routerState,
prefetchData, prefetchData,
prefetchHead, prefetchHead,
isPrefetchHeadPartial isPrefetchHeadPartial,
segmentPath,
scrollableSegmentsResult
), ),
// Because this is non-null, and it gets propagated up through the parent // Because this is non-null, and it gets propagated up through the parent
// tasks, the root task will know that it needs to perform a server request. // tasks, the root task will know that it needs to perform a server request.
...@@ -754,7 +802,9 @@ function createPendingCacheNode( ...@@ -754,7 +802,9 @@ function createPendingCacheNode(
routerState: FlightRouterState, routerState: FlightRouterState,
prefetchData: CacheNodeSeedData | null, prefetchData: CacheNodeSeedData | null,
prefetchHead: HeadData | null, prefetchHead: HeadData | null,
isPrefetchHeadPartial: boolean isPrefetchHeadPartial: boolean,
segmentPath: FlightSegmentPath,
scrollableSegmentsResult: Array<FlightSegmentPath>
): ReadyCacheNode { ): ReadyCacheNode {
const routerStateChildren = routerState[1] const routerStateChildren = routerState[1]
const prefetchDataChildren = prefetchData !== null ? prefetchData[2] : null const prefetchDataChildren = prefetchData !== null ? prefetchData[2] : null
...@@ -769,13 +819,19 @@ function createPendingCacheNode( ...@@ -769,13 +819,19 @@ function createPendingCacheNode(
: null : null
const segmentChild = routerStateChild[0] const segmentChild = routerStateChild[0]
const segmentPathChild = segmentPath.concat([
parallelRouteKey,
segmentChild,
])
const segmentKeyChild = createRouterCacheKey(segmentChild) const segmentKeyChild = createRouterCacheKey(segmentChild)
const newCacheNodeChild = createPendingCacheNode( const newCacheNodeChild = createPendingCacheNode(
routerStateChild, routerStateChild,
prefetchDataChild === undefined ? null : prefetchDataChild, prefetchDataChild === undefined ? null : prefetchDataChild,
prefetchHead, prefetchHead,
isPrefetchHeadPartial isPrefetchHeadPartial,
segmentPathChild,
scrollableSegmentsResult
) )
const newSegmentMapChild: ChildSegmentMap = new Map() const newSegmentMapChild: ChildSegmentMap = new Map()
...@@ -786,6 +842,17 @@ function createPendingCacheNode( ...@@ -786,6 +842,17 @@ function createPendingCacheNode(
// The head is assigned to every leaf segment delivered by the server. Based // The head is assigned to every leaf segment delivered by the server. Based
// on corresponding logic in fill-lazy-items-till-leaf-with-head.ts // on corresponding logic in fill-lazy-items-till-leaf-with-head.ts
const isLeafSegment = parallelRoutes.size === 0 const isLeafSegment = parallelRoutes.size === 0
if (isLeafSegment) {
// The segment path of every leaf segment (i.e. page) is collected into
// a result array. This is used by the LayoutRouter to scroll to ensure that
// new pages are visible after a navigation.
// TODO: We should use a string to represent the segment path instead of
// an array. We already use a string representation for the path when
// accessing the Segment Cache, so we can use the same one.
scrollableSegmentsResult.push(segmentPath)
}
const maybePrefetchRsc = prefetchData !== null ? prefetchData[1] : null const maybePrefetchRsc = prefetchData !== null ? prefetchData[1] : null
const maybePrefetchLoading = prefetchData !== null ? prefetchData[3] : null const maybePrefetchLoading = prefetchData !== null ? prefetchData[3] : null
return { return {
......
...@@ -120,10 +120,10 @@ function handleNavigationResult( ...@@ -120,10 +120,10 @@ function handleNavigationResult(
mutable.cache = result.data.cacheNode mutable.cache = result.data.cacheNode
mutable.patchedTree = result.data.flightRouterState mutable.patchedTree = result.data.flightRouterState
mutable.canonicalUrl = result.data.canonicalUrl mutable.canonicalUrl = result.data.canonicalUrl
mutable.scrollableSegments = result.data.scrollableSegments
mutable.shouldScroll = result.data.shouldScroll
// TODO: Not yet implemented // TODO: Not yet implemented
// mutable.scrollableSegments = scrollableSegments
// mutable.hashFragment = hash // mutable.hashFragment = hash
// mutable.shouldScroll = shouldScroll
return handleMutable(state, mutable) return handleMutable(state, mutable)
} }
case NavigationResultTag.Async: { case NavigationResultTag.Async: {
...@@ -186,7 +186,8 @@ export function navigateReducer( ...@@ -186,7 +186,8 @@ export function navigateReducer(
url, url,
state.cache, state.cache,
state.tree, state.tree,
state.nextUrl state.nextUrl,
shouldScroll
) )
return handleNavigationResult(state, mutable, pendingPush, result) return handleNavigationResult(state, mutable, pendingPush, result)
} }
...@@ -311,7 +312,8 @@ export function navigateReducer( ...@@ -311,7 +312,8 @@ export function navigateReducer(
treePatch, treePatch,
seedData, seedData,
head, head,
isHeadPartial isHeadPartial,
scrollableSegments
) )
if (task !== null) { if (task !== null) {
...@@ -437,12 +439,12 @@ export function navigateReducer( ...@@ -437,12 +439,12 @@ export function navigateReducer(
// segments in the FlightDataPath will be able to reference the updated cache. // segments in the FlightDataPath will be able to reference the updated cache.
currentCache = cache currentCache = cache
} }
}
currentTree = newTree
for (const subSegment of generateSegmentsFromPatch(treePatch)) { for (const subSegment of generateSegmentsFromPatch(treePatch)) {
const scrollableSegmentPath = [...flightSegmentPath, ...subSegment] const scrollableSegmentPath = [
...flightSegmentPath,
...subSegment,
]
// Filter out the __DEFAULT__ paths as they shouldn't be scrolled to in this case. // Filter out the __DEFAULT__ paths as they shouldn't be scrolled to in this case.
if ( if (
scrollableSegmentPath[scrollableSegmentPath.length - 1] !== scrollableSegmentPath[scrollableSegmentPath.length - 1] !==
...@@ -452,6 +454,9 @@ export function navigateReducer( ...@@ -452,6 +454,9 @@ export function navigateReducer(
} }
} }
} }
currentTree = newTree
}
} }
mutable.patchedTree = currentTree mutable.patchedTree = currentTree
......
...@@ -48,6 +48,8 @@ type SuccessfulNavigationResult = { ...@@ -48,6 +48,8 @@ type SuccessfulNavigationResult = {
flightRouterState: FlightRouterState flightRouterState: FlightRouterState
cacheNode: CacheNode cacheNode: CacheNode
canonicalUrl: string canonicalUrl: string
scrollableSegments: Array<FlightSegmentPath>
shouldScroll: boolean
} }
} }
...@@ -81,7 +83,8 @@ export function navigate( ...@@ -81,7 +83,8 @@ export function navigate(
url: URL, url: URL,
currentCacheNode: CacheNode, currentCacheNode: CacheNode,
currentFlightRouterState: FlightRouterState, currentFlightRouterState: FlightRouterState,
nextUrl: string | null nextUrl: string | null,
shouldScroll: boolean
): NavigationResult { ): NavigationResult {
const now = Date.now() const now = Date.now()
...@@ -104,7 +107,8 @@ export function navigate( ...@@ -104,7 +107,8 @@ export function navigate(
prefetchSeedData, prefetchSeedData,
prefetchHead, prefetchHead,
isPrefetchHeadPartial, isPrefetchHeadPartial,
canonicalUrl canonicalUrl,
shouldScroll
) )
} }
// There's no matching prefetch for this route in the cache. // There's no matching prefetch for this route in the cache.
...@@ -114,7 +118,8 @@ export function navigate( ...@@ -114,7 +118,8 @@ export function navigate(
url, url,
nextUrl, nextUrl,
currentCacheNode, currentCacheNode,
currentFlightRouterState currentFlightRouterState,
shouldScroll
), ),
} }
} }
...@@ -128,7 +133,8 @@ function navigateUsingPrefetchedRouteTree( ...@@ -128,7 +133,8 @@ function navigateUsingPrefetchedRouteTree(
prefetchSeedData: CacheNodeSeedData | null, prefetchSeedData: CacheNodeSeedData | null,
prefetchHead: HeadData | null, prefetchHead: HeadData | null,
isPrefetchHeadPartial: boolean, isPrefetchHeadPartial: boolean,
canonicalUrl: string canonicalUrl: string,
shouldScroll: boolean
): SuccessfulNavigationResult | NoOpNavigationResult | MPANavigationResult { ): SuccessfulNavigationResult | NoOpNavigationResult | MPANavigationResult {
// Recursively construct a prefetch tree by reading from the Segment Cache. To // Recursively construct a prefetch tree by reading from the Segment Cache. To
// maintain compatibility, we output the same data structures as the old // maintain compatibility, we output the same data structures as the old
...@@ -136,13 +142,15 @@ function navigateUsingPrefetchedRouteTree( ...@@ -136,13 +142,15 @@ function navigateUsingPrefetchedRouteTree(
// TODO: Eventually updateCacheNodeOnNavigation (or the equivalent) should // TODO: Eventually updateCacheNodeOnNavigation (or the equivalent) should
// read from the Segment Cache directly. It's only structured this way for now // read from the Segment Cache directly. It's only structured this way for now
// so we can share code with the old prefetching implementation. // so we can share code with the old prefetching implementation.
const scrollableSegments: Array<FlightSegmentPath> = []
const task = startPPRNavigation( const task = startPPRNavigation(
currentCacheNode, currentCacheNode,
currentFlightRouterState, currentFlightRouterState,
prefetchFlightRouterState, prefetchFlightRouterState,
prefetchSeedData, prefetchSeedData,
prefetchHead, prefetchHead,
isPrefetchHeadPartial isPrefetchHeadPartial,
scrollableSegments
) )
if (task !== null) { if (task !== null) {
const dynamicRequestTree = task.dynamicRequestTree const dynamicRequestTree = task.dynamicRequestTree
...@@ -156,7 +164,13 @@ function navigateUsingPrefetchedRouteTree( ...@@ -156,7 +164,13 @@ function navigateUsingPrefetchedRouteTree(
// The prefetched tree does not contain dynamic holes — it's // The prefetched tree does not contain dynamic holes — it's
// fully static. We can skip the dynamic request. // fully static. We can skip the dynamic request.
} }
return navigationTaskToResult(task, currentCacheNode, canonicalUrl) return navigationTaskToResult(
task,
currentCacheNode,
canonicalUrl,
scrollableSegments,
shouldScroll
)
} }
// The server sent back an empty tree patch. There's nothing to update. // The server sent back an empty tree patch. There's nothing to update.
return noOpNavigationResult return noOpNavigationResult
...@@ -165,7 +179,9 @@ function navigateUsingPrefetchedRouteTree( ...@@ -165,7 +179,9 @@ function navigateUsingPrefetchedRouteTree(
function navigationTaskToResult( function navigationTaskToResult(
task: PPRNavigationTask, task: PPRNavigationTask,
currentCacheNode: CacheNode, currentCacheNode: CacheNode,
canonicalUrl: string canonicalUrl: string,
scrollableSegments: Array<FlightSegmentPath>,
shouldScroll: boolean
): SuccessfulNavigationResult | MPANavigationResult { ): SuccessfulNavigationResult | MPANavigationResult {
const flightRouterState = task.route const flightRouterState = task.route
if (flightRouterState === null) { if (flightRouterState === null) {
...@@ -183,6 +199,8 @@ function navigationTaskToResult( ...@@ -183,6 +199,8 @@ function navigationTaskToResult(
flightRouterState, flightRouterState,
cacheNode: newCacheNode !== null ? newCacheNode : currentCacheNode, cacheNode: newCacheNode !== null ? newCacheNode : currentCacheNode,
canonicalUrl, canonicalUrl,
scrollableSegments,
shouldScroll,
}, },
} }
} }
...@@ -260,7 +278,8 @@ async function navigateDynamicallyWithNoPrefetch( ...@@ -260,7 +278,8 @@ async function navigateDynamicallyWithNoPrefetch(
url: URL, url: URL,
nextUrl: string | null, nextUrl: string | null,
currentCacheNode: CacheNode, currentCacheNode: CacheNode,
currentFlightRouterState: FlightRouterState currentFlightRouterState: FlightRouterState,
shouldScroll: boolean
): Promise< ): Promise<
MPANavigationResult | SuccessfulNavigationResult | NoOpNavigationResult MPANavigationResult | SuccessfulNavigationResult | NoOpNavigationResult
> { > {
...@@ -314,13 +333,15 @@ async function navigateDynamicallyWithNoPrefetch( ...@@ -314,13 +333,15 @@ async function navigateDynamicallyWithNoPrefetch(
) )
// Now we proceed exactly as we would for normal navigation. // Now we proceed exactly as we would for normal navigation.
const scrollableSegments: Array<FlightSegmentPath> = []
const task = startPPRNavigation( const task = startPPRNavigation(
currentCacheNode, currentCacheNode,
currentFlightRouterState, currentFlightRouterState,
prefetchFlightRouterState, prefetchFlightRouterState,
prefetchSeedData, prefetchSeedData,
prefetchHead, prefetchHead,
isPrefetchHeadPartial isPrefetchHeadPartial,
scrollableSegments
) )
if (task !== null) { if (task !== null) {
// In this case, we've already sent the dynamic request, so we don't // In this case, we've already sent the dynamic request, so we don't
...@@ -338,7 +359,13 @@ async function navigateDynamicallyWithNoPrefetch( ...@@ -338,7 +359,13 @@ async function navigateDynamicallyWithNoPrefetch(
// The prefetched tree does not contain dynamic holes — it's // The prefetched tree does not contain dynamic holes — it's
// fully static. We don't need to process the server response further. // fully static. We don't need to process the server response further.
} }
return navigationTaskToResult(task, currentCacheNode, canonicalUrl) return navigationTaskToResult(
task,
currentCacheNode,
canonicalUrl,
scrollableSegments,
shouldScroll
)
} }
// The server sent back an empty tree patch. There's nothing to update. // The server sent back an empty tree patch. There's nothing to update.
return noOpNavigationResult return noOpNavigationResult
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment