8
8
*/
9
9
10
10
import type { AnyNativeEvent } from '../events/PluginModuleType' ;
11
- import type {
12
- FiberRoot ,
13
- ReactPriorityLevel ,
14
- } from 'react-reconciler/src/ReactInternalTypes' ;
11
+ import type { FiberRoot } from 'react-reconciler/src/ReactInternalTypes' ;
15
12
import type { Container , SuspenseInstance } from '../client/ReactDOMHostConfig' ;
16
13
import type { DOMEventName } from '../events/DOMEventNames' ;
17
- import type { LanePriority } from 'react-reconciler/src/ReactFiberLane.new' ;
18
14
19
15
import {
20
16
isReplayableDiscreteEvent ,
@@ -74,6 +70,8 @@ import {
74
70
IdleEventPriority ,
75
71
} from 'react-reconciler/src/ReactEventPriorities' ;
76
72
73
+ // TODO: These should use the opaque EventPriority type instead of LanePriority.
74
+ // Then internally we can use a Lane.
77
75
const InputContinuousLanePriority = enableNewReconciler
78
76
? InputContinuousLanePriority_new
79
77
: InputContinuousLanePriority_old ;
@@ -87,25 +85,6 @@ const getCurrentPriorityLevel = enableNewReconciler
87
85
? getCurrentPriorityLevel_new
88
86
: getCurrentPriorityLevel_old ;
89
87
90
- function schedulerPriorityToLanePriority (
91
- schedulerPriorityLevel : ReactPriorityLevel ,
92
- ) : LanePriority {
93
- switch ( schedulerPriorityLevel ) {
94
- case ImmediateSchedulerPriority :
95
- return DiscreteEventPriority ;
96
- case UserBlockingSchedulerPriority :
97
- return ContinuousEventPriority ;
98
- case NormalSchedulerPriority :
99
- case LowSchedulerPriority :
100
- // TODO: Handle LowSchedulerPriority, somehow. Maybe the same lane as hydration.
101
- return DefaultEventPriority ;
102
- case IdleSchedulerPriority :
103
- return IdleEventPriority ;
104
- default :
105
- return DefaultEventPriority ;
106
- }
107
- }
108
-
109
88
// TODO: can we stop exporting these?
110
89
export let _enabled = true ;
111
90
@@ -431,7 +410,20 @@ export function getEventPriority(domEventName: DOMEventName): * {
431
410
// Eventually this mechanism will be replaced by a check
432
411
// of the current priority on the native scheduler.
433
412
const schedulerPriority = getCurrentPriorityLevel ( ) ;
434
- return schedulerPriorityToLanePriority ( schedulerPriority ) ;
413
+ switch ( schedulerPriority ) {
414
+ case ImmediateSchedulerPriority :
415
+ return DiscreteEventPriority ;
416
+ case UserBlockingSchedulerPriority :
417
+ return ContinuousEventPriority ;
418
+ case NormalSchedulerPriority :
419
+ case LowSchedulerPriority :
420
+ // TODO: Handle LowSchedulerPriority, somehow. Maybe the same lane as hydration.
421
+ return DefaultEventPriority ;
422
+ case IdleSchedulerPriority :
423
+ return IdleEventPriority ;
424
+ default :
425
+ return DefaultEventPriority ;
426
+ }
435
427
}
436
428
default :
437
429
return DefaultEventPriority ;
0 commit comments