GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [Flight] Allow values to be encoded by "reference" to a value rather than the value itself by sebmarkbage · Pull Request #20136 · react/react

Conversation

@sebmarkbage

@sebmarkbage sebmarkbage commented Oct 30, 2020 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

NE-SmallTown reacted with eyes emoji
All reactions
  • 👀 1 reaction
@sebmarkbage
Allow values to be encoded by "reference" to a value rather than the …
e87f38c
…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.
@sebmarkbage
sebmarkbage requested review from gaearon and lunaruan October 30, 2020 19:40
@facebook-github-bot facebook-github-bot added CLA Signed React Core Team Opened by a member of the React Core Team labels Oct 30, 2020
@codesandbox-ci

codesandbox-ci Bot commented Oct 30, 2020

Copy link
Copy Markdown

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:

Sandbox Source
React Configuration
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@sizebot

sizebot commented Oct 30, 2020

Copy link
Copy Markdown
Details of bundled changes.

Comparing: 39eb6d1...e87f38c

react-transport-dom-relay

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
ReactFlightDOMRelayServer-dev.js +2.0% +2.3% 25.04 KB 25.54 KB 6.45 KB 6.6 KB FB_WWW_DEV
ReactFlightDOMRelayServer-prod.js 🔺+0.7% 🔺+0.7% 14.91 KB 15.01 KB 3.88 KB 3.91 KB FB_WWW_PROD
ReactFlightDOMRelayClient-dev.js +4.5% +3.2% 11.67 KB 12.19 KB 3.46 KB 3.56 KB FB_WWW_DEV
ReactFlightDOMRelayClient-prod.js 🔺+4.4% 🔺+1.5% 5.33 KB 5.57 KB 1.6 KB 1.63 KB FB_WWW_PROD

react-transport-dom-webpack

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-transport-dom-webpack-server-runtime.development.js 0.0% -0.1% 2.99 KB 2.99 KB 1.07 KB 1.07 KB NODE_DEV
react-transport-dom-webpack-server-runtime.production.min.js 0.0% -0.3% 513 B 513 B 351 B 350 B NODE_PROD
react-transport-dom-webpack.development.js +3.4% +2.2% 18.19 KB 18.81 KB 5 KB 5.11 KB UMD_DEV
react-transport-dom-webpack.production.min.js 🔺+3.7% 🔺+1.9% 4.01 KB 4.16 KB 1.81 KB 1.84 KB UMD_PROD
react-transport-dom-webpack.development.js +3.4% +2.3% 16.97 KB 17.55 KB 4.88 KB 4.99 KB NODE_DEV
react-transport-dom-webpack.production.min.js 🔺+4.0% 🔺+1.6% 3.81 KB 3.96 KB 1.71 KB 1.74 KB NODE_PROD
react-transport-dom-webpack-server.node.development.js +2.0% +2.2% 24.82 KB 25.32 KB 6.73 KB 6.88 KB NODE_DEV
react-transport-dom-webpack-server.browser.development.js +2.1% +2.3% 25.45 KB 25.98 KB 6.6 KB 6.75 KB UMD_DEV
react-transport-dom-webpack-server.node.production.min.js 🔺+0.6% 🔺+0.5% 6.44 KB 6.48 KB 2.66 KB 2.67 KB NODE_PROD
react-transport-dom-webpack-server.browser.production.min.js 🔺+0.6% 🔺+0.5% 6.47 KB 6.5 KB 2.71 KB 2.73 KB UMD_PROD
react-transport-dom-webpack-server.browser.development.js +2.1% +2.4% 23.88 KB 24.38 KB 6.47 KB 6.62 KB NODE_DEV
react-transport-dom-webpack-plugin.js 0.0% -0.3% 437 B 437 B 298 B 297 B NODE_ES2015
react-transport-dom-webpack-server.browser.production.min.js 🔺+0.6% 🔺+0.5% 6.26 KB 6.29 KB 2.64 KB 2.65 KB NODE_PROD

react-client

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-client-flight.development.js +3.9% +2.5% 14.95 KB 15.53 KB 4.37 KB 4.48 KB NODE_DEV
react-client-flight.production.min.js 🔺+4.4% 🔺+1.6% 3.4 KB 3.55 KB 1.54 KB 1.57 KB NODE_PROD

