Skip to content

Commit

Permalink
React sync for revisions ca0941f...bc1ea9c
Browse files Browse the repository at this point in the history
Summary:
@public
This sync includes the following changes:
- **[bc1ea9cd9](facebook/react@bc1ea9cd9)**: Handle errors thrown in gDSFP of a module-style context provider (#13269) //<Andrew Clark>//
- **[0154a79fe](facebook/react@0154a79fe)**: Remove 'warning' module from the JS scheduler (#13264) //<Flarnie Marchan>//
- **[dbd16c8a9](facebook/react@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
  • Loading branch information
acdlite authored and facebook-github-bot committed Jul 25, 2018
1 parent 12e15e4 commit b7bb25f
Show file tree
Hide file tree
Showing 7 changed files with 283 additions and 273 deletions.
2 changes: 1 addition & 1 deletion Libraries/Renderer/REVISION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ca0941fce3a03592530f6111f77cbc9c0daf79af
bc1ea9cd96c81467c574b134349eafc303835d0e
9 changes: 5 additions & 4 deletions Libraries/Renderer/oss/ReactFabric-dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -10379,6 +10379,11 @@ function mountIndeterminateComponent(
// Proceed under the assumption that this is a class instance
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 =
value.state !== null && value.state !== undefined ? value.state : null;

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

0 comments on commit b7bb25f

Please sign in to comment.