React sync for revisions ca0941f...bc1ea9c

Summary:
@public
This sync includes the following changes:
- **[bc1ea9cd9](https://github.com/facebook/react/commit/bc1ea9cd9)**: Handle errors thrown in gDSFP of a module-style context provider (#13269) //<Andrew Clark>//
- **[0154a79fe](https://github.com/facebook/react/commit/0154a79fe)**: Remove 'warning' module from the JS scheduler (#13264) //<Flarnie Marchan>//
- **[dbd16c8a9](https://github.com/facebook/react/commit/dbd16c8a9)**: Add flow directive to findDOMNode shim (#13265) //<Brian Vaughn>//

Release Notes:
[GENERAL] [FEATURE] [React] - React sync for revisions ca0941f...bc1ea9c

Reviewed By: bvaughn

Differential Revision: D9005608

fbshipit-source-id: c293add468badc5323179fda9341912710d4e840
This commit is contained in:
Andrew Clark 2018-07-25 16:03:19 -07:00 committed by Facebook Github Bot
parent 12e15e4fdf
commit b7bb25fe4c
7 changed files with 283 additions and 273 deletions

View File

@ -1 +1 @@
ca0941fce3a03592530f6111f77cbc9c0daf79af bc1ea9cd96c81467c574b134349eafc303835d0e

View File

@ -10379,6 +10379,11 @@ function mountIndeterminateComponent(
// Proceed under the assumption that this is a class instance // Proceed under the assumption that this is a class instance
workInProgress.tag = ClassComponent; workInProgress.tag = ClassComponent;
// Push context providers early to prevent context stack mismatches.
// During mounting we don't know the child context yet as the instance doesn't exist.
// We will invalidate the child context in finishClassComponent() right after rendering.
var hasContext = pushContextProvider(workInProgress);
workInProgress.memoizedState = workInProgress.memoizedState =
value.state !== null && value.state !== undefined ? value.state : null; value.state !== null && value.state !== undefined ? value.state : null;
@ -10391,10 +10396,6 @@ function mountIndeterminateComponent(
); );
} }
// Push context providers early to prevent context stack mismatches.
// During mounting we don't know the child context yet as the instance doesn't exist.
// We will invalidate the child context in finishClassComponent() right after rendering.
var hasContext = pushContextProvider(workInProgress);
adoptClassInstance(workInProgress, value); adoptClassInstance(workInProgress, value);
mountClassInstance(workInProgress, renderExpirationTime); mountClassInstance(workInProgress, renderExpirationTime);
return finishClassComponent( return finishClassComponent(

View File

@ -3490,34 +3490,37 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
prepareToReadContext(workInProgress, renderExpirationTime); prepareToReadContext(workInProgress, renderExpirationTime);
fn = fn(updateExpirationTime, unmaskedContext); fn = fn(updateExpirationTime, unmaskedContext);
workInProgress.effectTag |= 1; workInProgress.effectTag |= 1;
if (
"object" === typeof fn && "object" === typeof fn &&
null !== fn && null !== fn &&
"function" === typeof fn.render && "function" === typeof fn.render &&
void 0 === fn.$$typeof void 0 === fn.$$typeof
? ((unmaskedContext = workInProgress.type), ) {
(workInProgress.tag = 2), var Component = workInProgress.type;
(workInProgress.memoizedState = workInProgress.tag = 2;
null !== fn.state && void 0 !== fn.state ? fn.state : null), unmaskedContext = pushContextProvider(workInProgress);
(unmaskedContext = unmaskedContext.getDerivedStateFromProps), workInProgress.memoizedState =
"function" === typeof unmaskedContext && null !== fn.state && void 0 !== fn.state ? fn.state : null;
Component = Component.getDerivedStateFromProps;
"function" === typeof Component &&
applyDerivedStateFromProps( applyDerivedStateFromProps(
workInProgress, workInProgress,
unmaskedContext, Component,
updateExpirationTime updateExpirationTime
), );
(updateExpirationTime = pushContextProvider(workInProgress)), fn.updater = classComponentUpdater;
(fn.updater = classComponentUpdater), workInProgress.stateNode = fn;
(workInProgress.stateNode = fn), fn._reactInternalFiber = workInProgress;
(fn._reactInternalFiber = workInProgress), mountClassInstance(workInProgress, renderExpirationTime);
mountClassInstance(workInProgress, renderExpirationTime), current$$1 = finishClassComponent(
(current$$1 = finishClassComponent(
current$$1, current$$1,
workInProgress, workInProgress,
!0, !0,
updateExpirationTime, unmaskedContext,
renderExpirationTime renderExpirationTime
))) );
: ((workInProgress.tag = 1), } else
(workInProgress.tag = 1),
reconcileChildren( reconcileChildren(
current$$1, current$$1,
workInProgress, workInProgress,
@ -3525,7 +3528,7 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
renderExpirationTime renderExpirationTime
), ),
(workInProgress.memoizedProps = updateExpirationTime), (workInProgress.memoizedProps = updateExpirationTime),
(current$$1 = workInProgress.child)); (current$$1 = workInProgress.child);
return current$$1; return current$$1;
case 1: case 1:
return ( return (
@ -3548,10 +3551,9 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
var props = workInProgress.pendingProps, var props = workInProgress.pendingProps,
ctor = workInProgress.type; ctor = workInProgress.type;
fn = getUnmaskedContext(workInProgress); fn = getUnmaskedContext(workInProgress);
var needsContext = unmaskedContext = (Component =
2 === workInProgress.tag && 2 === workInProgress.tag &&
null != workInProgress.type.contextTypes; null != workInProgress.type.contextTypes)
unmaskedContext = needsContext
? getMaskedContext(workInProgress, fn) ? getMaskedContext(workInProgress, fn)
: emptyContextObject; : emptyContextObject;
props = new ctor(props, unmaskedContext); props = new ctor(props, unmaskedContext);
@ -3560,17 +3562,17 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
props.updater = classComponentUpdater; props.updater = classComponentUpdater;
workInProgress.stateNode = props; workInProgress.stateNode = props;
props._reactInternalFiber = workInProgress; props._reactInternalFiber = workInProgress;
needsContext && Component &&
((needsContext = workInProgress.stateNode), ((Component = workInProgress.stateNode),
(needsContext.__reactInternalMemoizedUnmaskedChildContext = fn), (Component.__reactInternalMemoizedUnmaskedChildContext = fn),
(needsContext.__reactInternalMemoizedMaskedChildContext = unmaskedContext)); (Component.__reactInternalMemoizedMaskedChildContext = unmaskedContext));
mountClassInstance(workInProgress, renderExpirationTime); mountClassInstance(workInProgress, renderExpirationTime);
fn = !0; fn = !0;
} else { } else {
var ctor$jscomp$0 = workInProgress.type; var ctor$jscomp$0 = workInProgress.type;
unmaskedContext = workInProgress.stateNode; unmaskedContext = workInProgress.stateNode;
props = workInProgress.memoizedProps; props = workInProgress.memoizedProps;
needsContext = workInProgress.pendingProps; Component = workInProgress.pendingProps;
unmaskedContext.props = props; unmaskedContext.props = props;
var oldContext = unmaskedContext.context; var oldContext = unmaskedContext.context;
ctor = getUnmaskedContext(workInProgress); ctor = getUnmaskedContext(workInProgress);
@ -3583,11 +3585,11 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
typeof unmaskedContext.UNSAFE_componentWillReceiveProps && typeof unmaskedContext.UNSAFE_componentWillReceiveProps &&
"function" !== "function" !==
typeof unmaskedContext.componentWillReceiveProps) || typeof unmaskedContext.componentWillReceiveProps) ||
((props !== needsContext || oldContext !== ctor) && ((props !== Component || oldContext !== ctor) &&
callComponentWillReceiveProps( callComponentWillReceiveProps(
workInProgress, workInProgress,
unmaskedContext, unmaskedContext,
needsContext, Component,
ctor ctor
)); ));
hasForceUpdate = !1; hasForceUpdate = !1;
@ -3598,12 +3600,12 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
(processUpdateQueue( (processUpdateQueue(
workInProgress, workInProgress,
updateQueue, updateQueue,
needsContext, Component,
unmaskedContext, unmaskedContext,
renderExpirationTime renderExpirationTime
), ),
(oldContext = workInProgress.memoizedState)); (oldContext = workInProgress.memoizedState));
props !== needsContext || props !== Component ||
oldState !== oldContext || oldState !== oldContext ||
didPerformWorkStackCursor.current || didPerformWorkStackCursor.current ||
fn || fn ||
@ -3612,7 +3614,7 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
(applyDerivedStateFromProps( (applyDerivedStateFromProps(
workInProgress, workInProgress,
getDerivedStateFromProps, getDerivedStateFromProps,
needsContext Component
), ),
(oldContext = workInProgress.memoizedState)), (oldContext = workInProgress.memoizedState)),
(fn = (fn =
@ -3621,7 +3623,7 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
checkShouldComponentUpdate( checkShouldComponentUpdate(
workInProgress, workInProgress,
props, props,
needsContext, Component,
oldState, oldState,
oldContext, oldContext,
ctor ctor
@ -3640,9 +3642,9 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
(workInProgress.effectTag |= 4)) (workInProgress.effectTag |= 4))
: ("function" === typeof unmaskedContext.componentDidMount && : ("function" === typeof unmaskedContext.componentDidMount &&
(workInProgress.effectTag |= 4), (workInProgress.effectTag |= 4),
(workInProgress.memoizedProps = needsContext), (workInProgress.memoizedProps = Component),
(workInProgress.memoizedState = oldContext)), (workInProgress.memoizedState = oldContext)),
(unmaskedContext.props = needsContext), (unmaskedContext.props = Component),
(unmaskedContext.state = oldContext), (unmaskedContext.state = oldContext),
(unmaskedContext.context = ctor)) (unmaskedContext.context = ctor))
: ("function" === typeof unmaskedContext.componentDidMount && : ("function" === typeof unmaskedContext.componentDidMount &&
@ -3652,9 +3654,9 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
else else
(ctor$jscomp$0 = workInProgress.type), (ctor$jscomp$0 = workInProgress.type),
(unmaskedContext = workInProgress.stateNode), (unmaskedContext = workInProgress.stateNode),
(needsContext = workInProgress.memoizedProps), (Component = workInProgress.memoizedProps),
(props = workInProgress.pendingProps), (props = workInProgress.pendingProps),
(unmaskedContext.props = needsContext), (unmaskedContext.props = Component),
(oldContext = unmaskedContext.context), (oldContext = unmaskedContext.context),
(ctor = getUnmaskedContext(workInProgress)), (ctor = getUnmaskedContext(workInProgress)),
(ctor = getMaskedContext(workInProgress, ctor)), (ctor = getMaskedContext(workInProgress, ctor)),
@ -3666,7 +3668,7 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
typeof unmaskedContext.UNSAFE_componentWillReceiveProps && typeof unmaskedContext.UNSAFE_componentWillReceiveProps &&
"function" !== "function" !==
typeof unmaskedContext.componentWillReceiveProps) || typeof unmaskedContext.componentWillReceiveProps) ||
((needsContext !== props || oldContext !== ctor) && ((Component !== props || oldContext !== ctor) &&
callComponentWillReceiveProps( callComponentWillReceiveProps(
workInProgress, workInProgress,
unmaskedContext, unmaskedContext,
@ -3686,7 +3688,7 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
renderExpirationTime renderExpirationTime
), ),
(oldState = workInProgress.memoizedState)), (oldState = workInProgress.memoizedState)),
needsContext !== props || Component !== props ||
oldContext !== oldState || oldContext !== oldState ||
didPerformWorkStackCursor.current || didPerformWorkStackCursor.current ||
fn || fn ||
@ -3703,7 +3705,7 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
fn || fn ||
checkShouldComponentUpdate( checkShouldComponentUpdate(
workInProgress, workInProgress,
needsContext, Component,
props, props,
oldContext, oldContext,
oldState, oldState,
@ -3734,12 +3736,12 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
typeof unmaskedContext.getSnapshotBeforeUpdate && typeof unmaskedContext.getSnapshotBeforeUpdate &&
(workInProgress.effectTag |= 256)) (workInProgress.effectTag |= 256))
: ("function" !== typeof unmaskedContext.componentDidUpdate || : ("function" !== typeof unmaskedContext.componentDidUpdate ||
(needsContext === current$$1.memoizedProps && (Component === current$$1.memoizedProps &&
oldContext === current$$1.memoizedState) || oldContext === current$$1.memoizedState) ||
(workInProgress.effectTag |= 4), (workInProgress.effectTag |= 4),
"function" !== "function" !==
typeof unmaskedContext.getSnapshotBeforeUpdate || typeof unmaskedContext.getSnapshotBeforeUpdate ||
(needsContext === current$$1.memoizedProps && (Component === current$$1.memoizedProps &&
oldContext === current$$1.memoizedState) || oldContext === current$$1.memoizedState) ||
(workInProgress.effectTag |= 256), (workInProgress.effectTag |= 256),
(workInProgress.memoizedProps = props), (workInProgress.memoizedProps = props),
@ -3748,11 +3750,11 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
(unmaskedContext.state = oldState), (unmaskedContext.state = oldState),
(unmaskedContext.context = ctor)) (unmaskedContext.context = ctor))
: ("function" !== typeof unmaskedContext.componentDidUpdate || : ("function" !== typeof unmaskedContext.componentDidUpdate ||
(needsContext === current$$1.memoizedProps && (Component === current$$1.memoizedProps &&
oldContext === current$$1.memoizedState) || oldContext === current$$1.memoizedState) ||
(workInProgress.effectTag |= 4), (workInProgress.effectTag |= 4),
"function" !== typeof unmaskedContext.getSnapshotBeforeUpdate || "function" !== typeof unmaskedContext.getSnapshotBeforeUpdate ||
(needsContext === current$$1.memoizedProps && (Component === current$$1.memoizedProps &&
oldContext === current$$1.memoizedState) || oldContext === current$$1.memoizedState) ||
(workInProgress.effectTag |= 256), (workInProgress.effectTag |= 256),
(fn = !1)); (fn = !1));
@ -3904,9 +3906,9 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
updateExpirationTime = workInProgress.type._context; updateExpirationTime = workInProgress.type._context;
fn = workInProgress.pendingProps; fn = workInProgress.pendingProps;
unmaskedContext = workInProgress.memoizedProps; unmaskedContext = workInProgress.memoizedProps;
needsContext = fn.value; Component = fn.value;
workInProgress.memoizedProps = fn; workInProgress.memoizedProps = fn;
if (null === unmaskedContext) needsContext = 1073741823; if (null === unmaskedContext) Component = 1073741823;
else if (unmaskedContext.value === fn.value) { else if (unmaskedContext.value === fn.value) {
if ( if (
unmaskedContext.children === fn.children && unmaskedContext.children === fn.children &&
@ -3921,12 +3923,12 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
); );
break a; break a;
} }
needsContext = 0; Component = 0;
} else if ( } else if (
((props = unmaskedContext.value), ((props = unmaskedContext.value),
(props === needsContext && (props === Component &&
(0 !== props || 1 / props === 1 / needsContext)) || (0 !== props || 1 / props === 1 / Component)) ||
(props !== props && needsContext !== needsContext)) (props !== props && Component !== Component))
) { ) {
if ( if (
unmaskedContext.children === fn.children && unmaskedContext.children === fn.children &&
@ -3941,14 +3943,14 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
); );
break a; break a;
} }
needsContext = 0; Component = 0;
} else if ( } else if (
((needsContext = ((Component =
"function" === typeof updateExpirationTime._calculateChangedBits "function" === typeof updateExpirationTime._calculateChangedBits
? updateExpirationTime._calculateChangedBits(props, needsContext) ? updateExpirationTime._calculateChangedBits(props, Component)
: 1073741823), : 1073741823),
(needsContext |= 0), (Component |= 0),
0 === needsContext) 0 === Component)
) { ) {
if ( if (
unmaskedContext.children === fn.children && unmaskedContext.children === fn.children &&
@ -3967,10 +3969,10 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
propagateContextChange( propagateContextChange(
workInProgress, workInProgress,
updateExpirationTime, updateExpirationTime,
needsContext, Component,
renderExpirationTime renderExpirationTime
); );
workInProgress.stateNode = needsContext; workInProgress.stateNode = Component;
pushProvider(workInProgress); pushProvider(workInProgress);
reconcileChildren( reconcileChildren(
current$$1, current$$1,

View File

@ -3531,34 +3531,37 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
prepareToReadContext(workInProgress, renderExpirationTime); prepareToReadContext(workInProgress, renderExpirationTime);
fn = fn(updateExpirationTime, unmaskedContext); fn = fn(updateExpirationTime, unmaskedContext);
workInProgress.effectTag |= 1; workInProgress.effectTag |= 1;
if (
"object" === typeof fn && "object" === typeof fn &&
null !== fn && null !== fn &&
"function" === typeof fn.render && "function" === typeof fn.render &&
void 0 === fn.$$typeof void 0 === fn.$$typeof
? ((unmaskedContext = workInProgress.type), ) {
(workInProgress.tag = 2), var Component = workInProgress.type;
(workInProgress.memoizedState = workInProgress.tag = 2;
null !== fn.state && void 0 !== fn.state ? fn.state : null), unmaskedContext = pushContextProvider(workInProgress);
(unmaskedContext = unmaskedContext.getDerivedStateFromProps), workInProgress.memoizedState =
"function" === typeof unmaskedContext && null !== fn.state && void 0 !== fn.state ? fn.state : null;
Component = Component.getDerivedStateFromProps;
"function" === typeof Component &&
applyDerivedStateFromProps( applyDerivedStateFromProps(
workInProgress, workInProgress,
unmaskedContext, Component,
updateExpirationTime updateExpirationTime
), );
(updateExpirationTime = pushContextProvider(workInProgress)), fn.updater = classComponentUpdater;
(fn.updater = classComponentUpdater), workInProgress.stateNode = fn;
(workInProgress.stateNode = fn), fn._reactInternalFiber = workInProgress;
(fn._reactInternalFiber = workInProgress), mountClassInstance(workInProgress, renderExpirationTime);
mountClassInstance(workInProgress, renderExpirationTime), current$$1 = finishClassComponent(
(current$$1 = finishClassComponent(
current$$1, current$$1,
workInProgress, workInProgress,
!0, !0,
updateExpirationTime, unmaskedContext,
renderExpirationTime renderExpirationTime
))) );
: ((workInProgress.tag = 1), } else
(workInProgress.tag = 1),
reconcileChildren( reconcileChildren(
current$$1, current$$1,
workInProgress, workInProgress,
@ -3566,7 +3569,7 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
renderExpirationTime renderExpirationTime
), ),
(workInProgress.memoizedProps = updateExpirationTime), (workInProgress.memoizedProps = updateExpirationTime),
(current$$1 = workInProgress.child)); (current$$1 = workInProgress.child);
return current$$1; return current$$1;
case 1: case 1:
return ( return (
@ -3589,10 +3592,9 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
var props = workInProgress.pendingProps, var props = workInProgress.pendingProps,
ctor = workInProgress.type; ctor = workInProgress.type;
fn = getUnmaskedContext(workInProgress); fn = getUnmaskedContext(workInProgress);
var needsContext = unmaskedContext = (Component =
2 === workInProgress.tag && 2 === workInProgress.tag &&
null != workInProgress.type.contextTypes; null != workInProgress.type.contextTypes)
unmaskedContext = needsContext
? getMaskedContext(workInProgress, fn) ? getMaskedContext(workInProgress, fn)
: emptyContextObject; : emptyContextObject;
props = new ctor(props, unmaskedContext); props = new ctor(props, unmaskedContext);
@ -3601,17 +3603,17 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
props.updater = classComponentUpdater; props.updater = classComponentUpdater;
workInProgress.stateNode = props; workInProgress.stateNode = props;
props._reactInternalFiber = workInProgress; props._reactInternalFiber = workInProgress;
needsContext && Component &&
((needsContext = workInProgress.stateNode), ((Component = workInProgress.stateNode),
(needsContext.__reactInternalMemoizedUnmaskedChildContext = fn), (Component.__reactInternalMemoizedUnmaskedChildContext = fn),
(needsContext.__reactInternalMemoizedMaskedChildContext = unmaskedContext)); (Component.__reactInternalMemoizedMaskedChildContext = unmaskedContext));
mountClassInstance(workInProgress, renderExpirationTime); mountClassInstance(workInProgress, renderExpirationTime);
fn = !0; fn = !0;
} else { } else {
var ctor$jscomp$0 = workInProgress.type; var ctor$jscomp$0 = workInProgress.type;
unmaskedContext = workInProgress.stateNode; unmaskedContext = workInProgress.stateNode;
props = workInProgress.memoizedProps; props = workInProgress.memoizedProps;
needsContext = workInProgress.pendingProps; Component = workInProgress.pendingProps;
unmaskedContext.props = props; unmaskedContext.props = props;
var oldContext = unmaskedContext.context; var oldContext = unmaskedContext.context;
ctor = getUnmaskedContext(workInProgress); ctor = getUnmaskedContext(workInProgress);
@ -3624,11 +3626,11 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
typeof unmaskedContext.UNSAFE_componentWillReceiveProps && typeof unmaskedContext.UNSAFE_componentWillReceiveProps &&
"function" !== "function" !==
typeof unmaskedContext.componentWillReceiveProps) || typeof unmaskedContext.componentWillReceiveProps) ||
((props !== needsContext || oldContext !== ctor) && ((props !== Component || oldContext !== ctor) &&
callComponentWillReceiveProps( callComponentWillReceiveProps(
workInProgress, workInProgress,
unmaskedContext, unmaskedContext,
needsContext, Component,
ctor ctor
)); ));
hasForceUpdate = !1; hasForceUpdate = !1;
@ -3639,12 +3641,12 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
(processUpdateQueue( (processUpdateQueue(
workInProgress, workInProgress,
updateQueue, updateQueue,
needsContext, Component,
unmaskedContext, unmaskedContext,
renderExpirationTime renderExpirationTime
), ),
(oldContext = workInProgress.memoizedState)); (oldContext = workInProgress.memoizedState));
props !== needsContext || props !== Component ||
oldState !== oldContext || oldState !== oldContext ||
didPerformWorkStackCursor.current || didPerformWorkStackCursor.current ||
fn || fn ||
@ -3653,7 +3655,7 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
(applyDerivedStateFromProps( (applyDerivedStateFromProps(
workInProgress, workInProgress,
getDerivedStateFromProps, getDerivedStateFromProps,
needsContext Component
), ),
(oldContext = workInProgress.memoizedState)), (oldContext = workInProgress.memoizedState)),
(fn = (fn =
@ -3662,7 +3664,7 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
checkShouldComponentUpdate( checkShouldComponentUpdate(
workInProgress, workInProgress,
props, props,
needsContext, Component,
oldState, oldState,
oldContext, oldContext,
ctor ctor
@ -3681,9 +3683,9 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
(workInProgress.effectTag |= 4)) (workInProgress.effectTag |= 4))
: ("function" === typeof unmaskedContext.componentDidMount && : ("function" === typeof unmaskedContext.componentDidMount &&
(workInProgress.effectTag |= 4), (workInProgress.effectTag |= 4),
(workInProgress.memoizedProps = needsContext), (workInProgress.memoizedProps = Component),
(workInProgress.memoizedState = oldContext)), (workInProgress.memoizedState = oldContext)),
(unmaskedContext.props = needsContext), (unmaskedContext.props = Component),
(unmaskedContext.state = oldContext), (unmaskedContext.state = oldContext),
(unmaskedContext.context = ctor)) (unmaskedContext.context = ctor))
: ("function" === typeof unmaskedContext.componentDidMount && : ("function" === typeof unmaskedContext.componentDidMount &&
@ -3693,9 +3695,9 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
else else
(ctor$jscomp$0 = workInProgress.type), (ctor$jscomp$0 = workInProgress.type),
(unmaskedContext = workInProgress.stateNode), (unmaskedContext = workInProgress.stateNode),
(needsContext = workInProgress.memoizedProps), (Component = workInProgress.memoizedProps),
(props = workInProgress.pendingProps), (props = workInProgress.pendingProps),
(unmaskedContext.props = needsContext), (unmaskedContext.props = Component),
(oldContext = unmaskedContext.context), (oldContext = unmaskedContext.context),
(ctor = getUnmaskedContext(workInProgress)), (ctor = getUnmaskedContext(workInProgress)),
(ctor = getMaskedContext(workInProgress, ctor)), (ctor = getMaskedContext(workInProgress, ctor)),
@ -3707,7 +3709,7 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
typeof unmaskedContext.UNSAFE_componentWillReceiveProps && typeof unmaskedContext.UNSAFE_componentWillReceiveProps &&
"function" !== "function" !==
typeof unmaskedContext.componentWillReceiveProps) || typeof unmaskedContext.componentWillReceiveProps) ||
((needsContext !== props || oldContext !== ctor) && ((Component !== props || oldContext !== ctor) &&
callComponentWillReceiveProps( callComponentWillReceiveProps(
workInProgress, workInProgress,
unmaskedContext, unmaskedContext,
@ -3727,7 +3729,7 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
renderExpirationTime renderExpirationTime
), ),
(oldState = workInProgress.memoizedState)), (oldState = workInProgress.memoizedState)),
needsContext !== props || Component !== props ||
oldContext !== oldState || oldContext !== oldState ||
didPerformWorkStackCursor.current || didPerformWorkStackCursor.current ||
fn || fn ||
@ -3744,7 +3746,7 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
fn || fn ||
checkShouldComponentUpdate( checkShouldComponentUpdate(
workInProgress, workInProgress,
needsContext, Component,
props, props,
oldContext, oldContext,
oldState, oldState,
@ -3775,12 +3777,12 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
typeof unmaskedContext.getSnapshotBeforeUpdate && typeof unmaskedContext.getSnapshotBeforeUpdate &&
(workInProgress.effectTag |= 256)) (workInProgress.effectTag |= 256))
: ("function" !== typeof unmaskedContext.componentDidUpdate || : ("function" !== typeof unmaskedContext.componentDidUpdate ||
(needsContext === current$$1.memoizedProps && (Component === current$$1.memoizedProps &&
oldContext === current$$1.memoizedState) || oldContext === current$$1.memoizedState) ||
(workInProgress.effectTag |= 4), (workInProgress.effectTag |= 4),
"function" !== "function" !==
typeof unmaskedContext.getSnapshotBeforeUpdate || typeof unmaskedContext.getSnapshotBeforeUpdate ||
(needsContext === current$$1.memoizedProps && (Component === current$$1.memoizedProps &&
oldContext === current$$1.memoizedState) || oldContext === current$$1.memoizedState) ||
(workInProgress.effectTag |= 256), (workInProgress.effectTag |= 256),
(workInProgress.memoizedProps = props), (workInProgress.memoizedProps = props),
@ -3789,11 +3791,11 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
(unmaskedContext.state = oldState), (unmaskedContext.state = oldState),
(unmaskedContext.context = ctor)) (unmaskedContext.context = ctor))
: ("function" !== typeof unmaskedContext.componentDidUpdate || : ("function" !== typeof unmaskedContext.componentDidUpdate ||
(needsContext === current$$1.memoizedProps && (Component === current$$1.memoizedProps &&
oldContext === current$$1.memoizedState) || oldContext === current$$1.memoizedState) ||
(workInProgress.effectTag |= 4), (workInProgress.effectTag |= 4),
"function" !== typeof unmaskedContext.getSnapshotBeforeUpdate || "function" !== typeof unmaskedContext.getSnapshotBeforeUpdate ||
(needsContext === current$$1.memoizedProps && (Component === current$$1.memoizedProps &&
oldContext === current$$1.memoizedState) || oldContext === current$$1.memoizedState) ||
(workInProgress.effectTag |= 256), (workInProgress.effectTag |= 256),
(fn = !1)); (fn = !1));
@ -3946,9 +3948,9 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
updateExpirationTime = workInProgress.type._context; updateExpirationTime = workInProgress.type._context;
fn = workInProgress.pendingProps; fn = workInProgress.pendingProps;
unmaskedContext = workInProgress.memoizedProps; unmaskedContext = workInProgress.memoizedProps;
needsContext = fn.value; Component = fn.value;
workInProgress.memoizedProps = fn; workInProgress.memoizedProps = fn;
if (null === unmaskedContext) needsContext = 1073741823; if (null === unmaskedContext) Component = 1073741823;
else if (unmaskedContext.value === fn.value) { else if (unmaskedContext.value === fn.value) {
if ( if (
unmaskedContext.children === fn.children && unmaskedContext.children === fn.children &&
@ -3963,12 +3965,12 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
); );
break a; break a;
} }
needsContext = 0; Component = 0;
} else if ( } else if (
((props = unmaskedContext.value), ((props = unmaskedContext.value),
(props === needsContext && (props === Component &&
(0 !== props || 1 / props === 1 / needsContext)) || (0 !== props || 1 / props === 1 / Component)) ||
(props !== props && needsContext !== needsContext)) (props !== props && Component !== Component))
) { ) {
if ( if (
unmaskedContext.children === fn.children && unmaskedContext.children === fn.children &&
@ -3983,14 +3985,14 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
); );
break a; break a;
} }
needsContext = 0; Component = 0;
} else if ( } else if (
((needsContext = ((Component =
"function" === typeof updateExpirationTime._calculateChangedBits "function" === typeof updateExpirationTime._calculateChangedBits
? updateExpirationTime._calculateChangedBits(props, needsContext) ? updateExpirationTime._calculateChangedBits(props, Component)
: 1073741823), : 1073741823),
(needsContext |= 0), (Component |= 0),
0 === needsContext) 0 === Component)
) { ) {
if ( if (
unmaskedContext.children === fn.children && unmaskedContext.children === fn.children &&
@ -4009,10 +4011,10 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
propagateContextChange( propagateContextChange(
workInProgress, workInProgress,
updateExpirationTime, updateExpirationTime,
needsContext, Component,
renderExpirationTime renderExpirationTime
); );
workInProgress.stateNode = needsContext; workInProgress.stateNode = Component;
pushProvider(workInProgress); pushProvider(workInProgress);
reconcileChildren( reconcileChildren(
current$$1, current$$1,

View File

@ -10672,6 +10672,11 @@ function mountIndeterminateComponent(
// Proceed under the assumption that this is a class instance // Proceed under the assumption that this is a class instance
workInProgress.tag = ClassComponent; workInProgress.tag = ClassComponent;
// Push context providers early to prevent context stack mismatches.
// During mounting we don't know the child context yet as the instance doesn't exist.
// We will invalidate the child context in finishClassComponent() right after rendering.
var hasContext = pushContextProvider(workInProgress);
workInProgress.memoizedState = workInProgress.memoizedState =
value.state !== null && value.state !== undefined ? value.state : null; value.state !== null && value.state !== undefined ? value.state : null;
@ -10684,10 +10689,6 @@ function mountIndeterminateComponent(
); );
} }
// Push context providers early to prevent context stack mismatches.
// During mounting we don't know the child context yet as the instance doesn't exist.
// We will invalidate the child context in finishClassComponent() right after rendering.
var hasContext = pushContextProvider(workInProgress);
adoptClassInstance(workInProgress, value); adoptClassInstance(workInProgress, value);
mountClassInstance(workInProgress, renderExpirationTime); mountClassInstance(workInProgress, renderExpirationTime);
return finishClassComponent( return finishClassComponent(

View File

@ -3545,34 +3545,37 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
prepareToReadContext(workInProgress, renderExpirationTime); prepareToReadContext(workInProgress, renderExpirationTime);
fn = fn(updateExpirationTime, unmaskedContext); fn = fn(updateExpirationTime, unmaskedContext);
workInProgress.effectTag |= 1; workInProgress.effectTag |= 1;
if (
"object" === typeof fn && "object" === typeof fn &&
null !== fn && null !== fn &&
"function" === typeof fn.render && "function" === typeof fn.render &&
void 0 === fn.$$typeof void 0 === fn.$$typeof
? ((unmaskedContext = workInProgress.type), ) {
(workInProgress.tag = 2), var Component = workInProgress.type;
(workInProgress.memoizedState = workInProgress.tag = 2;
null !== fn.state && void 0 !== fn.state ? fn.state : null), unmaskedContext = pushContextProvider(workInProgress);
(unmaskedContext = unmaskedContext.getDerivedStateFromProps), workInProgress.memoizedState =
"function" === typeof unmaskedContext && null !== fn.state && void 0 !== fn.state ? fn.state : null;
Component = Component.getDerivedStateFromProps;
"function" === typeof Component &&
applyDerivedStateFromProps( applyDerivedStateFromProps(
workInProgress, workInProgress,
unmaskedContext, Component,
updateExpirationTime updateExpirationTime
), );
(updateExpirationTime = pushContextProvider(workInProgress)), fn.updater = classComponentUpdater;
(fn.updater = classComponentUpdater), workInProgress.stateNode = fn;
(workInProgress.stateNode = fn), fn._reactInternalFiber = workInProgress;
(fn._reactInternalFiber = workInProgress), mountClassInstance(workInProgress, renderExpirationTime);
mountClassInstance(workInProgress, renderExpirationTime), current$$1 = finishClassComponent(
(current$$1 = finishClassComponent(
current$$1, current$$1,
workInProgress, workInProgress,
!0, !0,
updateExpirationTime, unmaskedContext,
renderExpirationTime renderExpirationTime
))) );
: ((workInProgress.tag = 1), } else
(workInProgress.tag = 1),
reconcileChildren( reconcileChildren(
current$$1, current$$1,
workInProgress, workInProgress,
@ -3580,7 +3583,7 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
renderExpirationTime renderExpirationTime
), ),
(workInProgress.memoizedProps = updateExpirationTime), (workInProgress.memoizedProps = updateExpirationTime),
(current$$1 = workInProgress.child)); (current$$1 = workInProgress.child);
return current$$1; return current$$1;
case 1: case 1:
return ( return (
@ -3603,10 +3606,9 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
var props = workInProgress.pendingProps, var props = workInProgress.pendingProps,
ctor = workInProgress.type; ctor = workInProgress.type;
fn = getUnmaskedContext(workInProgress); fn = getUnmaskedContext(workInProgress);
var needsContext = unmaskedContext = (Component =
2 === workInProgress.tag && 2 === workInProgress.tag &&
null != workInProgress.type.contextTypes; null != workInProgress.type.contextTypes)
unmaskedContext = needsContext
? getMaskedContext(workInProgress, fn) ? getMaskedContext(workInProgress, fn)
: emptyContextObject; : emptyContextObject;
props = new ctor(props, unmaskedContext); props = new ctor(props, unmaskedContext);
@ -3615,17 +3617,17 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
props.updater = classComponentUpdater; props.updater = classComponentUpdater;
workInProgress.stateNode = props; workInProgress.stateNode = props;
props._reactInternalFiber = workInProgress; props._reactInternalFiber = workInProgress;
needsContext && Component &&
((needsContext = workInProgress.stateNode), ((Component = workInProgress.stateNode),
(needsContext.__reactInternalMemoizedUnmaskedChildContext = fn), (Component.__reactInternalMemoizedUnmaskedChildContext = fn),
(needsContext.__reactInternalMemoizedMaskedChildContext = unmaskedContext)); (Component.__reactInternalMemoizedMaskedChildContext = unmaskedContext));
mountClassInstance(workInProgress, renderExpirationTime); mountClassInstance(workInProgress, renderExpirationTime);
fn = !0; fn = !0;
} else { } else {
var ctor$jscomp$0 = workInProgress.type; var ctor$jscomp$0 = workInProgress.type;
unmaskedContext = workInProgress.stateNode; unmaskedContext = workInProgress.stateNode;
props = workInProgress.memoizedProps; props = workInProgress.memoizedProps;
needsContext = workInProgress.pendingProps; Component = workInProgress.pendingProps;
unmaskedContext.props = props; unmaskedContext.props = props;
var oldContext = unmaskedContext.context; var oldContext = unmaskedContext.context;
ctor = getUnmaskedContext(workInProgress); ctor = getUnmaskedContext(workInProgress);
@ -3638,11 +3640,11 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
typeof unmaskedContext.UNSAFE_componentWillReceiveProps && typeof unmaskedContext.UNSAFE_componentWillReceiveProps &&
"function" !== "function" !==
typeof unmaskedContext.componentWillReceiveProps) || typeof unmaskedContext.componentWillReceiveProps) ||
((props !== needsContext || oldContext !== ctor) && ((props !== Component || oldContext !== ctor) &&
callComponentWillReceiveProps( callComponentWillReceiveProps(
workInProgress, workInProgress,
unmaskedContext, unmaskedContext,
needsContext, Component,
ctor ctor
)); ));
hasForceUpdate = !1; hasForceUpdate = !1;
@ -3653,12 +3655,12 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
(processUpdateQueue( (processUpdateQueue(
workInProgress, workInProgress,
updateQueue, updateQueue,
needsContext, Component,
unmaskedContext, unmaskedContext,
renderExpirationTime renderExpirationTime
), ),
(oldContext = workInProgress.memoizedState)); (oldContext = workInProgress.memoizedState));
props !== needsContext || props !== Component ||
oldState !== oldContext || oldState !== oldContext ||
didPerformWorkStackCursor.current || didPerformWorkStackCursor.current ||
fn || fn ||
@ -3667,7 +3669,7 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
(applyDerivedStateFromProps( (applyDerivedStateFromProps(
workInProgress, workInProgress,
getDerivedStateFromProps, getDerivedStateFromProps,
needsContext Component
), ),
(oldContext = workInProgress.memoizedState)), (oldContext = workInProgress.memoizedState)),
(fn = (fn =
@ -3676,7 +3678,7 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
checkShouldComponentUpdate( checkShouldComponentUpdate(
workInProgress, workInProgress,
props, props,
needsContext, Component,
oldState, oldState,
oldContext, oldContext,
ctor ctor
@ -3695,9 +3697,9 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
(workInProgress.effectTag |= 4)) (workInProgress.effectTag |= 4))
: ("function" === typeof unmaskedContext.componentDidMount && : ("function" === typeof unmaskedContext.componentDidMount &&
(workInProgress.effectTag |= 4), (workInProgress.effectTag |= 4),
(workInProgress.memoizedProps = needsContext), (workInProgress.memoizedProps = Component),
(workInProgress.memoizedState = oldContext)), (workInProgress.memoizedState = oldContext)),
(unmaskedContext.props = needsContext), (unmaskedContext.props = Component),
(unmaskedContext.state = oldContext), (unmaskedContext.state = oldContext),
(unmaskedContext.context = ctor)) (unmaskedContext.context = ctor))
: ("function" === typeof unmaskedContext.componentDidMount && : ("function" === typeof unmaskedContext.componentDidMount &&
@ -3707,9 +3709,9 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
else else
(ctor$jscomp$0 = workInProgress.type), (ctor$jscomp$0 = workInProgress.type),
(unmaskedContext = workInProgress.stateNode), (unmaskedContext = workInProgress.stateNode),
(needsContext = workInProgress.memoizedProps), (Component = workInProgress.memoizedProps),
(props = workInProgress.pendingProps), (props = workInProgress.pendingProps),
(unmaskedContext.props = needsContext), (unmaskedContext.props = Component),
(oldContext = unmaskedContext.context), (oldContext = unmaskedContext.context),
(ctor = getUnmaskedContext(workInProgress)), (ctor = getUnmaskedContext(workInProgress)),
(ctor = getMaskedContext(workInProgress, ctor)), (ctor = getMaskedContext(workInProgress, ctor)),
@ -3721,7 +3723,7 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
typeof unmaskedContext.UNSAFE_componentWillReceiveProps && typeof unmaskedContext.UNSAFE_componentWillReceiveProps &&
"function" !== "function" !==
typeof unmaskedContext.componentWillReceiveProps) || typeof unmaskedContext.componentWillReceiveProps) ||
((needsContext !== props || oldContext !== ctor) && ((Component !== props || oldContext !== ctor) &&
callComponentWillReceiveProps( callComponentWillReceiveProps(
workInProgress, workInProgress,
unmaskedContext, unmaskedContext,
@ -3741,7 +3743,7 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
renderExpirationTime renderExpirationTime
), ),
(oldState = workInProgress.memoizedState)), (oldState = workInProgress.memoizedState)),
needsContext !== props || Component !== props ||
oldContext !== oldState || oldContext !== oldState ||
didPerformWorkStackCursor.current || didPerformWorkStackCursor.current ||
fn || fn ||
@ -3758,7 +3760,7 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
fn || fn ||
checkShouldComponentUpdate( checkShouldComponentUpdate(
workInProgress, workInProgress,
needsContext, Component,
props, props,
oldContext, oldContext,
oldState, oldState,
@ -3789,12 +3791,12 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
typeof unmaskedContext.getSnapshotBeforeUpdate && typeof unmaskedContext.getSnapshotBeforeUpdate &&
(workInProgress.effectTag |= 256)) (workInProgress.effectTag |= 256))
: ("function" !== typeof unmaskedContext.componentDidUpdate || : ("function" !== typeof unmaskedContext.componentDidUpdate ||
(needsContext === current$$1.memoizedProps && (Component === current$$1.memoizedProps &&
oldContext === current$$1.memoizedState) || oldContext === current$$1.memoizedState) ||
(workInProgress.effectTag |= 4), (workInProgress.effectTag |= 4),
"function" !== "function" !==
typeof unmaskedContext.getSnapshotBeforeUpdate || typeof unmaskedContext.getSnapshotBeforeUpdate ||
(needsContext === current$$1.memoizedProps && (Component === current$$1.memoizedProps &&
oldContext === current$$1.memoizedState) || oldContext === current$$1.memoizedState) ||
(workInProgress.effectTag |= 256), (workInProgress.effectTag |= 256),
(workInProgress.memoizedProps = props), (workInProgress.memoizedProps = props),
@ -3803,11 +3805,11 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
(unmaskedContext.state = oldState), (unmaskedContext.state = oldState),
(unmaskedContext.context = ctor)) (unmaskedContext.context = ctor))
: ("function" !== typeof unmaskedContext.componentDidUpdate || : ("function" !== typeof unmaskedContext.componentDidUpdate ||
(needsContext === current$$1.memoizedProps && (Component === current$$1.memoizedProps &&
oldContext === current$$1.memoizedState) || oldContext === current$$1.memoizedState) ||
(workInProgress.effectTag |= 4), (workInProgress.effectTag |= 4),
"function" !== typeof unmaskedContext.getSnapshotBeforeUpdate || "function" !== typeof unmaskedContext.getSnapshotBeforeUpdate ||
(needsContext === current$$1.memoizedProps && (Component === current$$1.memoizedProps &&
oldContext === current$$1.memoizedState) || oldContext === current$$1.memoizedState) ||
(workInProgress.effectTag |= 256), (workInProgress.effectTag |= 256),
(fn = !1)); (fn = !1));
@ -3959,9 +3961,9 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
updateExpirationTime = workInProgress.type._context; updateExpirationTime = workInProgress.type._context;
fn = workInProgress.pendingProps; fn = workInProgress.pendingProps;
unmaskedContext = workInProgress.memoizedProps; unmaskedContext = workInProgress.memoizedProps;
needsContext = fn.value; Component = fn.value;
workInProgress.memoizedProps = fn; workInProgress.memoizedProps = fn;
if (null === unmaskedContext) needsContext = 1073741823; if (null === unmaskedContext) Component = 1073741823;
else if (unmaskedContext.value === fn.value) { else if (unmaskedContext.value === fn.value) {
if ( if (
unmaskedContext.children === fn.children && unmaskedContext.children === fn.children &&
@ -3976,12 +3978,12 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
); );
break a; break a;
} }
needsContext = 0; Component = 0;
} else if ( } else if (
((props = unmaskedContext.value), ((props = unmaskedContext.value),
(props === needsContext && (props === Component &&
(0 !== props || 1 / props === 1 / needsContext)) || (0 !== props || 1 / props === 1 / Component)) ||
(props !== props && needsContext !== needsContext)) (props !== props && Component !== Component))
) { ) {
if ( if (
unmaskedContext.children === fn.children && unmaskedContext.children === fn.children &&
@ -3996,14 +3998,14 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
); );
break a; break a;
} }
needsContext = 0; Component = 0;
} else if ( } else if (
((needsContext = ((Component =
"function" === typeof updateExpirationTime._calculateChangedBits "function" === typeof updateExpirationTime._calculateChangedBits
? updateExpirationTime._calculateChangedBits(props, needsContext) ? updateExpirationTime._calculateChangedBits(props, Component)
: 1073741823), : 1073741823),
(needsContext |= 0), (Component |= 0),
0 === needsContext) 0 === Component)
) { ) {
if ( if (
unmaskedContext.children === fn.children && unmaskedContext.children === fn.children &&
@ -4022,10 +4024,10 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
propagateContextChange( propagateContextChange(
workInProgress, workInProgress,
updateExpirationTime, updateExpirationTime,
needsContext, Component,
renderExpirationTime renderExpirationTime
); );
workInProgress.stateNode = needsContext; workInProgress.stateNode = Component;
pushProvider(workInProgress); pushProvider(workInProgress);
reconcileChildren( reconcileChildren(
current$$1, current$$1,

View File

@ -3587,34 +3587,37 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
prepareToReadContext(workInProgress, renderExpirationTime); prepareToReadContext(workInProgress, renderExpirationTime);
fn = fn(updateExpirationTime, unmaskedContext); fn = fn(updateExpirationTime, unmaskedContext);
workInProgress.effectTag |= 1; workInProgress.effectTag |= 1;
if (
"object" === typeof fn && "object" === typeof fn &&
null !== fn && null !== fn &&
"function" === typeof fn.render && "function" === typeof fn.render &&
void 0 === fn.$$typeof void 0 === fn.$$typeof
? ((unmaskedContext = workInProgress.type), ) {
(workInProgress.tag = 2), var Component = workInProgress.type;
(workInProgress.memoizedState = workInProgress.tag = 2;
null !== fn.state && void 0 !== fn.state ? fn.state : null), unmaskedContext = pushContextProvider(workInProgress);
(unmaskedContext = unmaskedContext.getDerivedStateFromProps), workInProgress.memoizedState =
"function" === typeof unmaskedContext && null !== fn.state && void 0 !== fn.state ? fn.state : null;
Component = Component.getDerivedStateFromProps;
"function" === typeof Component &&
applyDerivedStateFromProps( applyDerivedStateFromProps(
workInProgress, workInProgress,
unmaskedContext, Component,
updateExpirationTime updateExpirationTime
), );
(updateExpirationTime = pushContextProvider(workInProgress)), fn.updater = classComponentUpdater;
(fn.updater = classComponentUpdater), workInProgress.stateNode = fn;
(workInProgress.stateNode = fn), fn._reactInternalFiber = workInProgress;
(fn._reactInternalFiber = workInProgress), mountClassInstance(workInProgress, renderExpirationTime);
mountClassInstance(workInProgress, renderExpirationTime), current$$1 = finishClassComponent(
(current$$1 = finishClassComponent(
current$$1, current$$1,
workInProgress, workInProgress,
!0, !0,
updateExpirationTime, unmaskedContext,
renderExpirationTime renderExpirationTime
))) );
: ((workInProgress.tag = 1), } else
(workInProgress.tag = 1),
reconcileChildren( reconcileChildren(
current$$1, current$$1,
workInProgress, workInProgress,
@ -3622,7 +3625,7 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
renderExpirationTime renderExpirationTime
), ),
(workInProgress.memoizedProps = updateExpirationTime), (workInProgress.memoizedProps = updateExpirationTime),
(current$$1 = workInProgress.child)); (current$$1 = workInProgress.child);
return current$$1; return current$$1;
case 1: case 1:
return ( return (
@ -3645,10 +3648,9 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
var props = workInProgress.pendingProps, var props = workInProgress.pendingProps,
ctor = workInProgress.type; ctor = workInProgress.type;
fn = getUnmaskedContext(workInProgress); fn = getUnmaskedContext(workInProgress);
var needsContext = unmaskedContext = (Component =
2 === workInProgress.tag && 2 === workInProgress.tag &&
null != workInProgress.type.contextTypes; null != workInProgress.type.contextTypes)
unmaskedContext = needsContext
? getMaskedContext(workInProgress, fn) ? getMaskedContext(workInProgress, fn)
: emptyContextObject; : emptyContextObject;
props = new ctor(props, unmaskedContext); props = new ctor(props, unmaskedContext);
@ -3657,17 +3659,17 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
props.updater = classComponentUpdater; props.updater = classComponentUpdater;
workInProgress.stateNode = props; workInProgress.stateNode = props;
props._reactInternalFiber = workInProgress; props._reactInternalFiber = workInProgress;
needsContext && Component &&
((needsContext = workInProgress.stateNode), ((Component = workInProgress.stateNode),
(needsContext.__reactInternalMemoizedUnmaskedChildContext = fn), (Component.__reactInternalMemoizedUnmaskedChildContext = fn),
(needsContext.__reactInternalMemoizedMaskedChildContext = unmaskedContext)); (Component.__reactInternalMemoizedMaskedChildContext = unmaskedContext));
mountClassInstance(workInProgress, renderExpirationTime); mountClassInstance(workInProgress, renderExpirationTime);
fn = !0; fn = !0;
} else { } else {
var ctor$jscomp$0 = workInProgress.type; var ctor$jscomp$0 = workInProgress.type;
unmaskedContext = workInProgress.stateNode; unmaskedContext = workInProgress.stateNode;
props = workInProgress.memoizedProps; props = workInProgress.memoizedProps;
needsContext = workInProgress.pendingProps; Component = workInProgress.pendingProps;
unmaskedContext.props = props; unmaskedContext.props = props;
var oldContext = unmaskedContext.context; var oldContext = unmaskedContext.context;
ctor = getUnmaskedContext(workInProgress); ctor = getUnmaskedContext(workInProgress);
@ -3680,11 +3682,11 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
typeof unmaskedContext.UNSAFE_componentWillReceiveProps && typeof unmaskedContext.UNSAFE_componentWillReceiveProps &&
"function" !== "function" !==
typeof unmaskedContext.componentWillReceiveProps) || typeof unmaskedContext.componentWillReceiveProps) ||
((props !== needsContext || oldContext !== ctor) && ((props !== Component || oldContext !== ctor) &&
callComponentWillReceiveProps( callComponentWillReceiveProps(
workInProgress, workInProgress,
unmaskedContext, unmaskedContext,
needsContext, Component,
ctor ctor
)); ));
hasForceUpdate = !1; hasForceUpdate = !1;
@ -3695,12 +3697,12 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
(processUpdateQueue( (processUpdateQueue(
workInProgress, workInProgress,
updateQueue, updateQueue,
needsContext, Component,
unmaskedContext, unmaskedContext,
renderExpirationTime renderExpirationTime
), ),
(oldContext = workInProgress.memoizedState)); (oldContext = workInProgress.memoizedState));
props !== needsContext || props !== Component ||
oldState !== oldContext || oldState !== oldContext ||
didPerformWorkStackCursor.current || didPerformWorkStackCursor.current ||
fn || fn ||
@ -3709,7 +3711,7 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
(applyDerivedStateFromProps( (applyDerivedStateFromProps(
workInProgress, workInProgress,
getDerivedStateFromProps, getDerivedStateFromProps,
needsContext Component
), ),
(oldContext = workInProgress.memoizedState)), (oldContext = workInProgress.memoizedState)),
(fn = (fn =
@ -3718,7 +3720,7 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
checkShouldComponentUpdate( checkShouldComponentUpdate(
workInProgress, workInProgress,
props, props,
needsContext, Component,
oldState, oldState,
oldContext, oldContext,
ctor ctor
@ -3737,9 +3739,9 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
(workInProgress.effectTag |= 4)) (workInProgress.effectTag |= 4))
: ("function" === typeof unmaskedContext.componentDidMount && : ("function" === typeof unmaskedContext.componentDidMount &&
(workInProgress.effectTag |= 4), (workInProgress.effectTag |= 4),
(workInProgress.memoizedProps = needsContext), (workInProgress.memoizedProps = Component),
(workInProgress.memoizedState = oldContext)), (workInProgress.memoizedState = oldContext)),
(unmaskedContext.props = needsContext), (unmaskedContext.props = Component),
(unmaskedContext.state = oldContext), (unmaskedContext.state = oldContext),
(unmaskedContext.context = ctor)) (unmaskedContext.context = ctor))
: ("function" === typeof unmaskedContext.componentDidMount && : ("function" === typeof unmaskedContext.componentDidMount &&
@ -3749,9 +3751,9 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
else else
(ctor$jscomp$0 = workInProgress.type), (ctor$jscomp$0 = workInProgress.type),
(unmaskedContext = workInProgress.stateNode), (unmaskedContext = workInProgress.stateNode),
(needsContext = workInProgress.memoizedProps), (Component = workInProgress.memoizedProps),
(props = workInProgress.pendingProps), (props = workInProgress.pendingProps),
(unmaskedContext.props = needsContext), (unmaskedContext.props = Component),
(oldContext = unmaskedContext.context), (oldContext = unmaskedContext.context),
(ctor = getUnmaskedContext(workInProgress)), (ctor = getUnmaskedContext(workInProgress)),
(ctor = getMaskedContext(workInProgress, ctor)), (ctor = getMaskedContext(workInProgress, ctor)),
@ -3763,7 +3765,7 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
typeof unmaskedContext.UNSAFE_componentWillReceiveProps && typeof unmaskedContext.UNSAFE_componentWillReceiveProps &&
"function" !== "function" !==
typeof unmaskedContext.componentWillReceiveProps) || typeof unmaskedContext.componentWillReceiveProps) ||
((needsContext !== props || oldContext !== ctor) && ((Component !== props || oldContext !== ctor) &&
callComponentWillReceiveProps( callComponentWillReceiveProps(
workInProgress, workInProgress,
unmaskedContext, unmaskedContext,
@ -3783,7 +3785,7 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
renderExpirationTime renderExpirationTime
), ),
(oldState = workInProgress.memoizedState)), (oldState = workInProgress.memoizedState)),
needsContext !== props || Component !== props ||
oldContext !== oldState || oldContext !== oldState ||
didPerformWorkStackCursor.current || didPerformWorkStackCursor.current ||
fn || fn ||
@ -3800,7 +3802,7 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
fn || fn ||
checkShouldComponentUpdate( checkShouldComponentUpdate(
workInProgress, workInProgress,
needsContext, Component,
props, props,
oldContext, oldContext,
oldState, oldState,
@ -3831,12 +3833,12 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
typeof unmaskedContext.getSnapshotBeforeUpdate && typeof unmaskedContext.getSnapshotBeforeUpdate &&
(workInProgress.effectTag |= 256)) (workInProgress.effectTag |= 256))
: ("function" !== typeof unmaskedContext.componentDidUpdate || : ("function" !== typeof unmaskedContext.componentDidUpdate ||
(needsContext === current$$1.memoizedProps && (Component === current$$1.memoizedProps &&
oldContext === current$$1.memoizedState) || oldContext === current$$1.memoizedState) ||
(workInProgress.effectTag |= 4), (workInProgress.effectTag |= 4),
"function" !== "function" !==
typeof unmaskedContext.getSnapshotBeforeUpdate || typeof unmaskedContext.getSnapshotBeforeUpdate ||
(needsContext === current$$1.memoizedProps && (Component === current$$1.memoizedProps &&
oldContext === current$$1.memoizedState) || oldContext === current$$1.memoizedState) ||
(workInProgress.effectTag |= 256), (workInProgress.effectTag |= 256),
(workInProgress.memoizedProps = props), (workInProgress.memoizedProps = props),
@ -3845,11 +3847,11 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
(unmaskedContext.state = oldState), (unmaskedContext.state = oldState),
(unmaskedContext.context = ctor)) (unmaskedContext.context = ctor))
: ("function" !== typeof unmaskedContext.componentDidUpdate || : ("function" !== typeof unmaskedContext.componentDidUpdate ||
(needsContext === current$$1.memoizedProps && (Component === current$$1.memoizedProps &&
oldContext === current$$1.memoizedState) || oldContext === current$$1.memoizedState) ||
(workInProgress.effectTag |= 4), (workInProgress.effectTag |= 4),
"function" !== typeof unmaskedContext.getSnapshotBeforeUpdate || "function" !== typeof unmaskedContext.getSnapshotBeforeUpdate ||
(needsContext === current$$1.memoizedProps && (Component === current$$1.memoizedProps &&
oldContext === current$$1.memoizedState) || oldContext === current$$1.memoizedState) ||
(workInProgress.effectTag |= 256), (workInProgress.effectTag |= 256),
(fn = !1)); (fn = !1));
@ -4002,9 +4004,9 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
updateExpirationTime = workInProgress.type._context; updateExpirationTime = workInProgress.type._context;
fn = workInProgress.pendingProps; fn = workInProgress.pendingProps;
unmaskedContext = workInProgress.memoizedProps; unmaskedContext = workInProgress.memoizedProps;
needsContext = fn.value; Component = fn.value;
workInProgress.memoizedProps = fn; workInProgress.memoizedProps = fn;
if (null === unmaskedContext) needsContext = 1073741823; if (null === unmaskedContext) Component = 1073741823;
else if (unmaskedContext.value === fn.value) { else if (unmaskedContext.value === fn.value) {
if ( if (
unmaskedContext.children === fn.children && unmaskedContext.children === fn.children &&
@ -4019,12 +4021,12 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
); );
break a; break a;
} }
needsContext = 0; Component = 0;
} else if ( } else if (
((props = unmaskedContext.value), ((props = unmaskedContext.value),
(props === needsContext && (props === Component &&
(0 !== props || 1 / props === 1 / needsContext)) || (0 !== props || 1 / props === 1 / Component)) ||
(props !== props && needsContext !== needsContext)) (props !== props && Component !== Component))
) { ) {
if ( if (
unmaskedContext.children === fn.children && unmaskedContext.children === fn.children &&
@ -4039,14 +4041,14 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
); );
break a; break a;
} }
needsContext = 0; Component = 0;
} else if ( } else if (
((needsContext = ((Component =
"function" === typeof updateExpirationTime._calculateChangedBits "function" === typeof updateExpirationTime._calculateChangedBits
? updateExpirationTime._calculateChangedBits(props, needsContext) ? updateExpirationTime._calculateChangedBits(props, Component)
: 1073741823), : 1073741823),
(needsContext |= 0), (Component |= 0),
0 === needsContext) 0 === Component)
) { ) {
if ( if (
unmaskedContext.children === fn.children && unmaskedContext.children === fn.children &&
@ -4065,10 +4067,10 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
propagateContextChange( propagateContextChange(
workInProgress, workInProgress,
updateExpirationTime, updateExpirationTime,
needsContext, Component,
renderExpirationTime renderExpirationTime
); );
workInProgress.stateNode = needsContext; workInProgress.stateNode = Component;
pushProvider(workInProgress); pushProvider(workInProgress);
reconcileChildren( reconcileChildren(
current$$1, current$$1,