next.js
e9a03ac1 - Refactor: Navigate and refresh simultaneously (#86747)

Commit
11 days ago
Refactor: Navigate and refresh simultaneously (#86747) This is a refactor of the ppr-navigations module to support navigating to a new tree and refreshing shared layouts within the same navigation. Rather than modeling navigations and refreshes/revalidations as separate operations, a refresh is considered a special case of a navigation where any existing dynamic data is disregarded, and new data is fetched from the server. The rest of the tree is diffed as usual, and the routing behavior is the same. Previously, the ppr-navigations module would revert to the "create" path whenever it was missing dynamic data (the CacheNode) for a shared segment. Now, the FlightRouterState alone is used to diff the old and new trees. When dynamic data is missing, any shared segment (one that exists in both the old and new trees) is considered to be part of a "refresh", and any segment that is present only in the new tree is considered to be part of a "navigation". There are subtle distinctions in behavior between refreshes and navigations. For example, refreshed page segments aren't scrolled to, but navigated page segments are.
Author
Parents
Loading