Skip to content

Commit

Permalink
Move checks inside
Browse files Browse the repository at this point in the history
  • Loading branch information
gaearon committed Aug 2, 2019
1 parent 133a4b5 commit 892df46
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions packages/react-reconciler/src/ReactFiberContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,11 @@ function hasContextChanged(): boolean {
}

function isContextProvider(type: Function): boolean {
const childContextTypes = type.childContextTypes;
const hasChildContextTypes =
childContextTypes !== null && childContextTypes !== undefined;
if (disableLegacyContext) {
return false;
} else {
return hasChildContextTypes;
const childContextTypes = type.childContextTypes;
return childContextTypes !== null && childContextTypes !== undefined;
}
}

Expand All @@ -154,7 +152,9 @@ function popContext(fiber: Fiber): void {
}

function popTopLevelContextObject(fiber: Fiber): void {
if (!disableLegacyContext) {
if (disableLegacyContext) {
return;
} else {
pop(didPerformWorkStackCursor, fiber);
pop(contextStackCursor, fiber);
}
Expand All @@ -165,7 +165,9 @@ function pushTopLevelContextObject(
context: Object,
didChange: boolean,
): void {
if (!disableLegacyContext) {
if (disableLegacyContext) {
return;
} else {
invariant(
contextStackCursor.current === emptyContextObject,
'Unexpected context found on stack. ' +
Expand Down

0 comments on commit 892df46

Please sign in to comment.