-
Notifications
You must be signed in to change notification settings - Fork 46.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Flight] Allow values to be encoded by "reference" to a value rather than the value itself #20136
Conversation
…value itself These references are currently transformed into React.lazy values. We can use these in React positions like element type or node position. This could be expanded to a more general concept like Suspensey Promises, asset references or JSResourceReferences. For now it's only used in React Element type position. The purpose of these is to let you suspend deeper in the tree.
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit e87f38c:
|
Details of bundled changes.Comparing: 39eb6d1...e87f38c react-transport-dom-relay
react-transport-dom-webpack
react-client
react-server
Size changes (experimental) |
Details of bundled changes.Comparing: 39eb6d1...e87f38c react-transport-dom-relay
react-transport-dom-webpack
react-client
react-server
Size changes (stable) |
@@ -479,12 +483,20 @@ export function resolveModelToJSON( | |||
request.pendingChunks++; | |||
const moduleId = request.nextChunkId++; | |||
emitModuleChunk(request, moduleId, moduleMetaData); | |||
return serializeIDRef(moduleId); | |||
if (parent[0] === REACT_ELEMENT_TYPE && key === '1') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does 1
mean here? Is this because it's a tuple?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yea
Summary: Base sync before adding Flight files. This sync includes the following changes: - **[454c2211c](facebook/react@454c2211c )**: Refactor SchedulerHostConfigs ([#20025](facebook/react#20025)) //<Ricky>// - **[56e9feead](facebook/react@56e9feead )**: Remove Blocks ([#20138](facebook/react#20138)) //<Sebastian Markbåge>// - **[3fbd47b86](facebook/react@3fbd47b86 )**: Serialize pending server components by reference (lazy component) ([#20137](facebook/react#20137)) //<Sebastian Markbåge>// - **[930ce7c15](facebook/react@930ce7c15 )**: Allow values to be encoded by "reference" to a value rather than the value itself ([#20136](facebook/react#20136)) //<Sebastian Markbåge>// - **[39eb6d176](facebook/react@39eb6d176 )**: Rename ([#20134](facebook/react#20134)) //<Sebastian Markbåge>// - **[ffd842335](facebook/react@ffd842335 )**: [Flight] Add support for Module References in transport protocol ([#20121](facebook/react#20121)) //<Sebastian Markbåge>// - **[343d7a4a7](facebook/react@343d7a4a7 )**: Fast Refresh: Don't block DevTools commit hook ([#20129](facebook/react#20129)) //<Brian Vaughn>// - **[779a472b0](facebook/react@779a472b0 )**: Prevent inlining into recursive commit functions ([#20105](facebook/react#20105)) //<Andrew Clark>// - **[25b18d31c](facebook/react@25b18d31c )**: Traverse commit phase effects iteratively ([#20094](facebook/react#20094)) //<Andrew Clark>// Changelog: [General][Changed] - React Native sync for revisions 4e5d7fa...454c221 Reviewed By: rickhanlonii Differential Revision: D24698701 fbshipit-source-id: dfaf692b1051150355dece1657764a484b7ae603
…value itself (facebook#20136) These references are currently transformed into React.lazy values. We can use these in React positions like element type or node position. This could be expanded to a more general concept like Suspensey Promises, asset references or JSResourceReferences. For now it's only used in React Element type position. The purpose of these is to let you suspend deeper in the tree.
These references are currently transformed into React.lazy values. We can use these in React positions like element type or node position.
This could be expanded to a more general concept like Suspensey Promises, asset references or JSResourceReferences.
For now it's only used in React Element type position.
The purpose of these is to let you suspend deeper in the tree.
"$1234"
in the JSON gets replaced with the actual value of row/chunk number 1234."@1234"
in the JSON gets replaced with a React.lazy object that when read either suspends or returns the actual value of row/chunk number 1234.