@@ -633,7 +633,11 @@ export function requestUpdateLane(fiber: Fiber): Lane {
633633 // This behavior is only a fallback. The flag only exists until we can roll
634634 // out the setState warning, since existing code might accidentally rely on
635635 // the current behavior.
636- return pickArbitraryLane ( workInProgressRootRenderLanes ) ;
636+ const nextLane = pickArbitraryLane ( workInProgressRootRenderLanes ) ;
637+ if ( ( nextLane & SyncLane ) === NoLane ) {
638+ currentUpdatePriority = NoEventPriority ;
639+ }
640+ return nextLane ;
637641 }
638642
639643 const isTransition = requestCurrentTransition ( ) !== NoTransition ;
@@ -657,6 +661,10 @@ export function requestUpdateLane(fiber: Fiber): Lane {
657661 // All transitions within the same event are assigned the same lane.
658662 currentEventTransitionLane = claimNextTransitionLane ( ) ;
659663 }
664+ if ( ( currentEventTransitionLane & SyncLane ) === NoLane ) {
665+ currentUpdatePriority = NoEventPriority ;
666+ }
667+
660668 return currentEventTransitionLane ;
661669 }
662670
@@ -665,8 +673,8 @@ export function requestUpdateLane(fiber: Fiber): Lane {
665673 //
666674 // TODO: Move this type conversion to the event priority module.
667675 const updatePriority = getCurrentUpdatePriority ( ) ;
676+ currentUpdatePriority = updatePriority ;
668677 if ( updatePriority !== NoEventPriority ) {
669- currentUpdatePriority = updatePriority ;
670678 if ( updatePriority === DefaultEventPriority ) {
671679 return enableUnifiedSyncLane ? SyncLane : DefaultLane ;
672680 }
@@ -699,8 +707,10 @@ function requestRetryLane(fiber: Fiber) {
699707 // Special cases
700708 const mode = fiber . mode ;
701709 if ( ( mode & ConcurrentMode ) === NoMode ) {
710+ currentUpdatePriority = DiscreteEventPriority ;
702711 return ( SyncLane : Lane ) ;
703712 }
713+ currentUpdatePriority = DefaultEventPriority ;
704714
705715 return claimNextRetryLane ( ) ;
706716}
@@ -845,7 +855,12 @@ export function scheduleInitialHydrationOnRoot(
845855 // match what was rendered on the server.
846856 const current = root . current ;
847857 current . lanes = lane ;
848- markRootUpdated ( root , lane , eventTime , root . tag === LegacyRoot ? DiscreteEventPriority : DefaultEventPriority ) ;
858+ markRootUpdated (
859+ root ,
860+ lane ,
861+ eventTime ,
862+ root . tag === LegacyRoot ? DiscreteEventPriority : DefaultEventPriority ,
863+ ) ;
849864 ensureRootIsScheduled ( root , eventTime ) ;
850865}
851866
@@ -2701,8 +2716,7 @@ function commitRootImpl(
27012716 //// TODO: Need to clear the updatePriority inorder to remove the sync lane check
27022717 if (
27032718 ( enableUnifiedSyncLane
2704- ? includesSomeLane ( pendingPassiveEffectsLanes , SyncLane ) &&
2705- prevRootUpdatePriority === DiscreteEventPriority
2719+ ? prevRootUpdatePriority === DiscreteEventPriority
27062720 : includesSomeLane ( pendingPassiveEffectsLanes , SyncLane ) ) &&
27072721 root . tag !== LegacyRoot
27082722 ) {
@@ -2726,6 +2740,7 @@ function commitRootImpl(
27262740 }
27272741 } else {
27282742 nestedUpdateCount = 0 ;
2743+ root . updatePriority = NoEventPriority ;
27292744 }
27302745
27312746 // If layout work was scheduled, flush it now.
@@ -3206,7 +3221,8 @@ function retryTimedOutBoundary(boundaryFiber: Fiber, retryLane: Lane) {
32063221 const eventTime = requestEventTime ( ) ;
32073222 const root = enqueueConcurrentRenderForLane ( boundaryFiber , retryLane ) ;
32083223 if ( root !== null ) {
3209- markRootUpdated ( root , retryLane , eventTime , root . updatePriority ) ;
3224+ // console.log(retryLane,root.updatePriority, currentUpdatePriority, new Error().stack);
3225+ markRootUpdated ( root , retryLane , eventTime , currentUpdatePriority ) ;
32103226 ensureRootIsScheduled ( root , eventTime ) ;
32113227 }
32123228}
0 commit comments