Skip to content

Commit b7bb25f

Browse files
acdlitefacebook-github-bot
authored andcommitted
React sync for revisions ca0941f...bc1ea9c
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
1 parent 12e15e4 commit b7bb25f

7 files changed

+283
-273
lines changed

Libraries/Renderer/REVISION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
ca0941fce3a03592530f6111f77cbc9c0daf79af
1+
bc1ea9cd96c81467c574b134349eafc303835d0e

Libraries/Renderer/oss/ReactFabric-dev.js

+5-4
Original file line numberDiff line numberDiff line change
@@ -10379,6 +10379,11 @@ function mountIndeterminateComponent(
1037910379
// Proceed under the assumption that this is a class instance
1038010380
workInProgress.tag = ClassComponent;
1038110381

10382+
// Push context providers early to prevent context stack mismatches.
10383+
// During mounting we don't know the child context yet as the instance doesn't exist.
10384+
// We will invalidate the child context in finishClassComponent() right after rendering.
10385+
var hasContext = pushContextProvider(workInProgress);
10386+
1038210387
workInProgress.memoizedState =
1038310388
value.state !== null && value.state !== undefined ? value.state : null;
1038410389

@@ -10391,10 +10396,6 @@ function mountIndeterminateComponent(
1039110396
);
1039210397
}
1039310398

