Skip to content

Conversation

@sebmarkbage
Copy link
Collaborator

This adds a "suspended by" row for each chunk that is referenced from a client reference. So when you select a client component, you can see what bundles will block that client component when loading on the client.

This is only done in the browser build since if we added it on the server, it would show up as a blocking resource and while it's possible we expect that a typical server request won't block on loading JS.

Screenshot 2025-08-17 at 3 45 14 PM Screenshot 2025-08-17 at 3 46 58 PM

Currently this is only included if it ends up wrapped in a lazy like in the typical type position of a Client Component, but there's a general issue that maybe hard references need to transfer their debug info to the parent which can transfer it to the Fiber.

@meta-cla meta-cla bot added the CLA Signed label Aug 17, 2025
@github-actions github-actions bot added the React Core Team Opened by a member of the React Core Team label Aug 17, 2025
@sebmarkbage sebmarkbage force-pushed the devtoolsbundlerchunks branch from cff1575 to a0b5498 Compare August 17, 2025 20:36
@react-sizebot
Copy link

react-sizebot commented Aug 17, 2025

Comparing: 42b1b33...e550808

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.js = 6.68 kB 6.68 kB = 1.83 kB 1.83 kB
oss-stable/react-dom/cjs/react-dom-client.production.js = 530.18 kB 530.18 kB = 93.39 kB 93.39 kB
oss-experimental/react-dom/cjs/react-dom.production.js = 6.69 kB 6.69 kB = 1.83 kB 1.83 kB
oss-experimental/react-dom/cjs/react-dom-client.production.js = 655.81 kB 655.81 kB = 115.30 kB 115.30 kB
facebook-www/ReactDOM-prod.classic.js = 675.58 kB 675.58 kB = 118.54 kB 118.54 kB
facebook-www/ReactDOM-prod.modern.js = 666.00 kB 666.00 kB = 116.87 kB 116.87 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-client.browser.development.js +2.03% 125.71 kB 128.26 kB +2.47% 23.20 kB 23.78 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-client.browser.development.js +2.02% 125.76 kB 128.31 kB +2.47% 23.23 kB 23.80 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-dom-webpack/cjs/react-server-dom-webpack-client.browser.development.js +2.03% 125.71 kB 128.26 kB +2.47% 23.20 kB 23.78 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-client.browser.development.js +2.02% 125.76 kB 128.31 kB +2.47% 23.23 kB 23.80 kB
oss-stable-semver/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.browser.development.js +1.93% 125.12 kB 127.53 kB +2.32% 23.06 kB 23.59 kB
oss-stable/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.browser.development.js +1.93% 125.17 kB 127.58 kB +2.31% 23.08 kB 23.62 kB
oss-stable-semver/react-server-dom-esm/cjs/react-server-dom-esm-client.browser.development.js +1.70% 122.97 kB 125.06 kB +2.06% 22.66 kB 23.13 kB
oss-stable/react-server-dom-esm/cjs/react-server-dom-esm-client.browser.development.js +1.70% 123.02 kB 125.11 kB +2.05% 22.69 kB 23.15 kB
oss-stable-semver/react-server-dom-esm/cjs/react-server-dom-esm-client.node.development.js +1.65% 126.25 kB 128.34 kB +2.02% 23.13 kB 23.59 kB
oss-stable/react-server-dom-esm/cjs/react-server-dom-esm-client.node.development.js +1.65% 126.25 kB 128.34 kB +2.02% 23.13 kB 23.59 kB
oss-stable-semver/react-server-dom-esm/esm/react-server-dom-esm-client.browser.development.js +1.64% 172.42 kB 175.25 kB +2.18% 39.22 kB 40.08 kB
oss-stable/react-server-dom-esm/esm/react-server-dom-esm-client.browser.development.js +1.64% 172.44 kB 175.28 kB +2.18% 39.25 kB 40.10 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-client.browser.development.js +1.63% 167.47 kB 170.20 kB +1.94% 29.86 kB 30.44 kB
oss-experimental/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.browser.development.js +1.56% 166.87 kB 169.47 kB +1.79% 29.71 kB 30.24 kB
oss-experimental/react-server-dom-esm/esm/react-server-dom-esm-client.browser.development.js +1.50% 207.48 kB 210.59 kB +1.98% 45.84 kB 46.75 kB
oss-experimental/react-server-dom-esm/cjs/react-server-dom-esm-client.browser.development.js +1.38% 164.73 kB 167.00 kB +1.57% 29.32 kB 29.78 kB
oss-experimental/react-server-dom-esm/cjs/react-server-dom-esm-client.node.development.js +1.35% 167.95 kB 170.22 kB +1.55% 29.86 kB 30.32 kB
oss-experimental/react-client/cjs/react-client-flight.development.js +0.25% 160.63 kB 161.04 kB +0.26% 28.28 kB 28.35 kB

Generated by 🚫 dangerJS against e550808

}

// We cache ReactIOInfo across requests so that inner refreshes can dedupe with outer.
const chunkIOInfoCache: Map<string, ReactIOInfo> = __DEV__
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we clean this up at some point? You probably end up reloading the page at some point during a dev session but it's still a potential memory leak, right?

I guess that's also another reason why we don't collect these on the Server? Dev servers are usually longer alive than pages.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Unless we get an event from webpack when a chunk has been invalidated and is no longer useful such as when it restarts, we can't really clean it up by the key.

We could potentially have a finalizer on the ReactIOInfo itself since this is not really about caching work but caching the referential identity and if there isn't any other objects retaining the old object then we don't really need it in the cache.

If they happened on the client, they they didn't block the Server Component.
} else if (
candidateInfo.awaited &&
// Skip awaits on client resources since they didn't block the server component.
candidateInfo.awaited.env != null
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 added these checks to only log awaits on something with an environment in the Server Components track.

That's because we now have debug info that originates on the client so they don't block the Server Component from completing on the server. They may still block the (Client) Component track but shouldn't be included in the Server Components track.

Currently these aren't included anyway since there's no start time on the lazy nodes but with some other changes this could change.

These are already not included in the Server Requests track since that's just logged when IO rows are resolved.

@sebmarkbage sebmarkbage merged commit 0c89b16 into facebook:main Aug 18, 2025
241 checks passed
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