Skip to content

Commit e5f6b91

Browse files
author
Brian Vaughn
authored
Add Lane labels to scheduling profiler marks (#20808)
This commit changes scheduling profiler marks from a format like '--schedule-render-1' to '--schedule-render-1-Sync' (where 1 is the numeric value of the Sync lane). This will enable the profiler itself to show more meaningful labels for updates and render work. The commit also refactors and adds additional tests for the scheduling profiler package. It also updates the preprocessor to 'support' instant events. These are no-ops for us, but adding recognition of the event type will prevent profiles imported from e.g. Chrome Canary from throwing with an 'unrecognized event' error. (This will resolve issue #20767.)
1 parent c62986c commit e5f6b91

13 files changed

+1055
-1817
lines changed

packages/react-devtools-scheduling-profiler/src/EventTooltip.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ const TooltipReactMeasure = ({
249249
return null;
250250
}
251251

252-
const {batchUID, duration, timestamp, lanes} = measure;
252+
const {batchUID, duration, timestamp, lanes, laneLabels} = measure;
253253
const [startTime, stopTime] = getBatchRange(batchUID, data);
254254

255255
return (
@@ -265,7 +265,11 @@ const TooltipReactMeasure = ({
265265
<div className={styles.DetailsGridLabel}>
266266
Lane{lanes.length === 1 ? '' : 's'}:
267267
</div>
268-
<div>{lanes.join(', ')}</div>
268+
<div>
269+
{laneLabels.length > 0
270+
? `${laneLabels.join(', ')} (${lanes.join(', ')})`
271+
: lanes.join(', ')}
272+
</div>
269273
</div>
270274
</div>
271275
);

packages/react-devtools-scheduling-profiler/src/constants.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@ export {
1111
COMFORTABLE_LINE_HEIGHT,
1212
COMPACT_LINE_HEIGHT,
1313
} from 'react-devtools-shared/src/constants.js';
14+
import {TotalLanes} from 'react-reconciler/src/ReactFiberLane.new';
1415

15-
export const REACT_TOTAL_NUM_LANES = 31;
16+
export const REACT_TOTAL_NUM_LANES = TotalLanes;

0 commit comments

Comments
 (0)