Skip to content

Commit

Permalink
Remove redundant expiration time comparisons (facebook#18620)
Browse files Browse the repository at this point in the history
I'm going through all the expiration times comparisons as part of my
refactor and I noticed this one has a redundancy.
  • Loading branch information
acdlite committed Apr 17, 2020
1 parent 58c895e commit a4b1e65
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 16 deletions.
11 changes: 3 additions & 8 deletions packages/react-reconciler/src/ReactFiberBeginWork.new.js
Original file line number Diff line number Diff line change
Expand Up @@ -3141,10 +3141,7 @@ function beginWork(
const primaryChildFragment: Fiber = (workInProgress.child: any);
const primaryChildExpirationTime =
primaryChildFragment.childExpirationTime;
if (
primaryChildExpirationTime !== NoWork &&
primaryChildExpirationTime >= renderExpirationTime
) {
if (primaryChildExpirationTime >= renderExpirationTime) {
// The primary children have pending work. Use the normal path
// to attempt to render the primary children again.
return updateSuspenseComponent(
Expand Down Expand Up @@ -3173,10 +3170,8 @@ function beginWork(
const childChildExpirationTime =
primaryChild.childExpirationTime;
if (
(childUpdateExpirationTime !== NoWork &&
childUpdateExpirationTime >= renderExpirationTime) ||
(childChildExpirationTime !== NoWork &&
childChildExpirationTime >= renderExpirationTime)
childUpdateExpirationTime >= renderExpirationTime ||
childChildExpirationTime >= renderExpirationTime
) {
// Found a child with an update with sufficient priority.
// Use the normal path to render the primary children again.
Expand Down
11 changes: 3 additions & 8 deletions packages/react-reconciler/src/ReactFiberBeginWork.old.js
Original file line number Diff line number Diff line change
Expand Up @@ -3141,10 +3141,7 @@ function beginWork(
const primaryChildFragment: Fiber = (workInProgress.child: any);
const primaryChildExpirationTime =
primaryChildFragment.childExpirationTime;
if (
primaryChildExpirationTime !== NoWork &&
primaryChildExpirationTime >= renderExpirationTime
) {
if (primaryChildExpirationTime >= renderExpirationTime) {
// The primary children have pending work. Use the normal path
// to attempt to render the primary children again.
return updateSuspenseComponent(
Expand Down Expand Up @@ -3173,10 +3170,8 @@ function beginWork(
const childChildExpirationTime =
primaryChild.childExpirationTime;
if (
(childUpdateExpirationTime !== NoWork &&
childUpdateExpirationTime >= renderExpirationTime) ||
(childChildExpirationTime !== NoWork &&
childChildExpirationTime >= renderExpirationTime)
childUpdateExpirationTime >= renderExpirationTime ||
childChildExpirationTime >= renderExpirationTime
) {
// Found a child with an update with sufficient priority.
// Use the normal path to render the primary children again.
Expand Down

0 comments on commit a4b1e65

Please sign in to comment.