10394-
// Push context providers early to prevent context stack mismatches.
10395-
// During mounting we don't know the child context yet as the instance doesn't exist.
10396-
// We will invalidate the child context in finishClassComponent() right after rendering.
10397-
var hasContext = pushContextProvider(workInProgress);
1039810399
adoptClassInstance(workInProgress, value);
1039910400
mountClassInstance(workInProgress, renderExpirationTime);
1040010401
return finishClassComponent(

Libraries/Renderer/oss/ReactFabric-prod.js

+68-66
Original file line numberDiff line numberDiff line change
@@ -3490,42 +3490,45 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
34903490
prepareToReadContext(workInProgress, renderExpirationTime);
34913491
fn = fn(updateExpirationTime, unmaskedContext);
34923492
workInProgress.effectTag |= 1;
3493-
"object" === typeof fn &&
3494-
null !== fn &&
3495-
"function" === typeof fn.render &&
3496-
void 0 === fn.$$typeof
3497-
? ((unmaskedContext = workInProgress.type),
3498-
(workInProgress.tag = 2),
3499-
(workInProgress.memoizedState =
3500-
null !== fn.state && void 0 !== fn.state ? fn.state : null),
3501-
(unmaskedContext = unmaskedContext.getDerivedStateFromProps),
3502-
"function" === typeof unmaskedContext &&
3503-
applyDerivedStateFromProps(
3504-
workInProgress,
3505-
unmaskedContext,
3506-
updateExpirationTime
3507-
),
3508-
(updateExpirationTime = pushContextProvider(workInProgress)),
3509-
(fn.updater = classComponentUpdater),
3510-
(workInProgress.stateNode = fn),
3511-
(fn._reactInternalFiber = workInProgress),
3512-
mountClassInstance(workInProgress, renderExpirationTime),
3513-
(current$$1 = finishClassComponent(
3514-
current$$1,
3493+
if (
3494+
"object" === typeof fn &&
3495+
null !== fn &&
3496+
"function" === typeof fn.render &&
3497+
void 0 === fn.$$typeof
3498+
) {
3499+
var Component = workInProgress.type;
3500+
workInProgress.tag = 2;
3501+
unmaskedContext = pushContextProvider(workInProgress);
3502+
workInProgress.memoizedState =
3503+
null !== fn.state && void 0 !== fn.state ? fn.state : null;
3504+
Component = Component.getDerivedStateFromProps;
3505+
"function" === typeof Component &&
3506+
applyDerivedStateFromProps(
35153507
workInProgress,
3516-
!0,
3517-
updateExpirationTime,
3518-
renderExpirationTime
3519-
)))
3520-
: ((workInProgress.tag = 1),
3508+
Component,
3509+
updateExpirationTime
3510+
);
3511+
fn.updater = classComponentUpdater;
3512+
workInProgress.stateNode = fn;
3513+
fn._reactInternalFiber = workInProgress;
3514+
mountClassInstance(workInProgress, renderExpirationTime);
3515+
current$$1 = finishClassComponent(
3516+
current$$1,
3517+
workInProgress,
3518+
!0,
3519+
unmaskedContext,
3520+
renderExpirationTime
3521+
);
3522+
} else
3523+
(workInProgress.tag = 1),
35213524
reconcileChildren(
35223525
current$$1,
35233526
workInProgress,
35243527
fn,
35253528
renderExpirationTime
35263529
),
35273530
(workInProgress.memoizedProps = updateExpirationTime),
3528-
(current$$1 = workInProgress.child));
3531+
(current$$1 = workInProgress.child);
35293532
return current$$1;
35303533
case 1:
35313534
return (
@@ -3548,10 +3551,9 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
35483551
var props = workInProgress.pendingProps,
35493552
ctor = workInProgress.type;
35503553
fn = getUnmaskedContext(workInProgress);
3551-
var needsContext =
3554+
unmaskedContext = (Component =
35523555
2 === workInProgress.tag &&
3553-
null != workInProgress.type.contextTypes;
3554-
unmaskedContext = needsContext
3556+
null != workInProgress.type.contextTypes)
35553557
? getMaskedContext(workInProgress, fn)
35563558
: emptyContextObject;
35573559
props = new ctor(props, unmaskedContext);
@@ -3560,17 +3562,17 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
35603562
props.updater = classComponentUpdater;
35613563
workInProgress.stateNode = props;
35623564
props._reactInternalFiber = workInProgress;
3563-
needsContext &&
3564-
((needsContext = workInProgress.stateNode),
3565-
(needsContext.__reactInternalMemoizedUnmaskedChildContext = fn),
3566-
(needsContext.__reactInternalMemoizedMaskedChildContext = unmaskedContext));
3565+
Component &&
3566+
((Component = workInProgress.stateNode),
3567+
(Component.__reactInternalMemoizedUnmaskedChildContext = fn),
3568+
(Component.__reactInternalMemoizedMaskedChildContext = unmaskedContext));
35673569
mountClassInstance(workInProgress, renderExpirationTime);
35683570
fn = !0;
35693571
} else {
35703572
var ctor$jscomp$0 = workInProgress.type;
35713573
unmaskedContext = workInProgress.stateNode;
35723574
props = workInProgress.memoizedProps;
3573-
needsContext = workInProgress.pendingProps;
3575+
Component = workInProgress.pendingProps;
35743576
unmaskedContext.props = props;
35753577
var oldContext = unmaskedContext.context;
35763578
ctor = getUnmaskedContext(workInProgress);
@@ -3583,11 +3585,11 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
35833585
typeof unmaskedContext.UNSAFE_componentWillReceiveProps &&
35843586
"function" !==
35853587
typeof unmaskedContext.componentWillReceiveProps) ||
3586-
((props !== needsContext || oldContext !== ctor) &&
3588+
((props !== Component || oldContext !== ctor) &&
35873589
callComponentWillReceiveProps(
35883590
workInProgress,
35893591
unmaskedContext,
3590-
needsContext,
3592+
Component,
35913593
ctor
35923594
));
35933595
hasForceUpdate = !1;
@@ -3598,12 +3600,12 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
35983600
(processUpdateQueue(
35993601
workInProgress,
36003602
updateQueue,
3601-
needsContext,
3603+
Component,
36023604
unmaskedContext,
36033605
renderExpirationTime
36043606
),
36053607
(oldContext = workInProgress.memoizedState));
3606-
props !== needsContext ||
3608+
props !== Component ||
36073609
oldState !== oldContext ||
36083610
didPerformWorkStackCursor.current ||
36093611
fn ||
@@ -3612,7 +3614,7 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
36123614
(applyDerivedStateFromProps(
36133615
workInProgress,
36143616
getDerivedStateFromProps,
3615-
needsContext
3617+
Component
36163618
),
36173619
(oldContext = workInProgress.memoizedState)),
36183620
(fn =
@@ -3621,7 +3623,7 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
36213623
checkShouldComponentUpdate(
36223624
workInProgress,
36233625
props,
3624-
needsContext,
3626+
Component,
36253627
oldState,
36263628
oldContext,
36273629
ctor
@@ -3640,9 +3642,9 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
36403642
(workInProgress.effectTag |= 4))
36413643
: ("function" === typeof unmaskedContext.componentDidMount &&
36423644
(workInProgress.effectTag |= 4),
3643-
(workInProgress.memoizedProps = needsContext),
3645+
(workInProgress.memoizedProps = Component),
36443646
(workInProgress.memoizedState = oldContext)),
3645-
(unmaskedContext.props = needsContext),
3647+
(unmaskedContext.props = Component),
36463648
(unmaskedContext.state = oldContext),
36473649
(unmaskedContext.context = ctor))
36483650
: ("function" === typeof unmaskedContext.componentDidMount &&
@@ -3652,9 +3654,9 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
36523654
else
36533655
(ctor$jscomp$0 = workInProgress.type),
36543656
(unmaskedContext = workInProgress.stateNode),
3655-
(needsContext = workInProgress.memoizedProps),
3657+
(Component = workInProgress.memoizedProps),
36563658
(props = workInProgress.pendingProps),
3657-
(unmaskedContext.props = needsContext),
3659+
(unmaskedContext.props = Component),
36583660
(oldContext = unmaskedContext.context),
36593661
(ctor = getUnmaskedContext(workInProgress)),
36603662
(ctor = getMaskedContext(workInProgress, ctor)),
@@ -3666,7 +3668,7 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
36663668
typeof unmaskedContext.UNSAFE_componentWillReceiveProps &&
36673669
"function" !==
36683670
typeof unmaskedContext.componentWillReceiveProps) ||
3669-
((needsContext !== props || oldContext !== ctor) &&
3671+
((Component !== props || oldContext !== ctor) &&
36703672
callComponentWillReceiveProps(
36713673
workInProgress,
36723674
unmaskedContext,
@@ -3686,7 +3688,7 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
36863688
renderExpirationTime
36873689
),
36883690
(oldState = workInProgress.memoizedState)),
3689-
needsContext !== props ||
3691+
Component !== props ||
36903692
oldContext !== oldState ||
36913693
didPerformWorkStackCursor.current ||
36923694
fn ||
@@ -3703,7 +3705,7 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
37033705
fn ||
37043706
checkShouldComponentUpdate(
37053707
workInProgress,
3706-
needsContext,
3708+
Component,
37073709
props,
37083710
oldContext,
37093711
oldState,
@@ -3734,12 +3736,12 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
37343736
typeof unmaskedContext.getSnapshotBeforeUpdate &&
37353737
(workInProgress.effectTag |= 256))
37363738
: ("function" !== typeof unmaskedContext.componentDidUpdate ||
3737-
(needsContext === current$$1.memoizedProps &&
3739+
(Component === current$$1.memoizedProps &&
37383740
oldContext === current$$1.memoizedState) ||
37393741
(workInProgress.effectTag |= 4),
37403742
"function" !==
37413743
typeof unmaskedContext.getSnapshotBeforeUpdate ||
3742-
(needsContext === current$$1.memoizedProps &&
3744+
(Component === current$$1.memoizedProps &&
37433745
oldContext === current$$1.memoizedState) ||
37443746
(workInProgress.effectTag |= 256),
37453747
(workInProgress.memoizedProps = props),
@@ -3748,11 +3750,11 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
37483750
(unmaskedContext.state = oldState),
37493751
(unmaskedContext.context = ctor))
37503752
: ("function" !== typeof unmaskedContext.componentDidUpdate ||
3751-
(needsContext === current$$1.memoizedProps &&
3753+
(Component === current$$1.memoizedProps &&
37523754
oldContext === current$$1.memoizedState) ||
37533755
(workInProgress.effectTag |= 4),
37543756
"function" !== typeof unmaskedContext.getSnapshotBeforeUpdate ||
3755-
(needsContext === current$$1.memoizedProps &&
3757+
(Component === current$$1.memoizedProps &&
37563758
oldContext === current$$1.memoizedState) ||
37573759
(workInProgress.effectTag |= 256),
37583760
(fn = !1));
@@ -3904,9 +3906,9 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
39043906
updateExpirationTime = workInProgress.type._context;
39053907
fn = workInProgress.pendingProps;
39063908
unmaskedContext = workInProgress.memoizedProps;
3907-
needsContext = fn.value;
3909+
Component = fn.value;
39083910
workInProgress.memoizedProps = fn;
3909-
if (null === unmaskedContext) needsContext = 1073741823;
3911+
if (null === unmaskedContext) Component = 1073741823;
39103912
else if (unmaskedContext.value === fn.value) {
39113913
if (
39123914
unmaskedContext.children === fn.children &&
@@ -3921,12 +3923,12 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
39213923
);
39223924
break a;
39233925
}
3924-
needsContext = 0;
3926+
Component = 0;
39253927
} else if (
39263928
((props = unmaskedContext.value),
3927-
(props === needsContext &&
3928-
(0 !== props || 1 / props === 1 / needsContext)) ||
3929-
(props !== props && needsContext !== needsContext))
3929+
(props === Component &&
3930+
(0 !== props || 1 / props === 1 / Component)) ||
3931+
(props !== props && Component !== Component))
39303932
) {
39313933
if (
39323934
unmaskedContext.children === fn.children &&
@@ -3941,14 +3943,14 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
39413943
);
39423944
break a;
39433945
}
3944-
needsContext = 0;
3946+
Component = 0;
39453947
} else if (
3946-
((needsContext =
3948+
((Component =
39473949
"function" === typeof updateExpirationTime._calculateChangedBits
3948-
? updateExpirationTime._calculateChangedBits(props, needsContext)
3950+
? updateExpirationTime._calculateChangedBits(props, Component)
39493951
: 1073741823),
3950-
(needsContext |= 0),
3951-
0 === needsContext)
3952+
(Component |= 0),
3953+
0 === Component)
39523954
) {
39533955
if (
39543956
unmaskedContext.children === fn.children &&
@@ -3967,10 +3969,10 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
39673969
propagateContextChange(
39683970
workInProgress,
39693971
updateExpirationTime,
3970-
needsContext,
3972+
Component,
39713973
renderExpirationTime
39723974
);
3973-
workInProgress.stateNode = needsContext;
3975+
workInProgress.stateNode = Component;
39743976
pushProvider(workInProgress);
39753977
reconcileChildren(
39763978
current$$1,

0 commit comments

Comments
 (0)