Skip to content
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

Preload imports #26664

Closed
wants to merge 2 commits into from
Closed

Preload imports #26664

wants to merge 2 commits into from

Conversation

gnoff
Copy link
Collaborator

@gnoff gnoff commented Apr 18, 2023

Preloads Import rows during SSR so browser can start to download before JS has loaded

@facebook-github-bot facebook-github-bot added CLA Signed React Core Team Opened by a member of the React Core Team labels Apr 18, 2023
@react-sizebot
Copy link

react-sizebot commented Apr 18, 2023

Comparing: cc93a85...2882053

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 = 163.95 kB 163.88 kB = 51.67 kB 51.67 kB
oss-experimental/react-dom/cjs/react-dom.production.min.js = 167.70 kB 167.64 kB = 52.81 kB 52.81 kB
facebook-www/ReactDOM-prod.classic.js = 566.07 kB 566.11 kB = 100.25 kB 100.26 kB
facebook-www/ReactDOM-prod.modern.js = 549.80 kB 549.85 kB +0.01% 97.57 kB 97.58 kB
oss-stable-semver/react-dom/cjs/react-dom-server-rendering-stub.development.js +21.96% 2.92 kB 3.57 kB +28.31% 0.92 kB 1.18 kB
oss-stable/react-dom/cjs/react-dom-server-rendering-stub.development.js +21.78% 2.95 kB 3.59 kB +27.80% 0.95 kB 1.21 kB
oss-experimental/react-dom/cjs/react-dom-server-rendering-stub.development.js +21.72% 2.96 kB 3.60 kB +27.66% 0.95 kB 1.21 kB
oss-stable-semver/react-dom/umd/react-dom-server-rendering-stub.development.js +20.47% 3.30 kB 3.98 kB +25.95% 1.03 kB 1.30 kB
oss-stable/react-dom/umd/react-dom-server-rendering-stub.development.js +20.32% 3.33 kB 4.00 kB +25.31% 1.06 kB 1.32 kB
oss-experimental/react-dom/umd/react-dom-server-rendering-stub.development.js +20.28% 3.33 kB 4.01 kB +25.26% 1.06 kB 1.32 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.unbundled.production.min.js +7.54% 6.78 kB 7.29 kB +6.34% 2.71 kB 2.89 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.unbundled.production.min.js +7.54% 6.78 kB 7.29 kB +6.34% 2.71 kB 2.89 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.unbundled.production.min.js +7.54% 6.78 kB 7.29 kB +6.34% 2.71 kB 2.89 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.production.min.js +7.21% 7.15 kB 7.67 kB +5.15% 2.90 kB 3.04 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.production.min.js +7.21% 7.15 kB 7.67 kB +5.15% 2.90 kB 3.04 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.production.min.js +7.21% 7.15 kB 7.67 kB +5.15% 2.90 kB 3.04 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-client.edge.production.min.js +7.20% 7.23 kB 7.75 kB +5.19% 2.95 kB 3.10 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-client.edge.production.min.js +7.20% 7.23 kB 7.75 kB +5.19% 2.95 kB 3.10 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-client.edge.production.min.js +7.20% 7.23 kB 7.75 kB +5.19% 2.95 kB 3.10 kB
facebook-www/ReactFlightDOMRelayServer-dev.classic.js +6.59% 61.97 kB 66.06 kB +5.98% 15.05 kB 15.95 kB
facebook-www/ReactFlightDOMRelayServer-dev.modern.js +6.59% 61.97 kB 66.06 kB +5.98% 15.05 kB 15.95 kB
facebook-www/ReactFlightDOMRelayServer-prod.classic.js +6.54% 31.70 kB 33.78 kB +4.97% 7.50 kB 7.88 kB
facebook-www/ReactFlightDOMRelayServer-prod.modern.js +6.54% 31.70 kB 33.78 kB +4.97% 7.50 kB 7.88 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.unbundled.development.js +5.88% 24.82 kB 26.28 kB +4.56% 6.49 kB 6.79 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.unbundled.development.js +5.88% 24.82 kB 26.28 kB +4.56% 6.49 kB 6.79 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.unbundled.development.js +5.88% 24.82 kB 26.28 kB +4.56% 6.49 kB 6.79 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.production.min.js +5.70% 20.03 kB 21.17 kB +5.30% 7.22 kB 7.60 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.production.min.js +5.70% 20.03 kB 21.17 kB +5.30% 7.22 kB 7.60 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.production.min.js +5.70% 20.03 kB 21.17 kB +5.30% 7.22 kB 7.60 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.development.js +5.68% 84.51 kB 89.31 kB +5.49% 20.87 kB 22.02 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.development.js +5.68% 84.51 kB 89.31 kB +5.49% 20.87 kB 22.02 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.development.js +5.68% 84.51 kB 89.31 kB +5.49% 20.87 kB 22.02 kB
oss-experimental/react-server-dom-webpack/umd/react-server-dom-webpack-client.browser.production.min.js +5.58% 9.70 kB 10.24 kB +3.94% 3.86 kB 4.01 kB
oss-stable-semver/react-server-dom-webpack/umd/react-server-dom-webpack-client.browser.production.min.js +5.58% 9.70 kB 10.24 kB +3.94% 3.86 kB 4.01 kB
oss-stable/react-server-dom-webpack/umd/react-server-dom-webpack-client.browser.production.min.js +5.58% 9.70 kB 10.24 kB +3.94% 3.86 kB 4.01 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.development.js +5.57% 86.58 kB 91.41 kB +5.31% 20.99 kB 22.10 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.development.js +5.57% 86.58 kB 91.41 kB +5.31% 20.99 kB 22.10 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.development.js +5.57% 86.58 kB 91.41 kB +5.31% 20.99 kB 22.10 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.development.js +5.56% 26.36 kB 27.82 kB +4.51% 6.94 kB 7.25 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.development.js +5.56% 26.36 kB 27.82 kB +4.51% 6.94 kB 7.25 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.development.js +5.56% 26.36 kB 27.82 kB +4.51% 6.94 kB 7.25 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-client.edge.development.js +5.52% 26.57 kB 28.04 kB +4.46% 7.02 kB 7.33 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-client.edge.development.js +5.52% 26.57 kB 28.04 kB +4.46% 7.02 kB 7.33 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-client.edge.development.js +5.52% 26.57 kB 28.04 kB +4.46% 7.02 kB 7.33 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-client.browser.production.min.js +5.51% 9.46 kB 9.98 kB +3.92% 3.75 kB 3.89 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-client.browser.production.min.js +5.51% 9.46 kB 9.98 kB +3.92% 3.75 kB 3.89 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-client.browser.production.min.js +5.51% 9.46 kB 9.98 kB +3.92% 3.75 kB 3.89 kB
oss-experimental/react-server-dom-webpack/umd/react-server-dom-webpack-server.browser.development.js +5.45% 88.79 kB 93.64 kB +5.27% 21.05 kB 22.16 kB
oss-stable-semver/react-server-dom-webpack/umd/react-server-dom-webpack-server.browser.development.js +5.45% 88.79 kB 93.64 kB +5.27% 21.05 kB 22.16 kB
oss-stable/react-server-dom-webpack/umd/react-server-dom-webpack-server.browser.development.js +5.45% 88.79 kB 93.64 kB +5.27% 21.05 kB 22.16 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.development.js +5.43% 88.90 kB 93.72 kB +5.26% 21.66 kB 22.79 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.development.js +5.43% 88.90 kB 93.72 kB +5.26% 21.66 kB 22.79 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.development.js +5.43% 88.90 kB 93.72 kB +5.26% 21.66 kB 22.79 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.development.js +5.42% 84.02 kB 88.57 kB +5.27% 20.74 kB 21.83 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.development.js +5.42% 84.02 kB 88.57 kB +5.27% 20.74 kB 21.83 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.development.js +5.42% 84.02 kB 88.57 kB +5.27% 20.74 kB 21.83 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.production.min.js +5.25% 20.80 kB 21.90 kB +5.03% 7.49 kB 7.87 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.production.min.js +5.25% 20.80 kB 21.90 kB +5.03% 7.49 kB 7.87 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.production.min.js +5.25% 20.80 kB 21.90 kB +5.03% 7.49 kB 7.87 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.production.min.js +5.14% 21.37 kB 22.47 kB +4.79% 7.68 kB 8.05 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.production.min.js +5.14% 21.37 kB 22.47 kB +4.79% 7.68 kB 8.05 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.production.min.js +5.14% 21.37 kB 22.47 kB +4.79% 7.68 kB 8.05 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.production.min.js +5.13% 19.74 kB 20.75 kB +4.84% 7.13 kB 7.47 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.production.min.js +5.13% 19.74 kB 20.75 kB +4.84% 7.13 kB 7.47 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.production.min.js +5.13% 19.74 kB 20.75 kB +4.84% 7.13 kB 7.47 kB
oss-experimental/react-server-dom-webpack/umd/react-server-dom-webpack-server.browser.production.min.js +5.05% 19.95 kB 20.96 kB +4.65% 7.25 kB 7.59 kB
oss-stable-semver/react-server-dom-webpack/umd/react-server-dom-webpack-server.browser.production.min.js +5.05% 19.95 kB 20.96 kB +4.65% 7.25 kB 7.59 kB
oss-stable/react-server-dom-webpack/umd/react-server-dom-webpack-server.browser.production.min.js +5.05% 19.95 kB 20.96 kB +4.65% 7.25 kB 7.59 kB
oss-experimental/react-server-dom-webpack/umd/react-server-dom-webpack-client.browser.development.js +3.16% 50.03 kB 51.61 kB +2.62% 11.84 kB 12.15 kB
oss-stable-semver/react-server-dom-webpack/umd/react-server-dom-webpack-client.browser.development.js +3.16% 50.03 kB 51.61 kB +2.62% 11.84 kB 12.15 kB
oss-stable/react-server-dom-webpack/umd/react-server-dom-webpack-client.browser.development.js +3.16% 50.03 kB 51.61 kB +2.62% 11.84 kB 12.15 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-client.browser.development.js +3.11% 47.07 kB 48.54 kB +2.57% 11.65 kB 11.95 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-client.browser.development.js +3.11% 47.07 kB 48.54 kB +2.57% 11.65 kB 11.95 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-client.browser.development.js +3.11% 47.07 kB 48.54 kB +2.57% 11.65 kB 11.95 kB
oss-experimental/react-server/cjs/react-server-flight.production.min.js +2.93% 15.47 kB 15.93 kB +2.51% 5.65 kB 5.80 kB
oss-stable-semver/react-server/cjs/react-server-flight.production.min.js +2.93% 15.47 kB 15.93 kB +2.51% 5.65 kB 5.80 kB
oss-stable/react-server/cjs/react-server-flight.production.min.js +2.93% 15.47 kB 15.93 kB +2.51% 5.65 kB 5.80 kB
oss-experimental/react-noop-renderer/cjs/react-noop-renderer-flight-server.production.min.js +2.85% 1.23 kB 1.26 kB +2.77% 0.58 kB 0.59 kB
oss-stable-semver/react-noop-renderer/cjs/react-noop-renderer-flight-server.production.min.js +2.85% 1.23 kB 1.26 kB +2.77% 0.58 kB 0.59 kB
oss-stable/react-noop-renderer/cjs/react-noop-renderer-flight-server.production.min.js +2.85% 1.23 kB 1.26 kB +2.77% 0.58 kB 0.59 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-plugin.js +2.36% 4.62 kB 4.73 kB +2.81% 2.03 kB 2.09 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-plugin.js +2.36% 4.62 kB 4.73 kB +2.81% 2.03 kB 2.09 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-plugin.js +2.36% 4.62 kB 4.73 kB +2.81% 2.03 kB 2.09 kB
oss-experimental/react-server/cjs/react-server-flight.development.js +2.25% 64.57 kB 66.03 kB +1.78% 15.65 kB 15.93 kB
oss-stable-semver/react-server/cjs/react-server-flight.development.js +2.25% 64.57 kB 66.03 kB +1.78% 15.65 kB 15.93 kB
oss-stable/react-server/cjs/react-server-flight.development.js +2.25% 64.57 kB 66.03 kB +1.78% 15.65 kB 15.93 kB
facebook-relay/flight/ReactFlightNativeRelayServer-prod.js +2.22% 31.61 kB 32.31 kB +2.11% 7.50 kB 7.66 kB
facebook-relay/flight/ReactFlightNativeRelayServer-dev.js +2.21% 61.94 kB 63.30 kB +1.85% 15.10 kB 15.38 kB
oss-experimental/react-dom/umd/react-dom-server-rendering-stub.production.min.js = 1.49 kB 1.40 kB +0.50% 0.80 kB 0.81 kB
oss-stable/react-dom/umd/react-dom-server-rendering-stub.production.min.js = 1.48 kB 1.39 kB +0.25% 0.80 kB 0.80 kB
oss-stable-semver/react-dom/umd/react-dom-server-rendering-stub.production.min.js = 1.46 kB 1.37 kB +0.26% 0.78 kB 0.78 kB
oss-experimental/react-dom/cjs/react-dom-server-rendering-stub.production.min.js = 1.26 kB 1.18 kB +1.33% 0.68 kB 0.69 kB
oss-stable/react-dom/cjs/react-dom-server-rendering-stub.production.min.js = 1.26 kB 1.17 kB +1.19% 0.67 kB 0.68 kB
oss-stable-semver/react-dom/cjs/react-dom-server-rendering-stub.production.min.js = 1.23 kB 1.15 kB +1.23% 0.65 kB 0.66 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-dom/cjs/react-dom-server-rendering-stub.development.js +21.96% 2.92 kB 3.57 kB +28.31% 0.92 kB 1.18 kB
oss-stable/react-dom/cjs/react-dom-server-rendering-stub.development.js +21.78% 2.95 kB 3.59 kB +27.80% 0.95 kB 1.21 kB
oss-experimental/react-dom/cjs/react-dom-server-rendering-stub.development.js +21.72% 2.96 kB 3.60 kB +27.66% 0.95 kB 1.21 kB
oss-stable-semver/react-dom/umd/react-dom-server-rendering-stub.development.js +20.47% 3.30 kB 3.98 kB +25.95% 1.03 kB 1.30 kB
oss-stable/react-dom/umd/react-dom-server-rendering-stub.development.js +20.32% 3.33 kB 4.00 kB +25.31% 1.06 kB 1.32 kB
oss-experimental/react-dom/umd/react-dom-server-rendering-stub.development.js +20.28% 3.33 kB 4.01 kB +25.26% 1.06 kB 1.32 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.unbundled.production.min.js +7.54% 6.78 kB 7.29 kB +6.34% 2.71 kB 2.89 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.unbundled.production.min.js +7.54% 6.78 kB 7.29 kB +6.34% 2.71 kB 2.89 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.unbundled.production.min.js +7.54% 6.78 kB 7.29 kB +6.34% 2.71 kB 2.89 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.production.min.js +7.21% 7.15 kB 7.67 kB +5.15% 2.90 kB 3.04 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.production.min.js +7.21% 7.15 kB 7.67 kB +5.15% 2.90 kB 3.04 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.production.min.js +7.21% 7.15 kB 7.67 kB +5.15% 2.90 kB 3.04 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-client.edge.production.min.js +7.20% 7.23 kB 7.75 kB +5.19% 2.95 kB 3.10 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-client.edge.production.min.js +7.20% 7.23 kB 7.75 kB +5.19% 2.95 kB 3.10 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-client.edge.production.min.js +7.20% 7.23 kB 7.75 kB +5.19% 2.95 kB 3.10 kB
facebook-www/ReactFlightDOMRelayServer-dev.classic.js +6.59% 61.97 kB 66.06 kB +5.98% 15.05 kB 15.95 kB
facebook-www/ReactFlightDOMRelayServer-dev.modern.js +6.59% 61.97 kB 66.06 kB +5.98% 15.05 kB 15.95 kB
facebook-www/ReactFlightDOMRelayServer-prod.classic.js +6.54% 31.70 kB 33.78 kB +4.97% 7.50 kB 7.88 kB
facebook-www/ReactFlightDOMRelayServer-prod.modern.js +6.54% 31.70 kB 33.78 kB +4.97% 7.50 kB 7.88 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.unbundled.development.js +5.88% 24.82 kB 26.28 kB +4.56% 6.49 kB 6.79 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.unbundled.development.js +5.88% 24.82 kB 26.28 kB +4.56% 6.49 kB 6.79 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.unbundled.development.js +5.88% 24.82 kB 26.28 kB +4.56% 6.49 kB 6.79 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.production.min.js +5.70% 20.03 kB 21.17 kB +5.30% 7.22 kB 7.60 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.production.min.js +5.70% 20.03 kB 21.17 kB +5.30% 7.22 kB 7.60 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.production.min.js +5.70% 20.03 kB 21.17 kB +5.30% 7.22 kB 7.60 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.development.js +5.68% 84.51 kB 89.31 kB +5.49% 20.87 kB 22.02 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.development.js +5.68% 84.51 kB 89.31 kB +5.49% 20.87 kB 22.02 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.development.js +5.68% 84.51 kB 89.31 kB +5.49% 20.87 kB 22.02 kB
oss-experimental/react-server-dom-webpack/umd/react-server-dom-webpack-client.browser.production.min.js +5.58% 9.70 kB 10.24 kB +3.94% 3.86 kB 4.01 kB
oss-stable-semver/react-server-dom-webpack/umd/react-server-dom-webpack-client.browser.production.min.js +5.58% 9.70 kB 10.24 kB +3.94% 3.86 kB 4.01 kB
oss-stable/react-server-dom-webpack/umd/react-server-dom-webpack-client.browser.production.min.js +5.58% 9.70 kB 10.24 kB +3.94% 3.86 kB 4.01 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.development.js +5.57% 86.58 kB 91.41 kB +5.31% 20.99 kB 22.10 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.development.js +5.57% 86.58 kB 91.41 kB +5.31% 20.99 kB 22.10 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.development.js +5.57% 86.58 kB 91.41 kB +5.31% 20.99 kB 22.10 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.development.js +5.56% 26.36 kB 27.82 kB +4.51% 6.94 kB 7.25 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.development.js +5.56% 26.36 kB 27.82 kB +4.51% 6.94 kB 7.25 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.development.js +5.56% 26.36 kB 27.82 kB +4.51% 6.94 kB 7.25 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-client.edge.development.js +5.52% 26.57 kB 28.04 kB +4.46% 7.02 kB 7.33 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-client.edge.development.js +5.52% 26.57 kB 28.04 kB +4.46% 7.02 kB 7.33 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-client.edge.development.js +5.52% 26.57 kB 28.04 kB +4.46% 7.02 kB 7.33 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-client.browser.production.min.js +5.51% 9.46 kB 9.98 kB +3.92% 3.75 kB 3.89 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-client.browser.production.min.js +5.51% 9.46 kB 9.98 kB +3.92% 3.75 kB 3.89 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-client.browser.production.min.js +5.51% 9.46 kB 9.98 kB +3.92% 3.75 kB 3.89 kB
oss-experimental/react-server-dom-webpack/umd/react-server-dom-webpack-server.browser.development.js +5.45% 88.79 kB 93.64 kB +5.27% 21.05 kB 22.16 kB
oss-stable-semver/react-server-dom-webpack/umd/react-server-dom-webpack-server.browser.development.js +5.45% 88.79 kB 93.64 kB +5.27% 21.05 kB 22.16 kB
oss-stable/react-server-dom-webpack/umd/react-server-dom-webpack-server.browser.development.js +5.45% 88.79 kB 93.64 kB +5.27% 21.05 kB 22.16 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.development.js +5.43% 88.90 kB 93.72 kB +5.26% 21.66 kB 22.79 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.development.js +5.43% 88.90 kB 93.72 kB +5.26% 21.66 kB 22.79 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.development.js +5.43% 88.90 kB 93.72 kB +5.26% 21.66 kB 22.79 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.development.js +5.42% 84.02 kB 88.57 kB +5.27% 20.74 kB 21.83 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.development.js +5.42% 84.02 kB 88.57 kB +5.27% 20.74 kB 21.83 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.development.js +5.42% 84.02 kB 88.57 kB +5.27% 20.74 kB 21.83 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.production.min.js +5.25% 20.80 kB 21.90 kB +5.03% 7.49 kB 7.87 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.production.min.js +5.25% 20.80 kB 21.90 kB +5.03% 7.49 kB 7.87 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.production.min.js +5.25% 20.80 kB 21.90 kB +5.03% 7.49 kB 7.87 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.production.min.js +5.14% 21.37 kB 22.47 kB +4.79% 7.68 kB 8.05 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.production.min.js +5.14% 21.37 kB 22.47 kB +4.79% 7.68 kB 8.05 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.production.min.js +5.14% 21.37 kB 22.47 kB +4.79% 7.68 kB 8.05 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.production.min.js +5.13% 19.74 kB 20.75 kB +4.84% 7.13 kB 7.47 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.production.min.js +5.13% 19.74 kB 20.75 kB +4.84% 7.13 kB 7.47 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.production.min.js +5.13% 19.74 kB 20.75 kB +4.84% 7.13 kB 7.47 kB
oss-experimental/react-server-dom-webpack/umd/react-server-dom-webpack-server.browser.production.min.js +5.05% 19.95 kB 20.96 kB +4.65% 7.25 kB 7.59 kB
oss-stable-semver/react-server-dom-webpack/umd/react-server-dom-webpack-server.browser.production.min.js +5.05% 19.95 kB 20.96 kB +4.65% 7.25 kB 7.59 kB
oss-stable/react-server-dom-webpack/umd/react-server-dom-webpack-server.browser.production.min.js +5.05% 19.95 kB 20.96 kB +4.65% 7.25 kB 7.59 kB
oss-experimental/react-server-dom-webpack/umd/react-server-dom-webpack-client.browser.development.js +3.16% 50.03 kB 51.61 kB +2.62% 11.84 kB 12.15 kB
oss-stable-semver/react-server-dom-webpack/umd/react-server-dom-webpack-client.browser.development.js +3.16% 50.03 kB 51.61 kB +2.62% 11.84 kB 12.15 kB
oss-stable/react-server-dom-webpack/umd/react-server-dom-webpack-client.browser.development.js +3.16% 50.03 kB 51.61 kB +2.62% 11.84 kB 12.15 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-client.browser.development.js +3.11% 47.07 kB 48.54 kB +2.57% 11.65 kB 11.95 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-client.browser.development.js +3.11% 47.07 kB 48.54 kB +2.57% 11.65 kB 11.95 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-client.browser.development.js +3.11% 47.07 kB 48.54 kB +2.57% 11.65 kB 11.95 kB
oss-experimental/react-server/cjs/react-server-flight.production.min.js +2.93% 15.47 kB 15.93 kB +2.51% 5.65 kB 5.80 kB
oss-stable-semver/react-server/cjs/react-server-flight.production.min.js +2.93% 15.47 kB 15.93 kB +2.51% 5.65 kB 5.80 kB
oss-stable/react-server/cjs/react-server-flight.production.min.js +2.93% 15.47 kB 15.93 kB +2.51% 5.65 kB 5.80 kB
oss-experimental/react-noop-renderer/cjs/react-noop-renderer-flight-server.production.min.js +2.85% 1.23 kB 1.26 kB +2.77% 0.58 kB 0.59 kB
oss-stable-semver/react-noop-renderer/cjs/react-noop-renderer-flight-server.production.min.js +2.85% 1.23 kB 1.26 kB +2.77% 0.58 kB 0.59 kB
oss-stable/react-noop-renderer/cjs/react-noop-renderer-flight-server.production.min.js +2.85% 1.23 kB 1.26 kB +2.77% 0.58 kB 0.59 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-plugin.js +2.36% 4.62 kB 4.73 kB +2.81% 2.03 kB 2.09 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-plugin.js +2.36% 4.62 kB 4.73 kB +2.81% 2.03 kB 2.09 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-plugin.js +2.36% 4.62 kB 4.73 kB +2.81% 2.03 kB 2.09 kB
oss-experimental/react-server/cjs/react-server-flight.development.js +2.25% 64.57 kB 66.03 kB +1.78% 15.65 kB 15.93 kB
oss-stable-semver/react-server/cjs/react-server-flight.development.js +2.25% 64.57 kB 66.03 kB +1.78% 15.65 kB 15.93 kB
oss-stable/react-server/cjs/react-server-flight.development.js +2.25% 64.57 kB 66.03 kB +1.78% 15.65 kB 15.93 kB
facebook-relay/flight/ReactFlightNativeRelayServer-prod.js +2.22% 31.61 kB 32.31 kB +2.11% 7.50 kB 7.66 kB
facebook-relay/flight/ReactFlightNativeRelayServer-dev.js +2.21% 61.94 kB 63.30 kB +1.85% 15.10 kB 15.38 kB
oss-experimental/react-noop-renderer/cjs/react-noop-renderer-flight-server.development.js +1.74% 2.35 kB 2.39 kB +2.22% 0.90 kB 0.92 kB
oss-stable-semver/react-noop-renderer/cjs/react-noop-renderer-flight-server.development.js +1.74% 2.35 kB 2.39 kB +2.22% 0.90 kB 0.92 kB
oss-stable/react-noop-renderer/cjs/react-noop-renderer-flight-server.development.js +1.74% 2.35 kB 2.39 kB +2.22% 0.90 kB 0.92 kB
oss-experimental/react-client/cjs/react-client-flight.production.min.js +1.30% 6.24 kB 6.32 kB +1.08% 2.49 kB 2.52 kB
oss-stable-semver/react-client/cjs/react-client-flight.production.min.js +1.30% 6.24 kB 6.32 kB +1.08% 2.49 kB 2.52 kB
oss-stable/react-client/cjs/react-client-flight.production.min.js +1.30% 6.24 kB 6.32 kB +1.08% 2.49 kB 2.52 kB
oss-experimental/react-client/cjs/react-client-flight.development.js +1.22% 22.84 kB 23.12 kB +0.76% 6.05 kB 6.10 kB
oss-stable-semver/react-client/cjs/react-client-flight.development.js +1.22% 22.84 kB 23.12 kB +0.76% 6.05 kB 6.10 kB
oss-stable/react-client/cjs/react-client-flight.development.js +1.22% 22.84 kB 23.12 kB +0.76% 6.05 kB 6.10 kB
oss-experimental/react-noop-renderer/cjs/react-noop-renderer-server.production.min.js +1.07% 3.26 kB 3.30 kB +0.98% 1.23 kB 1.24 kB
oss-stable-semver/react-noop-renderer/cjs/react-noop-renderer-server.production.min.js +1.07% 3.26 kB 3.30 kB +0.98% 1.23 kB 1.24 kB
oss-stable/react-noop-renderer/cjs/react-noop-renderer-server.production.min.js +1.07% 3.26 kB 3.30 kB +0.98% 1.23 kB 1.24 kB
oss-experimental/react-noop-renderer/cjs/react-noop-renderer-server.development.js +0.63% 6.53 kB 6.57 kB +0.78% 1.80 kB 1.81 kB
oss-stable-semver/react-noop-renderer/cjs/react-noop-renderer-server.development.js +0.63% 6.53 kB 6.57 kB +0.78% 1.80 kB 1.81 kB
oss-stable/react-noop-renderer/cjs/react-noop-renderer-server.development.js +0.63% 6.53 kB 6.57 kB +0.78% 1.80 kB 1.81 kB
oss-stable-semver/react-server/cjs/react-server.production.min.js +0.48% 24.41 kB 24.52 kB +0.35% 8.37 kB 8.40 kB
oss-stable/react-server/cjs/react-server.production.min.js +0.48% 24.41 kB 24.52 kB +0.35% 8.37 kB 8.40 kB
oss-experimental/react-server/cjs/react-server.production.min.js +0.47% 24.66 kB 24.78 kB +0.28% 8.46 kB 8.49 kB
oss-stable-semver/react-dom/cjs/react-dom-server.edge.development.js +0.24% 355.65 kB 356.51 kB +0.20% 78.93 kB 79.08 kB
oss-stable/react-dom/cjs/react-dom-server.edge.development.js +0.24% 355.67 kB 356.53 kB +0.20% 78.95 kB 79.10 kB
oss-experimental/react-dom/cjs/react-dom-static.edge.development.js +0.24% 360.43 kB 361.28 kB +0.20% 79.98 kB 80.14 kB
oss-experimental/react-dom/cjs/react-dom-server.edge.development.js +0.24% 361.12 kB 361.98 kB +0.20% 80.16 kB 80.32 kB
oss-experimental/react-dom/cjs/react-dom-static.edge.production.min.js +0.23% 59.04 kB 59.18 kB +0.24% 18.05 kB 18.09 kB
oss-stable-semver/react-dom/cjs/react-dom-server.node.development.js +0.21% 356.88 kB 357.63 kB +0.20% 78.88 kB 79.04 kB
oss-stable/react-dom/cjs/react-dom-server.node.development.js +0.21% 356.91 kB 357.66 kB +0.20% 78.90 kB 79.06 kB
oss-stable-semver/react-dom/cjs/react-dom-server.edge.production.min.js +0.21% 62.49 kB 62.62 kB +0.24% 19.24 kB 19.29 kB
oss-stable/react-dom/cjs/react-dom-server.edge.production.min.js +0.21% 62.51 kB 62.64 kB +0.24% 19.27 kB 19.31 kB
oss-experimental/react-dom/cjs/react-dom-server.edge.production.min.js +0.21% 63.00 kB 63.14 kB +0.22% 19.44 kB 19.48 kB
oss-experimental/react-dom/cjs/react-dom-static.node.development.js +0.21% 362.31 kB 363.06 kB +0.20% 80.20 kB 80.36 kB
oss-experimental/react-dom/cjs/react-dom-server.node.development.js +0.21% 362.35 kB 363.10 kB +0.20% 80.12 kB 80.28 kB
oss-experimental/react-dom/umd/react-dom-server-rendering-stub.production.min.js = 1.49 kB 1.40 kB +0.50% 0.80 kB 0.81 kB
oss-stable/react-dom/umd/react-dom-server-rendering-stub.production.min.js = 1.48 kB 1.39 kB +0.25% 0.80 kB 0.80 kB
oss-stable-semver/react-dom/umd/react-dom-server-rendering-stub.production.min.js = 1.46 kB 1.37 kB +0.26% 0.78 kB 0.78 kB
oss-experimental/react-dom/cjs/react-dom-server-rendering-stub.production.min.js = 1.26 kB 1.18 kB +1.33% 0.68 kB 0.69 kB
oss-stable/react-dom/cjs/react-dom-server-rendering-stub.production.min.js = 1.26 kB 1.17 kB +1.19% 0.67 kB 0.68 kB
oss-stable-semver/react-dom/cjs/react-dom-server-rendering-stub.production.min.js = 1.23 kB 1.15 kB +1.23% 0.65 kB 0.66 kB

