Skip to content

Commit 47905a7

Browse files
authored
Fix/add missing else branch for renders with no props change (#34837)
Stacked on #34822. Fixes a bug introduced in #34370. Just copying the lower else branch to the `properties.length` else branch at the top.
1 parent 7b971c0 commit 47905a7

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

packages/react-reconciler/src/ReactFiberPerformanceTrack.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,30 @@ export function logComponentRender(
305305
} else {
306306
performance.measure('\u200b' + name, reusableComponentOptions);
307307
}
308+
} else {
309+
if (debugTask != null) {
310+
debugTask.run(
311+
// $FlowFixMe[method-unbinding]
312+
console.timeStamp.bind(
313+
console,
314+
name,
315+
startTime,
316+
endTime,
317+
COMPONENTS_TRACK,
318+
undefined,
319+
color,
320+
),
321+
);
322+
} else {
323+
console.timeStamp(
324+
name,
325+
startTime,
326+
endTime,
327+
COMPONENTS_TRACK,
328+
undefined,
329+
color,
330+
);
331+
}
308332
}
309333
} else {
310334
if (debugTask != null) {

packages/react-reconciler/src/__tests__/ReactPerformanceTrack-test.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ describe('ReactPerformanceTracks', () => {
350350
});
351351

352352
// @gate __DEV__ && enableComponentPerformanceTrack
353-
it('includes spans for Components with no prop changes', async () => {
353+
it('includes console.timeStamp spans for Components with no prop changes', async () => {
354354
function Left({value}) {
355355
Scheduler.unstable_advanceTime(5000);
356356
}
@@ -436,6 +436,7 @@ describe('ReactPerformanceTracks', () => {
436436
]);
437437
expect(getConsoleTimestampEntries()).toEqual([
438438
['Render', 16000, 31000, 'Blocking', 'Scheduler ⚛', 'primary-dark'],
439+
['Right', 21000, 31000, 'Components ⚛', undefined, 'error'],
439440
]);
440441
performanceMeasureCalls.length = 0;
441442
});

0 commit comments

Comments
 (0)