Avoid double logging component render time (#32749)
This got moved into the functional component and class component case statements here: https://github.com/facebook/react/commit/0de1233fd180969f7ffdfc98151922f2466ceb1f. So that we could separate the error case for class components. However, due to a faulty rebase this got restored at the top as well. Leading to double component renders being logged. In the other offscreen reconnect passes we don't do this in each case statement but still once at the top. The reason this doesn't matter is because use the PerformedWork flag and that is only set for function and class components. Although maybe it should be set for expensive DOM components too and then we have to remember this.
Sebastian Markbåge committed
Mar 25, 2025 at 20:57 UTC
f9e1b16098f2ff4ed483285219b07066525796b6
1 file changed
-19
packages/react-reconciler/src/ReactFiberCommitWork.js
-19
@@ -3095,25 +3095,6 @@ function commitPassiveMountOnFiber(
3095
const prevEffectStart = pushComponentEffectStart();
3096
const prevEffectErrors = pushComponentEffectErrors();
3097
3098
- // If this component rendered in Profiling mode (DEV or in Profiler component) then log its
3099
- // render time. We do this after the fact in the passive effect to avoid the overhead of this
3100
- // getting in the way of the render characteristics and avoid the overhead of unwinding
3101
- // uncommitted renders.
3102
- if (
3103
- enableProfilerTimer &&
3104
- enableComponentPerformanceTrack &&
3105
- (finishedWork.mode & ProfileMode) !== NoMode &&
3106
- ((finishedWork.actualStartTime: any): number) > 0 &&
3107
- (finishedWork.flags & PerformedWork) !== NoFlags
3108
- ) {
3109
- logComponentRender(
3110
- finishedWork,
3111
- ((finishedWork.actualStartTime: any): number),
3112
- endTime,
3113
- inHydratedSubtree,
3114
- );
3115
- }
3116
-
3098
const isViewTransitionEligible = enableViewTransition
3099
? includesOnlyViewTransitionEligibleLanes(committedLanes)
3100
: false;