@@ -679,9 +679,10 @@ function performConcurrentWorkOnRoot(root, didTimeout) {
679
679
680
680
// We now have a consistent tree. The next step is either to commit it,
681
681
// or, if something suspended, wait to commit it after a timeout.
682
- const finishedWork : Fiber = ( ( root . finishedWork =
683
- root . current . alternate ) : any ) ;
682
+ const finishedWork : Fiber = ( root . current . alternate : any ) ;
683
+ root . finishedWork = finishedWork ;
684
684
root . finishedExpirationTime = expirationTime ;
685
+ root . nextKnownPendingLevel = getRemainingExpirationTime ( finishedWork ) ;
685
686
finishConcurrentRender ( root , finishedWork , exitStatus , expirationTime ) ;
686
687
}
687
688
@@ -717,9 +718,6 @@ function finishConcurrentRender(
717
718
case RootSuspended : {
718
719
markRootSuspendedAtTime ( root , expirationTime ) ;
719
720
const lastSuspendedTime = root . lastSuspendedTime ;
720
- if ( expirationTime === lastSuspendedTime ) {
721
- root . nextKnownPendingLevel = getRemainingExpirationTime ( finishedWork ) ;
722
- }
723
721
724
722
// We have an acceptable loading state. We need to figure out if we
725
723
// should immediately commit it or wait a bit.
@@ -792,9 +790,6 @@ function finishConcurrentRender(
792
790
case RootSuspendedWithDelay : {
793
791
markRootSuspendedAtTime ( root , expirationTime ) ;
794
792
const lastSuspendedTime = root . lastSuspendedTime ;
795
- if ( expirationTime === lastSuspendedTime ) {
796
- root . nextKnownPendingLevel = getRemainingExpirationTime ( finishedWork ) ;
797
- }
798
793
799
794
if (
800
795
// do not delay if we're inside an act() scope
@@ -979,9 +974,10 @@ function performSyncWorkOnRoot(root) {
979
974
980
975
// We now have a consistent tree. Because this is a sync render, we
981
976
// will commit it even if something suspended.
982
- root . finishedWork = ( root . current . alternate : any ) ;
977
+ const finishedWork : Fiber = ( root . current . alternate : any ) ;
978
+ root . finishedWork = finishedWork ;
983
979
root . finishedExpirationTime = expirationTime ;
984
-
980
+ root . nextKnownPendingLevel = getRemainingExpirationTime ( finishedWork ) ;
985
981
commitRoot ( root ) ;
986
982
987
983
// Before exiting, make sure there's a callback scheduled for the next
@@ -1176,6 +1172,8 @@ function prepareFreshStack(root, expirationTime) {
1176
1172
// to it later, in case the render we're about to start gets aborted.
1177
1173
// Generally we only reach this path via a ping, but we shouldn't assume
1178
1174
// that will always be the case.
1175
+ // Note: This is defensive coding to prevent a pending commit from
1176
+ // being dropped without being rescheduled. It shouldn't be necessary.
1179
1177
if ( lastPingedTime === NoWork || lastPingedTime > lastSuspendedTime ) {
1180
1178
root . lastPingedTime = lastSuspendedTime ;
1181
1179
}
@@ -1772,7 +1770,6 @@ function commitRootImpl(root, renderPriorityLevel) {
1772
1770
root . callbackNode = null ;
1773
1771
root . callbackExpirationTime = NoWork ;
1774
1772
root . callbackPriority = NoPriority ;
1775
- root . nextKnownPendingLevel = NoWork ;
1776
1773
1777
1774
// Update the first and last pending times on this root. The new first
1778
1775
// pending time is whatever is left on the root fiber.
0 commit comments