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

[Fiber] Stash usables on _debugUsables for DevTools #28295

Closed
wants to merge 6 commits into from

Conversation

sebmarkbage
Copy link
Collaborator

Stacked on #28286.

Stash usables on _debugUsables so that DevTools can pick up any use() calls. These can also include further DebugInfo on them such as what Server Component rendered the Promise or async debug info. This is nice just to see which use() calls were made in the side-panel but it can also be used to gather everything that might have suspended.

Together with #28286 we cover the case when a Promise was used a child and if it was unwrapped with use(). Notably we don't cover a Promise that was thrown (although we do support that in a Server Component which maybe we shouldn't). Throwing a Promise isn't officially supported though and that use case should move to the use() Hook.

The pattern of conditionally suspending based on cache also isn't really supported with the use() pattern. You should always call use() if you previously called use() with the same input. This also ensures that we can track what might have suspended rather than what actually did.

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.
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.
Merge any debug info we got from intermediate objects until we create or
update a fiber that can hold it.
use() calls. These can also include further DebugInfo on them such as
what Server Component rendered the Promise or async debug info.
@sebmarkbage sebmarkbage requested review from acdlite and hoxyq February 9, 2024 18:37
@facebook-github-bot facebook-github-bot added CLA Signed React Core Team Opened by a member of the React Core Team labels Feb 9, 2024
@react-sizebot
Copy link

