@@ -677,10 +677,10 @@ function markUpdateLaneFromFiberToRoot(
677
677
}
678
678
679
679
// Use this function to schedule a task for a root. There's only one task per
680
- // root; if a task was already scheduled, we'll check to make sure the
681
- // expiration time of the existing task is the same as the expiration time of
682
- // the next level that the root has work on. This function is called on every
683
- // update, and right before exiting a task.
680
+ // root; if a task was already scheduled, we'll check to make sure the priority
681
+ // of the existing task is the same as the priority of the next level that the
682
+ // root has work on. This function is called on every update, and right before
683
+ // exiting a task.
684
684
function ensureRootIsScheduled ( root : FiberRoot , currentTime : number ) {
685
685
const existingCallbackNode = root . callbackNode ;
686
686
@@ -689,37 +689,32 @@ function ensureRootIsScheduled(root: FiberRoot, currentTime: number) {
689
689
markStarvedLanesAsExpired ( root , currentTime ) ;
690
690
691
691
// Determine the next lanes to work on, and their priority.
692
- const newCallbackId = getNextLanes (
692
+ const nextLanes = getNextLanes (
693
693
root ,
694
694
root === workInProgressRoot ? workInProgressRootRenderLanes : NoLanes ,
695
695
) ;
696
696
// This returns the priority level computed during the `getNextLanes` call.
697
697
const newCallbackPriority = returnNextLanesPriority ( ) ;
698
698
699
- if ( newCallbackId === NoLanes ) {
699
+ if ( nextLanes === NoLanes ) {
700
700
// Special case: There's nothing to work on.
701
701
if ( existingCallbackNode !== null ) {
702
702
cancelCallback ( existingCallbackNode ) ;
703
703
root . callbackNode = null ;
704
704
root . callbackPriority = NoLanePriority ;
705
- root . callbackId = NoLanes ;
706
705
}
707
706
return ;
708
707
}
709
708
710
709
// Check if there's an existing task. We may be able to reuse it.
711
- const existingCallbackId = root . callbackId ;
712
- const existingCallbackPriority = root . callbackPriority ;
713
- if ( existingCallbackId !== NoLanes ) {
714
- if ( newCallbackId === existingCallbackId ) {
715
- // This task is already scheduled. Let's check its priority.
716
- if ( existingCallbackPriority === newCallbackPriority ) {
717
- // The priority hasn't changed. Exit.
718
- return ;
719
- }
720
- // The task ID is the same but the priority changed. Cancel the existing
721
- // callback. We'll schedule a new one below.
710
+ if ( existingCallbackNode !== null ) {
711
+ const existingCallbackPriority = root . callbackPriority ;
712
+ if ( existingCallbackPriority === newCallbackPriority ) {
713
+ // The priority hasn't changed. We can reuse the existing task. Exit.
714
+ return;
722
715
}
716
+ // The priority changed. Cancel the existing callback. We'll schedule a new
717
+ // one below.
723
718
cancelCallback ( existingCallbackNode ) ;
724
719
}
725
720
@@ -741,7 +736,6 @@ function ensureRootIsScheduled(root: FiberRoot, currentTime: number) {
741
736
) ;
742
737
}
743
738
744
- root.callbackId = newCallbackId;
745
739
root.callbackPriority = newCallbackPriority;
746
740
root.callbackNode = newCallbackNode;
747
741
}
@@ -2041,7 +2035,6 @@ function commitRootImpl(root, renderPriorityLevel) {
2041
2035
// commitRoot never returns a continuation; it always finishes synchronously.
2042
2036
// So we can clear these now to allow a new callback to be scheduled.
2043
2037
root . callbackNode = null ;
2044
- root . callbackId = NoLanes ;
2045
2038
2046
2039
// Update the first and last pending times on this root. The new first
2047
2040
// pending time is whatever is left on the root fiber.
0 commit comments