-
Notifications
You must be signed in to change notification settings - Fork 27.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Per-Segment Prefetch] Add Route Tree prefetch
In the new design for prefetching, instead of prefetching all the data for a page in a single request, the client issues a separate request for each segment. The benefit of using separate requests is that the responses can be separately cached. For example, when prefetching multiple pages that share the same layout, the layout data only needs to be fetched once. Simlarly, when revalidating a tag, only segments that access that tag need to be refetched. The client needs to know about the structure of the route tree in order to determine which segments can be reused. So, before it prefetches any actual segment data for a page, it will first fetch information about the route tree. The route tree contains the necessary data for sending and caching prefetch requests. This PR updates the server to respond to route tree prefetches. To prefetch the route tree, the client sets the `Next-Router-Segment-Prefetch` to `/_tree`.
- Loading branch information
Showing
3 changed files
with
89 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters