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