Skip to content

Commit a4b1e65

Browse files
authored
Remove redundant expiration time comparisons (facebook#18620)
I'm going through all the expiration times comparisons as part of my refactor and I noticed this one has a redundancy.
1 parent 58c895e commit a4b1e65

File tree

2 files changed

+6
-16
lines changed

2 files changed

+6
-16
lines changed

packages/react-reconciler/src/ReactFiberBeginWork.new.js

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3141,10 +3141,7 @@ function beginWork(
31413141
const primaryChildFragment: Fiber = (workInProgress.child: any);
31423142
const primaryChildExpirationTime =
31433143
primaryChildFragment.childExpirationTime;
3144-
if (
3145-
primaryChildExpirationTime !== NoWork &&
3146-
primaryChildExpirationTime >= renderExpirationTime
3147-
) {
3144+
if (primaryChildExpirationTime >= renderExpirationTime) {
31483145
// The primary children have pending work. Use the normal path
31493146
// to attempt to render the primary children again.
31503147
return updateSuspenseComponent(
@@ -3173,10 +3170,8 @@ function beginWork(
31733170
const childChildExpirationTime =
31743171
primaryChild.childExpirationTime;
31753172
if (
3176-
(childUpdateExpirationTime !== NoWork &&
3177-
childUpdateExpirationTime >= renderExpirationTime) ||
3178-
(childChildExpirationTime !== NoWork &&
3179-
childChildExpirationTime >= renderExpirationTime)
3173+
childUpdateExpirationTime >= renderExpirationTime ||
3174+
childChildExpirationTime >= renderExpirationTime
31803175
) {
31813176
// Found a child with an update with sufficient priority.
31823177
// Use the normal path to render the primary children again.

packages/react-reconciler/src/ReactFiberBeginWork.old.js

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3141,10 +3141,7 @@ function beginWork(
31413141
const primaryChildFragment: Fiber = (workInProgress.child: any);
31423142
const primaryChildExpirationTime =
31433143
primaryChildFragment.childExpirationTime;
3144-
if (
3145-
primaryChildExpirationTime !== NoWork &&
3146-
primaryChildExpirationTime >= renderExpirationTime
3147-
) {
3144+
if (primaryChildExpirationTime >= renderExpirationTime) {
31483145
// The primary children have pending work. Use the normal path
31493146
// to attempt to render the primary children again.
31503147
return updateSuspenseComponent(
@@ -3173,10 +3170,8 @@ function beginWork(
31733170
const childChildExpirationTime =
31743171
primaryChild.childExpirationTime;
31753172
if (
3176-
(childUpdateExpirationTime !== NoWork &&
3177-
childUpdateExpirationTime >= renderExpirationTime) ||
3178-
(childChildExpirationTime !== NoWork &&
3179-
childChildExpirationTime >= renderExpirationTime)
3173+
childUpdateExpirationTime >= renderExpirationTime ||
3174+
childChildExpirationTime >= renderExpirationTime
31803175
) {
31813176
// Found a child with an update with sufficient priority.
31823177
// Use the normal path to render the primary children again.

0 commit comments

Comments
 (0)