Comparing: ba5e6a8...c18e7e7

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.61 kB = 55.02 kB 55.01 kB
oss-experimental/react-dom/cjs/react-dom.production.min.js = 178.63 kB 178.61 kB +0.03% 55.60 kB 55.61 kB
facebook-www/ReactDOM-prod.classic.js = 591.73 kB 591.67 kB = 104.44 kB 104.44 kB
facebook-www/ReactDOM-prod.modern.js = 575.51 kB 575.45 kB = 101.53 kB 101.53 kB
oss-stable-semver/react-server/cjs/react-server-flight.development.js +4.25% 66.90 kB 69.74 kB +2.43% 16.31 kB 16.71 kB
oss-stable/react-server/cjs/react-server-flight.development.js +4.25% 66.90 kB 69.74 kB +2.43% 16.31 kB 16.71 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.71% 76.60 kB 79.44 kB +2.08% 18.29 kB 18.67 kB
facebook-www/ReactFlightDOMServer-dev.modern.js +3.67% 84.81 kB 87.92 kB +2.09% 18.36 kB 18.75 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.86% 101.06 kB 103.95 kB +1.71% 24.09 kB 24.50 kB
oss-stable/react-server-dom-esm/cjs/react-server-dom-esm-server.node.development.js +2.86% 101.06 kB 103.95 kB +1.71% 24.09 kB 24.50 kB
oss-stable-semver/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.browser.development.js +2.79% 103.34 kB 106.23 kB +1.64% 24.93 kB 25.34 kB
oss-stable/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.browser.development.js +2.79% 103.34 kB 106.23 kB +1.64% 24.93 kB 25.34 kB
oss-stable-semver/react-server-dom-turbopack/umd/react-server-dom-turbopack-server.browser.development.js +2.78% 109.12 kB 112.15 kB +1.75% 25.22 kB 25.66 kB
oss-stable/react-server-dom-turbopack/umd/react-server-dom-turbopack-server.browser.development.js +2.78% 109.12 kB 112.15 kB +1.75% 25.22 kB 25.66 kB
oss-stable-semver/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.edge.development.js +2.77% 104.04 kB 106.93 kB +1.64% 25.12 kB 25.53 kB
oss-stable/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.edge.development.js +2.77% 104.04 kB 106.93 kB +1.64% 25.12 kB 25.53 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.development.js +2.73% 105.92 kB 108.81 kB +1.61% 25.64 kB 26.05 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.development.js +2.73% 105.92 kB 108.81 kB +1.61% 25.64 kB 26.05 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.development.js +2.72% 106.11 kB 108.99 kB +1.61% 25.67 kB 26.08 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.development.js +2.72% 106.11 kB 108.99 kB +1.61% 25.67 kB 26.08 kB
oss-stable-semver/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.unbundled.development.js +2.71% 106.48 kB 109.36 kB +1.60% 25.30 kB 25.70 kB
oss-stable/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.unbundled.development.js +2.71% 106.48 kB 109.36 kB +1.60% 25.30 kB 25.70 kB
oss-stable-semver/react-server-dom-webpack/umd/react-server-dom-webpack-server.browser.development.js +2.71% 111.84 kB 114.87 kB +1.63% 25.95 kB 26.37 kB
oss-stable/react-server-dom-webpack/umd/react-server-dom-webpack-server.browser.development.js +2.71% 111.84 kB 114.87 kB +1.63% 25.95 kB 26.37 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.development.js +2.65% 108.90 kB 111.79 kB +1.58% 25.91 kB 26.32 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.development.js +2.65% 108.90 kB 111.79 kB +1.58% 25.91 kB 26.32 kB
oss-stable-semver/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.development.js +2.65% 109.12 kB 112.00 kB +1.59% 26.12 kB 26.54 kB
oss-stable/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.development.js +2.65% 109.12 kB 112.00 kB +1.59% 26.12 kB 26.54 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.development.js +2.59% 111.54 kB 114.42 kB +1.58% 26.78 kB 27.20 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.development.js +2.59% 111.54 kB 114.42 kB +1.58% 26.78 kB 27.20 kB
oss-experimental/react-server-dom-esm/cjs/react-server-dom-esm-server.node.development.js +2.59% 111.64 kB 114.53 kB +1.48% 26.38 kB 26.77 kB
oss-experimental/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.browser.development.js +2.54% 113.72 kB 116.60 kB +1.52% 27.16 kB 27.58 kB
oss-experimental/react-server-dom-turbopack/umd/react-server-dom-turbopack-server.browser.development.js +2.52% 119.95 kB 122.98 kB +1.37% 27.53 kB 27.90 kB
oss-experimental/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.edge.development.js +2.51% 115.09 kB 117.98 kB +1.50% 27.59 kB 28.00 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.development.js +2.48% 116.30 kB 119.18 kB +1.49% 27.89 kB 28.30 kB
oss-experimental/react-server-dom-webpack/umd/react-server-dom-webpack-server.browser.development.js +2.47% 122.68 kB 125.71 kB +1.32% 28.25 kB 28.62 kB
oss-experimental/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.unbundled.development.js +2.47% 117.05 kB 119.94 kB +1.42% 27.59 kB 27.98 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.development.js +2.46% 117.16 kB 120.04 kB +1.48% 28.15 kB 28.56 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.development.js +2.42% 119.48 kB 122.36 kB +1.39% 28.21 kB 28.61 kB
oss-experimental/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.development.js +2.41% 119.69 kB 122.58 kB +1.46% 28.42 kB 28.84 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.development.js +2.36% 122.11 kB 125.00 kB +1.42% 29.10 kB 29.51 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.25% 66.90 kB 69.74 kB +2.43% 16.31 kB 16.71 kB
oss-stable/react-server/cjs/react-server-flight.development.js +4.25% 66.90 kB 69.74 kB +2.43% 16.31 kB 16.71 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.71% 76.60 kB 79.44 kB +2.08% 18.29 kB 18.67 kB
facebook-www/ReactFlightDOMServer-dev.modern.js +3.67% 84.81 kB 87.92 kB +2.09% 18.36 kB 18.75 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.86% 101.06 kB 103.95 kB +1.71% 24.09 kB 24.50 kB
oss-stable/react-server-dom-esm/cjs/react-server-dom-esm-server.node.development.js +2.86% 101.06 kB 103.95 kB +1.71% 24.09 kB 24.50 kB
oss-stable-semver/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.browser.development.js +2.79% 103.34 kB 106.23 kB +1.64% 24.93 kB 25.34 kB
oss-stable/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.browser.development.js +2.79% 103.34 kB 106.23 kB +1.64% 24.93 kB 25.34 kB
oss-stable-semver/react-server-dom-turbopack/umd/react-server-dom-turbopack-server.browser.development.js +2.78% 109.12 kB 112.15 kB +1.75% 25.22 kB 25.66 kB
oss-stable/react-server-dom-turbopack/umd/react-server-dom-turbopack-server.browser.development.js +2.78% 109.12 kB 112.15 kB +1.75% 25.22 kB 25.66 kB
oss-stable-semver/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.edge.development.js +2.77% 104.04 kB 106.93 kB +1.64% 25.12 kB 25.53 kB
oss-stable/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.edge.development.js +2.77% 104.04 kB 106.93 kB +1.64% 25.12 kB 25.53 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.development.js +2.73% 105.92 kB 108.81 kB +1.61% 25.64 kB 26.05 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.development.js +2.73% 105.92 kB 108.81 kB +1.61% 25.64 kB 26.05 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.development.js +2.72% 106.11 kB 108.99 kB +1.61% 25.67 kB 26.08 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.development.js +2.72% 106.11 kB 108.99 kB +1.61% 25.67 kB 26.08 kB
oss-stable-semver/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.unbundled.development.js +2.71% 106.48 kB 109.36 kB +1.60% 25.30 kB 25.70 kB
oss-stable/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.unbundled.development.js +2.71% 106.48 kB 109.36 kB +1.60% 25.30 kB 25.70 kB
oss-stable-semver/react-server-dom-webpack/umd/react-server-dom-webpack-server.browser.development.js +2.71% 111.84 kB 114.87 kB +1.63% 25.95 kB 26.37 kB
oss-stable/react-server-dom-webpack/umd/react-server-dom-webpack-server.browser.development.js +2.71% 111.84 kB 114.87 kB +1.63% 25.95 kB 26.37 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.development.js +2.65% 108.90 kB 111.79 kB +1.58% 25.91 kB 26.32 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.development.js +2.65% 108.90 kB 111.79 kB +1.58% 25.91 kB 26.32 kB
oss-stable-semver/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.development.js +2.65% 109.12 kB 112.00 kB +1.59% 26.12 kB 26.54 kB
oss-stable/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.development.js +2.65% 109.12 kB 112.00 kB +1.59% 26.12 kB 26.54 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.development.js +2.59% 111.54 kB 114.42 kB +1.58% 26.78 kB 27.20 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.development.js +2.59% 111.54 kB 114.42 kB +1.58% 26.78 kB 27.20 kB
oss-experimental/react-server-dom-esm/cjs/react-server-dom-esm-server.node.development.js +2.59% 111.64 kB 114.53 kB +1.48% 26.38 kB 26.77 kB
oss-experimental/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.browser.development.js +2.54% 113.72 kB 116.60 kB +1.52% 27.16 kB 27.58 kB
oss-experimental/react-server-dom-turbopack/umd/react-server-dom-turbopack-server.browser.development.js +2.52% 119.95 kB 122.98 kB +1.37% 27.53 kB 27.90 kB
oss-experimental/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.edge.development.js +2.51% 115.09 kB 117.98 kB +1.50% 27.59 kB 28.00 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.development.js +2.48% 116.30 kB 119.18 kB +1.49% 27.89 kB 28.30 kB
oss-experimental/react-server-dom-webpack/umd/react-server-dom-webpack-server.browser.development.js +2.47% 122.68 kB 125.71 kB +1.32% 28.25 kB 28.62 kB
oss-experimental/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.unbundled.development.js +2.47% 117.05 kB 119.94 kB +1.42% 27.59 kB 27.98 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.development.js +2.46% 117.16 kB 120.04 kB +1.48% 28.15 kB 28.56 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.development.js +2.42% 119.48 kB 122.36 kB +1.39% 28.21 kB 28.61 kB
oss-experimental/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.development.js +2.41% 119.69 kB 122.58 kB +1.46% 28.42 kB 28.84 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.development.js +2.36% 122.11 kB 125.00 kB +1.42% 29.10 kB 29.51 kB
facebook-react-native/react-test-renderer/cjs/ReactTestRenderer-dev.js +0.52% 937.30 kB 942.16 kB +0.29% 187.82 kB 188.36 kB
facebook-www/ReactTestRenderer-dev.modern.js +0.51% 947.58 kB 952.43 kB +0.28% 189.55 kB 190.08 kB
facebook-www/ReactTestRenderer-dev.classic.js +0.51% 947.58 kB 952.43 kB +0.28% 189.55 kB 190.08 kB
react-native/implementations/ReactFabric-dev.js +0.51% 979.09 kB 984.04 kB +0.28% 197.84 kB 198.39 kB
react-native/implementations/ReactNativeRenderer-dev.js +0.50% 995.37 kB 1,000.32 kB +0.28% 202.12 kB 202.68 kB
react-native/implementations/ReactFabric-dev.fb.js +0.49% 1,006.17 kB 1,011.12 kB +0.27% 202.29 kB 202.85 kB
react-native/implementations/ReactNativeRenderer-dev.fb.js +0.49% 1,020.77 kB 1,025.72 kB +0.27% 206.12 kB 206.67 kB
facebook-www/ReactART-dev.modern.js +0.47% 1,048.62 kB 1,053.57 kB +0.27% 206.46 kB 207.01 kB
facebook-www/ReactART-dev.classic.js +0.47% 1,061.22 kB 1,066.17 kB +0.27% 208.87 kB 209.43 kB
oss-stable-semver/react-art/cjs/react-art.development.js +0.37% 845.10 kB 848.26 kB +0.26% 184.99 kB 185.48 kB
oss-stable/react-art/cjs/react-art.development.js +0.37% 845.13 kB 848.29 kB +0.26% 185.02 kB 185.50 kB
oss-stable-semver/react-test-renderer/umd/react-test-renderer.development.js +0.37% 866.33 kB 869.55 kB +0.26% 183.55 kB 184.03 kB
oss-stable/react-test-renderer/umd/react-test-renderer.development.js +0.37% 866.36 kB 869.58 kB +0.26% 183.58 kB 184.06 kB
oss-experimental/react-test-renderer/umd/react-test-renderer.development.js +0.37% 867.66 kB 870.88 kB +0.26% 183.82 kB 184.30 kB
oss-stable-semver/react-test-renderer/cjs/react-test-renderer.development.js +0.37% 827.38 kB 830.45 kB +0.25% 181.67 kB 182.13 kB
oss-stable/react-test-renderer/cjs/react-test-renderer.development.js +0.37% 827.41 kB 830.47 kB +0.25% 181.70 kB 182.16 kB
oss-experimental/react-test-renderer/cjs/react-test-renderer.development.js +0.37% 828.67 kB 831.73 kB +0.25% 181.97 kB 182.42 kB
oss-experimental/react-art/cjs/react-art.development.js +0.37% 854.45 kB 857.60 kB +0.27% 186.69 kB 187.18 kB
oss-stable-semver/react-art/umd/react-art.development.js +0.34% 961.60 kB 964.92 kB +0.24% 204.13 kB 204.63 kB
oss-stable/react-art/umd/react-art.development.js +0.34% 961.63 kB 964.95 kB +0.24% 204.16 kB 204.65 kB
oss-experimental/react-art/umd/react-art.development.js +0.34% 971.43 kB 974.74 kB +0.25% 205.87 kB 206.38 kB
oss-stable-semver/react-reconciler/cjs/react-reconciler.development.js +0.33% 945.30 kB 948.45 kB +0.24% 203.56 kB 204.05 kB
oss-stable/react-reconciler/cjs/react-reconciler.development.js +0.33% 945.32 kB 948.48 kB +0.24% 203.59 kB 204.08 kB
oss-experimental/react-reconciler/cjs/react-reconciler.development.js +0.33% 954.64 kB 957.79 kB +0.24% 205.28 kB 205.77 kB
oss-stable-semver/react-server/cjs/react-server-flight.production.js +0.31% 57.15 kB 57.33 kB +0.29% 14.02 kB 14.06 kB
oss-stable/react-server/cjs/react-server-flight.production.js +0.31% 57.15 kB 57.33 kB +0.29% 14.02 kB 14.06 kB
facebook-www/ReactDOM-dev.modern.js +0.30% 1,633.07 kB 1,638.02 kB +0.17% 325.34 kB 325.89 kB
facebook-www/ReactDOMTesting-dev.modern.js +0.30% 1,654.59 kB 1,659.55 kB +0.16% 329.91 kB 330.45 kB
facebook-www/ReactDOM-dev.classic.js +0.30% 1,664.66 kB 1,669.61 kB +0.17% 331.02 kB 331.57 kB
facebook-www/ReactDOMTesting-dev.classic.js +0.29% 1,686.24 kB 1,691.19 kB +0.16% 335.58 kB 336.13 kB
oss-experimental/react-server/cjs/react-server-flight.production.js +0.27% 66.83 kB 67.01 kB +0.23% 15.99 kB 16.03 kB
oss-stable-semver/react-dom/umd/react-dom.development.js +0.24% 1,402.18 kB 1,405.50 kB +0.17% 299.07 kB 299.57 kB
oss-stable/react-dom/umd/react-dom.development.js +0.24% 1,402.21 kB 1,405.53 kB +0.17% 299.10 kB 299.60 kB
oss-stable-semver/react-dom/cjs/react-dom.development.js +0.24% 1,337.93 kB 1,341.08 kB +0.16% 296.00 kB 296.47 kB
oss-stable/react-dom/cjs/react-dom.development.js +0.24% 1,337.96 kB 1,341.11 kB +0.16% 296.03 kB 296.49 kB
oss-experimental/react-dom/umd/react-dom.development.js +0.23% 1,415.94 kB 1,419.26 kB +0.17% 301.56 kB 302.05 kB
oss-experimental/react-dom/cjs/react-dom.development.js +0.23% 1,351.03 kB 1,354.19 kB +0.17% 298.49 kB 298.98 kB
oss-experimental/react-dom/cjs/react-dom-unstable_testing.development.js +0.23% 1,368.89 kB 1,372.04 kB +0.16% 302.78 kB 303.26 kB
test_utils/ReactAllWarnings.js Deleted 67.02 kB 0.00 kB Deleted 16.42 kB 0.00 kB

