File tree Expand file tree Collapse file tree 2 files changed +42
-0
lines changed
packages/react-reconciler/src Expand file tree Collapse file tree 2 files changed +42
-0
lines changed Original file line number Diff line number Diff line change @@ -598,6 +598,27 @@ export function scheduleUpdateOnFiber(
598598 flushSyncCallbackQueue ( ) ;
599599 }
600600 }
601+ } else if ( decoupleUpdatePriorityFromScheduler ) {
602+ const updateLanePriority = getCurrentUpdateLanePriority ( ) ;
603+
604+ // Schedule a discrete update but only if it's not Sync.
605+ if (
606+ ( executionContext & DiscreteEventContext ) !== NoContext &&
607+ // Only updates at user-blocking priority or greater are considered
608+ // discrete, even inside a discrete event.
609+ updateLanePriority === InputDiscreteLanePriority
610+ ) {
611+ // This is the result of a discrete event. Track the lowest priority
612+ // discrete update per root so we can flush them early, if needed.
613+ if ( rootsWithPendingDiscreteUpdates === null ) {
614+ rootsWithPendingDiscreteUpdates = new Set ( [ root ] ) ;
615+ } else {
616+ rootsWithPendingDiscreteUpdates . add ( root ) ;
617+ }
618+ }
619+ // Schedule other updates after in case the callback is sync.
620+ ensureRootIsScheduled ( root , eventTime ) ;
621+ schedulePendingInteractions ( root , lane ) ;
601622 } else {
602623 // Schedule a discrete update but only if it's not Sync.
603624 if (
Original file line number Diff line number Diff line change @@ -598,6 +598,27 @@ export function scheduleUpdateOnFiber(
598598 flushSyncCallbackQueue ( ) ;
599599 }
600600 }
601+ } else if ( decoupleUpdatePriorityFromScheduler ) {
602+ const updateLanePriority = getCurrentUpdateLanePriority ( ) ;
603+
604+ // Schedule a discrete update but only if it's not Sync.
605+ if (
606+ ( executionContext & DiscreteEventContext ) !== NoContext &&
607+ // Only updates at user-blocking priority or greater are considered
608+ // discrete, even inside a discrete event.
609+ updateLanePriority === InputDiscreteLanePriority
610+ ) {
611+ // This is the result of a discrete event. Track the lowest priority
612+ // discrete update per root so we can flush them early, if needed.
613+ if ( rootsWithPendingDiscreteUpdates === null ) {
614+ rootsWithPendingDiscreteUpdates = new Set ( [ root ] ) ;
615+ } else {
616+ rootsWithPendingDiscreteUpdates . add ( root ) ;
617+ }
618+ }
619+ // Schedule other updates after in case the callback is sync.
620+ ensureRootIsScheduled ( root , eventTime ) ;
621+ schedulePendingInteractions ( root , lane ) ;
601622 } else {
602623 // Schedule a discrete update but only if it's not Sync.
603624 if (
You can’t perform that action at this time.
0 commit comments