react-dom 16.3.0-alpha.3 → 16.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/react-dom-server.browser.development.js +9 -14
- package/cjs/react-dom-server.browser.production.min.js +26 -26
- package/cjs/react-dom-server.node.development.js +10 -15
- package/cjs/react-dom-server.node.production.min.js +27 -27
- package/cjs/react-dom-test-utils.development.js +7 -10
- package/cjs/react-dom-test-utils.production.min.js +25 -25
- package/cjs/react-dom-unstable-native-dependencies.development.js +10 -14
- package/cjs/react-dom-unstable-native-dependencies.production.min.js +27 -27
- package/cjs/react-dom.development.js +471 -182
- package/cjs/react-dom.production.min.js +217 -214
- package/package.json +2 -2
- package/umd/react-dom-server.browser.development.js +13 -18
- package/umd/react-dom-server.browser.production.min.js +25 -24
- package/umd/react-dom-test-utils.development.js +7 -10
- package/umd/react-dom-test-utils.production.min.js +22 -22
- package/umd/react-dom-unstable-native-dependencies.development.js +11 -15
- package/umd/react-dom-unstable-native-dependencies.production.min.js +23 -23
- package/umd/react-dom.development.js +471 -182
- package/umd/react-dom.production.min.js +197 -194
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license React v16.3.
|
|
1
|
+
/** @license React v16.3.2
|
|
2
2
|
* react-dom.development.js
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) 2013-present, Facebook, Inc.
|
|
@@ -15,13 +15,6 @@
|
|
|
15
15
|
(global.ReactDOM = factory(global.React));
|
|
16
16
|
}(this, (function (React) { 'use strict';
|
|
17
17
|
|
|
18
|
-
/**
|
|
19
|
-
* WARNING: DO NOT manually require this module.
|
|
20
|
-
* This is a replacement for `invariant(...)` used by the error code system
|
|
21
|
-
* and will _only_ be required by the corresponding babel pass.
|
|
22
|
-
* It always throws.
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
18
|
/**
|
|
26
19
|
* Copyright (c) 2013-present, Facebook, Inc.
|
|
27
20
|
*
|
|
@@ -76,6 +69,9 @@ function invariant(condition, format, a, b, c, d, e, f) {
|
|
|
76
69
|
|
|
77
70
|
var invariant_1 = invariant;
|
|
78
71
|
|
|
72
|
+
// Relying on the `invariant()` implementation lets us
|
|
73
|
+
// have preserve the format and params in the www builds.
|
|
74
|
+
|
|
79
75
|
!React ? invariant_1(false, 'ReactDOM was loaded before React. Make sure you load the React package before loading ReactDOM.') : void 0;
|
|
80
76
|
|
|
81
77
|
var invokeGuardedCallback = function (name, func, context, a, b, c, d, e, f) {
|
|
@@ -569,7 +565,7 @@ var injection$1 = {
|
|
|
569
565
|
getNodeFromInstance = Injected.getNodeFromInstance;
|
|
570
566
|
|
|
571
567
|
{
|
|
572
|
-
|
|
568
|
+
!(getNodeFromInstance && getInstanceFromNode) ? warning_1(false, 'EventPluginUtils.injection.injectComponentTree(...): Injected ' + 'module is missing getNodeFromInstance or getInstanceFromNode.') : void 0;
|
|
573
569
|
}
|
|
574
570
|
}
|
|
575
571
|
};
|
|
@@ -591,7 +587,7 @@ var validateEventDispatches = void 0;
|
|
|
591
587
|
var instancesIsArr = Array.isArray(dispatchInstances);
|
|
592
588
|
var instancesLen = instancesIsArr ? dispatchInstances.length : dispatchInstances ? 1 : 0;
|
|
593
589
|
|
|
594
|
-
|
|
590
|
+
!(instancesIsArr === listenersIsArr && instancesLen === listenersLen) ? warning_1(false, 'EventPluginUtils: Invalid `event`.') : void 0;
|
|
595
591
|
};
|
|
596
592
|
}
|
|
597
593
|
|
|
@@ -1144,7 +1140,7 @@ function listenerAtPhase(inst, event, propagationPhase) {
|
|
|
1144
1140
|
*/
|
|
1145
1141
|
function accumulateDirectionalDispatches(inst, phase, event) {
|
|
1146
1142
|
{
|
|
1147
|
-
warning_1(
|
|
1143
|
+
!inst ? warning_1(false, 'Dispatching inst must not be null') : void 0;
|
|
1148
1144
|
}
|
|
1149
1145
|
var listener = listenerAtPhase(inst, event, phase);
|
|
1150
1146
|
if (listener) {
|
|
@@ -1552,7 +1548,7 @@ SyntheticEvent.extend = function (Interface) {
|
|
|
1552
1548
|
return new Proxy(constructor.apply(that, args), {
|
|
1553
1549
|
set: function (target, prop, value) {
|
|
1554
1550
|
if (prop !== 'isPersistent' && !target.constructor.Interface.hasOwnProperty(prop) && shouldBeReleasedProperties.indexOf(prop) === -1) {
|
|
1555
|
-
|
|
1551
|
+
!(didWarnForAddedNewProperty || target.isPersistent()) ? warning_1(false, "This synthetic event is reused for performance reasons. If you're " + "seeing this, you're adding a new property in the synthetic event object. " + 'The property is never released. See ' + 'https://fb.me/react-event-pooling for more information.') : void 0;
|
|
1556
1552
|
didWarnForAddedNewProperty = true;
|
|
1557
1553
|
}
|
|
1558
1554
|
target[prop] = value;
|
|
@@ -1597,7 +1593,7 @@ function getPooledWarningPropertyDefinition(propName, getVal) {
|
|
|
1597
1593
|
|
|
1598
1594
|
function warn(action, result) {
|
|
1599
1595
|
var warningCondition = false;
|
|
1600
|
-
warning_1(
|
|
1596
|
+
!warningCondition ? warning_1(false, "This synthetic event is reused for performance reasons. If you're seeing this, " + "you're %s `%s` on a released/nullified synthetic event. %s. " + 'If you must keep the original synthetic event around, use event.persist(). ' + 'See https://fb.me/react-event-pooling for more information.', action, propName, result) : void 0;
|
|
1601
1597
|
}
|
|
1602
1598
|
}
|
|
1603
1599
|
|
|
@@ -2407,6 +2403,13 @@ function getComponentName(fiber) {
|
|
|
2407
2403
|
case REACT_RETURN_TYPE:
|
|
2408
2404
|
return 'ReactReturn';
|
|
2409
2405
|
}
|
|
2406
|
+
if (typeof type === 'object' && type !== null) {
|
|
2407
|
+
switch (type.$$typeof) {
|
|
2408
|
+
case REACT_FORWARD_REF_TYPE:
|
|
2409
|
+
var functionName = type.render.displayName || type.render.name || '';
|
|
2410
|
+
return functionName !== '' ? 'ForwardRef(' + functionName + ')' : 'ForwardRef';
|
|
2411
|
+
}
|
|
2412
|
+
}
|
|
2410
2413
|
return null;
|
|
2411
2414
|
}
|
|
2412
2415
|
|
|
@@ -3788,9 +3791,10 @@ var Callback = /* */32;
|
|
|
3788
3791
|
var DidCapture = /* */64;
|
|
3789
3792
|
var Ref = /* */128;
|
|
3790
3793
|
var ErrLog = /* */256;
|
|
3794
|
+
var Snapshot = /* */2048;
|
|
3791
3795
|
|
|
3792
3796
|
// Union of all host effects
|
|
3793
|
-
var HostEffectMask = /* */
|
|
3797
|
+
var HostEffectMask = /* */2559;
|
|
3794
3798
|
|
|
3795
3799
|
var Incomplete = /* */512;
|
|
3796
3800
|
var ShouldCapture = /* */1024;
|
|
@@ -3838,7 +3842,7 @@ function isMounted(component) {
|
|
|
3838
3842
|
if (owner !== null && owner.tag === ClassComponent) {
|
|
3839
3843
|
var ownerFiber = owner;
|
|
3840
3844
|
var instance = ownerFiber.stateNode;
|
|
3841
|
-
|
|
3845
|
+
!instance._warnedAboutRefsInRender ? warning_1(false, '%s is accessing isMounted inside its render() function. ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', getComponentName(ownerFiber) || 'A component') : void 0;
|
|
3842
3846
|
instance._warnedAboutRefsInRender = true;
|
|
3843
3847
|
}
|
|
3844
3848
|
}
|
|
@@ -5865,6 +5869,47 @@ function createFiberFromPortal(portal, mode, expirationTime) {
|
|
|
5865
5869
|
return fiber;
|
|
5866
5870
|
}
|
|
5867
5871
|
|
|
5872
|
+
// Used for stashing WIP properties to replay failed work in DEV.
|
|
5873
|
+
function assignFiberPropertiesInDEV(target, source) {
|
|
5874
|
+
if (target === null) {
|
|
5875
|
+
// This Fiber's initial properties will always be overwritten.
|
|
5876
|
+
// We only use a Fiber to ensure the same hidden class so DEV isn't slow.
|
|
5877
|
+
target = createFiber(IndeterminateComponent, null, null, NoContext);
|
|
5878
|
+
}
|
|
5879
|
+
|
|
5880
|
+
// This is intentionally written as a list of all properties.
|
|
5881
|
+
// We tried to use Object.assign() instead but this is called in
|
|
5882
|
+
// the hottest path, and Object.assign() was too slow:
|
|
5883
|
+
// https://github.com/facebook/react/issues/12502
|
|
5884
|
+
// This code is DEV-only so size is not a concern.
|
|
5885
|
+
|
|
5886
|
+
target.tag = source.tag;
|
|
5887
|
+
target.key = source.key;
|
|
5888
|
+
target.type = source.type;
|
|
5889
|
+
target.stateNode = source.stateNode;
|
|
5890
|
+
target['return'] = source['return'];
|
|
5891
|
+
target.child = source.child;
|
|
5892
|
+
target.sibling = source.sibling;
|
|
5893
|
+
target.index = source.index;
|
|
5894
|
+
target.ref = source.ref;
|
|
5895
|
+
target.pendingProps = source.pendingProps;
|
|
5896
|
+
target.memoizedProps = source.memoizedProps;
|
|
5897
|
+
target.updateQueue = source.updateQueue;
|
|
5898
|
+
target.memoizedState = source.memoizedState;
|
|
5899
|
+
target.mode = source.mode;
|
|
5900
|
+
target.effectTag = source.effectTag;
|
|
5901
|
+
target.nextEffect = source.nextEffect;
|
|
5902
|
+
target.firstEffect = source.firstEffect;
|
|
5903
|
+
target.lastEffect = source.lastEffect;
|
|
5904
|
+
target.expirationTime = source.expirationTime;
|
|
5905
|
+
target.alternate = source.alternate;
|
|
5906
|
+
target._debugID = source._debugID;
|
|
5907
|
+
target._debugSource = source._debugSource;
|
|
5908
|
+
target._debugOwner = source._debugOwner;
|
|
5909
|
+
target._debugIsCurrentlyTiming = source._debugIsCurrentlyTiming;
|
|
5910
|
+
return target;
|
|
5911
|
+
}
|
|
5912
|
+
|
|
5868
5913
|
// TODO: This should be lifted into the renderer.
|
|
5869
5914
|
|
|
5870
5915
|
|
|
@@ -6033,6 +6078,14 @@ var ReactStrictModeWarnings = {
|
|
|
6033
6078
|
var didWarnAboutDeprecatedLifecycles = new Set();
|
|
6034
6079
|
var didWarnAboutUnsafeLifecycles = new Set();
|
|
6035
6080
|
|
|
6081
|
+
var setToSortedString = function (set) {
|
|
6082
|
+
var array = [];
|
|
6083
|
+
set.forEach(function (value) {
|
|
6084
|
+
array.push(value);
|
|
6085
|
+
});
|
|
6086
|
+
return array.sort().join(', ');
|
|
6087
|
+
};
|
|
6088
|
+
|
|
6036
6089
|
ReactStrictModeWarnings.discardPendingWarnings = function () {
|
|
6037
6090
|
pendingComponentWillMountWarnings = [];
|
|
6038
6091
|
pendingComponentWillReceivePropsWarnings = [];
|
|
@@ -6055,7 +6108,7 @@ var ReactStrictModeWarnings = {
|
|
|
6055
6108
|
|
|
6056
6109
|
var formatted = lifecycle.replace('UNSAFE_', '');
|
|
6057
6110
|
var suggestion = LIFECYCLE_SUGGESTIONS[lifecycle];
|
|
6058
|
-
var sortedComponentNames =
|
|
6111
|
+
var sortedComponentNames = setToSortedString(componentNames);
|
|
6059
6112
|
|
|
6060
6113
|
lifecyclesWarningMesages.push(formatted + ': Please update the following components to use ' + (suggestion + ' instead: ' + sortedComponentNames));
|
|
6061
6114
|
}
|
|
@@ -6093,7 +6146,7 @@ var ReactStrictModeWarnings = {
|
|
|
6093
6146
|
didWarnAboutDeprecatedLifecycles.add(fiber.type);
|
|
6094
6147
|
});
|
|
6095
6148
|
|
|
6096
|
-
var sortedNames =
|
|
6149
|
+
var sortedNames = setToSortedString(uniqueNames);
|
|
6097
6150
|
|
|
6098
6151
|
lowPriorityWarning$1(false, 'componentWillMount is deprecated and will be removed in the next major version. ' + 'Use componentDidMount instead. As a temporary workaround, ' + 'you can rename to UNSAFE_componentWillMount.' + '\n\nPlease update the following components: %s' + '\n\nLearn more about this warning here:' + '\nhttps://fb.me/react-async-component-lifecycle-hooks', sortedNames);
|
|
6099
6152
|
|
|
@@ -6107,7 +6160,7 @@ var ReactStrictModeWarnings = {
|
|
|
6107
6160
|
didWarnAboutDeprecatedLifecycles.add(fiber.type);
|
|
6108
6161
|
});
|
|
6109
6162
|
|
|
6110
|
-
var _sortedNames =
|
|
6163
|
+
var _sortedNames = setToSortedString(_uniqueNames);
|
|
6111
6164
|
|
|
6112
6165
|
lowPriorityWarning$1(false, 'componentWillReceiveProps is deprecated and will be removed in the next major version. ' + 'Use static getDerivedStateFromProps instead.' + '\n\nPlease update the following components: %s' + '\n\nLearn more about this warning here:' + '\nhttps://fb.me/react-async-component-lifecycle-hooks', _sortedNames);
|
|
6113
6166
|
|
|
@@ -6121,7 +6174,7 @@ var ReactStrictModeWarnings = {
|
|
|
6121
6174
|
didWarnAboutDeprecatedLifecycles.add(fiber.type);
|
|
6122
6175
|
});
|
|
6123
6176
|
|
|
6124
|
-
var _sortedNames2 =
|
|
6177
|
+
var _sortedNames2 = setToSortedString(_uniqueNames2);
|
|
6125
6178
|
|
|
6126
6179
|
lowPriorityWarning$1(false, 'componentWillUpdate is deprecated and will be removed in the next major version. ' + 'Use componentDidUpdate instead. As a temporary workaround, ' + 'you can rename to UNSAFE_componentWillUpdate.' + '\n\nPlease update the following components: %s' + '\n\nLearn more about this warning here:' + '\nhttps://fb.me/react-async-component-lifecycle-hooks', _sortedNames2);
|
|
6127
6180
|
|
|
@@ -6142,7 +6195,7 @@ var ReactStrictModeWarnings = {
|
|
|
6142
6195
|
if (typeof instance.componentWillReceiveProps === 'function' && instance.componentWillReceiveProps.__suppressDeprecationWarning !== true) {
|
|
6143
6196
|
pendingComponentWillReceivePropsWarnings.push(fiber);
|
|
6144
6197
|
}
|
|
6145
|
-
if (typeof instance.componentWillUpdate === 'function') {
|
|
6198
|
+
if (typeof instance.componentWillUpdate === 'function' && instance.componentWillUpdate.__suppressDeprecationWarning !== true) {
|
|
6146
6199
|
pendingComponentWillUpdateWarnings.push(fiber);
|
|
6147
6200
|
}
|
|
6148
6201
|
};
|
|
@@ -6199,7 +6252,6 @@ var ReactStrictModeWarnings = {
|
|
|
6199
6252
|
}
|
|
6200
6253
|
|
|
6201
6254
|
// Exports ReactDOM.createRoot
|
|
6202
|
-
var enableCreateRoot = true;
|
|
6203
6255
|
var enableUserTimingAPI = true;
|
|
6204
6256
|
|
|
6205
6257
|
// Mutating mode (React DOM, React ART, React Native):
|
|
@@ -6356,6 +6408,7 @@ var shouldIgnoreFiber = function (fiber) {
|
|
|
6356
6408
|
case Fragment:
|
|
6357
6409
|
case ContextProvider:
|
|
6358
6410
|
case ContextConsumer:
|
|
6411
|
+
case Mode:
|
|
6359
6412
|
return true;
|
|
6360
6413
|
default:
|
|
6361
6414
|
return false;
|
|
@@ -6425,12 +6478,12 @@ function startRequestCallbackTimer() {
|
|
|
6425
6478
|
}
|
|
6426
6479
|
}
|
|
6427
6480
|
|
|
6428
|
-
function stopRequestCallbackTimer(didExpire) {
|
|
6481
|
+
function stopRequestCallbackTimer(didExpire, expirationTime) {
|
|
6429
6482
|
if (enableUserTimingAPI) {
|
|
6430
6483
|
if (supportsUserTiming) {
|
|
6431
6484
|
isWaitingForCallback = false;
|
|
6432
6485
|
var warning = didExpire ? 'React was blocked by main thread' : null;
|
|
6433
|
-
endMark('(Waiting for async callback...)', '(Waiting for async callback...)', warning);
|
|
6486
|
+
endMark('(Waiting for async callback... will force flush in ' + expirationTime + ' ms)', '(Waiting for async callback...)', warning);
|
|
6434
6487
|
}
|
|
6435
6488
|
}
|
|
6436
6489
|
}
|
|
@@ -6535,7 +6588,7 @@ function startWorkLoopTimer(nextUnitOfWork) {
|
|
|
6535
6588
|
}
|
|
6536
6589
|
}
|
|
6537
6590
|
|
|
6538
|
-
function stopWorkLoopTimer(interruptedBy) {
|
|
6591
|
+
function stopWorkLoopTimer(interruptedBy, didCompleteRoot) {
|
|
6539
6592
|
if (enableUserTimingAPI) {
|
|
6540
6593
|
if (!supportsUserTiming) {
|
|
6541
6594
|
return;
|
|
@@ -6552,9 +6605,10 @@ function stopWorkLoopTimer(interruptedBy) {
|
|
|
6552
6605
|
warning = 'There were cascading updates';
|
|
6553
6606
|
}
|
|
6554
6607
|
commitCountInCurrentWorkLoop = 0;
|
|
6608
|
+
var label = didCompleteRoot ? '(React Tree Reconciliation: Completed Root)' : '(React Tree Reconciliation: Yielded)';
|
|
6555
6609
|
// Pause any measurements until the next loop.
|
|
6556
6610
|
pauseTimers();
|
|
6557
|
-
endMark(
|
|
6611
|
+
endMark(label, '(React Tree Reconciliation)', warning);
|
|
6558
6612
|
}
|
|
6559
6613
|
}
|
|
6560
6614
|
|
|
@@ -6591,6 +6645,27 @@ function stopCommitTimer() {
|
|
|
6591
6645
|
}
|
|
6592
6646
|
}
|
|
6593
6647
|
|
|
6648
|
+
function startCommitSnapshotEffectsTimer() {
|
|
6649
|
+
if (enableUserTimingAPI) {
|
|
6650
|
+
if (!supportsUserTiming) {
|
|
6651
|
+
return;
|
|
6652
|
+
}
|
|
6653
|
+
effectCountInCurrentCommit = 0;
|
|
6654
|
+
beginMark('(Committing Snapshot Effects)');
|
|
6655
|
+
}
|
|
6656
|
+
}
|
|
6657
|
+
|
|
6658
|
+
function stopCommitSnapshotEffectsTimer() {
|
|
6659
|
+
if (enableUserTimingAPI) {
|
|
6660
|
+
if (!supportsUserTiming) {
|
|
6661
|
+
return;
|
|
6662
|
+
}
|
|
6663
|
+
var count = effectCountInCurrentCommit;
|
|
6664
|
+
effectCountInCurrentCommit = 0;
|
|
6665
|
+
endMark('(Committing Snapshot Effects: ' + count + ' Total)', '(Committing Snapshot Effects)', null);
|
|
6666
|
+
}
|
|
6667
|
+
}
|
|
6668
|
+
|
|
6594
6669
|
function startCommitHostEffectsTimer() {
|
|
6595
6670
|
if (enableUserTimingAPI) {
|
|
6596
6671
|
if (!supportsUserTiming) {
|
|
@@ -6934,25 +7009,27 @@ var isArray = Array.isArray;
|
|
|
6934
7009
|
var didWarnAboutStateAssignmentForComponent = void 0;
|
|
6935
7010
|
var didWarnAboutUndefinedDerivedState = void 0;
|
|
6936
7011
|
var didWarnAboutUninitializedState = void 0;
|
|
7012
|
+
var didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate = void 0;
|
|
6937
7013
|
var didWarnAboutLegacyLifecyclesAndDerivedState = void 0;
|
|
6938
7014
|
var warnOnInvalidCallback$1 = void 0;
|
|
6939
7015
|
|
|
6940
7016
|
{
|
|
6941
|
-
didWarnAboutStateAssignmentForComponent =
|
|
6942
|
-
didWarnAboutUndefinedDerivedState =
|
|
6943
|
-
didWarnAboutUninitializedState =
|
|
6944
|
-
|
|
7017
|
+
didWarnAboutStateAssignmentForComponent = new Set();
|
|
7018
|
+
didWarnAboutUndefinedDerivedState = new Set();
|
|
7019
|
+
didWarnAboutUninitializedState = new Set();
|
|
7020
|
+
didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate = new Set();
|
|
7021
|
+
didWarnAboutLegacyLifecyclesAndDerivedState = new Set();
|
|
6945
7022
|
|
|
6946
|
-
var didWarnOnInvalidCallback =
|
|
7023
|
+
var didWarnOnInvalidCallback = new Set();
|
|
6947
7024
|
|
|
6948
7025
|
warnOnInvalidCallback$1 = function (callback, callerName) {
|
|
6949
7026
|
if (callback === null || typeof callback === 'function') {
|
|
6950
7027
|
return;
|
|
6951
7028
|
}
|
|
6952
7029
|
var key = callerName + '_' + callback;
|
|
6953
|
-
if (!didWarnOnInvalidCallback
|
|
7030
|
+
if (!didWarnOnInvalidCallback.has(key)) {
|
|
7031
|
+
didWarnOnInvalidCallback.add(key);
|
|
6954
7032
|
warning_1(false, '%s(...): Expected the last optional `callback` argument to be a ' + 'function. Instead received: %s.', callerName, callback);
|
|
6955
|
-
didWarnOnInvalidCallback[key] = true;
|
|
6956
7033
|
}
|
|
6957
7034
|
};
|
|
6958
7035
|
|
|
@@ -7066,7 +7143,7 @@ var ReactFiberClassComponent = function (legacyContext, scheduleWork, computeExp
|
|
|
7066
7143
|
stopPhaseTimer();
|
|
7067
7144
|
|
|
7068
7145
|
{
|
|
7069
|
-
|
|
7146
|
+
!(shouldUpdate !== undefined) ? warning_1(false, '%s.shouldComponentUpdate(): Returned undefined instead of a ' + 'boolean value. Make sure to return true or false.', getComponentName(workInProgress) || 'Component') : void 0;
|
|
7070
7147
|
}
|
|
7071
7148
|
|
|
7072
7149
|
return shouldUpdate;
|
|
@@ -7095,40 +7172,48 @@ var ReactFiberClassComponent = function (legacyContext, scheduleWork, computeExp
|
|
|
7095
7172
|
}
|
|
7096
7173
|
|
|
7097
7174
|
var noGetInitialStateOnES6 = !instance.getInitialState || instance.getInitialState.isReactClassApproved || instance.state;
|
|
7098
|
-
warning_1(
|
|
7175
|
+
!noGetInitialStateOnES6 ? warning_1(false, 'getInitialState was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Did you mean to define a state property instead?', name) : void 0;
|
|
7099
7176
|
var noGetDefaultPropsOnES6 = !instance.getDefaultProps || instance.getDefaultProps.isReactClassApproved;
|
|
7100
|
-
warning_1(
|
|
7177
|
+
!noGetDefaultPropsOnES6 ? warning_1(false, 'getDefaultProps was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Use a static property to define defaultProps instead.', name) : void 0;
|
|
7101
7178
|
var noInstancePropTypes = !instance.propTypes;
|
|
7102
|
-
warning_1(
|
|
7179
|
+
!noInstancePropTypes ? warning_1(false, 'propTypes was defined as an instance property on %s. Use a static ' + 'property to define propTypes instead.', name) : void 0;
|
|
7103
7180
|
var noInstanceContextTypes = !instance.contextTypes;
|
|
7104
|
-
warning_1(
|
|
7181
|
+
!noInstanceContextTypes ? warning_1(false, 'contextTypes was defined as an instance property on %s. Use a static ' + 'property to define contextTypes instead.', name) : void 0;
|
|
7105
7182
|
var noComponentShouldUpdate = typeof instance.componentShouldUpdate !== 'function';
|
|
7106
|
-
warning_1(
|
|
7183
|
+
!noComponentShouldUpdate ? warning_1(false, '%s has a method called ' + 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + 'The name is phrased as a question because the function is ' + 'expected to return a value.', name) : void 0;
|
|
7107
7184
|
if (type.prototype && type.prototype.isPureReactComponent && typeof instance.shouldComponentUpdate !== 'undefined') {
|
|
7108
7185
|
warning_1(false, '%s has a method called shouldComponentUpdate(). ' + 'shouldComponentUpdate should not be used when extending React.PureComponent. ' + 'Please extend React.Component if shouldComponentUpdate is used.', getComponentName(workInProgress) || 'A pure component');
|
|
7109
7186
|
}
|
|
7110
7187
|
var noComponentDidUnmount = typeof instance.componentDidUnmount !== 'function';
|
|
7111
|
-
warning_1(
|
|
7188
|
+
!noComponentDidUnmount ? warning_1(false, '%s has a method called ' + 'componentDidUnmount(). But there is no such lifecycle method. ' + 'Did you mean componentWillUnmount()?', name) : void 0;
|
|
7112
7189
|
var noComponentDidReceiveProps = typeof instance.componentDidReceiveProps !== 'function';
|
|
7113
|
-
warning_1(
|
|
7190
|
+
!noComponentDidReceiveProps ? warning_1(false, '%s has a method called ' + 'componentDidReceiveProps(). But there is no such lifecycle method. ' + 'If you meant to update the state in response to changing props, ' + 'use componentWillReceiveProps(). If you meant to fetch data or ' + 'run side-effects or mutations after React has updated the UI, use componentDidUpdate().', name) : void 0;
|
|
7114
7191
|
var noComponentWillRecieveProps = typeof instance.componentWillRecieveProps !== 'function';
|
|
7115
|
-
warning_1(
|
|
7192
|
+
!noComponentWillRecieveProps ? warning_1(false, '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', name) : void 0;
|
|
7116
7193
|
var noUnsafeComponentWillRecieveProps = typeof instance.UNSAFE_componentWillRecieveProps !== 'function';
|
|
7117
|
-
warning_1(
|
|
7194
|
+
!noUnsafeComponentWillRecieveProps ? warning_1(false, '%s has a method called ' + 'UNSAFE_componentWillRecieveProps(). Did you mean UNSAFE_componentWillReceiveProps()?', name) : void 0;
|
|
7118
7195
|
var hasMutatedProps = instance.props !== workInProgress.pendingProps;
|
|
7119
|
-
|
|
7196
|
+
!(instance.props === undefined || !hasMutatedProps) ? warning_1(false, '%s(...): When calling super() in `%s`, make sure to pass ' + "up the same props that your component's constructor was passed.", name, name) : void 0;
|
|
7120
7197
|
var noInstanceDefaultProps = !instance.defaultProps;
|
|
7121
|
-
warning_1(
|
|
7198
|
+
!noInstanceDefaultProps ? warning_1(false, 'Setting defaultProps as an instance property on %s is not supported and will be ignored.' + ' Instead, define defaultProps as a static property on %s.', name, name) : void 0;
|
|
7199
|
+
|
|
7200
|
+
if (typeof instance.getSnapshotBeforeUpdate === 'function' && typeof instance.componentDidUpdate !== 'function' && !didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate.has(type)) {
|
|
7201
|
+
didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate.add(type);
|
|
7202
|
+
warning_1(false, '%s: getSnapshotBeforeUpdate() should be used with componentDidUpdate(). ' + 'This component defines getSnapshotBeforeUpdate() only.', getComponentName(workInProgress));
|
|
7203
|
+
}
|
|
7204
|
+
|
|
7122
7205
|
var noInstanceGetDerivedStateFromProps = typeof instance.getDerivedStateFromProps !== 'function';
|
|
7123
|
-
warning_1(
|
|
7206
|
+
!noInstanceGetDerivedStateFromProps ? warning_1(false, '%s: getDerivedStateFromProps() is defined as an instance method ' + 'and will be ignored. Instead, declare it as a static method.', name) : void 0;
|
|
7124
7207
|
var noInstanceGetDerivedStateFromCatch = typeof instance.getDerivedStateFromCatch !== 'function';
|
|
7125
|
-
warning_1(
|
|
7208
|
+
!noInstanceGetDerivedStateFromCatch ? warning_1(false, '%s: getDerivedStateFromCatch() is defined as an instance method ' + 'and will be ignored. Instead, declare it as a static method.', name) : void 0;
|
|
7209
|
+
var noStaticGetSnapshotBeforeUpdate = typeof type.getSnapshotBeforeUpdate !== 'function';
|
|
7210
|
+
!noStaticGetSnapshotBeforeUpdate ? warning_1(false, '%s: getSnapshotBeforeUpdate() is defined as a static method ' + 'and will be ignored. Instead, declare it as an instance method.', name) : void 0;
|
|
7126
7211
|
var _state = instance.state;
|
|
7127
7212
|
if (_state && (typeof _state !== 'object' || isArray(_state))) {
|
|
7128
7213
|
warning_1(false, '%s.state: must be set to an object or null', name);
|
|
7129
7214
|
}
|
|
7130
7215
|
if (typeof instance.getChildContext === 'function') {
|
|
7131
|
-
|
|
7216
|
+
!(typeof type.childContextTypes === 'object') ? warning_1(false, '%s.getChildContext(): childContextTypes must be defined in order to ' + 'use getChildContext().', name) : void 0;
|
|
7132
7217
|
}
|
|
7133
7218
|
}
|
|
7134
7219
|
}
|
|
@@ -7164,18 +7249,18 @@ var ReactFiberClassComponent = function (legacyContext, scheduleWork, computeExp
|
|
|
7164
7249
|
adoptClassInstance(workInProgress, instance);
|
|
7165
7250
|
|
|
7166
7251
|
{
|
|
7167
|
-
if (typeof ctor.getDerivedStateFromProps === 'function') {
|
|
7168
|
-
|
|
7169
|
-
|
|
7170
|
-
|
|
7171
|
-
|
|
7172
|
-
didWarnAboutUninitializedState[componentName] = true;
|
|
7173
|
-
}
|
|
7252
|
+
if (typeof ctor.getDerivedStateFromProps === 'function' && state === null) {
|
|
7253
|
+
var componentName = getComponentName(workInProgress) || 'Component';
|
|
7254
|
+
if (!didWarnAboutUninitializedState.has(componentName)) {
|
|
7255
|
+
didWarnAboutUninitializedState.add(componentName);
|
|
7256
|
+
warning_1(false, '%s: Did not properly initialize state during construction. ' + 'Expected state to be an object, but it was %s.', componentName, instance.state === null ? 'null' : 'undefined');
|
|
7174
7257
|
}
|
|
7258
|
+
}
|
|
7175
7259
|
|
|
7176
|
-
|
|
7177
|
-
|
|
7178
|
-
|
|
7260
|
+
// If new component APIs are defined, "unsafe" lifecycles won't be called.
|
|
7261
|
+
// Warn about these lifecycles if they are present.
|
|
7262
|
+
// Don't warn about react-lifecycles-compat polyfilled methods though.
|
|
7263
|
+
if (typeof ctor.getDerivedStateFromProps === 'function' || typeof instance.getSnapshotBeforeUpdate === 'function') {
|
|
7179
7264
|
var foundWillMountName = null;
|
|
7180
7265
|
var foundWillReceivePropsName = null;
|
|
7181
7266
|
var foundWillUpdateName = null;
|
|
@@ -7189,16 +7274,17 @@ var ReactFiberClassComponent = function (legacyContext, scheduleWork, computeExp
|
|
|
7189
7274
|
} else if (typeof instance.UNSAFE_componentWillReceiveProps === 'function') {
|
|
7190
7275
|
foundWillReceivePropsName = 'UNSAFE_componentWillReceiveProps';
|
|
7191
7276
|
}
|
|
7192
|
-
if (typeof instance.componentWillUpdate === 'function') {
|
|
7277
|
+
if (typeof instance.componentWillUpdate === 'function' && instance.componentWillUpdate.__suppressDeprecationWarning !== true) {
|
|
7193
7278
|
foundWillUpdateName = 'componentWillUpdate';
|
|
7194
7279
|
} else if (typeof instance.UNSAFE_componentWillUpdate === 'function') {
|
|
7195
7280
|
foundWillUpdateName = 'UNSAFE_componentWillUpdate';
|
|
7196
7281
|
}
|
|
7197
7282
|
if (foundWillMountName !== null || foundWillReceivePropsName !== null || foundWillUpdateName !== null) {
|
|
7198
7283
|
var _componentName = getComponentName(workInProgress) || 'Component';
|
|
7199
|
-
|
|
7200
|
-
|
|
7201
|
-
didWarnAboutLegacyLifecyclesAndDerivedState
|
|
7284
|
+
var newApiName = typeof ctor.getDerivedStateFromProps === 'function' ? 'getDerivedStateFromProps()' : 'getSnapshotBeforeUpdate()';
|
|
7285
|
+
if (!didWarnAboutLegacyLifecyclesAndDerivedState.has(_componentName)) {
|
|
7286
|
+
didWarnAboutLegacyLifecyclesAndDerivedState.add(_componentName);
|
|
7287
|
+
warning_1(false, 'Unsafe legacy lifecycles will not be called for components using new component APIs.\n\n' + '%s uses %s but also contains the following legacy lifecycles:%s%s%s\n\n' + 'The above lifecycles should be removed. Learn more about this warning here:\n' + 'https://fb.me/react-async-component-lifecycle-hooks', _componentName, newApiName, foundWillMountName !== null ? '\n ' + foundWillMountName : '', foundWillReceivePropsName !== null ? '\n ' + foundWillReceivePropsName : '', foundWillUpdateName !== null ? '\n ' + foundWillUpdateName : '');
|
|
7202
7288
|
}
|
|
7203
7289
|
}
|
|
7204
7290
|
}
|
|
@@ -7259,9 +7345,9 @@ var ReactFiberClassComponent = function (legacyContext, scheduleWork, computeExp
|
|
|
7259
7345
|
if (instance.state !== oldState) {
|
|
7260
7346
|
{
|
|
7261
7347
|
var componentName = getComponentName(workInProgress) || 'Component';
|
|
7262
|
-
if (!didWarnAboutStateAssignmentForComponent
|
|
7348
|
+
if (!didWarnAboutStateAssignmentForComponent.has(componentName)) {
|
|
7349
|
+
didWarnAboutStateAssignmentForComponent.add(componentName);
|
|
7263
7350
|
warning_1(false, '%s.componentWillReceiveProps(): Assigning directly to ' + "this.state is deprecated (except inside a component's " + 'constructor). Use setState instead.', componentName);
|
|
7264
|
-
didWarnAboutStateAssignmentForComponent[componentName] = true;
|
|
7265
7351
|
}
|
|
7266
7352
|
}
|
|
7267
7353
|
updater.enqueueReplaceState(instance, instance.state, null);
|
|
@@ -7283,9 +7369,9 @@ var ReactFiberClassComponent = function (legacyContext, scheduleWork, computeExp
|
|
|
7283
7369
|
{
|
|
7284
7370
|
if (partialState === undefined) {
|
|
7285
7371
|
var componentName = getComponentName(workInProgress) || 'Component';
|
|
7286
|
-
if (!didWarnAboutUndefinedDerivedState
|
|
7372
|
+
if (!didWarnAboutUndefinedDerivedState.has(componentName)) {
|
|
7373
|
+
didWarnAboutUndefinedDerivedState.add(componentName);
|
|
7287
7374
|
warning_1(false, '%s.getDerivedStateFromProps(): A valid state object (or null) must be returned. ' + 'You have returned undefined.', componentName);
|
|
7288
|
-
didWarnAboutUndefinedDerivedState[componentName] = componentName;
|
|
7289
7375
|
}
|
|
7290
7376
|
}
|
|
7291
7377
|
}
|
|
@@ -7323,8 +7409,8 @@ var ReactFiberClassComponent = function (legacyContext, scheduleWork, computeExp
|
|
|
7323
7409
|
}
|
|
7324
7410
|
|
|
7325
7411
|
// In order to support react-lifecycles-compat polyfilled components,
|
|
7326
|
-
// Unsafe lifecycles should not be invoked for
|
|
7327
|
-
if (
|
|
7412
|
+
// Unsafe lifecycles should not be invoked for components using the new APIs.
|
|
7413
|
+
if (typeof ctor.getDerivedStateFromProps !== 'function' && typeof instance.getSnapshotBeforeUpdate !== 'function' && (typeof instance.UNSAFE_componentWillMount === 'function' || typeof instance.componentWillMount === 'function')) {
|
|
7328
7414
|
callComponentWillMount(workInProgress, instance);
|
|
7329
7415
|
// If we had additional state updates during this life-cycle, let's
|
|
7330
7416
|
// process them now.
|
|
@@ -7349,13 +7435,15 @@ var ReactFiberClassComponent = function (legacyContext, scheduleWork, computeExp
|
|
|
7349
7435
|
var newUnmaskedContext = getUnmaskedContext(workInProgress);
|
|
7350
7436
|
var newContext = getMaskedContext(workInProgress, newUnmaskedContext);
|
|
7351
7437
|
|
|
7438
|
+
var hasNewLifecycles = typeof ctor.getDerivedStateFromProps === 'function' || typeof instance.getSnapshotBeforeUpdate === 'function';
|
|
7439
|
+
|
|
7352
7440
|
// Note: During these life-cycles, instance.props/instance.state are what
|
|
7353
7441
|
// ever the previously attempted to render - not the "current". However,
|
|
7354
7442
|
// during componentDidUpdate we pass the "current" props.
|
|
7355
7443
|
|
|
7356
7444
|
// In order to support react-lifecycles-compat polyfilled components,
|
|
7357
|
-
// Unsafe lifecycles should not be invoked for
|
|
7358
|
-
if ((typeof instance.UNSAFE_componentWillReceiveProps === 'function' || typeof instance.componentWillReceiveProps === 'function')
|
|
7445
|
+
// Unsafe lifecycles should not be invoked for components using the new APIs.
|
|
7446
|
+
if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillReceiveProps === 'function' || typeof instance.componentWillReceiveProps === 'function')) {
|
|
7359
7447
|
if (oldProps !== newProps || oldContext !== newContext) {
|
|
7360
7448
|
callComponentWillReceiveProps(workInProgress, instance, newProps, newContext);
|
|
7361
7449
|
}
|
|
@@ -7394,12 +7482,26 @@ var ReactFiberClassComponent = function (legacyContext, scheduleWork, computeExp
|
|
|
7394
7482
|
// So that multiple render passes do not enqueue multiple updates.
|
|
7395
7483
|
// Instead, just synchronously merge the returned state into the instance.
|
|
7396
7484
|
newState = newState === null || newState === undefined ? derivedStateFromProps : _assign({}, newState, derivedStateFromProps);
|
|
7485
|
+
|
|
7486
|
+
// Update the base state of the update queue.
|
|
7487
|
+
// FIXME: This is getting ridiculous. Refactor plz!
|
|
7488
|
+
var _updateQueue = workInProgress.updateQueue;
|
|
7489
|
+
if (_updateQueue !== null) {
|
|
7490
|
+
_updateQueue.baseState = _assign({}, _updateQueue.baseState, derivedStateFromProps);
|
|
7491
|
+
}
|
|
7397
7492
|
}
|
|
7398
7493
|
if (derivedStateFromCatch !== null && derivedStateFromCatch !== undefined) {
|
|
7399
7494
|
// Render-phase updates (like this) should not be added to the update queue,
|
|
7400
7495
|
// So that multiple render passes do not enqueue multiple updates.
|
|
7401
7496
|
// Instead, just synchronously merge the returned state into the instance.
|
|
7402
7497
|
newState = newState === null || newState === undefined ? derivedStateFromCatch : _assign({}, newState, derivedStateFromCatch);
|
|
7498
|
+
|
|
7499
|
+
// Update the base state of the update queue.
|
|
7500
|
+
// FIXME: This is getting ridiculous. Refactor plz!
|
|
7501
|
+
var _updateQueue2 = workInProgress.updateQueue;
|
|
7502
|
+
if (_updateQueue2 !== null) {
|
|
7503
|
+
_updateQueue2.baseState = _assign({}, _updateQueue2.baseState, derivedStateFromCatch);
|
|
7504
|
+
}
|
|
7403
7505
|
}
|
|
7404
7506
|
|
|
7405
7507
|
if (oldProps === newProps && oldState === newState && !hasContextChanged() && !(workInProgress.updateQueue !== null && workInProgress.updateQueue.hasForceUpdate)) {
|
|
@@ -7415,8 +7517,8 @@ var ReactFiberClassComponent = function (legacyContext, scheduleWork, computeExp
|
|
|
7415
7517
|
|
|
7416
7518
|
if (shouldUpdate) {
|
|
7417
7519
|
// In order to support react-lifecycles-compat polyfilled components,
|
|
7418
|
-
// Unsafe lifecycles should not be invoked for
|
|
7419
|
-
if ((typeof instance.UNSAFE_componentWillMount === 'function' || typeof instance.componentWillMount === 'function')
|
|
7520
|
+
// Unsafe lifecycles should not be invoked for components using the new APIs.
|
|
7521
|
+
if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillMount === 'function' || typeof instance.componentWillMount === 'function')) {
|
|
7420
7522
|
startPhaseTimer(workInProgress, 'componentWillMount');
|
|
7421
7523
|
if (typeof instance.componentWillMount === 'function') {
|
|
7422
7524
|
instance.componentWillMount();
|
|
@@ -7463,13 +7565,15 @@ var ReactFiberClassComponent = function (legacyContext, scheduleWork, computeExp
|
|
|
7463
7565
|
var newUnmaskedContext = getUnmaskedContext(workInProgress);
|
|
7464
7566
|
var newContext = getMaskedContext(workInProgress, newUnmaskedContext);
|
|
7465
7567
|
|
|
7568
|
+
var hasNewLifecycles = typeof ctor.getDerivedStateFromProps === 'function' || typeof instance.getSnapshotBeforeUpdate === 'function';
|
|
7569
|
+
|
|
7466
7570
|
// Note: During these life-cycles, instance.props/instance.state are what
|
|
7467
7571
|
// ever the previously attempted to render - not the "current". However,
|
|
7468
7572
|
// during componentDidUpdate we pass the "current" props.
|
|
7469
7573
|
|
|
7470
7574
|
// In order to support react-lifecycles-compat polyfilled components,
|
|
7471
|
-
// Unsafe lifecycles should not be invoked for
|
|
7472
|
-
if ((typeof instance.UNSAFE_componentWillReceiveProps === 'function' || typeof instance.componentWillReceiveProps === 'function')
|
|
7575
|
+
// Unsafe lifecycles should not be invoked for components using the new APIs.
|
|
7576
|
+
if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillReceiveProps === 'function' || typeof instance.componentWillReceiveProps === 'function')) {
|
|
7473
7577
|
if (oldProps !== newProps || oldContext !== newContext) {
|
|
7474
7578
|
callComponentWillReceiveProps(workInProgress, instance, newProps, newContext);
|
|
7475
7579
|
}
|
|
@@ -7480,6 +7584,7 @@ var ReactFiberClassComponent = function (legacyContext, scheduleWork, computeExp
|
|
|
7480
7584
|
// TODO: Previous state can be null.
|
|
7481
7585
|
var newState = void 0;
|
|
7482
7586
|
var derivedStateFromCatch = void 0;
|
|
7587
|
+
|
|
7483
7588
|
if (workInProgress.updateQueue !== null) {
|
|
7484
7589
|
newState = processUpdateQueue(current, workInProgress, workInProgress.updateQueue, instance, newProps, renderExpirationTime);
|
|
7485
7590
|
|
|
@@ -7508,12 +7613,26 @@ var ReactFiberClassComponent = function (legacyContext, scheduleWork, computeExp
|
|
|
7508
7613
|
// So that multiple render passes do not enqueue multiple updates.
|
|
7509
7614
|
// Instead, just synchronously merge the returned state into the instance.
|
|
7510
7615
|
newState = newState === null || newState === undefined ? derivedStateFromProps : _assign({}, newState, derivedStateFromProps);
|
|
7616
|
+
|
|
7617
|
+
// Update the base state of the update queue.
|
|
7618
|
+
// FIXME: This is getting ridiculous. Refactor plz!
|
|
7619
|
+
var _updateQueue3 = workInProgress.updateQueue;
|
|
7620
|
+
if (_updateQueue3 !== null) {
|
|
7621
|
+
_updateQueue3.baseState = _assign({}, _updateQueue3.baseState, derivedStateFromProps);
|
|
7622
|
+
}
|
|
7511
7623
|
}
|
|
7512
7624
|
if (derivedStateFromCatch !== null && derivedStateFromCatch !== undefined) {
|
|
7513
7625
|
// Render-phase updates (like this) should not be added to the update queue,
|
|
7514
7626
|
// So that multiple render passes do not enqueue multiple updates.
|
|
7515
7627
|
// Instead, just synchronously merge the returned state into the instance.
|
|
7516
7628
|
newState = newState === null || newState === undefined ? derivedStateFromCatch : _assign({}, newState, derivedStateFromCatch);
|
|
7629
|
+
|
|
7630
|
+
// Update the base state of the update queue.
|
|
7631
|
+
// FIXME: This is getting ridiculous. Refactor plz!
|
|
7632
|
+
var _updateQueue4 = workInProgress.updateQueue;
|
|
7633
|
+
if (_updateQueue4 !== null) {
|
|
7634
|
+
_updateQueue4.baseState = _assign({}, _updateQueue4.baseState, derivedStateFromCatch);
|
|
7635
|
+
}
|
|
7517
7636
|
}
|
|
7518
7637
|
|
|
7519
7638
|
if (oldProps === newProps && oldState === newState && !hasContextChanged() && !(workInProgress.updateQueue !== null && workInProgress.updateQueue.hasForceUpdate)) {
|
|
@@ -7524,6 +7643,11 @@ var ReactFiberClassComponent = function (legacyContext, scheduleWork, computeExp
|
|
|
7524
7643
|
workInProgress.effectTag |= Update;
|
|
7525
7644
|
}
|
|
7526
7645
|
}
|
|
7646
|
+
if (typeof instance.getSnapshotBeforeUpdate === 'function') {
|
|
7647
|
+
if (oldProps !== current.memoizedProps || oldState !== current.memoizedState) {
|
|
7648
|
+
workInProgress.effectTag |= Snapshot;
|
|
7649
|
+
}
|
|
7650
|
+
}
|
|
7527
7651
|
return false;
|
|
7528
7652
|
}
|
|
7529
7653
|
|
|
@@ -7531,8 +7655,8 @@ var ReactFiberClassComponent = function (legacyContext, scheduleWork, computeExp
|
|
|
7531
7655
|
|
|
7532
7656
|
if (shouldUpdate) {
|
|
7533
7657
|
// In order to support react-lifecycles-compat polyfilled components,
|
|
7534
|
-
// Unsafe lifecycles should not be invoked for
|
|
7535
|
-
if ((typeof instance.UNSAFE_componentWillUpdate === 'function' || typeof instance.componentWillUpdate === 'function')
|
|
7658
|
+
// Unsafe lifecycles should not be invoked for components using the new APIs.
|
|
7659
|
+
if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillUpdate === 'function' || typeof instance.componentWillUpdate === 'function')) {
|
|
7536
7660
|
startPhaseTimer(workInProgress, 'componentWillUpdate');
|
|
7537
7661
|
if (typeof instance.componentWillUpdate === 'function') {
|
|
7538
7662
|
instance.componentWillUpdate(newProps, newState, newContext);
|
|
@@ -7545,6 +7669,9 @@ var ReactFiberClassComponent = function (legacyContext, scheduleWork, computeExp
|
|
|
7545
7669
|
if (typeof instance.componentDidUpdate === 'function') {
|
|
7546
7670
|
workInProgress.effectTag |= Update;
|
|
7547
7671
|
}
|
|
7672
|
+
if (typeof instance.getSnapshotBeforeUpdate === 'function') {
|
|
7673
|
+
workInProgress.effectTag |= Snapshot;
|
|
7674
|
+
}
|
|
7548
7675
|
} else {
|
|
7549
7676
|
// If an update was already in progress, we should schedule an Update
|
|
7550
7677
|
// effect even though we're bailing out, so that cWU/cDU are called.
|
|
@@ -7553,6 +7680,11 @@ var ReactFiberClassComponent = function (legacyContext, scheduleWork, computeExp
|
|
|
7553
7680
|
workInProgress.effectTag |= Update;
|
|
7554
7681
|
}
|
|
7555
7682
|
}
|
|
7683
|
+
if (typeof instance.getSnapshotBeforeUpdate === 'function') {
|
|
7684
|
+
if (oldProps !== current.memoizedProps || oldState !== current.memoizedState) {
|
|
7685
|
+
workInProgress.effectTag |= Snapshot;
|
|
7686
|
+
}
|
|
7687
|
+
}
|
|
7556
7688
|
|
|
7557
7689
|
// If shouldComponentUpdate returned false, we should still update the
|
|
7558
7690
|
// memoized props/state to indicate that this work can be reused.
|
|
@@ -8181,7 +8313,7 @@ function ChildReconciler(shouldTrackSideEffects) {
|
|
|
8181
8313
|
if (typeof newChildrenIterable.entries === 'function') {
|
|
8182
8314
|
var possibleMap = newChildrenIterable;
|
|
8183
8315
|
if (possibleMap.entries === iteratorFn) {
|
|
8184
|
-
warning_1(
|
|
8316
|
+
!didWarnAboutMaps ? warning_1(false, 'Using Maps as children is unsupported and will likely yield ' + 'unexpected results. Convert it to a sequence/iterable of keyed ' + 'ReactElements instead.%s', getCurrentFiberStackAddendum$2()) : void 0;
|
|
8185
8317
|
didWarnAboutMaps = true;
|
|
8186
8318
|
}
|
|
8187
8319
|
}
|
|
@@ -8920,7 +9052,7 @@ var ReactFiberBeginWork = function (config, hostContext, legacyContext, newConte
|
|
|
8920
9052
|
var _Component = workInProgress.type;
|
|
8921
9053
|
|
|
8922
9054
|
if (_Component) {
|
|
8923
|
-
|
|
9055
|
+
!!_Component.childContextTypes ? warning_1(false, '%s(...): childContextTypes cannot be defined on a functional component.', _Component.displayName || _Component.name || 'Component') : void 0;
|
|
8924
9056
|
}
|
|
8925
9057
|
if (workInProgress.ref !== null) {
|
|
8926
9058
|
var info = '';
|
|
@@ -9086,7 +9218,7 @@ var ReactFiberBeginWork = function (config, hostContext, legacyContext, newConte
|
|
|
9086
9218
|
|
|
9087
9219
|
function updateContextProvider(current, workInProgress, renderExpirationTime) {
|
|
9088
9220
|
var providerType = workInProgress.type;
|
|
9089
|
-
var context = providerType.
|
|
9221
|
+
var context = providerType._context;
|
|
9090
9222
|
|
|
9091
9223
|
var newProps = workInProgress.pendingProps;
|
|
9092
9224
|
var oldProps = workInProgress.memoizedProps;
|
|
@@ -9133,7 +9265,7 @@ var ReactFiberBeginWork = function (config, hostContext, legacyContext, newConte
|
|
|
9133
9265
|
} else {
|
|
9134
9266
|
changedBits = typeof context._calculateChangedBits === 'function' ? context._calculateChangedBits(oldValue, newValue) : MAX_SIGNED_31_BIT_INT;
|
|
9135
9267
|
{
|
|
9136
|
-
|
|
9268
|
+
!((changedBits & MAX_SIGNED_31_BIT_INT) === changedBits) ? warning_1(false, 'calculateChangedBits: Expected the return value to be a ' + '31-bit integer. Instead received: %s', changedBits) : void 0;
|
|
9137
9269
|
}
|
|
9138
9270
|
changedBits |= 0;
|
|
9139
9271
|
|
|
@@ -9187,15 +9319,19 @@ var ReactFiberBeginWork = function (config, hostContext, legacyContext, newConte
|
|
|
9187
9319
|
// Context change propagation stops at matching consumers, for time-
|
|
9188
9320
|
// slicing. Continue the propagation here.
|
|
9189
9321
|
propagateContextChange(workInProgress, context, changedBits, renderExpirationTime);
|
|
9190
|
-
} else if (oldProps
|
|
9191
|
-
//
|
|
9322
|
+
} else if (oldProps === newProps) {
|
|
9323
|
+
// Skip over a memoized parent with a bitmask bailout even
|
|
9324
|
+
// if we began working on it because of a deeper matching child.
|
|
9192
9325
|
return bailoutOnAlreadyFinishedWork(current, workInProgress);
|
|
9193
9326
|
}
|
|
9327
|
+
// There is no bailout on `children` equality because we expect people
|
|
9328
|
+
// to often pass a bound method as a child, but it may reference
|
|
9329
|
+
// `this.state` or `this.props` (and thus needs to re-render on `setState`).
|
|
9194
9330
|
|
|
9195
9331
|
var render = newProps.children;
|
|
9196
9332
|
|
|
9197
9333
|
{
|
|
9198
|
-
|
|
9334
|
+
!(typeof render === 'function') ? warning_1(false, 'A context consumer was rendered with multiple children, or a child ' + "that isn't a function. A context consumer expects a single child " + 'that is a function. If you did pass a function, make sure there ' + 'is no trailing or leading whitespace around it.') : void 0;
|
|
9199
9335
|
}
|
|
9200
9336
|
|
|
9201
9337
|
var newChildren = render(newValue);
|
|
@@ -9350,7 +9486,7 @@ var ReactFiberCompleteWork = function (config, hostContext, legacyContext, newCo
|
|
|
9350
9486
|
|
|
9351
9487
|
function markUpdate(workInProgress) {
|
|
9352
9488
|
// Tag the fiber with an update effect. This turns a Placement into
|
|
9353
|
-
//
|
|
9489
|
+
// a PlacementAndUpdate.
|
|
9354
9490
|
workInProgress.effectTag |= Update;
|
|
9355
9491
|
}
|
|
9356
9492
|
|
|
@@ -9959,6 +10095,11 @@ var hasCaughtError$1 = ReactErrorUtils.hasCaughtError;
|
|
|
9959
10095
|
var clearCaughtError$1 = ReactErrorUtils.clearCaughtError;
|
|
9960
10096
|
|
|
9961
10097
|
|
|
10098
|
+
var didWarnAboutUndefinedSnapshotBeforeUpdate = null;
|
|
10099
|
+
{
|
|
10100
|
+
didWarnAboutUndefinedSnapshotBeforeUpdate = new Set();
|
|
10101
|
+
}
|
|
10102
|
+
|
|
9962
10103
|
function logError(boundary, errorInfo) {
|
|
9963
10104
|
var source = errorInfo.source;
|
|
9964
10105
|
var stack = errorInfo.stack;
|
|
@@ -9968,20 +10109,19 @@ function logError(boundary, errorInfo) {
|
|
|
9968
10109
|
|
|
9969
10110
|
var capturedError = {
|
|
9970
10111
|
componentName: source !== null ? getComponentName(source) : null,
|
|
9971
|
-
error: errorInfo.value,
|
|
9972
|
-
errorBoundary: boundary,
|
|
9973
10112
|
componentStack: stack !== null ? stack : '',
|
|
10113
|
+
error: errorInfo.value,
|
|
10114
|
+
errorBoundary: null,
|
|
9974
10115
|
errorBoundaryName: null,
|
|
9975
10116
|
errorBoundaryFound: false,
|
|
9976
10117
|
willRetry: false
|
|
9977
10118
|
};
|
|
9978
10119
|
|
|
9979
|
-
if (boundary !== null) {
|
|
10120
|
+
if (boundary !== null && boundary.tag === ClassComponent) {
|
|
10121
|
+
capturedError.errorBoundary = boundary.stateNode;
|
|
9980
10122
|
capturedError.errorBoundaryName = getComponentName(boundary);
|
|
9981
|
-
capturedError.errorBoundaryFound =
|
|
9982
|
-
|
|
9983
|
-
capturedError.errorBoundaryName = null;
|
|
9984
|
-
capturedError.errorBoundaryFound = capturedError.willRetry = false;
|
|
10123
|
+
capturedError.errorBoundaryFound = true;
|
|
10124
|
+
capturedError.willRetry = true;
|
|
9985
10125
|
}
|
|
9986
10126
|
|
|
9987
10127
|
try {
|
|
@@ -10038,31 +10178,70 @@ var ReactFiberCommitWork = function (config, captureError, scheduleWork, compute
|
|
|
10038
10178
|
}
|
|
10039
10179
|
}
|
|
10040
10180
|
|
|
10181
|
+
function commitBeforeMutationLifeCycles(current, finishedWork) {
|
|
10182
|
+
switch (finishedWork.tag) {
|
|
10183
|
+
case ClassComponent:
|
|
10184
|
+
{
|
|
10185
|
+
if (finishedWork.effectTag & Snapshot) {
|
|
10186
|
+
if (current !== null) {
|
|
10187
|
+
var prevProps = current.memoizedProps;
|
|
10188
|
+
var prevState = current.memoizedState;
|
|
10189
|
+
startPhaseTimer(finishedWork, 'getSnapshotBeforeUpdate');
|
|
10190
|
+
var _instance = finishedWork.stateNode;
|
|
10191
|
+
_instance.props = finishedWork.memoizedProps;
|
|
10192
|
+
_instance.state = finishedWork.memoizedState;
|
|
10193
|
+
var snapshot = _instance.getSnapshotBeforeUpdate(prevProps, prevState);
|
|
10194
|
+
{
|
|
10195
|
+
var didWarnSet = didWarnAboutUndefinedSnapshotBeforeUpdate;
|
|
10196
|
+
if (snapshot === undefined && !didWarnSet.has(finishedWork.type)) {
|
|
10197
|
+
didWarnSet.add(finishedWork.type);
|
|
10198
|
+
warning_1(false, '%s.getSnapshotBeforeUpdate(): A snapshot value (or null) ' + 'must be returned. You have returned undefined.', getComponentName(finishedWork));
|
|
10199
|
+
}
|
|
10200
|
+
}
|
|
10201
|
+
_instance.__reactInternalSnapshotBeforeUpdate = snapshot;
|
|
10202
|
+
stopPhaseTimer();
|
|
10203
|
+
}
|
|
10204
|
+
}
|
|
10205
|
+
return;
|
|
10206
|
+
}
|
|
10207
|
+
case HostRoot:
|
|
10208
|
+
case HostComponent:
|
|
10209
|
+
case HostText:
|
|
10210
|
+
case HostPortal:
|
|
10211
|
+
// Nothing to do for these component types
|
|
10212
|
+
return;
|
|
10213
|
+
default:
|
|
10214
|
+
{
|
|
10215
|
+
invariant_1(false, 'This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue.');
|
|
10216
|
+
}
|
|
10217
|
+
}
|
|
10218
|
+
}
|
|
10219
|
+
|
|
10041
10220
|
function commitLifeCycles(finishedRoot, current, finishedWork, currentTime, committedExpirationTime) {
|
|
10042
10221
|
switch (finishedWork.tag) {
|
|
10043
10222
|
case ClassComponent:
|
|
10044
10223
|
{
|
|
10045
|
-
var
|
|
10224
|
+
var _instance2 = finishedWork.stateNode;
|
|
10046
10225
|
if (finishedWork.effectTag & Update) {
|
|
10047
10226
|
if (current === null) {
|
|
10048
10227
|
startPhaseTimer(finishedWork, 'componentDidMount');
|
|
10049
|
-
|
|
10050
|
-
|
|
10051
|
-
|
|
10228
|
+
_instance2.props = finishedWork.memoizedProps;
|
|
10229
|
+
_instance2.state = finishedWork.memoizedState;
|
|
10230
|
+
_instance2.componentDidMount();
|
|
10052
10231
|
stopPhaseTimer();
|
|
10053
10232
|
} else {
|
|
10054
10233
|
var prevProps = current.memoizedProps;
|
|
10055
10234
|
var prevState = current.memoizedState;
|
|
10056
10235
|
startPhaseTimer(finishedWork, 'componentDidUpdate');
|
|
10057
|
-
|
|
10058
|
-
|
|
10059
|
-
|
|
10236
|
+
_instance2.props = finishedWork.memoizedProps;
|
|
10237
|
+
_instance2.state = finishedWork.memoizedState;
|
|
10238
|
+
_instance2.componentDidUpdate(prevProps, prevState, _instance2.__reactInternalSnapshotBeforeUpdate);
|
|
10060
10239
|
stopPhaseTimer();
|
|
10061
10240
|
}
|
|
10062
10241
|
}
|
|
10063
10242
|
var updateQueue = finishedWork.updateQueue;
|
|
10064
10243
|
if (updateQueue !== null) {
|
|
10065
|
-
commitCallbacks(updateQueue,
|
|
10244
|
+
commitCallbacks(updateQueue, _instance2);
|
|
10066
10245
|
}
|
|
10067
10246
|
return;
|
|
10068
10247
|
}
|
|
@@ -10070,24 +10249,24 @@ var ReactFiberCommitWork = function (config, captureError, scheduleWork, compute
|
|
|
10070
10249
|
{
|
|
10071
10250
|
var _updateQueue = finishedWork.updateQueue;
|
|
10072
10251
|
if (_updateQueue !== null) {
|
|
10073
|
-
var
|
|
10252
|
+
var _instance3 = null;
|
|
10074
10253
|
if (finishedWork.child !== null) {
|
|
10075
10254
|
switch (finishedWork.child.tag) {
|
|
10076
10255
|
case HostComponent:
|
|
10077
|
-
|
|
10256
|
+
_instance3 = getPublicInstance(finishedWork.child.stateNode);
|
|
10078
10257
|
break;
|
|
10079
10258
|
case ClassComponent:
|
|
10080
|
-
|
|
10259
|
+
_instance3 = finishedWork.child.stateNode;
|
|
10081
10260
|
break;
|
|
10082
10261
|
}
|
|
10083
10262
|
}
|
|
10084
|
-
commitCallbacks(_updateQueue,
|
|
10263
|
+
commitCallbacks(_updateQueue, _instance3);
|
|
10085
10264
|
}
|
|
10086
10265
|
return;
|
|
10087
10266
|
}
|
|
10088
10267
|
case HostComponent:
|
|
10089
10268
|
{
|
|
10090
|
-
var
|
|
10269
|
+
var _instance4 = finishedWork.stateNode;
|
|
10091
10270
|
|
|
10092
10271
|
// Renderers may schedule work to be done after host components are mounted
|
|
10093
10272
|
// (eg DOM renderer may schedule auto-focus for inputs and form controls).
|
|
@@ -10096,7 +10275,7 @@ var ReactFiberCommitWork = function (config, captureError, scheduleWork, compute
|
|
|
10096
10275
|
if (current === null && finishedWork.effectTag & Update) {
|
|
10097
10276
|
var type = finishedWork.type;
|
|
10098
10277
|
var props = finishedWork.memoizedProps;
|
|
10099
|
-
commitMount(
|
|
10278
|
+
commitMount(_instance4, type, props, finishedWork);
|
|
10100
10279
|
}
|
|
10101
10280
|
|
|
10102
10281
|
return;
|
|
@@ -10123,7 +10302,7 @@ var ReactFiberCommitWork = function (config, captureError, scheduleWork, compute
|
|
|
10123
10302
|
case ClassComponent:
|
|
10124
10303
|
{
|
|
10125
10304
|
var ctor = finishedWork.type;
|
|
10126
|
-
var
|
|
10305
|
+
var _instance5 = finishedWork.stateNode;
|
|
10127
10306
|
var updateQueue = finishedWork.updateQueue;
|
|
10128
10307
|
!(updateQueue !== null && updateQueue.capturedValues !== null) ? invariant_1(false, 'An error logging effect should not have been scheduled if no errors were captured. This error is likely caused by a bug in React. Please file an issue.') : void 0;
|
|
10129
10308
|
var capturedErrors = updateQueue.capturedValues;
|
|
@@ -10135,17 +10314,17 @@ var ReactFiberCommitWork = function (config, captureError, scheduleWork, compute
|
|
|
10135
10314
|
// This gets reset before we yield back to the browser.
|
|
10136
10315
|
// TODO: Warn in strict mode if getDerivedStateFromCatch is
|
|
10137
10316
|
// not defined.
|
|
10138
|
-
markLegacyErrorBoundaryAsFailed(
|
|
10317
|
+
markLegacyErrorBoundaryAsFailed(_instance5);
|
|
10139
10318
|
}
|
|
10140
10319
|
|
|
10141
|
-
|
|
10142
|
-
|
|
10320
|
+
_instance5.props = finishedWork.memoizedProps;
|
|
10321
|
+
_instance5.state = finishedWork.memoizedState;
|
|
10143
10322
|
for (var i = 0; i < capturedErrors.length; i++) {
|
|
10144
10323
|
var errorInfo = capturedErrors[i];
|
|
10145
10324
|
var _error = errorInfo.value;
|
|
10146
10325
|
var stack = errorInfo.stack;
|
|
10147
10326
|
logError(finishedWork, errorInfo);
|
|
10148
|
-
|
|
10327
|
+
_instance5.componentDidCatch(_error, {
|
|
10149
10328
|
componentStack: stack !== null ? stack : ''
|
|
10150
10329
|
});
|
|
10151
10330
|
}
|
|
@@ -10172,14 +10351,14 @@ var ReactFiberCommitWork = function (config, captureError, scheduleWork, compute
|
|
|
10172
10351
|
function commitAttachRef(finishedWork) {
|
|
10173
10352
|
var ref = finishedWork.ref;
|
|
10174
10353
|
if (ref !== null) {
|
|
10175
|
-
var
|
|
10354
|
+
var _instance6 = finishedWork.stateNode;
|
|
10176
10355
|
var instanceToUse = void 0;
|
|
10177
10356
|
switch (finishedWork.tag) {
|
|
10178
10357
|
case HostComponent:
|
|
10179
|
-
instanceToUse = getPublicInstance(
|
|
10358
|
+
instanceToUse = getPublicInstance(_instance6);
|
|
10180
10359
|
break;
|
|
10181
10360
|
default:
|
|
10182
|
-
instanceToUse =
|
|
10361
|
+
instanceToUse = _instance6;
|
|
10183
10362
|
}
|
|
10184
10363
|
if (typeof ref === 'function') {
|
|
10185
10364
|
ref(instanceToUse);
|
|
@@ -10218,9 +10397,9 @@ var ReactFiberCommitWork = function (config, captureError, scheduleWork, compute
|
|
|
10218
10397
|
case ClassComponent:
|
|
10219
10398
|
{
|
|
10220
10399
|
safelyDetachRef(current);
|
|
10221
|
-
var
|
|
10222
|
-
if (typeof
|
|
10223
|
-
safelyCallComponentWillUnmount(current,
|
|
10400
|
+
var _instance7 = current.stateNode;
|
|
10401
|
+
if (typeof _instance7.componentWillUnmount === 'function') {
|
|
10402
|
+
safelyCallComponentWillUnmount(current, _instance7);
|
|
10224
10403
|
}
|
|
10225
10404
|
return;
|
|
10226
10405
|
}
|
|
@@ -10359,6 +10538,7 @@ var ReactFiberCommitWork = function (config, captureError, scheduleWork, compute
|
|
|
10359
10538
|
},
|
|
10360
10539
|
|
|
10361
10540
|
commitLifeCycles: commitLifeCycles,
|
|
10541
|
+
commitBeforeMutationLifeCycles: commitBeforeMutationLifeCycles,
|
|
10362
10542
|
commitErrorLogging: commitErrorLogging,
|
|
10363
10543
|
commitAttachRef: commitAttachRef,
|
|
10364
10544
|
commitDetachRef: commitDetachRef
|
|
@@ -10604,8 +10784,8 @@ var ReactFiberCommitWork = function (config, captureError, scheduleWork, compute
|
|
|
10604
10784
|
}
|
|
10605
10785
|
case HostComponent:
|
|
10606
10786
|
{
|
|
10607
|
-
var
|
|
10608
|
-
if (
|
|
10787
|
+
var _instance8 = finishedWork.stateNode;
|
|
10788
|
+
if (_instance8 != null) {
|
|
10609
10789
|
// Commit the work prepared earlier.
|
|
10610
10790
|
var newProps = finishedWork.memoizedProps;
|
|
10611
10791
|
// For hydration we reuse the update path but we treat the oldProps
|
|
@@ -10617,7 +10797,7 @@ var ReactFiberCommitWork = function (config, captureError, scheduleWork, compute
|
|
|
10617
10797
|
var updatePayload = finishedWork.updateQueue;
|
|
10618
10798
|
finishedWork.updateQueue = null;
|
|
10619
10799
|
if (updatePayload !== null) {
|
|
10620
|
-
commitUpdate(
|
|
10800
|
+
commitUpdate(_instance8, updatePayload, type, oldProps, newProps, finishedWork);
|
|
10621
10801
|
}
|
|
10622
10802
|
}
|
|
10623
10803
|
return;
|
|
@@ -10651,6 +10831,7 @@ var ReactFiberCommitWork = function (config, captureError, scheduleWork, compute
|
|
|
10651
10831
|
|
|
10652
10832
|
if (enableMutatingReconciler) {
|
|
10653
10833
|
return {
|
|
10834
|
+
commitBeforeMutationLifeCycles: commitBeforeMutationLifeCycles,
|
|
10654
10835
|
commitResetTextContent: commitResetTextContent,
|
|
10655
10836
|
commitPlacement: commitPlacement,
|
|
10656
10837
|
commitDeletion: commitDeletion,
|
|
@@ -10693,12 +10874,19 @@ var ReactFiberHostContext = function (config, stack) {
|
|
|
10693
10874
|
// Push current root instance onto the stack;
|
|
10694
10875
|
// This allows us to reset root when portals are popped.
|
|
10695
10876
|
push(rootInstanceStackCursor, nextRootInstance, fiber);
|
|
10696
|
-
|
|
10697
|
-
var nextRootContext = getRootHostContext(nextRootInstance);
|
|
10698
|
-
|
|
10699
10877
|
// Track the context and the Fiber that provided it.
|
|
10700
10878
|
// This enables us to pop only Fibers that provide unique contexts.
|
|
10701
10879
|
push(contextFiberStackCursor, fiber, fiber);
|
|
10880
|
+
|
|
10881
|
+
// Finally, we need to push the host context to the stack.
|
|
10882
|
+
// However, we can't just call getRootHostContext() and push it because
|
|
10883
|
+
// we'd have a different number of entries on the stack depending on
|
|
10884
|
+
// whether getRootHostContext() throws somewhere in renderer code or not.
|
|
10885
|
+
// So we push an empty value first. This lets us safely unwind on errors.
|
|
10886
|
+
push(contextStackCursor, NO_CONTEXT, fiber);
|
|
10887
|
+
var nextRootContext = getRootHostContext(nextRootInstance);
|
|
10888
|
+
// Now that we know this function doesn't throw, replace it.
|
|
10889
|
+
pop(contextStackCursor, fiber);
|
|
10702
10890
|
push(contextStackCursor, nextRootContext, fiber);
|
|
10703
10891
|
}
|
|
10704
10892
|
|
|
@@ -11301,7 +11489,7 @@ var ReactFiberNewContext = function (stack) {
|
|
|
11301
11489
|
}
|
|
11302
11490
|
|
|
11303
11491
|
function pushProvider(providerFiber) {
|
|
11304
|
-
var context = providerFiber.type.
|
|
11492
|
+
var context = providerFiber.type._context;
|
|
11305
11493
|
|
|
11306
11494
|
push(changedBitsCursor, context._changedBits, providerFiber);
|
|
11307
11495
|
push(valueCursor, context._currentValue, providerFiber);
|
|
@@ -11311,7 +11499,7 @@ var ReactFiberNewContext = function (stack) {
|
|
|
11311
11499
|
context._changedBits = providerFiber.stateNode;
|
|
11312
11500
|
|
|
11313
11501
|
{
|
|
11314
|
-
|
|
11502
|
+
!(context._currentRenderer === null || context._currentRenderer === rendererSigil) ? warning_1(false, 'Detected multiple renderers concurrently rendering the ' + 'same context provider. This is currently unsupported.') : void 0;
|
|
11315
11503
|
context._currentRenderer = rendererSigil;
|
|
11316
11504
|
}
|
|
11317
11505
|
}
|
|
@@ -11324,7 +11512,7 @@ var ReactFiberNewContext = function (stack) {
|
|
|
11324
11512
|
pop(valueCursor, providerFiber);
|
|
11325
11513
|
pop(changedBitsCursor, providerFiber);
|
|
11326
11514
|
|
|
11327
|
-
var context = providerFiber.type.
|
|
11515
|
+
var context = providerFiber.type._context;
|
|
11328
11516
|
context._currentValue = currentValue;
|
|
11329
11517
|
context._changedBits = changedBits;
|
|
11330
11518
|
}
|
|
@@ -11435,11 +11623,13 @@ var warnAboutInvalidUpdates = void 0;
|
|
|
11435
11623
|
var didWarnStateUpdateForUnmountedComponent = {};
|
|
11436
11624
|
|
|
11437
11625
|
warnAboutUpdateOnUnmounted = function (fiber) {
|
|
11626
|
+
// We show the whole stack but dedupe on the top component's name because
|
|
11627
|
+
// the problematic code almost always lies inside that component.
|
|
11438
11628
|
var componentName = getComponentName(fiber) || 'ReactClass';
|
|
11439
11629
|
if (didWarnStateUpdateForUnmountedComponent[componentName]) {
|
|
11440
11630
|
return;
|
|
11441
11631
|
}
|
|
11442
|
-
warning_1(false, '
|
|
11632
|
+
warning_1(false, "Can't call setState (or forceUpdate) on an unmounted component. This " + 'is a no-op, but it indicates a memory leak in your application. To ' + 'fix, cancel all subscriptions and asynchronous tasks in the ' + 'componentWillUnmount method.%s', getStackAddendumByWorkInProgressFiber(fiber));
|
|
11443
11633
|
didWarnStateUpdateForUnmountedComponent[componentName] = true;
|
|
11444
11634
|
};
|
|
11445
11635
|
|
|
@@ -11488,6 +11678,7 @@ var ReactFiberScheduler = function (config) {
|
|
|
11488
11678
|
unwindInterruptedWork = _ReactFiberUnwindWork.unwindInterruptedWork;
|
|
11489
11679
|
|
|
11490
11680
|
var _ReactFiberCommitWork = ReactFiberCommitWork(config, onCommitPhaseError, scheduleWork, computeExpirationForFiber, markLegacyErrorBoundaryAsFailed, recalculateCurrentTime),
|
|
11681
|
+
commitBeforeMutationLifeCycles = _ReactFiberCommitWork.commitBeforeMutationLifeCycles,
|
|
11491
11682
|
commitResetTextContent = _ReactFiberCommitWork.commitResetTextContent,
|
|
11492
11683
|
commitPlacement = _ReactFiberCommitWork.commitPlacement,
|
|
11493
11684
|
commitDeletion = _ReactFiberCommitWork.commitDeletion,
|
|
@@ -11539,11 +11730,16 @@ var ReactFiberScheduler = function (config) {
|
|
|
11539
11730
|
|
|
11540
11731
|
var stashedWorkInProgressProperties = void 0;
|
|
11541
11732
|
var replayUnitOfWork = void 0;
|
|
11733
|
+
var isReplayingFailedUnitOfWork = void 0;
|
|
11734
|
+
var originalReplayError = void 0;
|
|
11735
|
+
var rethrowOriginalError = void 0;
|
|
11542
11736
|
if (true && replayFailedUnitOfWorkWithInvokeGuardedCallback) {
|
|
11543
11737
|
stashedWorkInProgressProperties = null;
|
|
11544
|
-
|
|
11545
|
-
|
|
11546
|
-
|
|
11738
|
+
isReplayingFailedUnitOfWork = false;
|
|
11739
|
+
originalReplayError = null;
|
|
11740
|
+
replayUnitOfWork = function (failedUnitOfWork, error, isAsync) {
|
|
11741
|
+
// Restore the original state of the work-in-progress
|
|
11742
|
+
assignFiberPropertiesInDEV(failedUnitOfWork, stashedWorkInProgressProperties);
|
|
11547
11743
|
switch (failedUnitOfWork.tag) {
|
|
11548
11744
|
case HostRoot:
|
|
11549
11745
|
popHostContainer(failedUnitOfWork);
|
|
@@ -11563,14 +11759,22 @@ var ReactFiberScheduler = function (config) {
|
|
|
11563
11759
|
break;
|
|
11564
11760
|
}
|
|
11565
11761
|
// Replay the begin phase.
|
|
11762
|
+
isReplayingFailedUnitOfWork = true;
|
|
11763
|
+
originalReplayError = error;
|
|
11566
11764
|
invokeGuardedCallback$2(null, workLoop, null, isAsync);
|
|
11765
|
+
isReplayingFailedUnitOfWork = false;
|
|
11766
|
+
originalReplayError = null;
|
|
11567
11767
|
if (hasCaughtError()) {
|
|
11568
11768
|
clearCaughtError();
|
|
11569
11769
|
} else {
|
|
11570
|
-
//
|
|
11571
|
-
//
|
|
11770
|
+
// If the begin phase did not fail the second time, set this pointer
|
|
11771
|
+
// back to the original value.
|
|
11772
|
+
nextUnitOfWork = failedUnitOfWork;
|
|
11572
11773
|
}
|
|
11573
11774
|
};
|
|
11775
|
+
rethrowOriginalError = function () {
|
|
11776
|
+
throw originalReplayError;
|
|
11777
|
+
};
|
|
11574
11778
|
}
|
|
11575
11779
|
|
|
11576
11780
|
function resetStack() {
|
|
@@ -11602,6 +11806,7 @@ var ReactFiberScheduler = function (config) {
|
|
|
11602
11806
|
recordEffect();
|
|
11603
11807
|
|
|
11604
11808
|
var effectTag = nextEffect.effectTag;
|
|
11809
|
+
|
|
11605
11810
|
if (effectTag & ContentReset) {
|
|
11606
11811
|
commitResetTextContent(nextEffect);
|
|
11607
11812
|
}
|
|
@@ -11663,6 +11868,22 @@ var ReactFiberScheduler = function (config) {
|
|
|
11663
11868
|
}
|
|
11664
11869
|
}
|
|
11665
11870
|
|
|
11871
|
+
function commitBeforeMutationLifecycles() {
|
|
11872
|
+
while (nextEffect !== null) {
|
|
11873
|
+
var effectTag = nextEffect.effectTag;
|
|
11874
|
+
|
|
11875
|
+
if (effectTag & Snapshot) {
|
|
11876
|
+
recordEffect();
|
|
11877
|
+
var current = nextEffect.alternate;
|
|
11878
|
+
commitBeforeMutationLifeCycles(current, nextEffect);
|
|
11879
|
+
}
|
|
11880
|
+
|
|
11881
|
+
// Don't cleanup effects yet;
|
|
11882
|
+
// This will be done by commitAllLifeCycles()
|
|
11883
|
+
nextEffect = nextEffect.nextEffect;
|
|
11884
|
+
}
|
|
11885
|
+
}
|
|
11886
|
+
|
|
11666
11887
|
function commitAllLifeCycles(finishedRoot, currentTime, committedExpirationTime) {
|
|
11667
11888
|
{
|
|
11668
11889
|
ReactStrictModeWarnings.flushPendingUnsafeLifecycleWarnings();
|
|
@@ -11748,16 +11969,14 @@ var ReactFiberScheduler = function (config) {
|
|
|
11748
11969
|
|
|
11749
11970
|
prepareForCommit(root.containerInfo);
|
|
11750
11971
|
|
|
11751
|
-
//
|
|
11752
|
-
// The first pass performs all the host insertions, updates, deletions and
|
|
11753
|
-
// ref unmounts.
|
|
11972
|
+
// Invoke instances of getSnapshotBeforeUpdate before mutation.
|
|
11754
11973
|
nextEffect = firstEffect;
|
|
11755
|
-
|
|
11974
|
+
startCommitSnapshotEffectsTimer();
|
|
11756
11975
|
while (nextEffect !== null) {
|
|
11757
11976
|
var didError = false;
|
|
11758
11977
|
var error = void 0;
|
|
11759
11978
|
{
|
|
11760
|
-
invokeGuardedCallback$2(null,
|
|
11979
|
+
invokeGuardedCallback$2(null, commitBeforeMutationLifecycles, null);
|
|
11761
11980
|
if (hasCaughtError()) {
|
|
11762
11981
|
didError = true;
|
|
11763
11982
|
error = clearCaughtError();
|
|
@@ -11772,6 +11991,32 @@ var ReactFiberScheduler = function (config) {
|
|
|
11772
11991
|
}
|
|
11773
11992
|
}
|
|
11774
11993
|
}
|
|
11994
|
+
stopCommitSnapshotEffectsTimer();
|
|
11995
|
+
|
|
11996
|
+
// Commit all the side-effects within a tree. We'll do this in two passes.
|
|
11997
|
+
// The first pass performs all the host insertions, updates, deletions and
|
|
11998
|
+
// ref unmounts.
|
|
11999
|
+
nextEffect = firstEffect;
|
|
12000
|
+
startCommitHostEffectsTimer();
|
|
12001
|
+
while (nextEffect !== null) {
|
|
12002
|
+
var _didError = false;
|
|
12003
|
+
var _error = void 0;
|
|
12004
|
+
{
|
|
12005
|
+
invokeGuardedCallback$2(null, commitAllHostEffects, null);
|
|
12006
|
+
if (hasCaughtError()) {
|
|
12007
|
+
_didError = true;
|
|
12008
|
+
_error = clearCaughtError();
|
|
12009
|
+
}
|
|
12010
|
+
}
|
|
12011
|
+
if (_didError) {
|
|
12012
|
+
!(nextEffect !== null) ? invariant_1(false, 'Should have next effect. This error is likely caused by a bug in React. Please file an issue.') : void 0;
|
|
12013
|
+
onCommitPhaseError(nextEffect, _error);
|
|
12014
|
+
// Clean-up
|
|
12015
|
+
if (nextEffect !== null) {
|
|
12016
|
+
nextEffect = nextEffect.nextEffect;
|
|
12017
|
+
}
|
|
12018
|
+
}
|
|
12019
|
+
}
|
|
11775
12020
|
stopCommitHostEffectsTimer();
|
|
11776
12021
|
|
|
11777
12022
|
resetAfterCommit(root.containerInfo);
|
|
@@ -11789,18 +12034,18 @@ var ReactFiberScheduler = function (config) {
|
|
|
11789
12034
|
nextEffect = firstEffect;
|
|
11790
12035
|
startCommitLifeCyclesTimer();
|
|
11791
12036
|
while (nextEffect !== null) {
|
|
11792
|
-
var
|
|
11793
|
-
var
|
|
12037
|
+
var _didError2 = false;
|
|
12038
|
+
var _error2 = void 0;
|
|
11794
12039
|
{
|
|
11795
12040
|
invokeGuardedCallback$2(null, commitAllLifeCycles, null, root, currentTime, committedExpirationTime);
|
|
11796
12041
|
if (hasCaughtError()) {
|
|
11797
|
-
|
|
11798
|
-
|
|
12042
|
+
_didError2 = true;
|
|
12043
|
+
_error2 = clearCaughtError();
|
|
11799
12044
|
}
|
|
11800
12045
|
}
|
|
11801
|
-
if (
|
|
12046
|
+
if (_didError2) {
|
|
11802
12047
|
!(nextEffect !== null) ? invariant_1(false, 'Should have next effect. This error is likely caused by a bug in React. Please file an issue.') : void 0;
|
|
11803
|
-
onCommitPhaseError(nextEffect,
|
|
12048
|
+
onCommitPhaseError(nextEffect, _error2);
|
|
11804
12049
|
if (nextEffect !== null) {
|
|
11805
12050
|
nextEffect = nextEffect.nextEffect;
|
|
11806
12051
|
}
|
|
@@ -12010,12 +12255,18 @@ var ReactFiberScheduler = function (config) {
|
|
|
12010
12255
|
}
|
|
12011
12256
|
|
|
12012
12257
|
if (true && replayFailedUnitOfWorkWithInvokeGuardedCallback) {
|
|
12013
|
-
stashedWorkInProgressProperties =
|
|
12258
|
+
stashedWorkInProgressProperties = assignFiberPropertiesInDEV(stashedWorkInProgressProperties, workInProgress);
|
|
12014
12259
|
}
|
|
12015
12260
|
var next = beginWork(current, workInProgress, nextRenderExpirationTime);
|
|
12016
|
-
|
|
12017
12261
|
{
|
|
12018
12262
|
ReactDebugCurrentFiber.resetCurrentFiber();
|
|
12263
|
+
if (isReplayingFailedUnitOfWork) {
|
|
12264
|
+
// Currently replaying a failed unit of work. This should be unreachable,
|
|
12265
|
+
// because the render phase is meant to be idempotent, and it should
|
|
12266
|
+
// have thrown again. Since it didn't, rethrow the original error, so
|
|
12267
|
+
// React's internal stack is not misaligned.
|
|
12268
|
+
rethrowOriginalError();
|
|
12269
|
+
}
|
|
12019
12270
|
}
|
|
12020
12271
|
if (true && ReactFiberInstrumentation_1.debugTool) {
|
|
12021
12272
|
ReactFiberInstrumentation_1.debugTool.onBeginWork(workInProgress);
|
|
@@ -12077,13 +12328,18 @@ var ReactFiberScheduler = function (config) {
|
|
|
12077
12328
|
|
|
12078
12329
|
if (true && replayFailedUnitOfWorkWithInvokeGuardedCallback) {
|
|
12079
12330
|
var failedUnitOfWork = nextUnitOfWork;
|
|
12080
|
-
replayUnitOfWork(failedUnitOfWork, isAsync);
|
|
12331
|
+
replayUnitOfWork(failedUnitOfWork, thrownValue, isAsync);
|
|
12081
12332
|
}
|
|
12082
12333
|
|
|
12083
12334
|
var sourceFiber = nextUnitOfWork;
|
|
12084
12335
|
var returnFiber = sourceFiber['return'];
|
|
12085
12336
|
if (returnFiber === null) {
|
|
12086
|
-
// This is
|
|
12337
|
+
// This is the root. The root could capture its own errors. However,
|
|
12338
|
+
// we don't know if it errors before or after we pushed the host
|
|
12339
|
+
// context. This information is needed to avoid a stack mismatch.
|
|
12340
|
+
// Because we're not sure, treat this as a fatal error. We could track
|
|
12341
|
+
// which phase it fails in, but doesn't seem worth it. At least
|
|
12342
|
+
// for now.
|
|
12087
12343
|
didFatal = true;
|
|
12088
12344
|
onUncaughtError(thrownValue);
|
|
12089
12345
|
break;
|
|
@@ -12095,12 +12351,13 @@ var ReactFiberScheduler = function (config) {
|
|
|
12095
12351
|
} while (true);
|
|
12096
12352
|
|
|
12097
12353
|
// We're done performing work. Time to clean up.
|
|
12098
|
-
|
|
12099
|
-
interruptedBy = null;
|
|
12354
|
+
var didCompleteRoot = false;
|
|
12100
12355
|
isWorking = false;
|
|
12101
12356
|
|
|
12102
12357
|
// Yield back to main thread.
|
|
12103
12358
|
if (didFatal) {
|
|
12359
|
+
stopWorkLoopTimer(interruptedBy, didCompleteRoot);
|
|
12360
|
+
interruptedBy = null;
|
|
12104
12361
|
// There was a fatal error.
|
|
12105
12362
|
{
|
|
12106
12363
|
stack.resetStackAfterFatalErrorInDev();
|
|
@@ -12109,15 +12366,22 @@ var ReactFiberScheduler = function (config) {
|
|
|
12109
12366
|
} else if (nextUnitOfWork === null) {
|
|
12110
12367
|
// We reached the root.
|
|
12111
12368
|
if (isRootReadyForCommit) {
|
|
12369
|
+
didCompleteRoot = true;
|
|
12370
|
+
stopWorkLoopTimer(interruptedBy, didCompleteRoot);
|
|
12371
|
+
interruptedBy = null;
|
|
12112
12372
|
// The root successfully completed. It's ready for commit.
|
|
12113
12373
|
root.pendingCommitExpirationTime = expirationTime;
|
|
12114
12374
|
var finishedWork = root.current.alternate;
|
|
12115
12375
|
return finishedWork;
|
|
12116
12376
|
} else {
|
|
12117
12377
|
// The root did not complete.
|
|
12378
|
+
stopWorkLoopTimer(interruptedBy, didCompleteRoot);
|
|
12379
|
+
interruptedBy = null;
|
|
12118
12380
|
invariant_1(false, 'Expired work should have completed. This error is likely caused by a bug in React. Please file an issue.');
|
|
12119
12381
|
}
|
|
12120
12382
|
} else {
|
|
12383
|
+
stopWorkLoopTimer(interruptedBy, didCompleteRoot);
|
|
12384
|
+
interruptedBy = null;
|
|
12121
12385
|
// There's more work to do, but we ran out of time. Yield back to
|
|
12122
12386
|
// the renderer.
|
|
12123
12387
|
return null;
|
|
@@ -12185,8 +12449,19 @@ var ReactFiberScheduler = function (config) {
|
|
|
12185
12449
|
}
|
|
12186
12450
|
|
|
12187
12451
|
function computeInteractiveExpiration(currentTime) {
|
|
12188
|
-
|
|
12189
|
-
|
|
12452
|
+
var expirationMs = void 0;
|
|
12453
|
+
// We intentionally set a higher expiration time for interactive updates in
|
|
12454
|
+
// dev than in production.
|
|
12455
|
+
// If the main thread is being blocked so long that you hit the expiration,
|
|
12456
|
+
// it's a problem that could be solved with better scheduling.
|
|
12457
|
+
// People will be more likely to notice this and fix it with the long
|
|
12458
|
+
// expiration time in development.
|
|
12459
|
+
// In production we opt for better UX at the risk of masking scheduling
|
|
12460
|
+
// problems, by expiring fast.
|
|
12461
|
+
{
|
|
12462
|
+
// Should complete within ~500ms. 600ms max.
|
|
12463
|
+
expirationMs = 500;
|
|
12464
|
+
}
|
|
12190
12465
|
var bucketSizeMs = 100;
|
|
12191
12466
|
return computeExpirationBucket(currentTime, expirationMs, bucketSizeMs);
|
|
12192
12467
|
}
|
|
@@ -12283,7 +12558,13 @@ var ReactFiberScheduler = function (config) {
|
|
|
12283
12558
|
interruptedBy = fiber;
|
|
12284
12559
|
resetStack();
|
|
12285
12560
|
}
|
|
12286
|
-
if (
|
|
12561
|
+
if (
|
|
12562
|
+
// If we're in the render phase, we don't need to schedule this root
|
|
12563
|
+
// for an update, because we'll do it before we exit...
|
|
12564
|
+
!isWorking || isCommitting ||
|
|
12565
|
+
// ...unless this is a different root than the one we're rendering.
|
|
12566
|
+
nextRoot !== root) {
|
|
12567
|
+
// Add this root to the root schedule.
|
|
12287
12568
|
requestWork(root, expirationTime);
|
|
12288
12569
|
}
|
|
12289
12570
|
if (nestedUpdateCount > NESTED_UPDATE_LIMIT) {
|
|
@@ -12521,7 +12802,8 @@ var ReactFiberScheduler = function (config) {
|
|
|
12521
12802
|
|
|
12522
12803
|
if (enableUserTimingAPI && deadline !== null) {
|
|
12523
12804
|
var didExpire = nextFlushedExpirationTime < recalculateCurrentTime();
|
|
12524
|
-
|
|
12805
|
+
var timeout = expirationTimeToMs(nextFlushedExpirationTime);
|
|
12806
|
+
stopRequestCallbackTimer(didExpire, timeout);
|
|
12525
12807
|
}
|
|
12526
12808
|
|
|
12527
12809
|
if (isAsync) {
|
|
@@ -12561,7 +12843,11 @@ var ReactFiberScheduler = function (config) {
|
|
|
12561
12843
|
// Perform work on root as if the given expiration time is the current time.
|
|
12562
12844
|
// This has the effect of synchronously flushing all work up to and
|
|
12563
12845
|
// including the given time.
|
|
12846
|
+
nextFlushedRoot = root;
|
|
12847
|
+
nextFlushedExpirationTime = expirationTime;
|
|
12564
12848
|
performWorkOnRoot(root, expirationTime, false);
|
|
12849
|
+
// Flush any sync work that was scheduled by lifecycles
|
|
12850
|
+
performSyncWork();
|
|
12565
12851
|
finishRendering();
|
|
12566
12852
|
}
|
|
12567
12853
|
|
|
@@ -12854,7 +13140,7 @@ var ReactFiberReconciler$1 = function (config) {
|
|
|
12854
13140
|
|
|
12855
13141
|
callback = callback === undefined ? null : callback;
|
|
12856
13142
|
{
|
|
12857
|
-
|
|
13143
|
+
!(callback === null || typeof callback === 'function') ? warning_1(false, 'render(...): Expected the last optional `callback` argument to be a ' + 'function. Instead received: %s.', callback) : void 0;
|
|
12858
13144
|
}
|
|
12859
13145
|
|
|
12860
13146
|
var update = {
|
|
@@ -12898,7 +13184,15 @@ var ReactFiberReconciler$1 = function (config) {
|
|
|
12898
13184
|
return scheduleRootUpdate(current, element, currentTime, expirationTime, callback);
|
|
12899
13185
|
}
|
|
12900
13186
|
|
|
12901
|
-
function findHostInstance(
|
|
13187
|
+
function findHostInstance(component) {
|
|
13188
|
+
var fiber = get(component);
|
|
13189
|
+
if (fiber === undefined) {
|
|
13190
|
+
if (typeof component.render === 'function') {
|
|
13191
|
+
invariant_1(false, 'Unable to find node on an unmounted component.');
|
|
13192
|
+
} else {
|
|
13193
|
+
invariant_1(false, 'Argument appears to not be a ReactComponent. Keys: %s', Object.keys(component));
|
|
13194
|
+
}
|
|
13195
|
+
}
|
|
12902
13196
|
var hostFiber = findCurrentHostFiber(fiber);
|
|
12903
13197
|
if (hostFiber === null) {
|
|
12904
13198
|
return null;
|
|
@@ -12972,7 +13266,11 @@ var ReactFiberReconciler$1 = function (config) {
|
|
|
12972
13266
|
|
|
12973
13267
|
return injectInternals(_assign({}, devToolsConfig, {
|
|
12974
13268
|
findHostInstanceByFiber: function (fiber) {
|
|
12975
|
-
|
|
13269
|
+
var hostFiber = findCurrentHostFiber(fiber);
|
|
13270
|
+
if (hostFiber === null) {
|
|
13271
|
+
return null;
|
|
13272
|
+
}
|
|
13273
|
+
return hostFiber.stateNode;
|
|
12976
13274
|
},
|
|
12977
13275
|
findFiberByHostInstance: function (instance) {
|
|
12978
13276
|
if (!findFiberByHostInstance) {
|
|
@@ -13017,7 +13315,7 @@ implementation) {
|
|
|
13017
13315
|
|
|
13018
13316
|
// TODO: this is special because it gets imported during build.
|
|
13019
13317
|
|
|
13020
|
-
var ReactVersion = '16.3.
|
|
13318
|
+
var ReactVersion = '16.3.2';
|
|
13021
13319
|
|
|
13022
13320
|
// a requestAnimationFrame, storing the time for the start of the frame, then
|
|
13023
13321
|
// scheduling a postMessage which gets scheduled after paint. Within the
|
|
@@ -13055,7 +13353,9 @@ if (!ExecutionEnvironment_1.canUseDOM) {
|
|
|
13055
13353
|
frameCallback({
|
|
13056
13354
|
timeRemaining: function () {
|
|
13057
13355
|
return Infinity;
|
|
13058
|
-
}
|
|
13356
|
+
},
|
|
13357
|
+
|
|
13358
|
+
didTimeout: false
|
|
13059
13359
|
});
|
|
13060
13360
|
});
|
|
13061
13361
|
};
|
|
@@ -14065,7 +14365,7 @@ function assertValidProps(tag, props, getStack) {
|
|
|
14065
14365
|
!(typeof props.dangerouslySetInnerHTML === 'object' && HTML$1 in props.dangerouslySetInnerHTML) ? invariant_1(false, '`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. Please visit https://fb.me/react-invariant-dangerously-set-inner-html for more information.') : void 0;
|
|
14066
14366
|
}
|
|
14067
14367
|
{
|
|
14068
|
-
|
|
14368
|
+
!(props.suppressContentEditableWarning || !props.contentEditable || props.children == null) ? warning_1(false, 'A component is `contentEditable` and contains `children` managed by ' + 'React. It is now your responsibility to guarantee that none of ' + 'those nodes are unexpectedly modified or duplicated. This is ' + 'probably not intentional.%s', getStack()) : void 0;
|
|
14069
14369
|
}
|
|
14070
14370
|
!(props.style == null || typeof props.style === 'object') ? invariant_1(false, 'The `style` prop expects a mapping from style properties to values, not a string. For example, style={{marginRight: spacing + \'em\'}} when using JSX.%s', getStack()) : void 0;
|
|
14071
14371
|
}
|
|
@@ -15128,7 +15428,7 @@ function createElement$1(type, props, rootContainerElement, parentNamespace) {
|
|
|
15128
15428
|
isCustomComponentTag = isCustomComponent(type, props);
|
|
15129
15429
|
// Should this check be gated by parent namespace? Not sure we want to
|
|
15130
15430
|
// allow <SVG> or <mATH>.
|
|
15131
|
-
|
|
15431
|
+
!(isCustomComponentTag || type === type.toLowerCase()) ? warning_1(false, '<%s /> is using incorrect casing. ' + 'Use PascalCase for React components, ' + 'or lowercase for HTML elements.', type) : void 0;
|
|
15132
15432
|
}
|
|
15133
15433
|
|
|
15134
15434
|
if (type === 'script') {
|
|
@@ -16081,7 +16381,7 @@ var validateDOMNesting = emptyFunction_1;
|
|
|
16081
16381
|
var parentTag = parentInfo && parentInfo.tag;
|
|
16082
16382
|
|
|
16083
16383
|
if (childText != null) {
|
|
16084
|
-
|
|
16384
|
+
!(childTag == null) ? warning_1(false, 'validateDOMNesting: when childText is passed, childTag should be null') : void 0;
|
|
16085
16385
|
childTag = '#text';
|
|
16086
16386
|
}
|
|
16087
16387
|
|
|
@@ -16167,7 +16467,7 @@ var didWarnAboutUnstableCreatePortal = false;
|
|
|
16167
16467
|
if (container._reactRootContainer && container.nodeType !== COMMENT_NODE) {
|
|
16168
16468
|
var hostInstance = DOMRenderer.findHostInstanceWithNoPortals(container._reactRootContainer._internalRoot.current);
|
|
16169
16469
|
if (hostInstance) {
|
|
16170
|
-
|
|
16470
|
+
!(hostInstance.parentNode === container) ? warning_1(false, 'render(...): It looks like the React-rendered content of this ' + 'container was removed without using React. This is not ' + 'supported and will cause errors. Instead, call ' + 'ReactDOM.unmountComponentAtNode to empty a container.') : void 0;
|
|
16171
16471
|
}
|
|
16172
16472
|
}
|
|
16173
16473
|
|
|
@@ -16175,13 +16475,13 @@ var didWarnAboutUnstableCreatePortal = false;
|
|
|
16175
16475
|
var rootEl = getReactRootElementInContainer(container);
|
|
16176
16476
|
var hasNonRootReactChild = !!(rootEl && getInstanceFromNode$1(rootEl));
|
|
16177
16477
|
|
|
16178
|
-
|
|
16478
|
+
!(!hasNonRootReactChild || isRootRenderedBySomeReact) ? warning_1(false, 'render(...): Replacing React-rendered children with a new root ' + 'component. If you intended to update the children of this node, ' + 'you should instead have the existing children update their state ' + 'and render the new components instead of calling ReactDOM.render.') : void 0;
|
|
16179
16479
|
|
|
16180
|
-
|
|
16480
|
+
!(container.nodeType !== ELEMENT_NODE || !container.tagName || container.tagName.toUpperCase() !== 'BODY') ? warning_1(false, 'render(): Rendering components directly into document.body is ' + 'discouraged, since its children are often manipulated by third-party ' + 'scripts and browser extensions. This may lead to subtle ' + 'reconciliation issues. Try rendering into a container element created ' + 'for your app.') : void 0;
|
|
16181
16481
|
};
|
|
16182
16482
|
|
|
16183
16483
|
warnOnInvalidCallback = function (callback, callerName) {
|
|
16184
|
-
|
|
16484
|
+
!(callback === null || typeof callback === 'function') ? warning_1(false, '%s(...): Expected the last optional `callback` argument to be a ' + 'function. Instead received: %s.', callerName, callback) : void 0;
|
|
16185
16485
|
};
|
|
16186
16486
|
}
|
|
16187
16487
|
|
|
@@ -16800,7 +17100,7 @@ var ReactDOM = {
|
|
|
16800
17100
|
var owner = ReactCurrentOwner.current;
|
|
16801
17101
|
if (owner !== null && owner.stateNode !== null) {
|
|
16802
17102
|
var warnedAboutRefsInRender = owner.stateNode._warnedAboutRefsInRender;
|
|
16803
|
-
warning_1(
|
|
17103
|
+
!warnedAboutRefsInRender ? warning_1(false, '%s is accessing findDOMNode inside its render(). ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', getComponentName(owner) || 'A component') : void 0;
|
|
16804
17104
|
owner.stateNode._warnedAboutRefsInRender = true;
|
|
16805
17105
|
}
|
|
16806
17106
|
}
|
|
@@ -16811,16 +17111,7 @@ var ReactDOM = {
|
|
|
16811
17111
|
return componentOrElement;
|
|
16812
17112
|
}
|
|
16813
17113
|
|
|
16814
|
-
|
|
16815
|
-
if (inst) {
|
|
16816
|
-
return DOMRenderer.findHostInstance(inst);
|
|
16817
|
-
}
|
|
16818
|
-
|
|
16819
|
-
if (typeof componentOrElement.render === 'function') {
|
|
16820
|
-
invariant_1(false, 'Unable to find node on an unmounted component.');
|
|
16821
|
-
} else {
|
|
16822
|
-
invariant_1(false, 'Element appears to be neither ReactComponent nor DOMNode. Keys: %s', Object.keys(componentOrElement));
|
|
16823
|
-
}
|
|
17114
|
+
return DOMRenderer.findHostInstance(componentOrElement);
|
|
16824
17115
|
},
|
|
16825
17116
|
hydrate: function (element, container, callback) {
|
|
16826
17117
|
// TODO: throw or warn if we couldn't hydrate?
|
|
@@ -16840,7 +17131,7 @@ var ReactDOM = {
|
|
|
16840
17131
|
{
|
|
16841
17132
|
var rootEl = getReactRootElementInContainer(container);
|
|
16842
17133
|
var renderedByDifferentReact = rootEl && !getInstanceFromNode$1(rootEl);
|
|
16843
|
-
warning_1(
|
|
17134
|
+
!!renderedByDifferentReact ? warning_1(false, "unmountComponentAtNode(): The node you're attempting to unmount " + 'was rendered by another copy of React.') : void 0;
|
|
16844
17135
|
}
|
|
16845
17136
|
|
|
16846
17137
|
// Unmount should not be batched.
|
|
@@ -16860,7 +17151,7 @@ var ReactDOM = {
|
|
|
16860
17151
|
// Check if the container itself is a React root node.
|
|
16861
17152
|
var isContainerReactRoot = container.nodeType === 1 && isValidContainer(container.parentNode) && !!container.parentNode._reactRootContainer;
|
|
16862
17153
|
|
|
16863
|
-
warning_1(
|
|
17154
|
+
!!hasNonRootReactChild ? warning_1(false, "unmountComponentAtNode(): The node you're attempting to unmount " + 'was rendered by React and is not a top-level container. %s', isContainerReactRoot ? 'You may have accidentally passed in a React root node instead ' + 'of its container.' : 'Instead, have the parent component update its state and ' + 'rerender in order to remove this component.') : void 0;
|
|
16864
17155
|
}
|
|
16865
17156
|
|
|
16866
17157
|
return false;
|
|
@@ -16899,12 +17190,10 @@ var ReactDOM = {
|
|
|
16899
17190
|
}
|
|
16900
17191
|
};
|
|
16901
17192
|
|
|
16902
|
-
|
|
16903
|
-
|
|
16904
|
-
|
|
16905
|
-
|
|
16906
|
-
};
|
|
16907
|
-
}
|
|
17193
|
+
ReactDOM.unstable_createRoot = function createRoot(container, options) {
|
|
17194
|
+
var hydrate = options != null && options.hydrate === true;
|
|
17195
|
+
return new ReactRoot(container, true, hydrate);
|
|
17196
|
+
};
|
|
16908
17197
|
|
|
16909
17198
|
var foundDevTools = DOMRenderer.injectIntoDevTools({
|
|
16910
17199
|
findFiberByHostInstance: getClosestInstanceFromNode,
|