mirror of
https://github.com/vercel/next.js.git
synced 2026-09-20 02:25:18 +08:00
d91019157b
Refactors the CacheNode tree to use the RouteTree<T> data type. CacheNode used to be a tree-shaped object, with a similar structure to RouteTree<T>. CacheNode is now a data container instead, embedded inside a RouteTree structure. So the usage sites change from CacheNode to RouteTree<CacheNode>. As a result, we can now diff against the render tree directly during prefetches and navigations, instead of diffing against FlightRouterState. This gets us closer to migrating everything away from FlightRouterState to our shared data types. Since CacheNode is now a data container, it also records which params its data was rendered under: `varyParams` is the source of the params `rsc` depends on, carried from the decoded response (as a settled thenable that `readVaryParams` reads) onto the node and into its BFCache entry, and filled in alongside `rsc` when a deferred response arrives. Nothing reads it yet; it's here so the node describes its own data.