Skip to content

Log Mount/Unmount/Reconnect/Disconnect in the Component Track #32816

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

Merged
merged 9 commits into from
Apr 4, 2025

Conversation

sebmarkbage
Copy link
Collaborator

@sebmarkbage sebmarkbage commented Apr 4, 2025

Stacked on #32815.

To be able to differentiate mounted subtrees from updated subtrees. This adds a yellow entry above the component subtree that mounted. This is added both to the render phase, mutation effect phase, layout effect phase and passive effect phase.

Screenshot 2025-04-03 at 10 41 02 PM

Ideally we could probably give an annotation to the component instead of adding a whole other line which is also a color that's kind of distracting. However, not all components are included and keeping track of which one is the first one below is kind of annoying. Adding a marker to all components is kind of noisy. So this is a compromise. It's only one per depth so it won't make it too deep even on larger trees.

If this is an unmount, those are added to the mutation effect phase for the layout unmounts and passive unmount effect phase. Since these never have a render, they're not in the render phase.

Screenshot 2025-04-03 at 11 05 57 PM

For showing / hiding <Activity> the terminology "Reconnect" and "Disconnect" is used instead.

This case doesn't actually log anything today because none of the effects
below are instrumented with timing. We don't time host mutations nor
useInsertionEffect but if we did, this is where they'd go.
We could log "hydrating" or something but it's already marked green
@react-sizebot
Copy link

Comparing: b10cb4c...5b01554

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 = 515.56 kB 515.56 kB = 91.84 kB 91.84 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 = 616.30 kB 616.30 kB = 109.03 kB 109.03 kB
facebook-www/ReactDOM-prod.classic.js = 650.16 kB 650.16 kB = 114.89 kB 114.89 kB
facebook-www/ReactDOM-prod.modern.js = 640.44 kB 640.44 kB = 113.33 kB 113.33 kB

Significant size changes

Includes any change greater than 0.2%:

Expand to show
Name +/- Base Current +/- gzip Base gzip Current gzip
oss-experimental/react-reconciler/cjs/react-reconciler.profiling.js +1.73% 516.69 kB 525.66 kB +1.00% 82.38 kB 83.21 kB
oss-experimental/react-art/cjs/react-art.development.js +1.52% 641.18 kB 650.96 kB +0.80% 102.37 kB 103.18 kB
facebook-www/ReactART-dev.modern.js +1.48% 693.97 kB 704.22 kB +0.82% 109.23 kB 110.13 kB
facebook-www/ReactART-dev.classic.js +1.46% 703.46 kB 713.72 kB +0.79% 111.09 kB 111.97 kB
oss-experimental/react-dom/cjs/react-dom-profiling.profiling.js +1.27% 672.43 kB 681.00 kB +0.74% 117.95 kB 118.83 kB
facebook-www/ReactDOM-profiling.modern.js +1.27% 705.16 kB 714.13 kB +0.79% 122.64 kB 123.62 kB
oss-experimental/react-reconciler/cjs/react-reconciler.development.js +1.27% 763.12 kB 772.81 kB +0.70% 120.49 kB 121.33 kB
facebook-www/ReactReconciler-dev.modern.js +1.27% 802.56 kB 812.73 kB +0.71% 126.06 kB 126.95 kB
facebook-www/ReactDOM-profiling.classic.js +1.26% 713.20 kB 722.17 kB +0.77% 123.99 kB 124.95 kB
facebook-www/ReactReconciler-dev.classic.js +1.25% 811.76 kB 821.94 kB +0.70% 127.75 kB 128.64 kB
oss-experimental/react-dom/cjs/react-dom-client.development.js +0.89% 1,107.82 kB 1,117.69 kB +0.50% 185.45 kB 186.39 kB
facebook-www/ReactDOM-dev.modern.js +0.89% 1,165.73 kB 1,176.11 kB +0.46% 194.13 kB 195.02 kB
facebook-www/ReactDOM-dev.classic.js +0.88% 1,174.87 kB 1,185.25 kB +0.47% 195.86 kB 196.79 kB
facebook-www/ReactDOMTesting-dev.modern.js +0.88% 1,182.26 kB 1,192.65 kB +0.44% 197.91 kB 198.79 kB
oss-experimental/react-dom/cjs/react-dom-profiling.development.js +0.88% 1,124.22 kB 1,134.09 kB +0.50% 188.28 kB 189.22 kB
oss-experimental/react-dom/cjs/react-dom-unstable_testing.development.js +0.88% 1,124.37 kB 1,134.24 kB +0.50% 189.12 kB 190.06 kB
facebook-www/ReactDOMTesting-dev.classic.js +0.87% 1,191.40 kB 1,201.79 kB +0.44% 199.71 kB 200.58 kB
facebook-react-native/react-test-renderer/cjs/ReactTestRenderer-profiling.js +0.66% 352.30 kB 354.63 kB +0.35% 60.86 kB 61.07 kB
react-native/implementations/ReactFabric-profiling.js +0.62% 383.72 kB 386.12 kB +0.34% 65.97 kB 66.20 kB
react-native/implementations/ReactFabric-profiling.fb.js +0.60% 401.50 kB 403.90 kB +0.33% 69.25 kB 69.47 kB
react-native/implementations/ReactNativeRenderer-profiling.js +0.60% 391.15 kB 393.48 kB +0.29% 67.21 kB 67.40 kB
oss-stable-semver/react-reconciler/cjs/react-reconciler.profiling.js +0.58% 417.33 kB 419.75 kB +0.31% 67.23 kB 67.44 kB
oss-stable/react-reconciler/cjs/react-reconciler.profiling.js +0.58% 417.36 kB 419.77 kB +0.31% 67.25 kB 67.46 kB
react-native/implementations/ReactNativeRenderer-profiling.fb.js +0.58% 405.14 kB 407.47 kB +0.29% 69.86 kB 70.06 kB
oss-stable-semver/react-test-renderer/cjs/react-test-renderer.development.js +0.43% 558.54 kB 560.95 kB +0.21% 90.67 kB 90.86 kB
oss-experimental/react-test-renderer/cjs/react-test-renderer.development.js +0.43% 558.57 kB 560.98 kB +0.21% 90.67 kB 90.87 kB
oss-stable/react-test-renderer/cjs/react-test-renderer.development.js +0.43% 558.61 kB 561.02 kB +0.21% 90.69 kB 90.88 kB
oss-stable-semver/react-art/cjs/react-art.development.js +0.43% 559.50 kB 561.89 kB +0.20% 89.94 kB 90.12 kB
oss-stable/react-art/cjs/react-art.development.js +0.43% 559.58 kB 561.97 kB +0.20% 89.96 kB 90.14 kB
oss-stable-semver/react-dom/cjs/react-dom-profiling.profiling.js +0.43% 545.78 kB 548.10 kB +0.21% 96.46 kB 96.66 kB
oss-stable/react-dom/cjs/react-dom-profiling.profiling.js +0.43% 545.90 kB 548.22 kB +0.21% 96.49 kB 96.69 kB
facebook-www/ReactTestRenderer-dev.modern.js +0.42% 576.50 kB 578.90 kB +0.25% 93.71 kB 93.94 kB
facebook-www/ReactTestRenderer-dev.classic.js +0.42% 576.50 kB 578.90 kB +0.25% 93.71 kB 93.94 kB
facebook-react-native/react-dom/cjs/ReactDOMClient-profiling.js +0.41% 564.07 kB 566.40 kB +0.22% 99.41 kB 99.62 kB
facebook-react-native/react-dom/cjs/ReactDOMProfiling-profiling.js +0.41% 570.01 kB 572.34 kB +0.21% 100.57 kB 100.78 kB
facebook-react-native/react-test-renderer/cjs/ReactTestRenderer-dev.js +0.41% 590.01 kB 592.41 kB +0.21% 95.33 kB 95.53 kB
react-native/implementations/ReactFabric-dev.js +0.39% 641.08 kB 643.59 kB +0.21% 104.59 kB 104.81 kB
react-native/implementations/ReactFabric-dev.fb.js +0.38% 660.11 kB 662.62 kB +0.20% 107.76 kB 107.97 kB
oss-stable-semver/react-reconciler/cjs/react-reconciler.development.js +0.37% 646.62 kB 649.01 kB +0.19% 103.12 kB 103.32 kB
oss-stable/react-reconciler/cjs/react-reconciler.development.js +0.37% 646.64 kB 649.04 kB +0.20% 103.15 kB 103.35 kB
react-native/implementations/ReactNativeRenderer-dev.js +0.37% 649.60 kB 652.01 kB +0.18% 105.95 kB 106.14 kB
react-native/implementations/ReactNativeRenderer-dev.fb.js +0.36% 665.04 kB 667.44 kB +0.23% 108.61 kB 108.86 kB
oss-stable-semver/react-dom/cjs/react-dom-client.development.js +0.26% 952.56 kB 954.99 kB +0.12% 160.74 kB 160.93 kB
oss-stable/react-dom/cjs/react-dom-client.development.js +0.26% 952.68 kB 955.11 kB +0.12% 160.76 kB 160.96 kB
oss-stable-semver/react-dom/cjs/react-dom-profiling.development.js +0.25% 969.00 kB 971.43 kB +0.13% 163.57 kB 163.78 kB
oss-stable/react-dom/cjs/react-dom-profiling.development.js +0.25% 969.12 kB 971.55 kB +0.13% 163.60 kB 163.81 kB
facebook-react-native/react-dom/cjs/ReactDOMClient-dev.js +0.25% 985.43 kB 987.87 kB +0.13% 165.98 kB 166.19 kB
facebook-react-native/react-dom/cjs/ReactDOMProfiling-dev.js +0.24% 1,001.76 kB 1,004.20 kB +0.13% 168.81 kB 169.02 kB

Generated by 🚫 dangerJS against 5b01554

@sebmarkbage
Copy link
Collaborator Author

It is possible to have a "Mount" without any children in this because we don't check that we actually logged anything below. I try to avoid logging if the time is near zero like if there's no children but React overhead can also add up to this.

Copy link
Member

@rickhanlonii rickhanlonii left a comment

Choose a reason for hiding this comment

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

this is sick, i like the idea of adding the bar, and yellow is kinda nice because you can visually see "event" -> mounted/updated/etc

@sebmarkbage sebmarkbage merged commit 540cd65 into facebook:main Apr 4, 2025
243 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