Generated by 🚫 dangerJS against 2882053

}
root = createFromNodeStream(rscResponse, moduleMap);
return root;
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like the implementation of what @sebmarkbage mentioned in this tweet. Can you explain why this change is needed for preloading the client chunks? Does it lead to HTML chunks being emitted earlier?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flight rows are processed outside of a render. For directives coming from Flight like instructions to preload something we still need to be able to associate these outside of render things to a specific request in SSR. By creating the Flight client during a Fizz render we can associate the flight client rows to a Request. If the environment supports AsyncLocalStorage then even async code (really anything outside of a render) can still see this Request. In environments that don’t support asynclocalstorage flight directives will get dropped because there is no associated Fizz request to refer to when not rendering. Currently all directives are optimistic so if we lose some during SSR it’s not going to break anything just be slower. The hope is that we get an AsyncContext or AsyncLocalStorage in every runtime that can do SSR and this will just be the norm. However none of this would work if you just created a random Flight client out of band because the client wouldn’t know where to route anything. We could take other approaches like encoding the directives into the value that will be rendered but that adds a lot of complexity and we think this pattern is sufficient.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for taking the time to write this thorough explanation!

So, we basically need to create the following sequence for preload resources to be associated with the request and thus rendered (I'm just sharing my debugging notes here, in case anyone else wants to follow along):

  • renderToPipeableStream
  • createRequest (with resources)
  • set current dispatcher to ReactDOMServerDispatcher
  • setCurrentResources (with resources from request)
  • ... *hand waiving* render Root
  • createFromNodeStream
  • processFullRow (case I)
  • resolveModule
  • preloadModule
  • preloadModuleForSSR
  • ReactDOMCurrentDispatcher.current.preload (which is now ReactDOMServerDispatcher)
  • create preload resource with link chunks and add to resources.explicitScriptPreloads
  • flush link chunks in writePreamble

If createFromNodeStream were to be called outside of Root, as was the case before in the Flight fixture, the current dispatcher would be (the default?) ReactDOMClientDispatcher, and the preload call would subsequently fail with ReferenceError: document is not defined.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is some nuance here maybe not captured in this linear list but in a handwavy way yeah this is what is happening.

What is important to happen during render is the flight client construction, the actual flight render can be initiated outside of the Fizz render.

Another note is that processFullRow doesn't actually run during the Fizz render even when the flight client is constructed during a Fizz render

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean to change the part where teh ReactDOMClientDispatcher is set during SSR. This should only be set when running in a browser so if you fail to create the flight client during a Fizz render it just noops instead of failing on a missing document

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. 👍

if (ssrChunks) {
for (let i = 0; i < ssrChunks.length; i++) {
const href = ssrChunks[i];
preloadModuleForSSR(href);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I'm reading through this pull request, I can see that this is intended for Float to render <link rel="preload" as="script" href="/some-client-chunk.js" />. As someone who is not as deeply involved in the project, I thought it might be helpful to share an outsider's perspective. From my point of view, renaming ssrChunks to clientChunks and preloadModuleForSSR to preloadModuleForHydration could potentially make the code more understandable without context.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the general intent of the code. I’m currently reworking the implementation significantly so none of these names are likely to stick around

unstubbable added a commit to unstubbable/mfng that referenced this pull request Apr 20, 2023
This is in preparation for the upcoming React feature of adding preload
link elements for client chunks that are needed for hydration.

See the following discussion for more details:
facebook/react#26664 (comment)
Supporting Float methods such as ReactDOM.preload() are challenging for flight because it does not have an easy means to convey direct executions in other environments. Because the flight wire format is a JSON-like serialization that is expected to be rendered it currently only describes renderable elements. We need a way to convey a function invocation that gets run in the context of the client environment whether that is Fizz or Fiber.

Fiber is somewhat straightforward because the HostDispatcher is always active and we can just have the FlightClient dispatch the serialized directive.

Fizz is much more challenging becaue the dispatcher is always scoped but the specific request the dispatch belongs to is not readily available. Environments that support AsyncLocalStorage (or in the future AsyncContext) we will use this to be able to resolve directives in Fizz to the appropriate Request. For other environments directives will be elided. Right now this is pragmatic and non-breaking because all directives are opportunistic and non-critical. If this changes in the future we will need to reconsider how widespread support for async context tracking is.

For Flight, if AsyncLocalStorage is available Float methods can be called before and after await points and be expected to work. If AsyncLocalStorage is not available float methods called in the sync phase of a component render will be captured but anything after an await point will be a noop. If a float call is dropped in this manner a DEV warning should help you realize your code may need to be modified.
@gnoff
Copy link
Collaborator Author

gnoff commented Jun 1, 2023

superceded by #26795

@gnoff gnoff closed this Jun 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed React Core Team Opened by a member of the React Core Team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants