@@ -166,16 +166,20 @@ import {
166166 movePendingFibersToMemoized ,
167167 addTransitionToLanesMap ,
168168 getTransitionsForLanes ,
169+ InputContinuousLane ,
170+ DefaultLane ,
169171} from './ReactFiberLane.new' ;
170172import {
171173 DiscreteEventPriority ,
172174 ContinuousEventPriority ,
173175 DefaultEventPriority ,
176+ NoEventPriority ,
174177 IdleEventPriority ,
175178 getCurrentUpdatePriority ,
176179 setCurrentUpdatePriority ,
177180 lowerEventPriority ,
178181 lanesToEventPriority ,
182+ laneToEventPriority ,
179183} from './ReactEventPriorities.new' ;
180184import { requestCurrentTransition , NoTransition } from './ReactFiberTransition' ;
181185import { beginWork as originalBeginWork } from './ReactFiberBeginWork.new' ;
@@ -663,22 +667,30 @@ export function requestUpdateLane(fiber: Fiber): Lane {
663667 // Updates originating inside certain React methods, like flushSync, have
664668 // their priority set by tracking it with a context variable.
665669 //
666- // The opaque type returned by the host config is internally a lane, so we can
667- // use that directly.
668670 // TODO: Move this type conversion to the event priority module.
669- const updateLane : Lane = ( getCurrentUpdatePriority ( ) : any ) ;
670- if ( updateLane !== NoLane ) {
671- return updateLane ;
671+ const updatePriority = getCurrentUpdatePriority ( ) ;
672+ if ( updatePriority !== NoEventPriority ) {
673+ if ( updatePriority === DefaultEventPriority ) {
674+ return DefaultLane ;
675+ }
676+ if ( updatePriority === ContinuousEventPriority ) {
677+ return InputContinuousLane ;
678+ }
679+ return ( updatePriority : any ) ;
672680 }
673681
674682 // This update originated outside React. Ask the host environment for an
675683 // appropriate priority, based on the type of event.
676684 //
677- // The opaque type returned by the host config is internally a lane, so we can
678- // use that directly.
679685 // TODO: Move this type conversion to the event priority module.
680- const eventLane : Lane = ( getCurrentEventPriority ( ) : any ) ;
681- return eventLane ;
686+ const eventPriority = getCurrentEventPriority ( ) ;
687+ if ( eventPriority === DefaultEventPriority ) {
688+ return DefaultLane ;
689+ }
690+ if ( eventPriority === ContinuousEventPriority ) {
691+ return InputContinuousLane ;
692+ }
693+ return ( eventPriority : any ) ;
682694}
683695
684696function requestRetryLane ( fiber : Fiber ) {
@@ -887,12 +899,14 @@ function ensureRootIsScheduled(root: FiberRoot, currentTime: number) {
887899 cancelCallback ( existingCallbackNode ) ;
888900 }
889901 root . callbackNode = null ;
890- root . callbackPriority = NoLane ;
902+ root . callbackPriority = NoEventPriority ;
891903 return ;
892904 }
893905
894906 // We use the highest priority lane to represent the priority of the callback.
895- const newCallbackPriority = getHighestPriorityLane ( nextLanes ) ;
907+ const newCallbackPriority = laneToEventPriority (
908+ getHighestPriorityLane ( nextLanes ) ,
909+ ) ;
896910
897911 // Check if there's an existing task. We may be able to reuse it.
898912 const existingCallbackPriority = root . callbackPriority ;
@@ -913,7 +927,7 @@ function ensureRootIsScheduled(root: FiberRoot, currentTime: number) {
913927 // TODO: Temporary until we confirm this warning is not fired.
914928 if (
915929 existingCallbackNode == null &&
916- existingCallbackPriority !== SyncLane
930+ existingCallbackPriority !== DiscreteEventPriority
917931 ) {
918932 console . error (
919933 'Expected scheduled callback to exist. This error is likely caused by a bug in React. Please file an issue.' ,
@@ -931,7 +945,7 @@ function ensureRootIsScheduled(root: FiberRoot, currentTime: number) {
931945
932946 // Schedule a new callback.
933947 let newCallbackNode ;
934- if ( newCallbackPriority === SyncLane ) {
948+ if ( newCallbackPriority === DiscreteEventPriority ) {
935949 // Special case: Sync React callbacks are scheduled on a special
936950 // internal queue
937951 if ( root . tag === LegacyRoot ) {
@@ -2547,7 +2561,7 @@ function commitRootImpl(
25472561 // commitRoot never returns a continuation; it always finishes synchronously.
25482562 // So we can clear these now to allow a new callback to be scheduled.
25492563 root . callbackNode = null ;
2550- root . callbackPriority = NoLane ;
2564+ root . callbackPriority = NoEventPriority ;
25512565
25522566 // Check which lanes no longer have any work scheduled on them, and mark
25532567 // those as finished.
0 commit comments