Generated by 🚫 dangerJS against c18e7e7

@sebmarkbage
Copy link
Collaborator Author

sebmarkbage commented Feb 10, 2024

On a second thought I think maybe we don't need this because, just like Hooks, we can just replay the render to collect this information on demand. I think I'll do that instead.

That wouldn't necessarily work with uncached promises though.

@sebmarkbage
Copy link
Collaborator Author

Abandoning this in favor of #28297.

One limitation of that strategy is that it's hard to find all the places something might suspend in a tree without rerendering all the fibers again. So we might need to still add something to the tree to indicate which Fibers may have further debug info / thenables.

sebmarkbage added a commit that referenced this pull request Feb 12, 2024
Alternative to #28295.

Instead of stashing all of the Usables eagerly, we can extract them by
replaying the render when we need them like we do with any other hook.
We already had an implementation of `use()` but it wasn't quite
complete.

These can also include further DebugInfo on them such as what Server
Component rendered the Promise or async debug info. This is nice just to
see which use() calls were made in the side-panel but it can also be
used to gather everything that might have suspended.

Together with #28286 we cover the
case when a Promise was used a child and if it was unwrapped with use().
Notably we don't cover a Promise that was thrown (although we do support
that in a Server Component which maybe we shouldn't). Throwing a Promise
isn't officially supported though and that use case should move to the
use() Hook.