react-server

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-server-flight-server-runtime.development.js 0.0% -0.2% 2.98 KB 2.98 KB 1.06 KB 1.06 KB NODE_DEV
react-server-flight-server-runtime.production.min.js 0.0% -0.3% 505 B 505 B 339 B 338 B NODE_PROD
react-server-flight.development.js +2.1% +2.4% 24.31 KB 24.82 KB 6.59 KB 6.75 KB NODE_DEV
react-server-flight.production.min.js 🔺+0.6% 🔺+0.6% 6.51 KB 6.55 KB 2.7 KB 2.72 KB NODE_PROD
react-server.development.js 0.0% -0.1% 5.45 KB 5.45 KB 1.73 KB 1.73 KB NODE_DEV
react-server.production.min.js 0.0% -0.2% 1.16 KB 1.16 KB 650 B 649 B NODE_PROD

Size changes (experimental)

Generated by 🚫 dangerJS against e87f38c

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@sizebot

sizebot commented Oct 30, 2020

Copy link
Copy Markdown
Details of bundled changes.

Comparing: 39eb6d1...e87f38c

react-transport-dom-relay

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
ReactFlightDOMRelayServer-dev.js +2.0% +2.3% 25.04 KB 25.54 KB 6.45 KB 6.6 KB FB_WWW_DEV
ReactFlightDOMRelayServer-prod.js 🔺+0.7% 🔺+0.7% 14.91 KB 15.01 KB 3.88 KB 3.91 KB FB_WWW_PROD
ReactFlightDOMRelayClient-dev.js +4.5% +3.2% 11.67 KB 12.19 KB 3.46 KB 3.56 KB FB_WWW_DEV
ReactFlightDOMRelayClient-prod.js 🔺+4.4% 🔺+1.5% 5.33 KB 5.57 KB 1.6 KB 1.63 KB FB_WWW_PROD

react-transport-dom-webpack

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-transport-dom-webpack-server-runtime.development.js 0.0% -0.1% 2.98 KB 2.98 KB 1.07 KB 1.07 KB NODE_DEV
react-transport-dom-webpack-server-runtime.production.min.js 0.0% -0.3% 500 B 500 B 341 B 340 B NODE_PROD
react-transport-dom-webpack.development.js +3.4% +2.3% 18.18 KB 18.8 KB 4.99 KB 5.1 KB UMD_DEV
react-transport-dom-webpack.production.min.js 🔺+3.8% 🔺+1.9% 4 KB 4.15 KB 1.8 KB 1.83 KB UMD_PROD
react-transport-dom-webpack.development.js +3.4% +2.2% 16.96 KB 17.54 KB 4.87 KB 4.98 KB NODE_DEV
react-transport-dom-webpack.production.min.js 🔺+4.0% 🔺+1.7% 3.8 KB 3.95 KB 1.7 KB 1.73 KB NODE_PROD
react-transport-dom-webpack-server.node.development.js +2.0% +2.2% 24.8 KB 25.31 KB 6.72 KB 6.88 KB NODE_DEV
react-transport-dom-webpack-server.browser.development.js +2.1% +2.3% 25.44 KB 25.96 KB 6.59 KB 6.75 KB UMD_DEV
react-transport-dom-webpack-server.node.production.min.js 🔺+0.6% 🔺+0.5% 6.43 KB 6.47 KB 2.65 KB 2.67 KB NODE_PROD
react-transport-dom-webpack-server.browser.production.min.js 🔺+0.6% 🔺+0.6% 6.45 KB 6.49 KB 2.7 KB 2.72 KB UMD_PROD
react-transport-dom-webpack-server.browser.development.js +2.1% +2.4% 23.86 KB 24.37 KB 6.46 KB 6.61 KB NODE_DEV
react-transport-dom-webpack-server.browser.production.min.js 🔺+0.6% 🔺+0.5% 6.25 KB 6.28 KB 2.63 KB 2.64 KB NODE_PROD

react-client

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-client-flight.development.js +3.9% +2.5% 14.93 KB 15.51 KB 4.37 KB 4.47 KB NODE_DEV
react-client-flight.production.min.js 🔺+4.4% 🔺+1.7% 3.38 KB 3.53 KB 1.54 KB 1.56 KB NODE_PROD

