Skip to content

Commit 3b9f88d

Browse files
committed
Log the render phase at commit time
This lets us log this phase differently if it is interrupted before commit.
1 parent 214697b commit 3b9f88d

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

packages/react-reconciler/src/ReactFiberWorkLoop.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1133,8 +1133,6 @@ function finishConcurrentRender(
11331133
// Track when we finished the last unit of work, before we actually commit it.
11341134
// The commit can be suspended/blocked until we commit it.
11351135
renderEndTime = now();
1136-
setCurrentTrackFromLanes(lanes);
1137-
logRenderPhase(renderStartTime, renderEndTime);
11381136
}
11391137

11401138
// TODO: The fact that most of these branches are identical suggests that some
@@ -1537,8 +1535,6 @@ export function performSyncWorkOnRoot(root: FiberRoot, lanes: Lanes): null {
15371535
let renderEndTime = 0;
15381536
if (enableProfilerTimer && enableComponentPerformanceTrack) {
15391537
renderEndTime = now();
1540-
setCurrentTrackFromLanes(lanes);
1541-
logRenderPhase(renderStartTime, renderEndTime);
15421538
}
15431539

15441540
// We now have a consistent tree. Because this is a sync render, we
@@ -3126,6 +3122,12 @@ function commitRootImpl(
31263122
const finishedWork = root.finishedWork;
31273123
const lanes = root.finishedLanes;
31283124

3125+
if (enableProfilerTimer && enableComponentPerformanceTrack) {
3126+
// Log the previous render phase once we commit. I.e. we weren't interrupted.
3127+
setCurrentTrackFromLanes(lanes);
3128+
logRenderPhase(completedRenderStartTime, completedRenderEndTime);
3129+
}
3130+
31293131
if (__DEV__) {
31303132
if (enableDebugTracing) {
31313133
logCommitStarted(lanes);

0 commit comments

Comments
 (0)