The pattern of conditionally suspending based on cache also isn't really
supported with the use() pattern. You should always call use() if you
previously called use() with the same input. This also ensures that we
can track what might have suspended rather than what actually did.

One limitation of this strategy is that it's hard to find all the places
something might suspend in a tree without rerendering all the fibers
again. So we might need to still add something to the tree to indicate
which Fibers may have further debug info / thenables.
EdisonVan pushed a commit to EdisonVan/react that referenced this pull request Apr 15, 2024
Alternative to facebook#28295.

Instead of stashing all of the Usables eagerly, we can extract them by
replaying the render when we need them like we do with any other hook.
We already had an implementation of `use()` but it wasn't quite
complete.

These can also include further DebugInfo on them such as what Server
Component rendered the Promise or async debug info. This is nice just to
see which use() calls were made in the side-panel but it can also be
used to gather everything that might have suspended.

Together with facebook#28286 we cover the
case when a Promise was used a child and if it was unwrapped with use().
Notably we don't cover a Promise that was thrown (although we do support
that in a Server Component which maybe we shouldn't). Throwing a Promise
isn't officially supported though and that use case should move to the
use() Hook.

The pattern of conditionally suspending based on cache also isn't really
supported with the use() pattern. You should always call use() if you
previously called use() with the same input. This also ensures that we
can track what might have suspended rather than what actually did.

