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] Transfer Debug Info in Server-to-Server Flight Requests by sebmarkbage · Pull Request #28275 · react/react

Conversation

@sebmarkbage

@sebmarkbage sebmarkbage commented Feb 8, 2024 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

A Flight Server can be a consumer of a stream from another Server. In this case the meta data is attached to debugInfo properties on lazy, Promises, Arrays or Elements that might in turn get forwarded to the next stream. In this case we want to forward this debug information to the client in the stream.

I also added a DEV only environmentName option to the Flight Server. This lets you name the server that is producing the debug info so that you can trace the origin of where that component is executing. This defaults to "server". DevTools could use this for badges or different colors.

Sorry, something went wrong.

Uh oh!

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

All reactions
@sebmarkbage
sebmarkbage requested review from acdlite and gnoff February 8, 2024 01:33
@facebook-github-bot facebook-github-bot added CLA Signed React Core Team Opened by a member of the React Core Team labels Feb 8, 2024
@sebmarkbage
sebmarkbage requested a review from hoxyq February 8, 2024 01:33
@react-sizebot

react-sizebot commented Feb 8, 2024 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown

Comparing: d3def47...c4c5e0f

Critical size changes

Includes critical production bundles, as well as any change greater than 2%:

Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable/react-dom/cjs/react-dom.production.min.js = 176.64 kB 176.64 kB = 55.02 kB 55.02 kB
oss-experimental/react-dom/cjs/react-dom.production.min.js = 178.63 kB 178.63 kB = 55.59 kB 55.59 kB
facebook-www/ReactDOM-prod.classic.js = 591.73 kB 591.73 kB = 104.44 kB 104.44 kB
facebook-www/ReactDOM-prod.modern.js = 575.51 kB 575.51 kB = 101.53 kB 101.53 kB
oss-stable-semver/react-server/cjs/react-server-flight.development.js +4.27% 66.51 kB 69.35 kB +2.43% 16.20 kB 16.59 kB
oss-stable/react-server/cjs/react-server-flight.development.js +4.27% 66.51 kB 69.35 kB +2.43% 16.20 kB 16.59 kB
oss-experimental/react-noop-renderer/cjs/react-noop-renderer-flight-server.production.js +4.05% 2.20 kB 2.28 kB +1.93% 0.88 kB 0.90 kB
oss-stable-semver/react-noop-renderer/cjs/react-noop-renderer-flight-server.production.js +4.05% 2.20 kB 2.28 kB +1.93% 0.88 kB 0.90 kB
oss-stable/react-noop-renderer/cjs/react-noop-renderer-flight-server.production.js +4.05% 2.20 kB 2.28 kB +1.93% 0.88 kB 0.90 kB
oss-experimental/react-noop-renderer/cjs/react-noop-renderer-flight-server.production.min.js +3.74% 1.34 kB 1.39 kB +3.54% 0.62 kB 0.64 kB
oss-stable-semver/react-noop-renderer/cjs/react-noop-renderer-flight-server.production.min.js +3.74% 1.34 kB 1.39 kB +3.54% 0.62 kB 0.64 kB
oss-stable/react-noop-renderer/cjs/react-noop-renderer-flight-server.production.min.js +3.74% 1.34 kB 1.39 kB +3.54% 0.62 kB 0.64 kB
oss-experimental/react-server/cjs/react-server-flight.development.js +3.73% 76.21 kB 79.05 kB +2.12% 18.18 kB 18.56 kB
facebook-www/ReactFlightDOMServer-dev.modern.js +3.68% 84.42 kB 87.53 kB +2.10% 18.25 kB 18.63 kB
oss-experimental/react-noop-renderer/cjs/react-noop-renderer-flight-server.development.js +3.66% 2.43 kB 2.52 kB +1.82% 0.94 kB 0.95 kB
oss-stable-semver/react-noop-renderer/cjs/react-noop-renderer-flight-server.development.js +3.66% 2.43 kB 2.52 kB +1.82% 0.94 kB 0.95 kB
oss-stable/react-noop-renderer/cjs/react-noop-renderer-flight-server.development.js +3.66% 2.43 kB 2.52 kB +1.82% 0.94 kB 0.95 kB
oss-stable-semver/react-server-dom-esm/cjs/react-server-dom-esm-server.node.development.js +2.87% 100.68 kB 103.57 kB +1.69% 23.99 kB 24.40 kB
oss-stable/react-server-dom-esm/cjs/react-server-dom-esm-server.node.development.js +2.87% 100.68 kB 103.57 kB +1.69% 23.99 kB 24.40 kB
oss-stable-semver/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.browser.development.js +2.80% 102.95 kB 105.84 kB +1.62% 24.83 kB 25.23 kB
oss-stable/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.browser.development.js +2.80% 102.95 kB 105.84 kB +1.62% 24.83 kB 25.23 kB
oss-stable-semver/react-server-dom-turbopack/umd/react-server-dom-turbopack-server.browser.development.js +2.79% 108.73 kB 111.76 kB +1.73% 25.12 kB 25.55 kB
oss-stable/react-server-dom-turbopack/umd/react-server-dom-turbopack-server.browser.development.js +2.79% 108.73 kB 111.76 kB +1.73% 25.12 kB 25.55 kB
oss-stable-semver/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.edge.development.js +2.79% 103.66 kB 106.54 kB +1.60% 25.02 kB 25.42 kB
oss-stable/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.edge.development.js +2.79% 103.66 kB 106.54 kB +1.60% 25.02 kB 25.42 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.development.js +2.74% 105.54 kB 108.42 kB +1.59% 25.55 kB 25.95 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.development.js +2.74% 105.54 kB 108.42 kB +1.59% 25.55 kB 25.95 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.development.js +2.73% 105.72 kB 108.61 kB +1.56% 25.58 kB 25.98 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.development.js +2.73% 105.72 kB 108.61 kB +1.56% 25.58 kB 25.98 kB
oss-stable-semver/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.unbundled.development.js +2.72% 106.09 kB 108.98 kB +1.60% 25.20 kB 25.60 kB
oss-stable/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.unbundled.development.js +2.72% 106.09 kB 108.98 kB +1.60% 25.20 kB 25.60 kB
oss-stable-semver/react-server-dom-webpack/umd/react-server-dom-webpack-server.browser.development.js +2.72% 111.45 kB 114.48 kB +1.61% 25.86 kB 26.27 kB
oss-stable/react-server-dom-webpack/umd/react-server-dom-webpack-server.browser.development.js +2.72% 111.45 kB 114.48 kB +1.61% 25.86 kB 26.27 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.development.js +2.66% 108.52 kB 111.40 kB +1.57% 25.81 kB 26.22 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.development.js +2.66% 108.52 kB 111.40 kB +1.57% 25.81 kB 26.22 kB
oss-stable-semver/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.development.js +2.66% 108.73 kB 111.62 kB +1.56% 26.03 kB 26.43 kB
oss-stable/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.development.js +2.66% 108.73 kB 111.62 kB +1.56% 26.03 kB 26.43 kB
oss-experimental/react-server-dom-esm/cjs/react-server-dom-esm-server.node.development.js +2.61% 111.26 kB 114.16 kB +1.53% 26.28 kB 26.68 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.development.js +2.60% 111.15 kB 114.04 kB +1.56% 26.68 kB 27.10 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.development.js +2.60% 111.15 kB 114.04 kB +1.56% 26.68 kB 27.10 kB
oss-experimental/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.browser.development.js +2.55% 113.33 kB 116.22 kB +1.49% 27.06 kB 27.47 kB
oss-experimental/react-server-dom-turbopack/umd/react-server-dom-turbopack-server.browser.development.js +2.53% 119.56 kB 122.59 kB +1.38% 27.42 kB 27.80 kB
oss-experimental/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.edge.development.js +2.53% 114.71 kB 117.61 kB +1.50% 27.49 kB 27.90 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.development.js +2.49% 115.91 kB 118.80 kB +1.45% 27.79 kB 28.19 kB
oss-experimental/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.unbundled.development.js +2.48% 116.67 kB 119.57 kB +1.47% 27.49 kB 27.89 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.development.js +2.48% 116.77 kB 119.67 kB +1.47% 28.05 kB 28.46 kB
oss-experimental/react-server-dom-webpack/umd/react-server-dom-webpack-server.browser.development.js +2.48% 122.29 kB 125.31 kB +1.33% 28.14 kB 28.51 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.development.js +2.43% 119.09 kB 121.99 kB +1.44% 28.11 kB 28.52 kB
oss-experimental/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.development.js +2.43% 119.31 kB 122.21 kB +1.45% 28.32 kB 28.73 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.development.js +2.38% 121.73 kB 124.63 kB +1.43% 28.99 kB 29.41 kB
test_utils/ReactAllWarnings.js Deleted 67.02 kB 0.00 kB Deleted 16.42 kB 0.00 kB

Significant size changes

Includes any change greater than 0.2%:

Expand to show
Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable-semver/react-server/cjs/react-server-flight.development.js +4.27% 66.51 kB 69.35 kB +2.43% 16.20 kB 16.59 kB
oss-stable/react-server/cjs/react-server-flight.development.js +4.27% 66.51 kB 69.35 kB +2.43% 16.20 kB 16.59 kB
oss-experimental/react-noop-renderer/cjs/react-noop-renderer-flight-server.production.js +4.05% 2.20 kB 2.28 kB +1.93% 0.88 kB 0.90 kB
oss-stable-semver/react-noop-renderer/cjs/react-noop-renderer-flight-server.production.js +4.05% 2.20 kB 2.28 kB +1.93% 0.88 kB 0.90 kB
oss-stable/react-noop-renderer/cjs/react-noop-renderer-flight-server.production.js +4.05% 2.20 kB 2.28 kB +1.93% 0.88 kB 0.90 kB
oss-experimental/react-noop-renderer/cjs/react-noop-renderer-flight-server.production.min.js +3.74% 1.34 kB 1.39 kB +3.54% 0.62 kB 0.64 kB
oss-stable-semver/react-noop-renderer/cjs/react-noop-renderer-flight-server.production.min.js +3.74% 1.34 kB 1.39 kB +3.54% 0.62 kB 0.64 kB
oss-stable/react-noop-renderer/cjs/react-noop-renderer-flight-server.production.min.js +3.74% 1.34 kB 1.39 kB +3.54% 0.62 kB 0.64 kB
oss-experimental/react-server/cjs/react-server-flight.development.js +3.73% 76.21 kB 79.05 kB +2.12% 18.18 kB 18.56 kB
facebook-www/ReactFlightDOMServer-dev.modern.js +3.68% 84.42 kB 87.53 kB +2.10% 18.25 kB 18.63 kB
oss-experimental/react-noop-renderer/cjs/react-noop-renderer-flight-server.development.js +3.66% 2.43 kB 2.52 kB +1.82% 0.94 kB 0.95 kB
oss-stable-semver/react-noop-renderer/cjs/react-noop-renderer-flight-server.development.js +3.66% 2.43 kB 2.52 kB +1.82% 0.94 kB 0.95 kB
oss-stable/react-noop-renderer/cjs/react-noop-renderer-flight-server.development.js +3.66% 2.43 kB 2.52 kB +1.82% 0.94 kB 0.95 kB
oss-stable-semver/react-server-dom-esm/cjs/react-server-dom-esm-server.node.development.js +2.87% 100.68 kB 103.57 kB +1.69% 23.99 kB 24.40 kB
oss-stable/react-server-dom-esm/cjs/react-server-dom-esm-server.node.development.js +2.87% 100.68 kB 103.57 kB +1.69% 23.99 kB 24.40 kB
oss-stable-semver/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.browser.development.js +2.80% 102.95 kB 105.84 kB +1.62% 24.83 kB 25.23 kB
oss-stable/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.browser.development.js +2.80% 102.95 kB 105.84 kB +1.62% 24.83 kB 25.23 kB
oss-stable-semver/react-server-dom-turbopack/umd/react-server-dom-turbopack-server.browser.development.js +2.79% 108.73 kB 111.76 kB +1.73% 25.12 kB 25.55 kB
oss-stable/react-server-dom-turbopack/umd/react-server-dom-turbopack-server.browser.development.js +2.79% 108.73 kB 111.76 kB +1.73% 25.12 kB 25.55 kB
oss-stable-semver/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.edge.development.js +2.79% 103.66 kB 106.54 kB +1.60% 25.02 kB 25.42 kB
oss-stable/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.edge.development.js +2.79% 103.66 kB 106.54 kB +1.60% 25.02 kB 25.42 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.development.js +2.74% 105.54 kB 108.42 kB +1.59% 25.55 kB 25.95 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.development.js +2.74% 105.54 kB 108.42 kB +1.59% 25.55 kB 25.95 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.development.js +2.73% 105.72 kB 108.61 kB +1.56% 25.58 kB 25.98 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.development.js +2.73% 105.72 kB 108.61 kB +1.56% 25.58 kB 25.98 kB
oss-stable-semver/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.unbundled.development.js +2.72% 106.09 kB 108.98 kB +1.60% 25.20 kB 25.60 kB
oss-stable/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.unbundled.development.js +2.72% 106.09 kB 108.98 kB +1.60% 25.20 kB 25.60 kB
oss-stable-semver/react-server-dom-webpack/umd/react-server-dom-webpack-server.browser.development.js +2.72% 111.45 kB 114.48 kB +1.61% 25.86 kB 26.27 kB
oss-stable/react-server-dom-webpack/umd/react-server-dom-webpack-server.browser.development.js +2.72% 111.45 kB 114.48 kB +1.61% 25.86 kB 26.27 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.development.js +2.66% 108.52 kB 111.40 kB +1.57% 25.81 kB 26.22 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.development.js +2.66% 108.52 kB 111.40 kB +1.57% 25.81 kB 26.22 kB
oss-stable-semver/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.development.js +2.66% 108.73 kB 111.62 kB +1.56% 26.03 kB 26.43 kB
oss-stable/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.development.js +2.66% 108.73 kB 111.62 kB +1.56% 26.03 kB 26.43 kB
oss-experimental/react-server-dom-esm/cjs/react-server-dom-esm-server.node.development.js +2.61% 111.26 kB 114.16 kB +1.53% 26.28 kB 26.68 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.development.js +2.60% 111.15 kB 114.04 kB +1.56% 26.68 kB 27.10 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.development.js +2.60% 111.15 kB 114.04 kB +1.56% 26.68 kB 27.10 kB
oss-experimental/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.browser.development.js +2.55% 113.33 kB 116.22 kB +1.49% 27.06 kB 27.47 kB
oss-experimental/react-server-dom-turbopack/umd/react-server-dom-turbopack-server.browser.development.js +2.53% 119.56 kB 122.59 kB +1.38% 27.42 kB 27.80 kB
oss-experimental/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.edge.development.js +2.53% 114.71 kB 117.61 kB +1.50% 27.49 kB 27.90 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.development.js +2.49% 115.91 kB 118.80 kB +1.45% 27.79 kB 28.19 kB
oss-experimental/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.unbundled.development.js +2.48% 116.67 kB 119.57 kB +1.47% 27.49 kB 27.89 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.development.js +2.48% 116.77 kB 119.67 kB +1.47% 28.05 kB 28.46 kB
oss-experimental/react-server-dom-webpack/umd/react-server-dom-webpack-server.browser.development.js +2.48% 122.29 kB 125.31 kB +1.33% 28.14 kB 28.51 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.development.js +2.43% 119.09 kB 121.99 kB +1.44% 28.11 kB 28.52 kB
oss-experimental/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.development.js +2.43% 119.31 kB 122.21 kB +1.45% 28.32 kB 28.73 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.development.js +2.38% 121.73 kB 124.63 kB +1.43% 28.99 kB 29.41 kB
oss-stable-semver/react-server/cjs/react-server-flight.production.js +0.32% 56.77 kB 56.95 kB +0.44% 13.89 kB 13.95 kB
oss-stable/react-server/cjs/react-server-flight.production.js +0.32% 56.77 kB 56.95 kB +0.44% 13.89 kB 13.95 kB
oss-experimental/react-server/cjs/react-server-flight.production.js +0.27% 66.44 kB 66.62 kB +0.23% 15.88 kB 15.92 kB
test_utils/ReactAllWarnings.js Deleted 67.02 kB 0.00 kB Deleted 16.42 kB 0.00 kB

