Skip to content

Conversation

hoxyq
Copy link
Contributor

@hoxyq hoxyq commented Sep 29, 2025

We've observed some scenarios, where cascading update happens in an effect that was shorter than 0.05ms. In this case, this effect won't be displayed on a timeline, because of the threshold that we are using, but it would be shown in entry properties or in a stack trace.

To avoid confusion, we should always log such effects.

Validated via manually changing the threshold to 100ms+ and observing that only effects that triggered an update are visible on a timeline.

@react-sizebot
Copy link

react-sizebot commented Sep 29, 2025

Comparing: ef88944...908c588

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 = 536.10 kB 536.10 kB = 94.79 kB 94.79 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 = 663.69 kB 663.69 kB = 117.00 kB 117.00 kB
facebook-www/ReactDOM-prod.classic.js = 687.59 kB 687.59 kB = 121.04 kB 121.04 kB
facebook-www/ReactDOM-prod.modern.js = 678.02 kB 678.02 kB = 119.40 kB 119.40 kB

Significant size changes

Includes any change greater than 0.2%:

Expand to show
Name +/- Base Current +/- gzip Base gzip Current gzip
react-native/implementations/ReactFabric-profiling.fb.js +0.40% 459.83 kB 461.69 kB +0.19% 76.98 kB 77.12 kB
react-native/implementations/ReactNativeRenderer-profiling.fb.js +0.40% 466.68 kB 468.54 kB +0.18% 77.95 kB 78.09 kB
oss-experimental/react-reconciler/cjs/react-reconciler.profiling.js +0.34% 556.74 kB 558.65 kB +0.16% 86.84 kB 86.98 kB
facebook-react-native/react-dom/cjs/ReactDOMClient-profiling.js +0.28% 667.73 kB 669.59 kB +0.13% 114.45 kB 114.60 kB
facebook-react-native/react-dom/cjs/ReactDOMProfiling-profiling.js +0.28% 673.67 kB 675.52 kB +0.14% 115.61 kB 115.76 kB
oss-experimental/react-art/cjs/react-art.development.js +0.27% 721.52 kB 723.45 kB +0.15% 113.57 kB 113.75 kB
facebook-www/ReactART-dev.modern.js +0.25% 766.08 kB 768.03 kB +0.09% 119.45 kB 119.56 kB
react-native/implementations/ReactFabric-dev.fb.js +0.25% 767.23 kB 769.18 kB +0.09% 121.73 kB 121.85 kB
facebook-www/ReactART-dev.classic.js +0.25% 775.60 kB 777.55 kB +0.09% 121.20 kB 121.32 kB
oss-experimental/react-dom/cjs/react-dom-profiling.profiling.js +0.25% 739.49 kB 741.35 kB +0.10% 128.05 kB 128.18 kB
react-native/implementations/ReactNativeRenderer-dev.fb.js +0.25% 776.25 kB 778.20 kB +0.09% 123.04 kB 123.15 kB
facebook-www/ReactDOM-profiling.modern.js +0.24% 758.97 kB 760.83 kB +0.12% 130.43 kB 130.58 kB
facebook-www/ReactDOM-profiling.classic.js +0.24% 767.07 kB 768.93 kB +0.12% 131.79 kB 131.95 kB
oss-experimental/react-reconciler/cjs/react-reconciler.development.js +0.23% 848.86 kB 850.81 kB +0.08% 132.37 kB 132.48 kB
facebook-www/ReactReconciler-dev.modern.js +0.22% 873.43 kB 875.39 kB +0.09% 135.16 kB 135.29 kB
facebook-www/ReactReconciler-dev.classic.js +0.22% 882.67 kB 884.62 kB +0.09% 136.91 kB 137.04 kB

Generated by 🚫 dangerJS against 908c588

if (!enableProfilerTimer || !enableProfilerCommitHooks) {
return 0;
}
componentEffectSpawnedUpdate = false; // Reset.
Copy link
Collaborator

Choose a reason for hiding this comment

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

There's no equivalent pop here. That means that this is not scoped to a single component and will leak to siblings. I believe it may also get reset in the case that an effect is in the beginning of the recursion.

I think another issue is that this probably makes this outlined instead of inlined.

The correct way would be to make another pushComponentEffectX with a paired popComponentEffectX. Just like pushComponentEffectDuration etc. do. So that the previous value can be stored and popped at the end.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makes sense, thanks for the context. Updated.

@hoxyq hoxyq force-pushed the refactor/always-log-effect-that-spawned-update branch from 970d9cc to 908c588 Compare September 30, 2025 15:16
@hoxyq hoxyq merged commit 063394c into facebook:main Sep 30, 2025
241 checks passed
@hoxyq hoxyq deleted the refactor/always-log-effect-that-spawned-update branch September 30, 2025 19:05
github-actions bot pushed a commit that referenced this pull request Sep 30, 2025
We've observed some scenarios, where cascading update happens in an
effect that was shorter than 0.05ms. In this case, this effect won't be
displayed on a timeline, because of the threshold that we are using, but
it would be shown in entry properties or in a stack trace.

To avoid confusion, we should always log such effects.

Validated via manually changing the threshold to 100ms+ and observing
that only effects that triggered an update are visible on a timeline.

DiffTrain build for [063394c](063394c)
github-actions bot pushed a commit that referenced this pull request Sep 30, 2025
We've observed some scenarios, where cascading update happens in an
effect that was shorter than 0.05ms. In this case, this effect won't be
displayed on a timeline, because of the threshold that we are using, but
it would be shown in entry properties or in a stack trace.

To avoid confusion, we should always log such effects.

Validated via manually changing the threshold to 100ms+ and observing
that only effects that triggered an update are visible on a timeline.

DiffTrain build for [063394c](063394c)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants