@@ -556,9 +556,7 @@ function commitRoot(root: FiberRoot, finishedWork: Fiber): void {
556
556
const updateExpirationTimeBeforeCommit = finishedWork . expirationTime ;
557
557
const childExpirationTimeBeforeCommit = finishedWork . childExpirationTime ;
558
558
const earliestRemainingTimeBeforeCommit =
559
- updateExpirationTimeBeforeCommit === NoWork ||
560
- ( childExpirationTimeBeforeCommit !== NoWork &&
561
- childExpirationTimeBeforeCommit < updateExpirationTimeBeforeCommit )
559
+ childExpirationTimeBeforeCommit < updateExpirationTimeBeforeCommit
562
560
? childExpirationTimeBeforeCommit
563
561
: updateExpirationTimeBeforeCommit ;
564
562
markCommittedPriorityLevels ( root , earliestRemainingTimeBeforeCommit ) ;
@@ -733,9 +731,7 @@ function commitRoot(root: FiberRoot, finishedWork: Fiber): void {
733
731
const updateExpirationTimeAfterCommit = finishedWork . expirationTime ;
734
732
const childExpirationTimeAfterCommit = finishedWork . childExpirationTime ;
735
733
const earliestRemainingTimeAfterCommit =
736
- updateExpirationTimeAfterCommit === NoWork ||
737
- ( childExpirationTimeAfterCommit !== NoWork &&
738
- childExpirationTimeAfterCommit < updateExpirationTimeAfterCommit )
734
+ childExpirationTimeAfterCommit < updateExpirationTimeAfterCommit
739
735
? childExpirationTimeAfterCommit
740
736
: updateExpirationTimeAfterCommit ;
741
737
if ( earliestRemainingTimeAfterCommit === NoWork ) {
@@ -776,10 +772,7 @@ function commitRoot(root: FiberRoot, finishedWork: Fiber): void {
776
772
// Only decrement the pending interaction count if we're done.
777
773
// If there's still work at the current priority,
778
774
// That indicates that we are waiting for suspense data.
779
- if (
780
- earliestRemainingTimeAfterCommit === NoWork ||
781
- scheduledExpirationTime < earliestRemainingTimeAfterCommit
782
- ) {
775
+ if ( scheduledExpirationTime < earliestRemainingTimeAfterCommit ) {
783
776
pendingInteractionMap . delete ( scheduledExpirationTime ) ;
784
777
785
778
scheduledInteractions . forEach ( interaction => {
@@ -839,18 +832,10 @@ function resetChildExpirationTime(
839
832
while ( child !== null ) {
840
833
const childUpdateExpirationTime = child . expirationTime ;
841
834
const childChildExpirationTime = child . childExpirationTime ;
842
- if (
843
- newChildExpirationTime === NoWork ||
844
- ( childUpdateExpirationTime !== NoWork &&
845
- childUpdateExpirationTime < newChildExpirationTime )
846
- ) {
835
+ if ( childUpdateExpirationTime < newChildExpirationTime ) {
847
836
newChildExpirationTime = childUpdateExpirationTime ;
848
837
}
849
- if (
850
- newChildExpirationTime === NoWork ||
851
- ( childChildExpirationTime !== NoWork &&
852
- childChildExpirationTime < newChildExpirationTime )
853
- ) {
838
+ if ( childChildExpirationTime < newChildExpirationTime ) {
854
839
newChildExpirationTime = childChildExpirationTime ;
855
840
}
856
841
if ( shouldBubbleActualDurations ) {
@@ -866,18 +851,10 @@ function resetChildExpirationTime(
866
851
while ( child !== null ) {
867
852
const childUpdateExpirationTime = child . expirationTime ;
868
853
const childChildExpirationTime = child . childExpirationTime ;
869
- if (
870
- newChildExpirationTime === NoWork ||
871
- ( childUpdateExpirationTime !== NoWork &&
872
- childUpdateExpirationTime < newChildExpirationTime )
873
- ) {
854
+ if ( childUpdateExpirationTime < newChildExpirationTime ) {
874
855
newChildExpirationTime = childUpdateExpirationTime ;
875
856
}
876
- if (
877
- newChildExpirationTime === NoWork ||
878
- ( childChildExpirationTime !== NoWork &&
879
- childChildExpirationTime < newChildExpirationTime )
880
- ) {
857
+ if ( childChildExpirationTime < newChildExpirationTime ) {
881
858
newChildExpirationTime = childChildExpirationTime ;
882
859
}
883
860
child = child . sibling ;
@@ -1645,18 +1622,11 @@ function scheduleWorkToRoot(fiber: Fiber, expirationTime): FiberRoot | null {
1645
1622
}
1646
1623
1647
1624
// Update the source fiber's expiration time
1648
- if (
1649
- fiber . expirationTime === NoWork ||
1650
- fiber . expirationTime > expirationTime
1651
- ) {
1625
+ if ( fiber . expirationTime > expirationTime ) {
1652
1626
fiber . expirationTime = expirationTime ;
1653
1627
}
1654
1628
let alternate = fiber . alternate ;
1655
- if (
1656
- alternate !== null &&
1657
- ( alternate . expirationTime === NoWork ||
1658
- alternate . expirationTime > expirationTime )
1659
- ) {
1629
+ if ( alternate !== null && alternate . expirationTime > expirationTime ) {
1660
1630
alternate . expirationTime = expirationTime ;
1661
1631
}
1662
1632
// Walk the parent path to the root and update the child expiration time.
@@ -1667,22 +1637,17 @@ function scheduleWorkToRoot(fiber: Fiber, expirationTime): FiberRoot | null {
1667
1637
} else {
1668
1638
while ( node !== null ) {
1669
1639
alternate = node . alternate ;
1670
- if (
1671
- node . childExpirationTime === NoWork ||
1672
- node . childExpirationTime > expirationTime
1673
- ) {
1640
+ if ( node . childExpirationTime > expirationTime ) {
1674
1641
node . childExpirationTime = expirationTime ;
1675
1642
if (
1676
1643
alternate !== null &&
1677
- ( alternate . childExpirationTime === NoWork ||
1678
- alternate . childExpirationTime > expirationTime )
1644
+ alternate . childExpirationTime > expirationTime
1679
1645
) {
1680
1646
alternate . childExpirationTime = expirationTime ;
1681
1647
}
1682
1648
} else if (
1683
1649
alternate !== null &&
1684
- ( alternate . childExpirationTime === NoWork ||
1685
- alternate . childExpirationTime > expirationTime )
1650
+ alternate . childExpirationTime > expirationTime
1686
1651
) {
1687
1652
alternate . childExpirationTime = expirationTime ;
1688
1653
}
@@ -2031,10 +1996,7 @@ function addRootToSchedule(root: FiberRoot, expirationTime: ExpirationTime) {
2031
1996
} else {
2032
1997
// This root is already scheduled, but its priority may have increased.
2033
1998
const remainingExpirationTime = root . expirationTime ;
2034
- if (
2035
- remainingExpirationTime === NoWork ||
2036
- expirationTime < remainingExpirationTime
2037
- ) {
1999
+ if ( expirationTime < remainingExpirationTime ) {
2038
2000
// Update the priority.
2039
2001
root . expirationTime = expirationTime ;
2040
2002
}
@@ -2083,10 +2045,7 @@ function findHighestPriorityRoot() {
2083
2045
}
2084
2046
root = previousScheduledRoot . nextScheduledRoot ;
2085
2047
} else {
2086
- if (
2087
- highestPriorityWork === NoWork ||
2088
- remainingExpirationTime < highestPriorityWork
2089
- ) {
2048
+ if ( remainingExpirationTime < highestPriorityWork ) {
2090
2049
// Update the priority, if it's higher
2091
2050
highestPriorityWork = remainingExpirationTime ;
2092
2051
highestPriorityRoot = root ;
@@ -2153,8 +2112,7 @@ function performWork(minExpirationTime: ExpirationTime, dl: Deadline | null) {
2153
2112
while (
2154
2113
nextFlushedRoot !== null &&
2155
2114
nextFlushedExpirationTime !== NoWork &&
2156
- ( minExpirationTime === NoWork ||
2157
- minExpirationTime >= nextFlushedExpirationTime ) &&
2115
+ minExpirationTime >= nextFlushedExpirationTime &&
2158
2116
( ! deadlineDidExpire || currentRendererTime >= nextFlushedExpirationTime )
2159
2117
) {
2160
2118
performWorkOnRoot (
@@ -2170,8 +2128,7 @@ function performWork(minExpirationTime: ExpirationTime, dl: Deadline | null) {
2170
2128
while (
2171
2129
nextFlushedRoot !== null &&
2172
2130
nextFlushedExpirationTime !== NoWork &&
2173
- ( minExpirationTime === NoWork ||
2174
- minExpirationTime >= nextFlushedExpirationTime )
2131
+ minExpirationTime >= nextFlushedExpirationTime
2175
2132
) {
2176
2133
performWorkOnRoot ( nextFlushedRoot , nextFlushedExpirationTime , true ) ;
2177
2134
findHighestPriorityRoot ( ) ;
0 commit comments