Skip to content

Conversation

sebmarkbage
Copy link
Collaborator

@sebmarkbage sebmarkbage commented Aug 8, 2025

This creates a debug info object for the React.lazy call when it's called on the client. We have some additional information we can track for these since they're created by React earlier.

We can track the stack trace where React.lazy was called to associate it back to something useful. We can track the start time when we initialized it for the first time and the end time when it resolves. The name from the promise if available.

This data is currently only picked up in child position and not component position. The component position is in a follow up.

Screenshot 2025-08-08 at 2 49 33 PM

This begs for ignore listing in the front end since these stacks aren't filtered on the server.

@sebmarkbage sebmarkbage requested a review from eps1lon August 8, 2025 18:55
@meta-cla meta-cla bot added the CLA Signed label Aug 8, 2025
@github-actions github-actions bot added the React Core Team Opened by a member of the React Core Team label Aug 8, 2025
@react-sizebot
Copy link

react-sizebot commented Aug 8, 2025

Comparing: 3958d5d...9876196

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 +0.05% 1.83 kB 1.83 kB
oss-stable/react-dom/cjs/react-dom-client.production.js = 530.04 kB 530.04 kB = 93.63 kB 93.63 kB
oss-experimental/react-dom/cjs/react-dom.production.js = 6.69 kB 6.69 kB +0.05% 1.83 kB 1.83 kB
oss-experimental/react-dom/cjs/react-dom-client.production.js = 654.48 kB 654.48 kB = 115.34 kB 115.34 kB
facebook-www/ReactDOM-prod.classic.js = 674.42 kB 674.42 kB = 118.68 kB 118.68 kB
facebook-www/ReactDOM-prod.modern.js = 664.84 kB 664.84 kB = 117.03 kB 117.03 kB
oss-stable-semver/react/cjs/react.react-server.development.js +4.61% 28.86 kB 30.19 kB +3.54% 6.98 kB 7.22 kB
oss-stable/react/cjs/react.react-server.development.js +4.60% 28.89 kB 30.22 kB +3.53% 7.00 kB 7.25 kB
oss-experimental/react/cjs/react.react-server.development.js +3.63% 36.67 kB 38.00 kB +2.89% 8.71 kB 8.96 kB
oss-stable-semver/react/cjs/react.development.js +2.92% 45.54 kB 46.87 kB +2.43% 10.38 kB 10.63 kB
oss-stable/react/cjs/react.development.js +2.92% 45.56 kB 46.89 kB +2.45% 10.40 kB 10.66 kB
oss-experimental/react/cjs/react.development.js +2.72% 48.93 kB 50.26 kB +2.18% 11.09 kB 11.33 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/cjs/react.react-server.development.js +4.61% 28.86 kB 30.19 kB +3.54% 6.98 kB 7.22 kB
oss-stable/react/cjs/react.react-server.development.js +4.60% 28.89 kB 30.22 kB +3.53% 7.00 kB 7.25 kB
oss-experimental/react/cjs/react.react-server.development.js +3.63% 36.67 kB 38.00 kB +2.89% 8.71 kB 8.96 kB
oss-stable-semver/react/cjs/react.development.js +2.92% 45.54 kB 46.87 kB +2.43% 10.38 kB 10.63 kB
oss-stable/react/cjs/react.development.js +2.92% 45.56 kB 46.89 kB +2.45% 10.40 kB 10.66 kB
oss-experimental/react/cjs/react.development.js +2.72% 48.93 kB 50.26 kB +2.18% 11.09 kB 11.33 kB
facebook-react-native/react/cjs/React-dev.js +0.58% 51.48 kB 51.78 kB +0.55% 11.46 kB 11.53 kB
facebook-www/React-dev.modern.js +0.57% 52.44 kB 52.74 kB +0.53% 11.71 kB 11.77 kB
facebook-www/React-dev.classic.js +0.57% 52.44 kB 52.74 kB +0.53% 11.71 kB 11.77 kB

Generated by 🚫 dangerJS against 9876196

We read a timestamp for start/end now.
@sebmarkbage sebmarkbage merged commit 6445b31 into facebook:main Aug 11, 2025
241 checks passed
sebmarkbage added a commit that referenced this pull request Aug 11, 2025
…#34144)

Normally, we pick up debug info from instrumented Promise or React.Lazy
while we're reconciling in ReactChildFiber when they appear in the child
position. We add those to the `_debugInfo` of the Fiber.

However, we don't do that for for Lazy in the Component type position.
Instead, we have to pick up the debug info from it explicitly in
DevTools. Likely this is the info added by #34137. Older versions
wouldn't be covered by this particular mechanism but more generally from
throwing a Promise.


<img width="592" height="449" alt="Screenshot 2025-08-08 at 11 32 33 PM"
src="https://github.com/user-attachments/assets/87211c64-a7df-47b7-a784-5cdc7c5fae16"
/>
sebmarkbage added a commit that referenced this pull request Aug 11, 2025
Similar to #34137 but for Promises.

This lets us pick up the debug info from a raw Promise as a child which
is not covered by `_debugThenables`. Currently ChildFiber doesn't stash
its thenables so we can't pick them up from devtools after the fact
without some debug info added to the parent.

It also lets us track some approximate start/end time of use():ed
promises based on the first time we saw this particular Promise.
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