Skip to content

Commit dcdf8de

Browse files
authored
Remove discrete lanes and priorities (#21040)
We use SyncLane everywhere we used to use InputDiscreteLane or InputDiscreteHydrationLane. So we can delete them now, along with their associated lane priority levels.
1 parent ca99ae9 commit dcdf8de

File tree

9 files changed

+75
-158
lines changed

9 files changed

+75
-158
lines changed

packages/react-devtools-scheduling-profiler/src/import-worker/__tests__/preprocessData-test.internal.js

+12-12
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ describe(preprocessData, () => {
404404
{
405405
componentStack: '',
406406
laneLabels: ['Default'],
407-
lanes: [7],
407+
lanes: [5],
408408
timestamp: 0.005,
409409
type: 'schedule-render',
410410
},
@@ -413,7 +413,7 @@ describe(preprocessData, () => {
413413
componentStack: '',
414414
isCascading: false,
415415
laneLabels: ['Default'],
416-
lanes: [7],
416+
lanes: [5],
417417
timestamp: 0.013,
418418
type: 'schedule-state-update',
419419
},
@@ -425,7 +425,7 @@ describe(preprocessData, () => {
425425
depth: 0,
426426
duration: 0.004999999999999999,
427427
laneLabels: ['Default'],
428-
lanes: [7],
428+
lanes: [5],
429429
timestamp: 0.006,
430430
type: 'render-idle',
431431
},
@@ -434,7 +434,7 @@ describe(preprocessData, () => {
434434
depth: 0,
435435
duration: 0.001,
436436
laneLabels: ['Default'],
437-
lanes: [7],
437+
lanes: [5],
438438
timestamp: 0.006,
439439
type: 'render',
440440
},
@@ -443,7 +443,7 @@ describe(preprocessData, () => {
443443
depth: 0,
444444
duration: 0.002999999999999999,
445445
laneLabels: ['Default'],
446-
lanes: [7],
446+
lanes: [5],
447447
timestamp: 0.008,
448448
type: 'commit',
449449
},
@@ -452,7 +452,7 @@ describe(preprocessData, () => {
452452
depth: 1,
453453
duration: 0.0010000000000000009,
454454
laneLabels: ['Default'],
455-
lanes: [7],
455+
lanes: [5],
456456
timestamp: 0.009,
457457
type: 'layout-effects',
458458
},
@@ -461,7 +461,7 @@ describe(preprocessData, () => {
461461
depth: 0,
462462
duration: 0.002,
463463
laneLabels: ['Default'],
464-
lanes: [7],
464+
lanes: [5],
465465
timestamp: 0.012,
466466
type: 'passive-effects',
467467
},
@@ -470,7 +470,7 @@ describe(preprocessData, () => {
470470
depth: 0,
471471
duration: 0.005000000000000001,
472472
laneLabels: ['Default'],
473-
lanes: [7],
473+
lanes: [5],
474474
timestamp: 0.015,
475475
type: 'render-idle',
476476
},
@@ -479,7 +479,7 @@ describe(preprocessData, () => {
479479
depth: 0,
480480
duration: 0.0010000000000000009,
481481
laneLabels: ['Default'],
482-
lanes: [7],
482+
lanes: [5],
483483
timestamp: 0.015,
484484
type: 'render',
485485
},
@@ -488,7 +488,7 @@ describe(preprocessData, () => {
488488
depth: 0,
489489
duration: 0.002999999999999999,
490490
laneLabels: ['Default'],
491-
lanes: [7],
491+
lanes: [5],
492492
timestamp: 0.017,
493493
type: 'commit',
494494
},
@@ -497,7 +497,7 @@ describe(preprocessData, () => {
497497
depth: 1,
498498
duration: 0.0010000000000000009,
499499
laneLabels: ['Default'],
500-
lanes: [7],
500+
lanes: [5],
501501
timestamp: 0.018,
502502
type: 'layout-effects',
503503
},
@@ -506,7 +506,7 @@ describe(preprocessData, () => {
506506
depth: 0,
507507
duration: 0.0009999999999999974,
508508
laneLabels: ['Default'],
509-
lanes: [7],
509+
lanes: [5],
510510
timestamp: 0.021,
511511
type: 'passive-effects',
512512
},

packages/react-dom/src/events/ReactDOMEventListener.js

+2-7
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,12 @@ import {
4848
} from './ReactDOMUpdateBatching';
4949

5050
import {
51-
InputDiscreteLanePriority as InputDiscreteLanePriority_old,
5251
InputContinuousLanePriority as InputContinuousLanePriority_old,
5352
DefaultLanePriority as DefaultLanePriority_old,
5453
getCurrentUpdateLanePriority as getCurrentUpdateLanePriority_old,
5554
setCurrentUpdateLanePriority as setCurrentUpdateLanePriority_old,
5655
} from 'react-reconciler/src/ReactFiberLane.old';
5756
import {
58-
InputDiscreteLanePriority as InputDiscreteLanePriority_new,
5957
InputContinuousLanePriority as InputContinuousLanePriority_new,
6058
DefaultLanePriority as DefaultLanePriority_new,
6159
getCurrentUpdateLanePriority as getCurrentUpdateLanePriority_new,
@@ -75,9 +73,6 @@ import {
7573
} from 'react-reconciler/src/SchedulerWithReactIntegration.new';
7674
import type {LanePriority} from 'react-reconciler/src/ReactFiberLane.new';
7775

78-
const InputDiscreteLanePriority = enableNewReconciler
79-
? InputDiscreteLanePriority_new
80-
: InputDiscreteLanePriority_old;
8176
const InputContinuousLanePriority = enableNewReconciler
8277
? InputContinuousLanePriority_new
8378
: InputContinuousLanePriority_old;
@@ -147,7 +142,7 @@ export function createEventListenerWrapperWithPriority(
147142
const eventPriority = getEventPriority(domEventName);
148143
let listenerWrapper;
149144
switch (eventPriority) {
150-
case InputDiscreteLanePriority:
145+
case SyncLanePriority:
151146
listenerWrapper = dispatchDiscreteEvent;
152147
break;
153148
case InputContinuousLanePriority:
@@ -412,7 +407,7 @@ export function getEventPriority(domEventName: DOMEventName): * {
412407
case 'popstate':
413408
case 'select':
414409
case 'selectstart':
415-
return InputDiscreteLanePriority;
410+
return SyncLanePriority;
416411
case 'drag':
417412
case 'dragenter':
418413
case 'dragexit':

packages/react-reconciler/src/ReactFiberLane.new.js

+28-51
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,8 @@ import {
4646
NoPriority as NoSchedulerPriority,
4747
} from './SchedulerWithReactIntegration.new';
4848

49-
export const SyncLanePriority: LanePriority = 15;
50-
export const SyncBatchedLanePriority: LanePriority = 14;
51-
52-
const InputDiscreteHydrationLanePriority: LanePriority = 13;
53-
export const InputDiscreteLanePriority: LanePriority = 12;
49+
export const SyncLanePriority: LanePriority = 13;
50+
export const SyncBatchedLanePriority: LanePriority = 12;
5451

5552
const InputContinuousHydrationLanePriority: LanePriority = 11;
5653
export const InputContinuousLanePriority: LanePriority = 10;
@@ -83,31 +80,30 @@ export const NoLane: Lane = /* */ 0b0000000000000000000
8380
export const SyncLane: Lane = /* */ 0b0000000000000000000000000000001;
8481
export const SyncBatchedLane: Lane = /* */ 0b0000000000000000000000000000010;
8582

86-
export const InputDiscreteHydrationLane: Lane = /* */ 0b0000000000000000000000000000100;
87-
export const InputDiscreteLane: Lanes = /* */ 0b0000000000000000000000000001000;
88-
89-
const InputContinuousHydrationLane: Lane = /* */ 0b0000000000000000000000000010000;
90-
export const InputContinuousLane: Lanes = /* */ 0b0000000000000000000000000100000;
91-
92-
export const DefaultHydrationLane: Lane = /* */ 0b0000000000000000000000001000000;
93-
export const DefaultLane: Lanes = /* */ 0b0000000000000000000000010000000;
94-
95-
const TransitionHydrationLane: Lane = /* */ 0b0000000000000000000000100000000;
96-
const TransitionLanes: Lanes = /* */ 0b0000000011111111111111000000000;
97-
const TransitionLane1: Lane = /* */ 0b0000000000000000000001000000000;
98-
const TransitionLane2: Lane = /* */ 0b0000000000000000000010000000000;
99-
const TransitionLane3: Lane = /* */ 0b0000000000000000000100000000000;
100-
const TransitionLane4: Lane = /* */ 0b0000000000000000001000000000000;
101-
const TransitionLane5: Lane = /* */ 0b0000000000000000010000000000000;
102-
const TransitionLane6: Lane = /* */ 0b0000000000000000100000000000000;
103-
const TransitionLane7: Lane = /* */ 0b0000000000000001000000000000000;
104-
const TransitionLane8: Lane = /* */ 0b0000000000000010000000000000000;
105-
const TransitionLane9: Lane = /* */ 0b0000000000000100000000000000000;
106-
const TransitionLane10: Lane = /* */ 0b0000000000001000000000000000000;
107-
const TransitionLane11: Lane = /* */ 0b0000000000010000000000000000000;
108-
const TransitionLane12: Lane = /* */ 0b0000000000100000000000000000000;
109-
const TransitionLane13: Lane = /* */ 0b0000000001000000000000000000000;
110-
const TransitionLane14: Lane = /* */ 0b0000000010000000000000000000000;
83+
const InputContinuousHydrationLane: Lane = /* */ 0b0000000000000000000000000000100;
84+
export const InputContinuousLane: Lanes = /* */ 0b0000000000000000000000000001000;
85+
86+
export const DefaultHydrationLane: Lane = /* */ 0b0000000000000000000000000010000;
87+
export const DefaultLane: Lanes = /* */ 0b0000000000000000000000000100000;
88+
89+
const TransitionHydrationLane: Lane = /* */ 0b0000000000000000000000001000000;
90+
const TransitionLanes: Lanes = /* */ 0b0000000011111111111111110000000;
91+
const TransitionLane1: Lane = /* */ 0b0000000000000000000000010000000;
92+
const TransitionLane2: Lane = /* */ 0b0000000000000000000000100000000;
93+
const TransitionLane3: Lane = /* */ 0b0000000000000000000001000000000;
94+
const TransitionLane4: Lane = /* */ 0b0000000000000000000010000000000;
95+
const TransitionLane5: Lane = /* */ 0b0000000000000000000100000000000;
96+
const TransitionLane6: Lane = /* */ 0b0000000000000000001000000000000;
97+
const TransitionLane7: Lane = /* */ 0b0000000000000000010000000000000;
98+
const TransitionLane8: Lane = /* */ 0b0000000000000000100000000000000;
99+
const TransitionLane9: Lane = /* */ 0b0000000000000001000000000000000;
100+
const TransitionLane10: Lane = /* */ 0b0000000000000010000000000000000;
101+
const TransitionLane11: Lane = /* */ 0b0000000000000100000000000000000;
102+
const TransitionLane12: Lane = /* */ 0b0000000000001000000000000000000;
103+
const TransitionLane13: Lane = /* */ 0b0000000000010000000000000000000;
104+
const TransitionLane14: Lane = /* */ 0b0000000000100000000000000000000;
105+
const TransitionLane15: Lane = /* */ 0b0000000001000000000000000000000;
106+
const TransitionLane16: Lane = /* */ 0b0000000010000000000000000000000;
111107

112108
const RetryLanes: Lanes = /* */ 0b0000111100000000000000000000000;
113109
const RetryLane1: Lane = /* */ 0b0000000100000000000000000000000;
@@ -137,12 +133,6 @@ export function getLabelsForLanes(lanes: Lanes): Array<string> | void {
137133
if (lanes & SyncBatchedLane) {
138134
labels.push('SyncBatched');
139135
}
140-
if (lanes & InputDiscreteHydrationLane) {
141-
labels.push('InputDiscreteHydration');
142-
}
143-
if (lanes & InputDiscreteLane) {
144-
labels.push('InputDiscrete');
145-
}
146136
if (lanes & InputContinuousHydrationLane) {
147137
labels.push('InputContinuousHydration');
148138
}
@@ -207,12 +197,6 @@ function getHighestPriorityLanes(lanes: Lanes | Lane): Lanes {
207197
case SyncBatchedLane:
208198
return_highestLanePriority = SyncBatchedLanePriority;
209199
return SyncBatchedLane;
210-
case InputDiscreteHydrationLane:
211-
return_highestLanePriority = InputDiscreteHydrationLanePriority;
212-
return InputDiscreteHydrationLane;
213-
case InputDiscreteLane:
214-
return_highestLanePriority = InputDiscreteLanePriority;
215-
return InputDiscreteLane;
216200
case InputContinuousHydrationLane:
217201
return_highestLanePriority = InputContinuousHydrationLanePriority;
218202
return InputContinuousHydrationLane;
@@ -242,6 +226,8 @@ function getHighestPriorityLanes(lanes: Lanes | Lane): Lanes {
242226
case TransitionLane12:
243227
case TransitionLane13:
244228
case TransitionLane14:
229+
case TransitionLane15:
230+
case TransitionLane16:
245231
return_highestLanePriority = TransitionPriority;
246232
return lanes & TransitionLanes;
247233
case RetryLane1:
@@ -281,8 +267,6 @@ export function lanePriorityToSchedulerPriority(
281267
case SyncLanePriority:
282268
case SyncBatchedLanePriority:
283269
return ImmediateSchedulerPriority;
284-
case InputDiscreteHydrationLanePriority:
285-
case InputDiscreteLanePriority:
286270
case InputContinuousHydrationLanePriority:
287271
case InputContinuousLanePriority:
288272
return UserBlockingSchedulerPriority;
@@ -565,8 +549,6 @@ export function findUpdateLane(lanePriority: LanePriority): Lane {
565549
return SyncLane;
566550
case SyncBatchedLanePriority:
567551
return SyncBatchedLane;
568-
case InputDiscreteLanePriority:
569-
return SyncLane;
570552
case InputContinuousLanePriority:
571553
return InputContinuousLane;
572554
case DefaultLanePriority:
@@ -826,11 +808,6 @@ export function getBumpedLaneForHydration(
826808
case SyncBatchedLanePriority:
827809
lane = NoLane;
828810
break;
829-
case InputDiscreteHydrationLanePriority:
830-
case InputDiscreteLanePriority:
831-
lane = InputDiscreteHydrationLane;
832-
break;
833-
case InputContinuousHydrationLanePriority:
834811
case InputContinuousLanePriority:
835812
lane = InputContinuousHydrationLane;
836813
break;

0 commit comments

Comments
 (0)