react-server

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-server-flight-server-runtime.development.js 0.0% -0.1% 2.97 KB 2.97 KB 1.06 KB 1.05 KB NODE_DEV
react-server-flight-server-runtime.production.min.js 0.0% -0.6% 492 B 492 B 331 B 329 B NODE_PROD
react-server-flight.development.js +2.1% +2.4% 24.3 KB 24.8 KB 6.58 KB 6.74 KB NODE_DEV
react-server-flight.production.min.js 🔺+0.6% 🔺+0.6% 6.5 KB 6.53 KB 2.7 KB 2.71 KB NODE_PROD
react-server.development.js 0.0% -0.1% 5.43 KB 5.43 KB 1.72 KB 1.72 KB NODE_DEV
react-server.production.min.js 0.0% -0.2% 1.15 KB 1.15 KB 642 B 641 B NODE_PROD

Size changes (stable)

Generated by 🚫 dangerJS against e87f38c

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

gaearon
gaearon reviewed Oct 30, 2020
View reviewed changes
Comment thread packages/react-server/src/ReactFlightServer.js
const moduleId = request.nextChunkId++;
emitModuleChunk(request, moduleId, moduleMetaData);
return serializeIDRef(moduleId);
if (parent[0] === REACT_ELEMENT_TYPE && key === '1') {

@gaearon gaearon Oct 30, 2020

Copy link
Copy Markdown
Collaborator

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?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@sebmarkbage sebmarkbage Oct 30, 2020

Copy link
Copy Markdown
Contributor Author

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
gaearon
gaearon approved these changes Oct 30, 2020
View reviewed changes
@sebmarkbage
sebmarkbage merged commit 930ce7c into react:master Oct 30, 2020
facebook-github-bot pushed a commit to react/react-native that referenced this pull request Nov 9, 2020
@sebmarkbage @facebook-github-bot
React Native sync for revisions 4e5d7fa...454c221
69ade59
Summary:
Base sync before adding Flight files.

This sync includes the following changes:
- **[454c221](react/react@454c2211c )**: Refactor SchedulerHostConfigs ([#20025](react/react#20025)) //<Ricky>//
- **[56e9fee](react/react@56e9feead )**: Remove Blocks ([#20138](react/react#20138)) //<Sebastian Markbåge>//
- **[3fbd47b](react/react@3fbd47b86 )**: Serialize pending server components by reference (lazy component) ([#20137](react/react#20137)) //<Sebastian Markbåge>//
- **[930ce7c](react/react@930ce7c15 )**: Allow values to be encoded by "reference" to a value rather than the value itself ([#20136](react/react#20136)) //<Sebastian Markbåge>//
- **[39eb6d1](react/react@39eb6d176 )**: Rename ([#20134](react/react#20134)) //<Sebastian Markbåge>//
- **[ffd8423](react/react@ffd842335 )**: [Flight] Add support for Module References in transport protocol ([#20121](react/react#20121)) //<Sebastian Markbåge>//
- **[343d7a4](react/react@343d7a4a7 )**: Fast Refresh: Don't block DevTools commit hook ([#20129](react/react#20129)) //<Brian Vaughn>//
- **[779a472](react/react@779a472b0 )**: Prevent inlining into recursive commit functions ([#20105](react/react#20105)) //<Andrew Clark>//
- **[25b18d3](react/react@25b18d31c )**: Traverse commit phase effects iteratively ([#20094](react/react#20094)) //<Andrew Clark>//

Changelog:
[General][Changed] - React Native sync for revisions 4e5d7fa...454c221

Reviewed By: rickhanlonii

Differential Revision: D24698701

fbshipit-source-id: dfaf692b1051150355dece1657764a484b7ae603
koto pushed a commit to koto/react that referenced this pull request Jun 15, 2021
@sebmarkbage @koto
Allow values to be encoded by "reference" to a value rather than the …
548eefe
…value itself (react#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.
mrizwanashiq pushed a commit to mrizwanashiq/react that referenced this pull request Jun 25, 2026
@sebmarkbage
Allow values to be encoded by "reference" to a value rather than the …
ef4f831
…value itself (react#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.
hanzo-dev pushed a commit to hanzoai/react that referenced this pull request Sep 9, 2026
@sebmarkbage
Allow values to be encoded by "reference" to a value rather than the …
e60c511
…value itself (react#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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@gaearon gaearon gaearon approved these changes
@lunaruan lunaruan Awaiting requested review from lunaruan

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

CLA Signed React Core Team Opened by a member of the React Core Team

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@sebmarkbage @sizebot @gaearon @facebook-github-bot
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.