Generated by 🚫 dangerJS against c4c5e0f

All reactions

Sorry, something went wrong.

Uh oh!

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

@sebmarkbage
sebmarkbage force-pushed the servertoserver branch 2 times, most recently from b5c0e57 to 053e9c1 Compare February 8, 2024 01:39
sebmarkbage added 2 commits February 8, 2024 11:50
@sebmarkbage
Transfer debug info for server-to-server request
ec33294
A Flight Server can be a consumer of a stream from another Server.

In this case the meta data is attached to debugInfo properties on lazy,
Promises, Arrays or Elements that might in turn get forwarded to the next
stream. In this case we want to forward this debug information to the
client.
@sebmarkbage
Add environmentName option
c4c5e0f
This lets you name the server that is producing the debug info so that
you can trace the origin of where that component is executing.
@sebmarkbage
sebmarkbage force-pushed the servertoserver branch from 053e9c1 to c4c5e0f Compare February 8, 2024 16:51
unstubbable
unstubbable reviewed Feb 8, 2024
View reviewed changes
Comment thread packages/react-client/src/__tests__/ReactFlight-test.js

function ServerComponent({transport}) {
// This is a Server Component that receives other Server Components from a third party.
const children = ReactNoopFlightClient.read(transport);

@unstubbable unstubbable Feb 8, 2024 •
edited
Loading

Uh oh!

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

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.

This is an interesting case. Up until this PR I wasn't aware that server-to-server RSC is supposed to be supported. Unfortunately, this is not exposed as public API, or is it? I guess, we would need something like ReactFlightDOMClient.createFromFetch that works without an SSR manifest, and preserves client references, instead of trying to resolve them? Is this something that's planned?

Sorry, something went wrong.

Uh oh!

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

lubieowoce reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

@lubieowoce lubieowoce Feb 8, 2024

Copy link
Copy Markdown
Contributor

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.

(for context, the usecase is federation via RSC, as in https://x.com/dan_abramov2/status/1747983201748861274 for example. currently it requires... some stream serialization acrobatics)

Sorry, something went wrong.

Uh oh!

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

unstubbable reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

@sebmarkbage sebmarkbage Feb 8, 2024

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.

Like anything else it's more of a bundler feature. You just need some way from the third party server to refer to "client" as meaning files in the "server". Like anything else the server needs a manifest from the client.

Sorry, something went wrong.

Uh oh!

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

All reactions

@sebmarkbage sebmarkbage Feb 8, 2024

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.

Btw, untrusted is NOT supported. Flight parsing isn't vetted from a security perspective if the protocol is from an untrusted source.

Sorry, something went wrong.

Uh oh!

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

All reactions

@lubieowoce lubieowoce Feb 8, 2024 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

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.

hm. i'm not sure if a server being able to refer to things from another server is a prerequisite for this
(edit: it is, but WMF already has ways of doing this)

i think what @unstubbable was talking about is something that'd allow incorporating foreign (but trusted) trees server-side, without going into client-land. those trees wouldn't necessarily need to refer to things from the consuming server (and if they would, this'd likely be handled using "remotes", i.e. module federation's existing pattern for this).

so it's really more of an implementation headache. because right now this seems to require tunneling one RSC stream over another and then deserializing in client-land, as seen here:
https://twitter.com/lubieowoce/status/1744854538060771614?t=IK4O45iZvCU4isBmTHIf1A
and here:
https://twitter.com/ebey_jacob/status/1744793367085727952?t=fOPDaYf3LLelv7gYhvSuzQ&s=19
which works but seems unnecessarily cumbersome. granted, some of the cumbersomeness is just because Flight doesn't currently handle ReadableStreams as props, but even if it did, we'd still be tunneling

basically, i think the feature request would be for a server-land createFromReadableStream that keeps client references as references, so that it can be returned from a server component like any other element. (it's unfortunate that it'd have to parse just to serialize it right back, but i'm not sure if that can be avoided -- at the very least, rows need renumbering).

also if i'm missing something, @jacob-ebey can probably explain the use-case better, he's had experience implementing this, i just helped out with a couple bits.

ofc the federated use-case ALSO needs bundler support, because eventually you need to resolve those foreign client references to something. but i believe that's been implemented in userspace already, really """just""" a matter of hooking the existing machinery of module federation into it all.

(sorry for making this a huge long thing in a drive-by comment 😅 probably not the best place, hope you don't mind!)

Sorry, something went wrong.

Uh oh!

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

All reactions

@sebmarkbage sebmarkbage Feb 9, 2024 •
edited
Loading

Uh oh!

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

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, I mean we'll support ReadableStream pass through but that's not really recommended. That's just module federation.

It needs to be deserialized and re-serialized so that the third-party can also render server components inside the first party and everything else can kick in. Sure, there's a slight perf hit but so does SSR. There could be optimizations added on top of that which can keep some parts pass through but that's an optimization and not the core model.

Sorry, something went wrong.

Uh oh!

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

All reactions

@sebmarkbage sebmarkbage Feb 9, 2024 •
edited
Loading

Uh oh!

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

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.

basically, i think the feature request would be for a server-land createFromReadableStream that keeps client references as references, so that it can be returned from a server component like any other element. (it's unfortunate that it'd have to parse just to serialize it right back, but i'm not sure if that can be avoided

Although now I'm confused what you mean because this is supported. That's what this PR uses.

There's no limitation that /client can't be used in react-server environments.

https://github.com/facebook/react/blob/main/packages/react-server-dom-webpack/package.json#L46-L49

Sorry, something went wrong.

Uh oh!

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

All reactions

@sebmarkbage sebmarkbage Feb 9, 2024

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.

Oh I think I understand the misunderstanding. The confusion is that Client References isn't actually 1:1 with "use client". It's not supposed to preserve the Client References. Instead, the Client Reference of a Third Party is a reference to a module in the first party. Requiring that module might be a Server Component but if it's "use client" then importing that same file will be a Client Reference again. So you don't need some way to do the rewriting.

Sorry, something went wrong.

Uh oh!

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

All reactions
@sebmarkbage sebmarkbage mentioned this pull request Feb 9, 2024
[Fiber] Transfer _debugInfo from Arrays, Lazy, Thenables and Elements to the inner Fibers. #28286
Merged
hoxyq
hoxyq reviewed Feb 12, 2024
View reviewed changes

@hoxyq hoxyq left a comment •
edited
Loading

Uh oh!

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

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.

LGTM from the approach side, passing it to someone who has more context on Flight

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread packages/react-server/src/ReactFlightServer.js
Comment on lines +1278 to +1280
// Reset the task's thenable state before continuing. If there was one, it was
// from suspending the lazy before.
task.thenableState = null;

@hoxyq hoxyq Feb 12, 2024

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.

Maybe a silly question, but why adding / changing debugInfo has side-effects on task.thenableState?
Or is it just a small drive-by fix?

Sorry, something went wrong.

Uh oh!

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

All reactions

@sebmarkbage sebmarkbage Feb 12, 2024

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, it's mainly a drive-by fix. The bug was introduced in #28068

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread packages/react-server/src/ReactFlightServer.js
Comment on lines +205 to +206
// DEV-only
environmentName: string,

@hoxyq hoxyq Feb 12, 2024

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.

Why can't we make this field optional?

This could backfire once someone decides to use this field and not actually inspecting the type definition.

Sorry, something went wrong.

Uh oh!

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

All reactions

@gnoff gnoff Feb 12, 2024

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.

Yeah personally I'd prefer we any cast the one place we read the name than do this to the Request type

Sorry, something went wrong.

Uh oh!

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

All reactions

@sebmarkbage sebmarkbage Feb 12, 2024

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.

We have had this pattern elsewhere. It's nice because there's only one place to mess it up.

There will be many more places where environmentName gets used but the Request type is only initialized in one place.

Optional fields are bad for perf when you do mess them up because it breaks the hidden class. You could potentially accidentally add a field by writing to it unconditionally.

I don't like that we use optional fields for Fiber for example because we instead have bugs in the continued working with the code by doing undefined checks, which lets things pass and keep working even if they're undefined or missing. We typically check for example === null exactly so that if we get an undefined flowing through the system it should error. Even if that errors only in production because then we'll quickly find the mistake.

Sorry, something went wrong.

Uh oh!

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

All reactions
gnoff
gnoff approved these changes Feb 12, 2024
View reviewed changes
Comment thread packages/react-server/src/ReactFlightServer.js
Comment on lines +205 to +206
// DEV-only
environmentName: string,

@gnoff gnoff Feb 12, 2024

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.

Yeah personally I'd prefer we any cast the one place we read the name than do this to the Request type

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread packages/react-server/src/ReactFlightServer.js
if (debugID === null) {
// We don't have a chunk to assign debug info. We need to outline this
// component to assign it an ID.
return outlineTask(request, task);

@gnoff gnoff Feb 12, 2024

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.

It seems unfortunate that we fork the dev/prod behavior here. Means we need to have faith that outlining won't hide or express bugs that won't happen absent the debugInfo.

Sorry, something went wrong.

Uh oh!

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

All reactions

@sebmarkbage sebmarkbage Feb 12, 2024

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.

Well it would show up in prod. As long as it's unobservable it doesn't affect dev/prod behavior for users. At some point we just have to trust that we don't mess up the implementation.

Sorry, something went wrong.

Uh oh!

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

All reactions
@sebmarkbage
sebmarkbage merged commit 629541b into react:main Feb 12, 2024
github-actions Bot pushed a commit that referenced this pull request Feb 12, 2024
@sebmarkbage
[Flight] Transfer Debug Info in Server-to-Server Flight Requests (#28275
c4aeba9
)

A Flight Server can be a consumer of a stream from another Server. In
this case the meta data is attached to debugInfo properties on lazy,
Promises, Arrays or Elements that might in turn get forwarded to the
next stream. In this case we want to forward this debug information to
the client in the stream.

I also added a DEV only `environmentName` option to the Flight Server.
This lets you name the server that is producing the debug info so that
you can trace the origin of where that component is executing. This
defaults to `"server"`. DevTools could use this for badges or different
colors.

DiffTrain build for [629541b](629541b)
This was referenced Feb 20, 2024
Bump vendored react versions vercel/next.js#62302
Closed
Upgrade vendored react vercel/next.js#62326
Merged
huozhi added a commit to vercel/next.js that referenced this pull request Feb 23, 2024
@huozhi
Upgrade vendored react (#62326)
e5d604f
### React upstream changes

- react/react#28333
- react/react#28334
- react/react#28378
- react/react#28377
- react/react#28376
- react/react#28338
- react/react#28331
- react/react#28336
- react/react#28320
- react/react#28317
- react/react#28375
- react/react#28367
- react/react#28380
- react/react#28368
- react/react#28343
- react/react#28355
- react/react#28374
- react/react#28362
- react/react#28344
- react/react#28339
- react/react#28353
- react/react#28346
- react/react#25790
- react/react#28352
- react/react#28326
- react/react#27688
- react/react#28329
- react/react#28332
- react/react#28340
- react/react#28327
- react/react#28325
- react/react#28324
- react/react#28309
- react/react#28310
- react/react#28307
- react/react#28306
- react/react#28315
- react/react#28318
- react/react#28226
- react/react#28308
- react/react#27563
- react/react#28297
- react/react#28286
- react/react#28284
- react/react#28275
- react/react#28145
- react/react#28301
- react/react#28224
- react/react#28152
- react/react#28296
- react/react#28294
- react/react#28279
- react/react#28273
- react/react#28269
- react/react#28376
- react/react#28338
- react/react#28331
- react/react#28336
- react/react#28320
- react/react#28317
- react/react#28375
- react/react#28367
- react/react#28380
- react/react#28368
- react/react#28343
- react/react#28355
- react/react#28374
- react/react#28362
- react/react#28344
- react/react#28339
- react/react#28353
- react/react#28346
- react/react#25790
- react/react#28352
- react/react#28326
- react/react#27688
- react/react#28329
- react/react#28332
- react/react#28340
- react/react#28327
- react/react#28325
- react/react#28324
- react/react#28309
- react/react#28310
- react/react#28307
- react/react#28306
- react/react#28315
- react/react#28318
- react/react#28226
- react/react#28308
- react/react#27563
- react/react#28297
- react/react#28286
- react/react#28284
- react/react#28275
- react/react#28145
- react/react#28301
- react/react#28224
- react/react#28152
- react/react#28296
- react/react#28294
- react/react#28279
- react/react#28273
- react/react#28269

Closes NEXT-2542


Disable ppr test for strict mode for now, @acdlite will check it and
we'll sync again
@ztanner ztanner mentioned this pull request Mar 19, 2024
(backport) Update React from 60a927d04 to 14898b6a9 vercel/next.js#63442
Closed
EdisonVan pushed a commit to EdisonVan/react that referenced this pull request Apr 15, 2024
@sebmarkbage @AndyPengc12
[Flight] Transfer Debug Info in Server-to-Server Flight Requests (rea…
d24d649
…ct#28275)

A Flight Server can be a consumer of a stream from another Server. In
this case the meta data is attached to debugInfo properties on lazy,
Promises, Arrays or Elements that might in turn get forwarded to the
next stream. In this case we want to forward this debug information to
the client in the stream.

I also added a DEV only `environmentName` option to the Flight Server.
This lets you name the server that is producing the debug info so that
you can trace the origin of where that component is executing. This
defaults to `"server"`. DevTools could use this for badges or different
colors.
bigfootjon pushed a commit that referenced this pull request Apr 18, 2024
@sebmarkbage
[Flight] Transfer Debug Info in Server-to-Server Flight Requests (#28275
0bd6d70
)

A Flight Server can be a consumer of a stream from another Server. In
this case the meta data is attached to debugInfo properties on lazy,
Promises, Arrays or Elements that might in turn get forwarded to the
next stream. In this case we want to forward this debug information to
the client in the stream.

I also added a DEV only `environmentName` option to the Flight Server.
This lets you name the server that is producing the debug info so that
you can trace the origin of where that component is executing. This
defaults to `"server"`. DevTools could use this for badges or different
colors.

DiffTrain build for commit 629541b.
hanzo-dev pushed a commit to hanzoai/react that referenced this pull request Sep 9, 2026
@sebmarkbage
[Flight] Transfer Debug Info in Server-to-Server Flight Requests (rea…
bca605e
…ct#28275)

A Flight Server can be a consumer of a stream from another Server. In
this case the meta data is attached to debugInfo properties on lazy,
Promises, Arrays or Elements that might in turn get forwarded to the
next stream. In this case we want to forward this debug information to
the client in the stream.

I also added a DEV only `environmentName` option to the Flight Server.
This lets you name the server that is producing the debug info so that
you can trace the origin of where that component is executing. This
defaults to `"server"`. DevTools could use this for badges or different
colors.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@unstubbable unstubbable unstubbable left review comments
@hoxyq hoxyq hoxyq left review comments
@gnoff gnoff gnoff approved these changes
@acdlite acdlite Awaiting requested review from acdlite
+1 more reviewer
@lubieowoce lubieowoce lubieowoce left review comments
Reviewers whose approvals may not affect merge requirements

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.

7 participants

@sebmarkbage @react-sizebot @unstubbable @gnoff @lubieowoce @hoxyq @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.