Combine subtreeData and CacheNodeSeedData slots#58666
Closed
acdlite wants to merge 3 commits intovercel:canaryfrom
Closed
Combine subtreeData and CacheNodeSeedData slots#58666acdlite wants to merge 3 commits intovercel:canaryfrom
acdlite wants to merge 3 commits intovercel:canaryfrom
Conversation
Member
Tests Passed |
Member
Stats from current PRDefault BuildGeneral
Client Bundles (main, webpack)
Legacy Client Bundles (polyfills)
Client Pages
Client Build Manifests
Rendered Page Sizes
Edge SSR bundle Size
Middleware size
Next Runtimes
Diff detailsDiff for page.jsDiff too large to display Diff for 199-HASH.jsDiff too large to display Diff for app-page-exp..ntime.dev.jsDiff too large to display Diff for app-page-exp..time.prod.jsDiff too large to display Diff for app-page-tur..time.prod.jsDiff too large to display Diff for app-page-tur..time.prod.jsDiff too large to display Diff for app-page.runtime.dev.jsDiff too large to display Diff for app-page.runtime.prod.jsDiff too large to display |
53bbe8b to
5c4fa7c
Compare
This reverts commit d5aea2c, which added an additional field to the RSC payload intended to represent a tree of subtree data for all the nested layouts in a response. I didn't think about the fact that the subtreeData slot, which represents the node at the root of the subtree, would be included twice. Instead, we should replace the subtreeData slot to be of the CacheNodeSeedData tree type, instead of just a single node. I'll do that in the following commits.
I need to use the result of createComponentTree in two different parts of the Flight response, but it shouldn't be called during a prefetch. So I hoisted the shouldSkipComponentTree check to earlier in the control flow. This also lets us get rid of an extra React element that was being used to lazily call createComponentTree.
The Flight response type includes the component node for the root of the subtree that was rendered. Instead of passing just the root node, we want to pass the entire tree of nested layouts. As an imcremental step, this changes the type to pass a CacheNodeSeedData object, but it passes only a partial tree that includes only the root node. In the next step, we'll pass the entire tree in this object, and in exchange we'll remove the initialChildNode prop to LayoutRouter.
53bbe8b to
ce4338f
Compare
acdlite
added a commit
to acdlite/next.js
that referenced
this pull request
Nov 21, 2023
## Based on vercel#58666 *I submitted this stack as separate PRs so I could run CI but I want to land them as a single unit. So I've left all but this last one in draft mode. You can review them commit-by-commit.* We render nested layouts in parallel on the server. This means we should be able to create a CacheNode entry for every layout in the tree as soon as the Flight response is received by the client, even before the nested layouts have streamed in. Currently, we wait until the nested layouts start rendering before we write them into the cache, which prevents us from performing certain optimizations. That's because the CacheNodes are sent as a prop to LayoutRouter; the only way to unwrap the CacheNode is to wait for LayoutRouter to render. In previous PRs, I updated the server to create a top-level data structure that contains all the CacheNodes for the entire tree. This PR updates the client side to receive the nodes and write them into the cache. --------- Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This file contains hidden or 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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Based on #58668
The Flight response type includes the component node for the root of the subtree that was rendered. Instead of passing just the root node, we want to pass the entire tree of nested layouts. As an incremental step, this changes the type to pass a CacheNodeSeedData object, but it passes only a partial tree that includes only the root node. In the next step, we'll pass the entire tree in this object, and in exchange we'll remove the initialChildNode prop to LayoutRouter.