Remove redundant expiration time comparisons (#18620)
I'm going through all the expiration times comparisons as part of my refactor and I noticed this one has a redundancy.
Andrew Clark committed
Apr 17, 2020 at 11:48 UTC
a4b1e65afc747b3559acbf684a6eec6dd2de65dc
2 files changed
+6
-16
packages/react-reconciler/src/ReactFiberBeginWork.new.js
+3
-8
@@ -3141,10 +3141,7 @@ function beginWork(
3141
const primaryChildFragment: Fiber = (workInProgress.child: any);
3142
const primaryChildExpirationTime =
3143
primaryChildFragment.childExpirationTime;
3144
- if (
3145
- primaryChildExpirationTime !== NoWork &&
3146
- primaryChildExpirationTime >= renderExpirationTime
3147
- ) {
3144
+ if (primaryChildExpirationTime >= renderExpirationTime) {
3145
// The primary children have pending work. Use the normal path
3146
// to attempt to render the primary children again.
3147
return updateSuspenseComponent(
@@ -3173,10 +3170,8 @@ function beginWork(
3170
const childChildExpirationTime =
3171
primaryChild.childExpirationTime;
3172
if (
3176
- (childUpdateExpirationTime !== NoWork &&
3177
- childUpdateExpirationTime >= renderExpirationTime) ||
3178
- (childChildExpirationTime !== NoWork &&
3179
- childChildExpirationTime >= renderExpirationTime)
3173
+ childUpdateExpirationTime >= renderExpirationTime ||
3174
+ childChildExpirationTime >= renderExpirationTime
3175
) {
3176
// Found a child with an update with sufficient priority.
3177
// Use the normal path to render the primary children again.
packages/react-reconciler/src/ReactFiberBeginWork.old.js
+3
-8
@@ -3141,10 +3141,7 @@ function beginWork(
3141
const primaryChildFragment: Fiber = (workInProgress.child: any);
3142
const primaryChildExpirationTime =
3143
primaryChildFragment.childExpirationTime;
3144
- if (
3145
- primaryChildExpirationTime !== NoWork &&
3146
- primaryChildExpirationTime >= renderExpirationTime
3147
- ) {
3144
+ if (primaryChildExpirationTime >= renderExpirationTime) {
3145
// The primary children have pending work. Use the normal path
3146
// to attempt to render the primary children again.
3147
return updateSuspenseComponent(
@@ -3173,10 +3170,8 @@ function beginWork(
3170
const childChildExpirationTime =
3171
primaryChild.childExpirationTime;
3172
if (
3176
- (childUpdateExpirationTime !== NoWork &&
3177
- childUpdateExpirationTime >= renderExpirationTime) ||
3178
- (childChildExpirationTime !== NoWork &&
3179
- childChildExpirationTime >= renderExpirationTime)
3173
+ childUpdateExpirationTime >= renderExpirationTime ||
3174
+ childChildExpirationTime >= renderExpirationTime
3175
) {
3176
// Found a child with an update with sufficient priority.
3177
// Use the normal path to render the primary children again.