One limitation of this strategy is that it's hard to find all the places
something might suspend in a tree without rerendering all the fibers
again. So we might need to still add something to the tree to indicate
which Fibers may have further debug info / thenables.
bigfootjon pushed a commit that referenced this pull request Apr 18, 2024
Alternative to #28295.

Instead of stashing all of the Usables eagerly, we can extract them by
replaying the render when we need them like we do with any other hook.
We already had an implementation of `use()` but it wasn't quite
complete.

These can also include further DebugInfo on them such as what Server
Component rendered the Promise or async debug info. This is nice just to
see which use() calls were made in the side-panel but it can also be
used to gather everything that might have suspended.

Together with #28286 we cover the
case when a Promise was used a child and if it was unwrapped with use().
Notably we don't cover a Promise that was thrown (although we do support
that in a Server Component which maybe we shouldn't). Throwing a Promise
isn't officially supported though and that use case should move to the
use() Hook.

The pattern of conditionally suspending based on cache also isn't really
supported with the use() pattern. You should always call use() if you
previously called use() with the same input. This also ensures that we
can track what might have suspended rather than what actually did.

One limitation of this strategy is that it's hard to find all the places
something might suspend in a tree without rerendering all the fibers
again. So we might need to still add something to the tree to indicate
which Fibers may have further debug info / thenables.

DiffTrain build for commit 7a32d71.
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.

3 participants