Unverified Commit 34fdbdcc authored by Andrew Clark's avatar Andrew Clark Committed by GitHub

Prefetch scheduler mirrors the navigation's tree walk (#98975)

The prefetch scheduler's static walk decided at the parent which child
was still part of the current page and which began the new part of the
route, and it fetched the head through two functions of its own that
copied the per-segment decision (a static attempt, then a runtime deopt
if that wasn't enough) for a node that hangs off the route root instead
of sitting in the tree.

Give the walk the same shape as the navigation's. The walk over the part
of the route the current page also has owns the comparison for its own
node — first whether the route position still matches, then whether any
of its params changed — and hands off to the walk over the new part of
the route when either fails, so the root enters the shared walk like
every other node. The per-segment decision, a static attempt or a
runtime deopt, lives in one function that the new-part walk calls for
every segment, and the runtime request's walk gets the same split
between iterating the children and deciding for one node.

The head is a one-node route tree like any other segment now, so it goes
through the same functions: the new-part static walk and the direct
runtime fetch it already had.

This is a pure restructuring and issues the same requests as before: a
segment the navigation keeps is still prefetched at the ordinary static
tier without a runtime deopt, the head is still fetched whenever
anything is, and a chain of inlined segments is still dropped where a
Shell-phase walk crosses from a kept node into the new part. A later
change uses the shape to prefetch only what the navigation would fetch.
parent b3512c2e
......@@ -3242,8 +3242,9 @@ function writeServerResponseIntoCache(
? now + getStaleTimeMs(headData.staleTimeSeconds)
: staleAt
// A head has no loading boundary. Match pingRuntimeHead, which spawns
// LoadingBoundary head entries using the concrete Full strategy.
// A head has no loading boundary. Match the scheduler, which spawns
// LoadingBoundary head entries using the concrete Full strategy (see the
// head's runtime fetch in pingRootRouteTree).
const headFetchStrategy =
fetchStrategy === FetchStrategy.LoadingBoundary
? FetchStrategy.Full
......
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