react-dom 16.6.0-alpha.8af6728 → 16.6.0
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 +116 -63
- package/cjs/react-dom-server.browser.production.min.js +35 -33
- package/cjs/react-dom-server.node.development.js +118 -65
- package/cjs/react-dom-server.node.production.min.js +38 -36
- package/cjs/react-dom-test-utils.development.js +6 -8
- package/cjs/react-dom-test-utils.production.min.js +4 -4
- package/cjs/react-dom-unstable-native-dependencies.development.js +2 -2
- package/cjs/react-dom-unstable-native-dependencies.production.min.js +2 -2
- package/cjs/react-dom.development.js +1068 -546
- package/cjs/react-dom.production.min.js +234 -227
- package/cjs/react-dom.profiling.min.js +239 -233
- package/package.json +3 -3
- package/umd/react-dom-server.browser.development.js +116 -63
- package/umd/react-dom-server.browser.production.min.js +31 -29
- package/umd/react-dom-test-utils.development.js +6 -8
- package/umd/react-dom-test-utils.production.min.js +8 -8
- package/umd/react-dom-unstable-native-dependencies.development.js +2 -2
- package/umd/react-dom-unstable-native-dependencies.production.min.js +2 -2
- package/umd/react-dom.development.js +1068 -546
- package/umd/react-dom.production.min.js +193 -188
- package/umd/react-dom.profiling.min.js +198 -194
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license React v16.6.0
|
|
1
|
+
/** @license React v16.6.0
|
|
2
2
|
* react-dom.development.js
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
@@ -873,24 +873,23 @@ function runExtractedEventsInBatch(topLevelType, targetInst, nativeEvent, native
|
|
|
873
873
|
}
|
|
874
874
|
|
|
875
875
|
var FunctionComponent = 0;
|
|
876
|
-
var
|
|
877
|
-
var
|
|
878
|
-
var
|
|
879
|
-
var
|
|
880
|
-
var
|
|
881
|
-
var
|
|
882
|
-
var
|
|
883
|
-
var
|
|
884
|
-
var
|
|
885
|
-
var
|
|
886
|
-
var
|
|
887
|
-
var
|
|
888
|
-
var
|
|
889
|
-
var
|
|
890
|
-
var
|
|
891
|
-
var
|
|
892
|
-
var
|
|
893
|
-
var PureComponentLazy = 18;
|
|
876
|
+
var ClassComponent = 1;
|
|
877
|
+
var IndeterminateComponent = 2; // Before we know whether it is function or class
|
|
878
|
+
var HostRoot = 3; // Root of a host tree. Could be nested inside another node.
|
|
879
|
+
var HostPortal = 4; // A subtree. Could be an entry point to a different renderer.
|
|
880
|
+
var HostComponent = 5;
|
|
881
|
+
var HostText = 6;
|
|
882
|
+
var Fragment = 7;
|
|
883
|
+
var Mode = 8;
|
|
884
|
+
var ContextConsumer = 9;
|
|
885
|
+
var ContextProvider = 10;
|
|
886
|
+
var ForwardRef = 11;
|
|
887
|
+
var Profiler = 12;
|
|
888
|
+
var SuspenseComponent = 13;
|
|
889
|
+
var MemoComponent = 14;
|
|
890
|
+
var SimpleMemoComponent = 15;
|
|
891
|
+
var LazyComponent = 16;
|
|
892
|
+
var IncompleteClassComponent = 17;
|
|
894
893
|
|
|
895
894
|
var randomKey = Math.random().toString(36).slice(2);
|
|
896
895
|
var internalInstanceKey = '__reactInternalInstance$' + randomKey;
|
|
@@ -2475,7 +2474,8 @@ var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace;
|
|
|
2475
2474
|
var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
|
|
2476
2475
|
var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
|
|
2477
2476
|
var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
|
|
2478
|
-
var
|
|
2477
|
+
var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
|
|
2478
|
+
var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
|
|
2479
2479
|
|
|
2480
2480
|
var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
|
|
2481
2481
|
var FAUX_ITERATOR_SYMBOL = '@@iterator';
|
|
@@ -2495,12 +2495,13 @@ var Pending = 0;
|
|
|
2495
2495
|
var Resolved = 1;
|
|
2496
2496
|
var Rejected = 2;
|
|
2497
2497
|
|
|
2498
|
-
function
|
|
2499
|
-
return
|
|
2498
|
+
function refineResolvedLazyComponent(lazyComponent) {
|
|
2499
|
+
return lazyComponent._status === Resolved ? lazyComponent._result : null;
|
|
2500
2500
|
}
|
|
2501
2501
|
|
|
2502
|
-
function
|
|
2503
|
-
|
|
2502
|
+
function getWrappedName(outerType, innerType, wrapperName) {
|
|
2503
|
+
var functionName = innerType.displayName || innerType.name || '';
|
|
2504
|
+
return outerType.displayName || (functionName !== '' ? wrapperName + '(' + functionName + ')' : wrapperName);
|
|
2504
2505
|
}
|
|
2505
2506
|
|
|
2506
2507
|
function getComponentName(type) {
|
|
@@ -2540,16 +2541,17 @@ function getComponentName(type) {
|
|
|
2540
2541
|
case REACT_PROVIDER_TYPE:
|
|
2541
2542
|
return 'Context.Provider';
|
|
2542
2543
|
case REACT_FORWARD_REF_TYPE:
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
return type.
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2544
|
+
return getWrappedName(type, type.render, 'ForwardRef');
|
|
2545
|
+
case REACT_MEMO_TYPE:
|
|
2546
|
+
return getComponentName(type.type);
|
|
2547
|
+
case REACT_LAZY_TYPE:
|
|
2548
|
+
{
|
|
2549
|
+
var thenable = type;
|
|
2550
|
+
var resolvedThenable = refineResolvedLazyComponent(thenable);
|
|
2551
|
+
if (resolvedThenable) {
|
|
2552
|
+
return getComponentName(resolvedThenable);
|
|
2553
|
+
}
|
|
2554
|
+
}
|
|
2553
2555
|
}
|
|
2554
2556
|
}
|
|
2555
2557
|
return null;
|
|
@@ -2560,10 +2562,9 @@ var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
|
2560
2562
|
function describeFiber(fiber) {
|
|
2561
2563
|
switch (fiber.tag) {
|
|
2562
2564
|
case IndeterminateComponent:
|
|
2565
|
+
case LazyComponent:
|
|
2563
2566
|
case FunctionComponent:
|
|
2564
|
-
case FunctionComponentLazy:
|
|
2565
2567
|
case ClassComponent:
|
|
2566
|
-
case ClassComponentLazy:
|
|
2567
2568
|
case HostComponent:
|
|
2568
2569
|
case Mode:
|
|
2569
2570
|
var owner = fiber._debugOwner;
|
|
@@ -3383,7 +3384,7 @@ function postMountWrapper(element, props, isHydrating) {
|
|
|
3383
3384
|
}
|
|
3384
3385
|
} else {
|
|
3385
3386
|
// When syncing the value attribute, the value property should use
|
|
3386
|
-
// the
|
|
3387
|
+
// the wrapperState._initialValue property. This uses:
|
|
3387
3388
|
//
|
|
3388
3389
|
// 1. The value React property when present
|
|
3389
3390
|
// 2. The defaultValue React property when present
|
|
@@ -3436,7 +3437,7 @@ function postMountWrapper(element, props, isHydrating) {
|
|
|
3436
3437
|
node.defaultChecked = !!props.defaultChecked;
|
|
3437
3438
|
}
|
|
3438
3439
|
} else {
|
|
3439
|
-
// When syncing the checked attribute, both the
|
|
3440
|
+
// When syncing the checked attribute, both the checked property and
|
|
3440
3441
|
// attribute are assigned at the same time using defaultChecked. This uses:
|
|
3441
3442
|
//
|
|
3442
3443
|
// 1. The checked React property when present
|
|
@@ -3772,11 +3773,6 @@ var SyntheticUIEvent = SyntheticEvent.extend({
|
|
|
3772
3773
|
detail: null
|
|
3773
3774
|
});
|
|
3774
3775
|
|
|
3775
|
-
/**
|
|
3776
|
-
* Translation from modifier key to the associated property in the event.
|
|
3777
|
-
* @see http://www.w3.org/TR/DOM-Level-3-Events/#keys-Modifiers
|
|
3778
|
-
*/
|
|
3779
|
-
|
|
3780
3776
|
var modifierKeyToProp = {
|
|
3781
3777
|
Alt: 'altKey',
|
|
3782
3778
|
Control: 'ctrlKey',
|
|
@@ -3787,6 +3783,11 @@ var modifierKeyToProp = {
|
|
|
3787
3783
|
// IE8 does not implement getModifierState so we simply map it to the only
|
|
3788
3784
|
// modifier keys exposed by the event itself, does not support Lock-keys.
|
|
3789
3785
|
// Currently, all major browsers except Chrome seems to support Lock-keys.
|
|
3786
|
+
/**
|
|
3787
|
+
* Translation from modifier key to the associated property in the event.
|
|
3788
|
+
* @see http://www.w3.org/TR/DOM-Level-3-Events/#keys-Modifiers
|
|
3789
|
+
*/
|
|
3790
|
+
|
|
3790
3791
|
function modifierStateGetter(keyArg) {
|
|
3791
3792
|
var syntheticEvent = this;
|
|
3792
3793
|
var nativeEvent = syntheticEvent.nativeEvent;
|
|
@@ -4133,7 +4134,7 @@ function isFiberMounted(fiber) {
|
|
|
4133
4134
|
function isMounted(component) {
|
|
4134
4135
|
{
|
|
4135
4136
|
var owner = ReactCurrentOwner$1.current;
|
|
4136
|
-
if (owner !== null &&
|
|
4137
|
+
if (owner !== null && owner.tag === ClassComponent) {
|
|
4137
4138
|
var ownerFiber = owner;
|
|
4138
4139
|
var instance = ownerFiber.stateNode;
|
|
4139
4140
|
!instance._warnedAboutRefsInRender ? warningWithoutStack$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.type) || 'A component') : void 0;
|
|
@@ -7285,7 +7286,7 @@ var SUPPRESS_CONTENT_EDITABLE_WARNING = 'suppressContentEditableWarning';
|
|
|
7285
7286
|
var SUPPRESS_HYDRATION_WARNING$1 = 'suppressHydrationWarning';
|
|
7286
7287
|
var AUTOFOCUS = 'autoFocus';
|
|
7287
7288
|
var CHILDREN = 'children';
|
|
7288
|
-
var STYLE = 'style';
|
|
7289
|
+
var STYLE$1 = 'style';
|
|
7289
7290
|
var HTML = '__html';
|
|
7290
7291
|
|
|
7291
7292
|
var HTML_NAMESPACE = Namespaces.html;
|
|
@@ -7440,7 +7441,7 @@ function setInitialDOMProperties(tag, domElement, rootContainerElement, nextProp
|
|
|
7440
7441
|
continue;
|
|
7441
7442
|
}
|
|
7442
7443
|
var nextProp = nextProps[propKey];
|
|
7443
|
-
if (propKey === STYLE) {
|
|
7444
|
+
if (propKey === STYLE$1) {
|
|
7444
7445
|
{
|
|
7445
7446
|
if (nextProp) {
|
|
7446
7447
|
// Freeze the next style object so that we can assume it won't be
|
|
@@ -7493,7 +7494,7 @@ function updateDOMProperties(domElement, updatePayload, wasCustomComponentTag, i
|
|
|
7493
7494
|
for (var i = 0; i < updatePayload.length; i += 2) {
|
|
7494
7495
|
var propKey = updatePayload[i];
|
|
7495
7496
|
var propValue = updatePayload[i + 1];
|
|
7496
|
-
if (propKey === STYLE) {
|
|
7497
|
+
if (propKey === STYLE$1) {
|
|
7497
7498
|
setValueForStyles(domElement, propValue);
|
|
7498
7499
|
} else if (propKey === DANGEROUSLY_SET_INNER_HTML) {
|
|
7499
7500
|
setInnerHTML(domElement, propValue);
|
|
@@ -7730,7 +7731,7 @@ function diffProperties(domElement, tag, lastRawProps, nextRawProps, rootContain
|
|
|
7730
7731
|
if (nextProps.hasOwnProperty(propKey) || !lastProps.hasOwnProperty(propKey) || lastProps[propKey] == null) {
|
|
7731
7732
|
continue;
|
|
7732
7733
|
}
|
|
7733
|
-
if (propKey === STYLE) {
|
|
7734
|
+
if (propKey === STYLE$1) {
|
|
7734
7735
|
var lastStyle = lastProps[propKey];
|
|
7735
7736
|
for (styleName in lastStyle) {
|
|
7736
7737
|
if (lastStyle.hasOwnProperty(styleName)) {
|
|
@@ -7765,7 +7766,7 @@ function diffProperties(domElement, tag, lastRawProps, nextRawProps, rootContain
|
|
|
7765
7766
|
if (!nextProps.hasOwnProperty(propKey) || nextProp === lastProp || nextProp == null && lastProp == null) {
|
|
7766
7767
|
continue;
|
|
7767
7768
|
}
|
|
7768
|
-
if (propKey === STYLE) {
|
|
7769
|
+
if (propKey === STYLE$1) {
|
|
7769
7770
|
{
|
|
7770
7771
|
if (nextProp) {
|
|
7771
7772
|
// Freeze the next style object so that we can assume it won't be
|
|
@@ -7840,7 +7841,7 @@ function diffProperties(domElement, tag, lastRawProps, nextRawProps, rootContain
|
|
|
7840
7841
|
}
|
|
7841
7842
|
}
|
|
7842
7843
|
if (styleUpdates) {
|
|
7843
|
-
(updatePayload = updatePayload || []).push(STYLE, styleUpdates);
|
|
7844
|
+
(updatePayload = updatePayload || []).push(STYLE$1, styleUpdates);
|
|
7844
7845
|
}
|
|
7845
7846
|
return updatePayload;
|
|
7846
7847
|
}
|
|
@@ -8044,7 +8045,7 @@ function diffHydratedProperties(domElement, tag, rawProps, parentNamespace, root
|
|
|
8044
8045
|
if (expectedHTML !== serverHTML) {
|
|
8045
8046
|
warnForPropDifference(propKey, serverHTML, expectedHTML);
|
|
8046
8047
|
}
|
|
8047
|
-
} else if (propKey === STYLE) {
|
|
8048
|
+
} else if (propKey === STYLE$1) {
|
|
8048
8049
|
// $FlowFixMe - Should be inferred as not undefined.
|
|
8049
8050
|
extraAttributeNames.delete(propKey);
|
|
8050
8051
|
|
|
@@ -8524,12 +8525,17 @@ var createContainerChildSet = shim;
|
|
|
8524
8525
|
var appendChildToContainerChildSet = shim;
|
|
8525
8526
|
var finalizeContainerChildren = shim;
|
|
8526
8527
|
var replaceContainerChildren = shim;
|
|
8528
|
+
var cloneHiddenInstance = shim;
|
|
8529
|
+
var cloneUnhiddenInstance = shim;
|
|
8530
|
+
var createHiddenTextInstance = shim;
|
|
8527
8531
|
|
|
8528
8532
|
var SUPPRESS_HYDRATION_WARNING = void 0;
|
|
8529
8533
|
{
|
|
8530
8534
|
SUPPRESS_HYDRATION_WARNING = 'suppressHydrationWarning';
|
|
8531
8535
|
}
|
|
8532
8536
|
|
|
8537
|
+
var STYLE = 'style';
|
|
8538
|
+
|
|
8533
8539
|
var eventsEnabled = null;
|
|
8534
8540
|
var selectionInformation = null;
|
|
8535
8541
|
|
|
@@ -8751,6 +8757,29 @@ function removeChildFromContainer(container, child) {
|
|
|
8751
8757
|
}
|
|
8752
8758
|
}
|
|
8753
8759
|
|
|
8760
|
+
function hideInstance(instance) {
|
|
8761
|
+
// TODO: Does this work for all element types? What about MathML? Should we
|
|
8762
|
+
// pass host context to this method?
|
|
8763
|
+
instance = instance;
|
|
8764
|
+
instance.style.display = 'none';
|
|
8765
|
+
}
|
|
8766
|
+
|
|
8767
|
+
function hideTextInstance(textInstance) {
|
|
8768
|
+
textInstance.nodeValue = '';
|
|
8769
|
+
}
|
|
8770
|
+
|
|
8771
|
+
function unhideInstance(instance, props) {
|
|
8772
|
+
instance = instance;
|
|
8773
|
+
var styleProp = props[STYLE];
|
|
8774
|
+
var display = styleProp !== undefined && styleProp !== null && styleProp.hasOwnProperty('display') ? styleProp.display : null;
|
|
8775
|
+
// $FlowFixMe Setting a style property to null is the valid way to reset it.
|
|
8776
|
+
instance.style.display = display;
|
|
8777
|
+
}
|
|
8778
|
+
|
|
8779
|
+
function unhideTextInstance(textInstance, text) {
|
|
8780
|
+
textInstance.nodeValue = text;
|
|
8781
|
+
}
|
|
8782
|
+
|
|
8754
8783
|
// -------------------
|
|
8755
8784
|
// Hydration
|
|
8756
8785
|
// -------------------
|
|
@@ -9121,7 +9150,7 @@ function stopFailedWorkTimer(fiber) {
|
|
|
9121
9150
|
return;
|
|
9122
9151
|
}
|
|
9123
9152
|
fiber._debugIsCurrentlyTiming = false;
|
|
9124
|
-
var warning = 'An error was thrown inside this error boundary';
|
|
9153
|
+
var warning = fiber.tag === SuspenseComponent ? 'Rendering was suspended' : 'An error was thrown inside this error boundary';
|
|
9125
9154
|
endFiberMark(fiber, null, warning);
|
|
9126
9155
|
}
|
|
9127
9156
|
}
|
|
@@ -9543,7 +9572,7 @@ function invalidateContextProvider(workInProgress, type, didChange) {
|
|
|
9543
9572
|
function findCurrentUnmaskedContext(fiber) {
|
|
9544
9573
|
// Currently this is only used with renderSubtreeIntoContainer; not sure if it
|
|
9545
9574
|
// makes sense elsewhere
|
|
9546
|
-
!(isFiberMounted(fiber) &&
|
|
9575
|
+
!(isFiberMounted(fiber) && fiber.tag === ClassComponent) ? invariant(false, 'Expected subtree parent to be a mounted class component. This error is likely caused by a bug in React. Please file an issue.') : void 0;
|
|
9547
9576
|
|
|
9548
9577
|
var node = fiber;
|
|
9549
9578
|
do {
|
|
@@ -9558,14 +9587,6 @@ function findCurrentUnmaskedContext(fiber) {
|
|
|
9558
9587
|
}
|
|
9559
9588
|
break;
|
|
9560
9589
|
}
|
|
9561
|
-
case ClassComponentLazy:
|
|
9562
|
-
{
|
|
9563
|
-
var _Component = getResultFromResolvedThenable(node.type);
|
|
9564
|
-
if (isContextProvider(_Component)) {
|
|
9565
|
-
return node.stateNode.__reactInternalMemoizedMergedChildContext;
|
|
9566
|
-
}
|
|
9567
|
-
break;
|
|
9568
|
-
}
|
|
9569
9590
|
}
|
|
9570
9591
|
node = node.return;
|
|
9571
9592
|
} while (node !== null);
|
|
@@ -9734,6 +9755,7 @@ function FiberNode(tag, pendingProps, key, mode) {
|
|
|
9734
9755
|
// Instance
|
|
9735
9756
|
this.tag = tag;
|
|
9736
9757
|
this.key = key;
|
|
9758
|
+
this.elementType = null;
|
|
9737
9759
|
this.type = null;
|
|
9738
9760
|
this.stateNode = null;
|
|
9739
9761
|
|
|
@@ -9806,16 +9828,20 @@ function shouldConstruct(Component) {
|
|
|
9806
9828
|
return !!(prototype && prototype.isReactComponent);
|
|
9807
9829
|
}
|
|
9808
9830
|
|
|
9809
|
-
function
|
|
9831
|
+
function isSimpleFunctionComponent(type) {
|
|
9832
|
+
return typeof type === 'function' && !shouldConstruct(type) && type.defaultProps === undefined;
|
|
9833
|
+
}
|
|
9834
|
+
|
|
9835
|
+
function resolveLazyComponentTag(Component) {
|
|
9810
9836
|
if (typeof Component === 'function') {
|
|
9811
|
-
return shouldConstruct(Component) ?
|
|
9837
|
+
return shouldConstruct(Component) ? ClassComponent : FunctionComponent;
|
|
9812
9838
|
} else if (Component !== undefined && Component !== null) {
|
|
9813
9839
|
var $$typeof = Component.$$typeof;
|
|
9814
9840
|
if ($$typeof === REACT_FORWARD_REF_TYPE) {
|
|
9815
|
-
return
|
|
9841
|
+
return ForwardRef;
|
|
9816
9842
|
}
|
|
9817
|
-
if ($$typeof ===
|
|
9818
|
-
return
|
|
9843
|
+
if ($$typeof === REACT_MEMO_TYPE) {
|
|
9844
|
+
return MemoComponent;
|
|
9819
9845
|
}
|
|
9820
9846
|
}
|
|
9821
9847
|
return IndeterminateComponent;
|
|
@@ -9831,6 +9857,7 @@ function createWorkInProgress(current, pendingProps, expirationTime) {
|
|
|
9831
9857
|
// extra objects for things that are never updated. It also allow us to
|
|
9832
9858
|
// reclaim the extra memory if needed.
|
|
9833
9859
|
workInProgress = createFiber(current.tag, pendingProps, current.key, current.mode);
|
|
9860
|
+
workInProgress.elementType = current.elementType;
|
|
9834
9861
|
workInProgress.type = current.type;
|
|
9835
9862
|
workInProgress.stateNode = current.stateNode;
|
|
9836
9863
|
|
|
@@ -9900,20 +9927,17 @@ function createHostRootFiber(isConcurrent) {
|
|
|
9900
9927
|
return createFiber(HostRoot, null, null, mode);
|
|
9901
9928
|
}
|
|
9902
9929
|
|
|
9903
|
-
function
|
|
9904
|
-
|
|
9905
|
-
{
|
|
9906
|
-
owner = element._owner;
|
|
9907
|
-
}
|
|
9908
|
-
|
|
9930
|
+
function createFiberFromTypeAndProps(type, // React$ElementType
|
|
9931
|
+
key, pendingProps, owner, mode, expirationTime) {
|
|
9909
9932
|
var fiber = void 0;
|
|
9910
|
-
var type = element.type;
|
|
9911
|
-
var key = element.key;
|
|
9912
|
-
var pendingProps = element.props;
|
|
9913
9933
|
|
|
9914
|
-
var fiberTag =
|
|
9934
|
+
var fiberTag = IndeterminateComponent;
|
|
9935
|
+
// The resolved type is set if we know what the final type will be. I.e. it's not lazy.
|
|
9936
|
+
var resolvedType = type;
|
|
9915
9937
|
if (typeof type === 'function') {
|
|
9916
|
-
|
|
9938
|
+
if (shouldConstruct(type)) {
|
|
9939
|
+
fiberTag = ClassComponent;
|
|
9940
|
+
}
|
|
9917
9941
|
} else if (typeof type === 'string') {
|
|
9918
9942
|
fiberTag = HostComponent;
|
|
9919
9943
|
} else {
|
|
@@ -9921,18 +9945,13 @@ function createFiberFromElement(element, mode, expirationTime) {
|
|
|
9921
9945
|
case REACT_FRAGMENT_TYPE:
|
|
9922
9946
|
return createFiberFromFragment(pendingProps.children, mode, expirationTime, key);
|
|
9923
9947
|
case REACT_CONCURRENT_MODE_TYPE:
|
|
9924
|
-
|
|
9925
|
-
mode |= ConcurrentMode | StrictMode;
|
|
9926
|
-
break;
|
|
9948
|
+
return createFiberFromMode(pendingProps, mode | ConcurrentMode | StrictMode, expirationTime, key);
|
|
9927
9949
|
case REACT_STRICT_MODE_TYPE:
|
|
9928
|
-
|
|
9929
|
-
mode |= StrictMode;
|
|
9930
|
-
break;
|
|
9950
|
+
return createFiberFromMode(pendingProps, mode | StrictMode, expirationTime, key);
|
|
9931
9951
|
case REACT_PROFILER_TYPE:
|
|
9932
9952
|
return createFiberFromProfiler(pendingProps, mode, expirationTime, key);
|
|
9933
9953
|
case REACT_SUSPENSE_TYPE:
|
|
9934
|
-
|
|
9935
|
-
break;
|
|
9954
|
+
return createFiberFromSuspense(pendingProps, mode, expirationTime, key);
|
|
9936
9955
|
default:
|
|
9937
9956
|
{
|
|
9938
9957
|
if (typeof type === 'object' && type !== null) {
|
|
@@ -9947,16 +9966,13 @@ function createFiberFromElement(element, mode, expirationTime) {
|
|
|
9947
9966
|
case REACT_FORWARD_REF_TYPE:
|
|
9948
9967
|
fiberTag = ForwardRef;
|
|
9949
9968
|
break getTag;
|
|
9950
|
-
case
|
|
9951
|
-
fiberTag =
|
|
9969
|
+
case REACT_MEMO_TYPE:
|
|
9970
|
+
fiberTag = MemoComponent;
|
|
9971
|
+
break getTag;
|
|
9972
|
+
case REACT_LAZY_TYPE:
|
|
9973
|
+
fiberTag = LazyComponent;
|
|
9974
|
+
resolvedType = null;
|
|
9952
9975
|
break getTag;
|
|
9953
|
-
default:
|
|
9954
|
-
{
|
|
9955
|
-
if (typeof type.then === 'function') {
|
|
9956
|
-
fiberTag = IndeterminateComponent;
|
|
9957
|
-
break getTag;
|
|
9958
|
-
}
|
|
9959
|
-
}
|
|
9960
9976
|
}
|
|
9961
9977
|
}
|
|
9962
9978
|
var info = '';
|
|
@@ -9975,14 +9991,26 @@ function createFiberFromElement(element, mode, expirationTime) {
|
|
|
9975
9991
|
}
|
|
9976
9992
|
|
|
9977
9993
|
fiber = createFiber(fiberTag, pendingProps, key, mode);
|
|
9978
|
-
fiber.
|
|
9994
|
+
fiber.elementType = type;
|
|
9995
|
+
fiber.type = resolvedType;
|
|
9979
9996
|
fiber.expirationTime = expirationTime;
|
|
9980
9997
|
|
|
9998
|
+
return fiber;
|
|
9999
|
+
}
|
|
10000
|
+
|
|
10001
|
+
function createFiberFromElement(element, mode, expirationTime) {
|
|
10002
|
+
var owner = null;
|
|
10003
|
+
{
|
|
10004
|
+
owner = element._owner;
|
|
10005
|
+
}
|
|
10006
|
+
var type = element.type;
|
|
10007
|
+
var key = element.key;
|
|
10008
|
+
var pendingProps = element.props;
|
|
10009
|
+
var fiber = createFiberFromTypeAndProps(type, key, pendingProps, owner, mode, expirationTime);
|
|
9981
10010
|
{
|
|
9982
10011
|
fiber._debugSource = element._source;
|
|
9983
10012
|
fiber._debugOwner = element._owner;
|
|
9984
10013
|
}
|
|
9985
|
-
|
|
9986
10014
|
return fiber;
|
|
9987
10015
|
}
|
|
9988
10016
|
|
|
@@ -10000,12 +10028,38 @@ function createFiberFromProfiler(pendingProps, mode, expirationTime, key) {
|
|
|
10000
10028
|
}
|
|
10001
10029
|
|
|
10002
10030
|
var fiber = createFiber(Profiler, pendingProps, key, mode | ProfileMode);
|
|
10031
|
+
// TODO: The Profiler fiber shouldn't have a type. It has a tag.
|
|
10032
|
+
fiber.elementType = REACT_PROFILER_TYPE;
|
|
10003
10033
|
fiber.type = REACT_PROFILER_TYPE;
|
|
10004
10034
|
fiber.expirationTime = expirationTime;
|
|
10005
10035
|
|
|
10006
10036
|
return fiber;
|
|
10007
10037
|
}
|
|
10008
10038
|
|
|
10039
|
+
function createFiberFromMode(pendingProps, mode, expirationTime, key) {
|
|
10040
|
+
var fiber = createFiber(Mode, pendingProps, key, mode);
|
|
10041
|
+
|
|
10042
|
+
// TODO: The Mode fiber shouldn't have a type. It has a tag.
|
|
10043
|
+
var type = (mode & ConcurrentMode) === NoContext ? REACT_STRICT_MODE_TYPE : REACT_CONCURRENT_MODE_TYPE;
|
|
10044
|
+
fiber.elementType = type;
|
|
10045
|
+
fiber.type = type;
|
|
10046
|
+
|
|
10047
|
+
fiber.expirationTime = expirationTime;
|
|
10048
|
+
return fiber;
|
|
10049
|
+
}
|
|
10050
|
+
|
|
10051
|
+
function createFiberFromSuspense(pendingProps, mode, expirationTime, key) {
|
|
10052
|
+
var fiber = createFiber(SuspenseComponent, pendingProps, key, mode);
|
|
10053
|
+
|
|
10054
|
+
// TODO: The SuspenseComponent fiber shouldn't have a type. It has a tag.
|
|
10055
|
+
var type = REACT_SUSPENSE_TYPE;
|
|
10056
|
+
fiber.elementType = type;
|
|
10057
|
+
fiber.type = type;
|
|
10058
|
+
|
|
10059
|
+
fiber.expirationTime = expirationTime;
|
|
10060
|
+
return fiber;
|
|
10061
|
+
}
|
|
10062
|
+
|
|
10009
10063
|
function createFiberFromText(content, mode, expirationTime) {
|
|
10010
10064
|
var fiber = createFiber(HostText, content, null, mode);
|
|
10011
10065
|
fiber.expirationTime = expirationTime;
|
|
@@ -10014,6 +10068,8 @@ function createFiberFromText(content, mode, expirationTime) {
|
|
|
10014
10068
|
|
|
10015
10069
|
function createFiberFromHostInstanceForDeletion() {
|
|
10016
10070
|
var fiber = createFiber(HostComponent, null, null, NoContext);
|
|
10071
|
+
// TODO: These should not need a type.
|
|
10072
|
+
fiber.elementType = 'DELETED';
|
|
10017
10073
|
fiber.type = 'DELETED';
|
|
10018
10074
|
return fiber;
|
|
10019
10075
|
}
|
|
@@ -10046,6 +10102,7 @@ function assignFiberPropertiesInDEV(target, source) {
|
|
|
10046
10102
|
|
|
10047
10103
|
target.tag = source.tag;
|
|
10048
10104
|
target.key = source.key;
|
|
10105
|
+
target.elementType = source.elementType;
|
|
10049
10106
|
target.type = source.type;
|
|
10050
10107
|
target.stateNode = source.stateNode;
|
|
10051
10108
|
target.return = source.return;
|
|
@@ -10906,7 +10963,7 @@ function enqueueUpdate(fiber, update) {
|
|
|
10906
10963
|
}
|
|
10907
10964
|
|
|
10908
10965
|
{
|
|
10909
|
-
if (
|
|
10966
|
+
if (fiber.tag === ClassComponent && (currentlyProcessingQueue === queue1 || queue2 !== null && currentlyProcessingQueue === queue2) && !didWarnUpdateInsideUpdate) {
|
|
10910
10967
|
warningWithoutStack$1(false, 'An update (setState, replaceState, or forceUpdate) was scheduled ' + 'from inside an update function. Update functions should be pure, ' + 'with zero side-effects. Consider using componentDidUpdate or a ' + 'callback.');
|
|
10911
10968
|
didWarnUpdateInsideUpdate = true;
|
|
10912
10969
|
}
|
|
@@ -11279,7 +11336,7 @@ function propagateContextChange(workInProgress, context, changedBits, renderExpi
|
|
|
11279
11336
|
if (dependency.context === context && (dependency.observedBits & changedBits) !== 0) {
|
|
11280
11337
|
// Match! Schedule an update on this fiber.
|
|
11281
11338
|
|
|
11282
|
-
if (fiber.tag === ClassComponent
|
|
11339
|
+
if (fiber.tag === ClassComponent) {
|
|
11283
11340
|
// Schedule a force update on the work-in-progress.
|
|
11284
11341
|
var update = createUpdate(renderExpirationTime);
|
|
11285
11342
|
update.tag = ForceUpdate;
|
|
@@ -11386,7 +11443,7 @@ function readContext(context, observedBits) {
|
|
|
11386
11443
|
};
|
|
11387
11444
|
|
|
11388
11445
|
if (lastContextDependency === null) {
|
|
11389
|
-
!(currentlyRenderingFiber !== null) ? invariant(false, 'Context
|
|
11446
|
+
!(currentlyRenderingFiber !== null) ? invariant(false, 'Context can only be read while React is rendering, e.g. inside the render method or getDerivedStateFromProps.') : void 0;
|
|
11390
11447
|
// This is the first dependency in the list
|
|
11391
11448
|
currentlyRenderingFiber.firstContextDependency = lastContextDependency = contextItem;
|
|
11392
11449
|
} else {
|
|
@@ -11519,6 +11576,13 @@ function stopProfilerTimerIfRunningAndRecordDelta(fiber, overrideBaseTime) {
|
|
|
11519
11576
|
}
|
|
11520
11577
|
}
|
|
11521
11578
|
|
|
11579
|
+
var ReactCurrentOwner$4 = ReactSharedInternals.ReactCurrentOwner;
|
|
11580
|
+
|
|
11581
|
+
function readContext$1(contextType) {
|
|
11582
|
+
var dispatcher = ReactCurrentOwner$4.currentDispatcher;
|
|
11583
|
+
return dispatcher.readContext(contextType);
|
|
11584
|
+
}
|
|
11585
|
+
|
|
11522
11586
|
var fakeInternalInstance = {};
|
|
11523
11587
|
var isArray$1 = Array.isArray;
|
|
11524
11588
|
|
|
@@ -11776,13 +11840,13 @@ function constructClassInstance(workInProgress, ctor, props, renderExpirationTim
|
|
|
11776
11840
|
var contextType = ctor.contextType;
|
|
11777
11841
|
if (typeof contextType === 'object' && contextType !== null) {
|
|
11778
11842
|
{
|
|
11779
|
-
if (typeof
|
|
11843
|
+
if (contextType.$$typeof !== REACT_CONTEXT_TYPE && !didWarnAboutInvalidateContextType.has(ctor)) {
|
|
11780
11844
|
didWarnAboutInvalidateContextType.add(ctor);
|
|
11781
11845
|
warningWithoutStack$1(false, '%s defines an invalid contextType. ' + 'contextType should point to the Context object returned by React.createContext(). ' + 'Did you accidentally pass the Context.Provider instead?', getComponentName(ctor) || 'Component');
|
|
11782
11846
|
}
|
|
11783
11847
|
}
|
|
11784
11848
|
|
|
11785
|
-
context = contextType
|
|
11849
|
+
context = readContext$1(contextType);
|
|
11786
11850
|
} else {
|
|
11787
11851
|
unmaskedContext = getUnmaskedContext(workInProgress, ctor, true);
|
|
11788
11852
|
var contextTypes = ctor.contextTypes;
|
|
@@ -11909,7 +11973,7 @@ function mountClassInstance(workInProgress, ctor, newProps, renderExpirationTime
|
|
|
11909
11973
|
|
|
11910
11974
|
var contextType = ctor.contextType;
|
|
11911
11975
|
if (typeof contextType === 'object' && contextType !== null) {
|
|
11912
|
-
instance.context = contextType
|
|
11976
|
+
instance.context = readContext$1(contextType);
|
|
11913
11977
|
} else {
|
|
11914
11978
|
var unmaskedContext = getUnmaskedContext(workInProgress, ctor, true);
|
|
11915
11979
|
instance.context = getMaskedContext(workInProgress, unmaskedContext);
|
|
@@ -11975,7 +12039,7 @@ function resumeMountClassInstance(workInProgress, ctor, newProps, renderExpirati
|
|
|
11975
12039
|
var contextType = ctor.contextType;
|
|
11976
12040
|
var nextContext = void 0;
|
|
11977
12041
|
if (typeof contextType === 'object' && contextType !== null) {
|
|
11978
|
-
nextContext = contextType
|
|
12042
|
+
nextContext = readContext$1(contextType);
|
|
11979
12043
|
} else {
|
|
11980
12044
|
var nextLegacyUnmaskedContext = getUnmaskedContext(workInProgress, ctor, true);
|
|
11981
12045
|
nextContext = getMaskedContext(workInProgress, nextLegacyUnmaskedContext);
|
|
@@ -12070,7 +12134,7 @@ function updateClassInstance(current, workInProgress, ctor, newProps, renderExpi
|
|
|
12070
12134
|
var contextType = ctor.contextType;
|
|
12071
12135
|
var nextContext = void 0;
|
|
12072
12136
|
if (typeof contextType === 'object' && contextType !== null) {
|
|
12073
|
-
nextContext = contextType
|
|
12137
|
+
nextContext = readContext$1(contextType);
|
|
12074
12138
|
} else {
|
|
12075
12139
|
var nextUnmaskedContext = getUnmaskedContext(workInProgress, ctor, true);
|
|
12076
12140
|
nextContext = getMaskedContext(workInProgress, nextUnmaskedContext);
|
|
@@ -12232,7 +12296,7 @@ function coerceRef(returnFiber, current$$1, element) {
|
|
|
12232
12296
|
var inst = void 0;
|
|
12233
12297
|
if (owner) {
|
|
12234
12298
|
var ownerFiber = owner;
|
|
12235
|
-
!(ownerFiber.tag === ClassComponent
|
|
12299
|
+
!(ownerFiber.tag === ClassComponent) ? invariant(false, 'Function components cannot have refs.') : void 0;
|
|
12236
12300
|
inst = ownerFiber.stateNode;
|
|
12237
12301
|
}
|
|
12238
12302
|
!inst ? invariant(false, 'Missing owner for string ref %s. This error is likely caused by a bug in React. Please file an issue.', mixedRef) : void 0;
|
|
@@ -12400,7 +12464,7 @@ function ChildReconciler(shouldTrackSideEffects) {
|
|
|
12400
12464
|
}
|
|
12401
12465
|
|
|
12402
12466
|
function updateElement(returnFiber, current$$1, element, expirationTime) {
|
|
12403
|
-
if (current$$1 !== null && current$$1.
|
|
12467
|
+
if (current$$1 !== null && current$$1.elementType === element.type) {
|
|
12404
12468
|
// Move based on index
|
|
12405
12469
|
var existing = useFiber(current$$1, element.props, expirationTime);
|
|
12406
12470
|
existing.ref = coerceRef(returnFiber, current$$1, element);
|
|
@@ -12942,7 +13006,7 @@ function ChildReconciler(shouldTrackSideEffects) {
|
|
|
12942
13006
|
// TODO: If key === null and child.key === null, then this only applies to
|
|
12943
13007
|
// the first item in the list.
|
|
12944
13008
|
if (child.key === key) {
|
|
12945
|
-
if (child.tag === Fragment ? element.type === REACT_FRAGMENT_TYPE : child.
|
|
13009
|
+
if (child.tag === Fragment ? element.type === REACT_FRAGMENT_TYPE : child.elementType === element.type) {
|
|
12946
13010
|
deleteRemainingChildren(returnFiber, child.sibling);
|
|
12947
13011
|
var existing = useFiber(child, element.type === REACT_FRAGMENT_TYPE ? element.props.children : element.props, expirationTime);
|
|
12948
13012
|
existing.ref = coerceRef(returnFiber, child, element);
|
|
@@ -13057,7 +13121,6 @@ function ChildReconciler(shouldTrackSideEffects) {
|
|
|
13057
13121
|
// we already threw above.
|
|
13058
13122
|
switch (returnFiber.tag) {
|
|
13059
13123
|
case ClassComponent:
|
|
13060
|
-
case ClassComponentLazy:
|
|
13061
13124
|
{
|
|
13062
13125
|
{
|
|
13063
13126
|
var instance = returnFiber.stateNode;
|
|
@@ -13372,40 +13435,49 @@ function resetHydrationState() {
|
|
|
13372
13435
|
isHydrating = false;
|
|
13373
13436
|
}
|
|
13374
13437
|
|
|
13375
|
-
function readLazyComponentType(
|
|
13376
|
-
var status =
|
|
13438
|
+
function readLazyComponentType(lazyComponent) {
|
|
13439
|
+
var status = lazyComponent._status;
|
|
13440
|
+
var result = lazyComponent._result;
|
|
13377
13441
|
switch (status) {
|
|
13378
13442
|
case Resolved:
|
|
13379
|
-
|
|
13380
|
-
|
|
13443
|
+
{
|
|
13444
|
+
var Component = result;
|
|
13445
|
+
return Component;
|
|
13446
|
+
}
|
|
13381
13447
|
case Rejected:
|
|
13382
|
-
|
|
13448
|
+
{
|
|
13449
|
+
var error = result;
|
|
13450
|
+
throw error;
|
|
13451
|
+
}
|
|
13383
13452
|
case Pending:
|
|
13384
|
-
|
|
13453
|
+
{
|
|
13454
|
+
var thenable = result;
|
|
13455
|
+
throw thenable;
|
|
13456
|
+
}
|
|
13385
13457
|
default:
|
|
13386
13458
|
{
|
|
13387
|
-
|
|
13388
|
-
|
|
13389
|
-
|
|
13390
|
-
|
|
13391
|
-
|
|
13392
|
-
|
|
13393
|
-
|
|
13394
|
-
|
|
13395
|
-
|
|
13396
|
-
|
|
13397
|
-
} else {
|
|
13398
|
-
resolvedValue = resolvedValue;
|
|
13459
|
+
lazyComponent._status = Pending;
|
|
13460
|
+
var ctor = lazyComponent._ctor;
|
|
13461
|
+
var _thenable = ctor();
|
|
13462
|
+
_thenable.then(function (moduleObject) {
|
|
13463
|
+
if (lazyComponent._status === Pending) {
|
|
13464
|
+
var defaultExport = moduleObject.default;
|
|
13465
|
+
{
|
|
13466
|
+
if (defaultExport === undefined) {
|
|
13467
|
+
warning$1(false, 'lazy: Expected the result of a dynamic import() call. ' + 'Instead received: %s\n\nYour code should look like: \n ' + "const MyComponent = lazy(() => import('./MyComponent'))", moduleObject);
|
|
13468
|
+
}
|
|
13399
13469
|
}
|
|
13400
|
-
|
|
13470
|
+
lazyComponent._status = Resolved;
|
|
13471
|
+
lazyComponent._result = defaultExport;
|
|
13401
13472
|
}
|
|
13402
13473
|
}, function (error) {
|
|
13403
|
-
if (
|
|
13404
|
-
|
|
13405
|
-
|
|
13474
|
+
if (lazyComponent._status === Pending) {
|
|
13475
|
+
lazyComponent._status = Rejected;
|
|
13476
|
+
lazyComponent._result = error;
|
|
13406
13477
|
}
|
|
13407
13478
|
});
|
|
13408
|
-
|
|
13479
|
+
lazyComponent._result = _thenable;
|
|
13480
|
+
throw _thenable;
|
|
13409
13481
|
}
|
|
13410
13482
|
}
|
|
13411
13483
|
}
|
|
@@ -13481,51 +13553,64 @@ function updateForwardRef(current$$1, workInProgress, type, nextProps, renderExp
|
|
|
13481
13553
|
}
|
|
13482
13554
|
|
|
13483
13555
|
reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
|
|
13484
|
-
memoizeProps(workInProgress, nextProps);
|
|
13485
13556
|
return workInProgress.child;
|
|
13486
13557
|
}
|
|
13487
13558
|
|
|
13488
|
-
function
|
|
13489
|
-
|
|
13490
|
-
|
|
13491
|
-
|
|
13492
|
-
|
|
13559
|
+
function updateMemoComponent(current$$1, workInProgress, Component, nextProps, updateExpirationTime, renderExpirationTime) {
|
|
13560
|
+
if (current$$1 === null) {
|
|
13561
|
+
var type = Component.type;
|
|
13562
|
+
if (isSimpleFunctionComponent(type) && Component.compare === null) {
|
|
13563
|
+
// If this is a plain function component without default props,
|
|
13564
|
+
// and with only the default shallow comparison, we upgrade it
|
|
13565
|
+
// to a SimpleMemoComponent to allow fast path updates.
|
|
13566
|
+
workInProgress.tag = SimpleMemoComponent;
|
|
13567
|
+
workInProgress.type = type;
|
|
13568
|
+
return updateSimpleMemoComponent(current$$1, workInProgress, type, nextProps, updateExpirationTime, renderExpirationTime);
|
|
13569
|
+
}
|
|
13570
|
+
var child = createFiberFromTypeAndProps(Component.type, null, nextProps, null, workInProgress.mode, renderExpirationTime);
|
|
13571
|
+
child.ref = workInProgress.ref;
|
|
13572
|
+
child.return = workInProgress;
|
|
13573
|
+
workInProgress.child = child;
|
|
13574
|
+
return child;
|
|
13575
|
+
}
|
|
13576
|
+
var currentChild = current$$1.child; // This is always exactly one child
|
|
13577
|
+
if (updateExpirationTime === NoWork || updateExpirationTime > renderExpirationTime) {
|
|
13578
|
+
// This will be the props with resolved defaultProps,
|
|
13579
|
+
// unlike current.memoizedProps which will be the unresolved ones.
|
|
13580
|
+
var prevProps = currentChild.memoizedProps;
|
|
13493
13581
|
// Default to shallow comparison
|
|
13494
13582
|
var compare = Component.compare;
|
|
13495
13583
|
compare = compare !== null ? compare : shallowEqual;
|
|
13496
|
-
if (compare(prevProps, nextProps)) {
|
|
13584
|
+
if (compare(prevProps, nextProps) && current$$1.ref === workInProgress.ref) {
|
|
13497
13585
|
return bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
|
|
13498
13586
|
}
|
|
13499
13587
|
}
|
|
13588
|
+
var newChild = createWorkInProgress(currentChild, nextProps, renderExpirationTime);
|
|
13589
|
+
newChild.ref = workInProgress.ref;
|
|
13590
|
+
newChild.return = workInProgress;
|
|
13591
|
+
workInProgress.child = newChild;
|
|
13592
|
+
return newChild;
|
|
13593
|
+
}
|
|
13500
13594
|
|
|
13501
|
-
|
|
13502
|
-
|
|
13503
|
-
|
|
13504
|
-
|
|
13505
|
-
|
|
13506
|
-
|
|
13507
|
-
nextChildren = render(nextProps);
|
|
13508
|
-
setCurrentPhase(null);
|
|
13595
|
+
function updateSimpleMemoComponent(current$$1, workInProgress, Component, nextProps, updateExpirationTime, renderExpirationTime) {
|
|
13596
|
+
if (current$$1 !== null && (updateExpirationTime === NoWork || updateExpirationTime > renderExpirationTime)) {
|
|
13597
|
+
var prevProps = current$$1.memoizedProps;
|
|
13598
|
+
if (shallowEqual(prevProps, nextProps) && current$$1.ref === workInProgress.ref) {
|
|
13599
|
+
return bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
|
|
13600
|
+
}
|
|
13509
13601
|
}
|
|
13510
|
-
|
|
13511
|
-
// React DevTools reads this flag.
|
|
13512
|
-
workInProgress.effectTag |= PerformedWork;
|
|
13513
|
-
reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
|
|
13514
|
-
memoizeProps(workInProgress, nextProps);
|
|
13515
|
-
return workInProgress.child;
|
|
13602
|
+
return updateFunctionComponent(current$$1, workInProgress, Component, nextProps, renderExpirationTime);
|
|
13516
13603
|
}
|
|
13517
13604
|
|
|
13518
13605
|
function updateFragment(current$$1, workInProgress, renderExpirationTime) {
|
|
13519
13606
|
var nextChildren = workInProgress.pendingProps;
|
|
13520
13607
|
reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
|
|
13521
|
-
memoizeProps(workInProgress, nextChildren);
|
|
13522
13608
|
return workInProgress.child;
|
|
13523
13609
|
}
|
|
13524
13610
|
|
|
13525
13611
|
function updateMode(current$$1, workInProgress, renderExpirationTime) {
|
|
13526
13612
|
var nextChildren = workInProgress.pendingProps.children;
|
|
13527
13613
|
reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
|
|
13528
|
-
memoizeProps(workInProgress, nextChildren);
|
|
13529
13614
|
return workInProgress.child;
|
|
13530
13615
|
}
|
|
13531
13616
|
|
|
@@ -13536,7 +13621,6 @@ function updateProfiler(current$$1, workInProgress, renderExpirationTime) {
|
|
|
13536
13621
|
var nextProps = workInProgress.pendingProps;
|
|
13537
13622
|
var nextChildren = nextProps.children;
|
|
13538
13623
|
reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
|
|
13539
|
-
memoizeProps(workInProgress, nextProps);
|
|
13540
13624
|
return workInProgress.child;
|
|
13541
13625
|
}
|
|
13542
13626
|
|
|
@@ -13564,7 +13648,6 @@ function updateFunctionComponent(current$$1, workInProgress, Component, nextProp
|
|
|
13564
13648
|
// React DevTools reads this flag.
|
|
13565
13649
|
workInProgress.effectTag |= PerformedWork;
|
|
13566
13650
|
reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
|
|
13567
|
-
memoizeProps(workInProgress, nextProps);
|
|
13568
13651
|
return workInProgress.child;
|
|
13569
13652
|
}
|
|
13570
13653
|
|
|
@@ -13581,17 +13664,26 @@ function updateClassComponent(current$$1, workInProgress, Component, nextProps,
|
|
|
13581
13664
|
}
|
|
13582
13665
|
prepareToReadContext(workInProgress, renderExpirationTime);
|
|
13583
13666
|
|
|
13667
|
+
var instance = workInProgress.stateNode;
|
|
13584
13668
|
var shouldUpdate = void 0;
|
|
13585
|
-
if (
|
|
13586
|
-
if (
|
|
13587
|
-
//
|
|
13588
|
-
|
|
13589
|
-
|
|
13590
|
-
|
|
13591
|
-
|
|
13592
|
-
|
|
13593
|
-
|
|
13594
|
-
|
|
13669
|
+
if (instance === null) {
|
|
13670
|
+
if (current$$1 !== null) {
|
|
13671
|
+
// An class component without an instance only mounts if it suspended
|
|
13672
|
+
// inside a non- concurrent tree, in an inconsistent state. We want to
|
|
13673
|
+
// tree it like a new mount, even though an empty version of it already
|
|
13674
|
+
// committed. Disconnect the alternate pointers.
|
|
13675
|
+
current$$1.alternate = null;
|
|
13676
|
+
workInProgress.alternate = null;
|
|
13677
|
+
// Since this is conceptually a new fiber, schedule a Placement effect
|
|
13678
|
+
workInProgress.effectTag |= Placement;
|
|
13679
|
+
}
|
|
13680
|
+
// In the initial pass we might need to construct the instance.
|
|
13681
|
+
constructClassInstance(workInProgress, Component, nextProps, renderExpirationTime);
|
|
13682
|
+
mountClassInstance(workInProgress, Component, nextProps, renderExpirationTime);
|
|
13683
|
+
shouldUpdate = true;
|
|
13684
|
+
} else if (current$$1 === null) {
|
|
13685
|
+
// In a resume, we'll already have an instance we can reuse.
|
|
13686
|
+
shouldUpdate = resumeMountClassInstance(workInProgress, Component, nextProps, renderExpirationTime);
|
|
13595
13687
|
} else {
|
|
13596
13688
|
shouldUpdate = updateClassInstance(current$$1, workInProgress, Component, nextProps, renderExpirationTime);
|
|
13597
13689
|
}
|
|
@@ -13652,10 +13744,9 @@ function finishClassComponent(current$$1, workInProgress, Component, shouldUpdat
|
|
|
13652
13744
|
reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
|
|
13653
13745
|
}
|
|
13654
13746
|
|
|
13655
|
-
// Memoize
|
|
13747
|
+
// Memoize state using the values we just used to render.
|
|
13656
13748
|
// TODO: Restructure so we never read values from the instance.
|
|
13657
|
-
|
|
13658
|
-
memoizeProps(workInProgress, instance.props);
|
|
13749
|
+
workInProgress.memoizedState = instance.state;
|
|
13659
13750
|
|
|
13660
13751
|
// The context might have changed so we need to recalculate it.
|
|
13661
13752
|
if (hasContext) {
|
|
@@ -13752,12 +13843,10 @@ function updateHostComponent(current$$1, workInProgress, renderExpirationTime) {
|
|
|
13752
13843
|
if (renderExpirationTime !== Never && workInProgress.mode & ConcurrentMode && shouldDeprioritizeSubtree(type, nextProps)) {
|
|
13753
13844
|
// Schedule this fiber to re-render at offscreen priority. Then bailout.
|
|
13754
13845
|
workInProgress.expirationTime = Never;
|
|
13755
|
-
workInProgress.memoizedProps = nextProps;
|
|
13756
13846
|
return null;
|
|
13757
13847
|
}
|
|
13758
13848
|
|
|
13759
13849
|
reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
|
|
13760
|
-
memoizeProps(workInProgress, nextProps);
|
|
13761
13850
|
return workInProgress.child;
|
|
13762
13851
|
}
|
|
13763
13852
|
|
|
@@ -13765,8 +13854,6 @@ function updateHostText(current$$1, workInProgress) {
|
|
|
13765
13854
|
if (current$$1 === null) {
|
|
13766
13855
|
tryToClaimNextHydratableInstance(workInProgress);
|
|
13767
13856
|
}
|
|
13768
|
-
var nextProps = workInProgress.pendingProps;
|
|
13769
|
-
memoizeProps(workInProgress, nextProps);
|
|
13770
13857
|
// Nothing to do here. This is terminal. We'll do the completion step
|
|
13771
13858
|
// immediately after.
|
|
13772
13859
|
return null;
|
|
@@ -13787,48 +13874,110 @@ function resolveDefaultProps(Component, baseProps) {
|
|
|
13787
13874
|
return baseProps;
|
|
13788
13875
|
}
|
|
13789
13876
|
|
|
13790
|
-
function
|
|
13791
|
-
|
|
13877
|
+
function mountLazyComponent(_current, workInProgress, elementType, updateExpirationTime, renderExpirationTime) {
|
|
13878
|
+
if (_current !== null) {
|
|
13879
|
+
// An lazy component only mounts if it suspended inside a non-
|
|
13880
|
+
// concurrent tree, in an inconsistent state. We want to tree it like
|
|
13881
|
+
// a new mount, even though an empty version of it already committed.
|
|
13882
|
+
// Disconnect the alternate pointers.
|
|
13883
|
+
_current.alternate = null;
|
|
13884
|
+
workInProgress.alternate = null;
|
|
13885
|
+
// Since this is conceptually a new fiber, schedule a Placement effect
|
|
13886
|
+
workInProgress.effectTag |= Placement;
|
|
13887
|
+
}
|
|
13792
13888
|
|
|
13793
13889
|
var props = workInProgress.pendingProps;
|
|
13794
|
-
|
|
13795
|
-
|
|
13796
|
-
|
|
13797
|
-
|
|
13798
|
-
|
|
13799
|
-
|
|
13800
|
-
|
|
13801
|
-
|
|
13802
|
-
|
|
13803
|
-
|
|
13804
|
-
|
|
13805
|
-
|
|
13806
|
-
|
|
13807
|
-
|
|
13808
|
-
|
|
13809
|
-
|
|
13810
|
-
|
|
13811
|
-
|
|
13812
|
-
|
|
13813
|
-
|
|
13814
|
-
|
|
13815
|
-
|
|
13816
|
-
|
|
13817
|
-
|
|
13818
|
-
|
|
13819
|
-
|
|
13820
|
-
|
|
13821
|
-
|
|
13822
|
-
|
|
13823
|
-
|
|
13824
|
-
|
|
13825
|
-
|
|
13826
|
-
|
|
13827
|
-
|
|
13828
|
-
|
|
13829
|
-
|
|
13890
|
+
// We can't start a User Timing measurement with correct label yet.
|
|
13891
|
+
// Cancel and resume right after we know the tag.
|
|
13892
|
+
cancelWorkTimer(workInProgress);
|
|
13893
|
+
var Component = readLazyComponentType(elementType);
|
|
13894
|
+
// Store the unwrapped component in the type.
|
|
13895
|
+
workInProgress.type = Component;
|
|
13896
|
+
var resolvedTag = workInProgress.tag = resolveLazyComponentTag(Component);
|
|
13897
|
+
startWorkTimer(workInProgress);
|
|
13898
|
+
var resolvedProps = resolveDefaultProps(Component, props);
|
|
13899
|
+
var child = void 0;
|
|
13900
|
+
switch (resolvedTag) {
|
|
13901
|
+
case FunctionComponent:
|
|
13902
|
+
{
|
|
13903
|
+
child = updateFunctionComponent(null, workInProgress, Component, resolvedProps, renderExpirationTime);
|
|
13904
|
+
break;
|
|
13905
|
+
}
|
|
13906
|
+
case ClassComponent:
|
|
13907
|
+
{
|
|
13908
|
+
child = updateClassComponent(null, workInProgress, Component, resolvedProps, renderExpirationTime);
|
|
13909
|
+
break;
|
|
13910
|
+
}
|
|
13911
|
+
case ForwardRef:
|
|
13912
|
+
{
|
|
13913
|
+
child = updateForwardRef(null, workInProgress, Component, resolvedProps, renderExpirationTime);
|
|
13914
|
+
break;
|
|
13915
|
+
}
|
|
13916
|
+
case MemoComponent:
|
|
13917
|
+
{
|
|
13918
|
+
child = updateMemoComponent(null, workInProgress, Component, resolveDefaultProps(Component.type, resolvedProps), // The inner type can have defaults too
|
|
13919
|
+
updateExpirationTime, renderExpirationTime);
|
|
13920
|
+
break;
|
|
13921
|
+
}
|
|
13922
|
+
default:
|
|
13923
|
+
{
|
|
13924
|
+
// This message intentionally doesn't metion ForwardRef or MemoComponent
|
|
13925
|
+
// because the fact that it's a separate type of work is an
|
|
13926
|
+
// implementation detail.
|
|
13927
|
+
invariant(false, 'Element type is invalid. Received a promise that resolves to: %s. Promise elements must resolve to a class or function.', Component);
|
|
13928
|
+
}
|
|
13929
|
+
}
|
|
13930
|
+
return child;
|
|
13931
|
+
}
|
|
13932
|
+
|
|
13933
|
+
function mountIncompleteClassComponent(_current, workInProgress, Component, nextProps, renderExpirationTime) {
|
|
13934
|
+
if (_current !== null) {
|
|
13935
|
+
// An incomplete component only mounts if it suspended inside a non-
|
|
13936
|
+
// concurrent tree, in an inconsistent state. We want to tree it like
|
|
13937
|
+
// a new mount, even though an empty version of it already committed.
|
|
13938
|
+
// Disconnect the alternate pointers.
|
|
13939
|
+
_current.alternate = null;
|
|
13940
|
+
workInProgress.alternate = null;
|
|
13941
|
+
// Since this is conceptually a new fiber, schedule a Placement effect
|
|
13942
|
+
workInProgress.effectTag |= Placement;
|
|
13830
13943
|
}
|
|
13831
13944
|
|
|
13945
|
+
// Promote the fiber to a class and try rendering again.
|
|
13946
|
+
workInProgress.tag = ClassComponent;
|
|
13947
|
+
|
|
13948
|
+
// The rest of this function is a fork of `updateClassComponent`
|
|
13949
|
+
|
|
13950
|
+
// Push context providers early to prevent context stack mismatches.
|
|
13951
|
+
// During mounting we don't know the child context yet as the instance doesn't exist.
|
|
13952
|
+
// We will invalidate the child context in finishClassComponent() right after rendering.
|
|
13953
|
+
var hasContext = void 0;
|
|
13954
|
+
if (isContextProvider(Component)) {
|
|
13955
|
+
hasContext = true;
|
|
13956
|
+
pushContextProvider(workInProgress);
|
|
13957
|
+
} else {
|
|
13958
|
+
hasContext = false;
|
|
13959
|
+
}
|
|
13960
|
+
prepareToReadContext(workInProgress, renderExpirationTime);
|
|
13961
|
+
|
|
13962
|
+
constructClassInstance(workInProgress, Component, nextProps, renderExpirationTime);
|
|
13963
|
+
mountClassInstance(workInProgress, Component, nextProps, renderExpirationTime);
|
|
13964
|
+
|
|
13965
|
+
return finishClassComponent(null, workInProgress, Component, true, hasContext, renderExpirationTime);
|
|
13966
|
+
}
|
|
13967
|
+
|
|
13968
|
+
function mountIndeterminateComponent(_current, workInProgress, Component, renderExpirationTime) {
|
|
13969
|
+
if (_current !== null) {
|
|
13970
|
+
// An indeterminate component only mounts if it suspended inside a non-
|
|
13971
|
+
// concurrent tree, in an inconsistent state. We want to tree it like
|
|
13972
|
+
// a new mount, even though an empty version of it already committed.
|
|
13973
|
+
// Disconnect the alternate pointers.
|
|
13974
|
+
_current.alternate = null;
|
|
13975
|
+
workInProgress.alternate = null;
|
|
13976
|
+
// Since this is conceptually a new fiber, schedule a Placement effect
|
|
13977
|
+
workInProgress.effectTag |= Placement;
|
|
13978
|
+
}
|
|
13979
|
+
|
|
13980
|
+
var props = workInProgress.pendingProps;
|
|
13832
13981
|
var unmaskedContext = getUnmaskedContext(workInProgress, Component, false);
|
|
13833
13982
|
var context = getMaskedContext(workInProgress, unmaskedContext);
|
|
13834
13983
|
|
|
@@ -13880,7 +14029,7 @@ function mountIndeterminateComponent(current$$1, workInProgress, Component, upda
|
|
|
13880
14029
|
|
|
13881
14030
|
adoptClassInstance(workInProgress, value);
|
|
13882
14031
|
mountClassInstance(workInProgress, Component, props, renderExpirationTime);
|
|
13883
|
-
return finishClassComponent(
|
|
14032
|
+
return finishClassComponent(null, workInProgress, Component, true, hasContext, renderExpirationTime);
|
|
13884
14033
|
} else {
|
|
13885
14034
|
// Proceed under the assumption that this is a function component
|
|
13886
14035
|
workInProgress.tag = FunctionComponent;
|
|
@@ -13924,64 +14073,166 @@ function mountIndeterminateComponent(current$$1, workInProgress, Component, upda
|
|
|
13924
14073
|
}
|
|
13925
14074
|
}
|
|
13926
14075
|
}
|
|
13927
|
-
reconcileChildren(
|
|
13928
|
-
memoizeProps(workInProgress, props);
|
|
14076
|
+
reconcileChildren(null, workInProgress, value, renderExpirationTime);
|
|
13929
14077
|
return workInProgress.child;
|
|
13930
14078
|
}
|
|
13931
14079
|
}
|
|
13932
14080
|
|
|
13933
14081
|
function updateSuspenseComponent(current$$1, workInProgress, renderExpirationTime) {
|
|
14082
|
+
var mode = workInProgress.mode;
|
|
13934
14083
|
var nextProps = workInProgress.pendingProps;
|
|
13935
14084
|
|
|
13936
|
-
//
|
|
13937
|
-
//
|
|
13938
|
-
var
|
|
13939
|
-
|
|
13940
|
-
|
|
13941
|
-
if (current$$1 !== null && workInProgress.updateQueue !== null) {
|
|
13942
|
-
// We're outside strict mode. Something inside this Placeholder boundary
|
|
13943
|
-
// suspended during the last commit. Switch to the placholder.
|
|
13944
|
-
workInProgress.updateQueue = null;
|
|
13945
|
-
nextDidTimeout = true;
|
|
14085
|
+
// We should attempt to render the primary children unless this boundary
|
|
14086
|
+
// already suspended during this render (`alreadyCaptured` is true).
|
|
14087
|
+
var nextState = workInProgress.memoizedState;
|
|
14088
|
+
if (nextState === null) {
|
|
14089
|
+
// An empty suspense state means this boundary has not yet timed out.
|
|
13946
14090
|
} else {
|
|
13947
|
-
|
|
14091
|
+
if (!nextState.alreadyCaptured) {
|
|
14092
|
+
// Since we haven't already suspended during this commit, clear the
|
|
14093
|
+
// existing suspense state. We'll try rendering again.
|
|
14094
|
+
nextState = null;
|
|
14095
|
+
} else {
|
|
14096
|
+
// Something in this boundary's subtree already suspended. Switch to
|
|
14097
|
+
// rendering the fallback children. Set `alreadyCaptured` to true.
|
|
14098
|
+
if (current$$1 !== null && nextState === current$$1.memoizedState) {
|
|
14099
|
+
// Create a new suspense state to avoid mutating the current tree's.
|
|
14100
|
+
nextState = {
|
|
14101
|
+
alreadyCaptured: true,
|
|
14102
|
+
didTimeout: true,
|
|
14103
|
+
timedOutAt: nextState.timedOutAt
|
|
14104
|
+
};
|
|
14105
|
+
} else {
|
|
14106
|
+
// Already have a clone, so it's safe to mutate.
|
|
14107
|
+
nextState.alreadyCaptured = true;
|
|
14108
|
+
nextState.didTimeout = true;
|
|
14109
|
+
}
|
|
14110
|
+
}
|
|
13948
14111
|
}
|
|
14112
|
+
var nextDidTimeout = nextState !== null && nextState.didTimeout;
|
|
13949
14113
|
|
|
13950
|
-
|
|
14114
|
+
// This next part is a bit confusing. If the children timeout, we switch to
|
|
14115
|
+
// showing the fallback children in place of the "primary" children.
|
|
14116
|
+
// However, we don't want to delete the primary children because then their
|
|
14117
|
+
// state will be lost (both the React state and the host state, e.g.
|
|
14118
|
+
// uncontrolled form inputs). Instead we keep them mounted and hide them.
|
|
14119
|
+
// Both the fallback children AND the primary children are rendered at the
|
|
14120
|
+
// same time. Once the primary children are un-suspended, we can delete
|
|
14121
|
+
// the fallback children — don't need to preserve their state.
|
|
14122
|
+
//
|
|
14123
|
+
// The two sets of children are siblings in the host environment, but
|
|
14124
|
+
// semantically, for purposes of reconciliation, they are two separate sets.
|
|
14125
|
+
// So we store them using two fragment fibers.
|
|
14126
|
+
//
|
|
14127
|
+
// However, we want to avoid allocating extra fibers for every placeholder.
|
|
14128
|
+
// They're only necessary when the children time out, because that's the
|
|
14129
|
+
// only time when both sets are mounted.
|
|
14130
|
+
//
|
|
14131
|
+
// So, the extra fragment fibers are only used if the children time out.
|
|
14132
|
+
// Otherwise, we render the primary children directly. This requires some
|
|
14133
|
+
// custom reconciliation logic to preserve the state of the primary
|
|
14134
|
+
// children. It's essentially a very basic form of re-parenting.
|
|
14135
|
+
|
|
14136
|
+
// `child` points to the child fiber. In the normal case, this is the first
|
|
14137
|
+
// fiber of the primary children set. In the timed-out case, it's a
|
|
14138
|
+
// a fragment fiber containing the primary children.
|
|
14139
|
+
var child = void 0;
|
|
14140
|
+
// `next` points to the next fiber React should render. In the normal case,
|
|
14141
|
+
// it's the same as `child`: the first fiber of the primary children set.
|
|
14142
|
+
// In the timed-out case, it's a fragment fiber containing the *fallback*
|
|
14143
|
+
// children -- we skip over the primary children entirely.
|
|
14144
|
+
var next = void 0;
|
|
14145
|
+
if (current$$1 === null) {
|
|
14146
|
+
// This is the initial mount. This branch is pretty simple because there's
|
|
14147
|
+
// no previous state that needs to be preserved.
|
|
13951
14148
|
if (nextDidTimeout) {
|
|
13952
|
-
//
|
|
13953
|
-
|
|
13954
|
-
|
|
14149
|
+
// Mount separate fragments for primary and fallback children.
|
|
14150
|
+
var nextFallbackChildren = nextProps.fallback;
|
|
14151
|
+
var primaryChildFragment = createFiberFromFragment(null, mode, NoWork, null);
|
|
14152
|
+
var fallbackChildFragment = createFiberFromFragment(nextFallbackChildren, mode, renderExpirationTime, null);
|
|
14153
|
+
primaryChildFragment.sibling = fallbackChildFragment;
|
|
14154
|
+
child = primaryChildFragment;
|
|
14155
|
+
// Skip the primary children, and continue working on the
|
|
14156
|
+
// fallback children.
|
|
14157
|
+
next = fallbackChildFragment;
|
|
14158
|
+
child.return = next.return = workInProgress;
|
|
13955
14159
|
} else {
|
|
13956
|
-
//
|
|
13957
|
-
|
|
13958
|
-
|
|
14160
|
+
// Mount the primary children without an intermediate fragment fiber.
|
|
14161
|
+
var nextPrimaryChildren = nextProps.children;
|
|
14162
|
+
child = next = mountChildFibers(workInProgress, null, nextPrimaryChildren, renderExpirationTime);
|
|
13959
14163
|
}
|
|
13960
|
-
}
|
|
13961
|
-
|
|
13962
|
-
// If the `children` prop is a function, treat it like a render prop.
|
|
13963
|
-
// TODO: This is temporary until we finalize a lower level API.
|
|
13964
|
-
var children = nextProps.children;
|
|
13965
|
-
var nextChildren = void 0;
|
|
13966
|
-
if (typeof children === 'function') {
|
|
13967
|
-
nextChildren = children(nextDidTimeout);
|
|
13968
14164
|
} else {
|
|
13969
|
-
|
|
14165
|
+
// This is an update. This branch is more complicated because we need to
|
|
14166
|
+
// ensure the state of the primary children is preserved.
|
|
14167
|
+
var prevState = current$$1.memoizedState;
|
|
14168
|
+
var prevDidTimeout = prevState !== null && prevState.didTimeout;
|
|
14169
|
+
if (prevDidTimeout) {
|
|
14170
|
+
// The current tree already timed out. That means each child set is
|
|
14171
|
+
var currentPrimaryChildFragment = current$$1.child;
|
|
14172
|
+
var currentFallbackChildFragment = currentPrimaryChildFragment.sibling;
|
|
14173
|
+
if (nextDidTimeout) {
|
|
14174
|
+
// Still timed out. Reuse the current primary children by cloning
|
|
14175
|
+
// its fragment. We're going to skip over these entirely.
|
|
14176
|
+
var _nextFallbackChildren = nextProps.fallback;
|
|
14177
|
+
var _primaryChildFragment = createWorkInProgress(currentPrimaryChildFragment, currentPrimaryChildFragment.pendingProps, NoWork);
|
|
14178
|
+
_primaryChildFragment.effectTag |= Placement;
|
|
14179
|
+
// Clone the fallback child fragment, too. These we'll continue
|
|
14180
|
+
// working on.
|
|
14181
|
+
var _fallbackChildFragment = _primaryChildFragment.sibling = createWorkInProgress(currentFallbackChildFragment, _nextFallbackChildren, currentFallbackChildFragment.expirationTime);
|
|
14182
|
+
_fallbackChildFragment.effectTag |= Placement;
|
|
14183
|
+
child = _primaryChildFragment;
|
|
14184
|
+
_primaryChildFragment.childExpirationTime = NoWork;
|
|
14185
|
+
// Skip the primary children, and continue working on the
|
|
14186
|
+
// fallback children.
|
|
14187
|
+
next = _fallbackChildFragment;
|
|
14188
|
+
child.return = next.return = workInProgress;
|
|
14189
|
+
} else {
|
|
14190
|
+
// No longer suspended. Switch back to showing the primary children,
|
|
14191
|
+
// and remove the intermediate fragment fiber.
|
|
14192
|
+
var _nextPrimaryChildren = nextProps.children;
|
|
14193
|
+
var currentPrimaryChild = currentPrimaryChildFragment.child;
|
|
14194
|
+
var currentFallbackChild = currentFallbackChildFragment.child;
|
|
14195
|
+
var primaryChild = reconcileChildFibers(workInProgress, currentPrimaryChild, _nextPrimaryChildren, renderExpirationTime);
|
|
14196
|
+
// Delete the fallback children.
|
|
14197
|
+
reconcileChildFibers(workInProgress, currentFallbackChild, null, renderExpirationTime);
|
|
14198
|
+
// Continue rendering the children, like we normally do.
|
|
14199
|
+
child = next = primaryChild;
|
|
14200
|
+
}
|
|
14201
|
+
} else {
|
|
14202
|
+
// The current tree has not already timed out. That means the primary
|
|
14203
|
+
var _currentPrimaryChild = current$$1.child;
|
|
14204
|
+
if (nextDidTimeout) {
|
|
14205
|
+
// Timed out. Wrap the children in a fragment fiber to keep them
|
|
14206
|
+
// separate from the fallback children.
|
|
14207
|
+
var _nextFallbackChildren2 = nextProps.fallback;
|
|
14208
|
+
var _primaryChildFragment2 = createFiberFromFragment(
|
|
14209
|
+
// It shouldn't matter what the pending props are because we aren't
|
|
14210
|
+
// going to render this fragment.
|
|
14211
|
+
null, mode, NoWork, null);
|
|
14212
|
+
_primaryChildFragment2.effectTag |= Placement;
|
|
14213
|
+
_primaryChildFragment2.child = _currentPrimaryChild;
|
|
14214
|
+
_currentPrimaryChild.return = _primaryChildFragment2;
|
|
14215
|
+
// Create a fragment from the fallback children, too.
|
|
14216
|
+
var _fallbackChildFragment2 = _primaryChildFragment2.sibling = createFiberFromFragment(_nextFallbackChildren2, mode, renderExpirationTime, null);
|
|
14217
|
+
_fallbackChildFragment2.effectTag |= Placement;
|
|
14218
|
+
child = _primaryChildFragment2;
|
|
14219
|
+
_primaryChildFragment2.childExpirationTime = NoWork;
|
|
14220
|
+
// Skip the primary children, and continue working on the
|
|
14221
|
+
// fallback children.
|
|
14222
|
+
next = _fallbackChildFragment2;
|
|
14223
|
+
child.return = next.return = workInProgress;
|
|
14224
|
+
} else {
|
|
14225
|
+
// Still haven't timed out. Continue rendering the children, like we
|
|
14226
|
+
// normally do.
|
|
14227
|
+
var _nextPrimaryChildren2 = nextProps.children;
|
|
14228
|
+
next = child = reconcileChildFibers(workInProgress, _currentPrimaryChild, _nextPrimaryChildren2, renderExpirationTime);
|
|
14229
|
+
}
|
|
14230
|
+
}
|
|
13970
14231
|
}
|
|
13971
14232
|
|
|
13972
|
-
|
|
13973
|
-
|
|
13974
|
-
|
|
13975
|
-
// happen to be stored in the same set. Call this special function to
|
|
13976
|
-
// force the new set not to match with the current set.
|
|
13977
|
-
// TODO: The proper way to model this is by storing each set separately.
|
|
13978
|
-
forceUnmountCurrentAndReconcile(current$$1, workInProgress, nextChildren, renderExpirationTime);
|
|
13979
|
-
} else {
|
|
13980
|
-
reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
|
|
13981
|
-
}
|
|
13982
|
-
workInProgress.memoizedProps = nextProps;
|
|
13983
|
-
workInProgress.memoizedState = nextDidTimeout;
|
|
13984
|
-
return workInProgress.child;
|
|
14233
|
+
workInProgress.memoizedState = nextState;
|
|
14234
|
+
workInProgress.child = child;
|
|
14235
|
+
return next;
|
|
13985
14236
|
}
|
|
13986
14237
|
|
|
13987
14238
|
function updatePortalComponent(current$$1, workInProgress, renderExpirationTime) {
|
|
@@ -13994,10 +14245,8 @@ function updatePortalComponent(current$$1, workInProgress, renderExpirationTime)
|
|
|
13994
14245
|
// the root always starts with a "current" with a null child.
|
|
13995
14246
|
// TODO: Consider unifying this with how the root works.
|
|
13996
14247
|
workInProgress.child = reconcileChildFibers(workInProgress, null, nextChildren, renderExpirationTime);
|
|
13997
|
-
memoizeProps(workInProgress, nextChildren);
|
|
13998
14248
|
} else {
|
|
13999
14249
|
reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
|
|
14000
|
-
memoizeProps(workInProgress, nextChildren);
|
|
14001
14250
|
}
|
|
14002
14251
|
return workInProgress.child;
|
|
14003
14252
|
}
|
|
@@ -14010,7 +14259,6 @@ function updateContextProvider(current$$1, workInProgress, renderExpirationTime)
|
|
|
14010
14259
|
var oldProps = workInProgress.memoizedProps;
|
|
14011
14260
|
|
|
14012
14261
|
var newValue = newProps.value;
|
|
14013
|
-
workInProgress.memoizedProps = newProps;
|
|
14014
14262
|
|
|
14015
14263
|
{
|
|
14016
14264
|
var providerPropTypes = workInProgress.type.propTypes;
|
|
@@ -14042,8 +14290,32 @@ function updateContextProvider(current$$1, workInProgress, renderExpirationTime)
|
|
|
14042
14290
|
return workInProgress.child;
|
|
14043
14291
|
}
|
|
14044
14292
|
|
|
14293
|
+
var hasWarnedAboutUsingContextAsConsumer = false;
|
|
14294
|
+
|
|
14045
14295
|
function updateContextConsumer(current$$1, workInProgress, renderExpirationTime) {
|
|
14046
14296
|
var context = workInProgress.type;
|
|
14297
|
+
// The logic below for Context differs depending on PROD or DEV mode. In
|
|
14298
|
+
// DEV mode, we create a separate object for Context.Consumer that acts
|
|
14299
|
+
// like a proxy to Context. This proxy object adds unnecessary code in PROD
|
|
14300
|
+
// so we use the old behaviour (Context.Consumer references Context) to
|
|
14301
|
+
// reduce size and overhead. The separate object references context via
|
|
14302
|
+
// a property called "_context", which also gives us the ability to check
|
|
14303
|
+
// in DEV mode if this property exists or not and warn if it does not.
|
|
14304
|
+
{
|
|
14305
|
+
if (context._context === undefined) {
|
|
14306
|
+
// This may be because it's a Context (rather than a Consumer).
|
|
14307
|
+
// Or it may be because it's older React where they're the same thing.
|
|
14308
|
+
// We only want to warn if we're sure it's a new React.
|
|
14309
|
+
if (context !== context.Consumer) {
|
|
14310
|
+
if (!hasWarnedAboutUsingContextAsConsumer) {
|
|
14311
|
+
hasWarnedAboutUsingContextAsConsumer = true;
|
|
14312
|
+
warning$1(false, 'Rendering <Context> directly is not supported and will be removed in ' + 'a future major release. Did you mean to render <Context.Consumer> instead?');
|
|
14313
|
+
}
|
|
14314
|
+
}
|
|
14315
|
+
} else {
|
|
14316
|
+
context = context._context;
|
|
14317
|
+
}
|
|
14318
|
+
}
|
|
14047
14319
|
var newProps = workInProgress.pendingProps;
|
|
14048
14320
|
var render = newProps.children;
|
|
14049
14321
|
|
|
@@ -14064,7 +14336,6 @@ function updateContextConsumer(current$$1, workInProgress, renderExpirationTime)
|
|
|
14064
14336
|
// React DevTools reads this flag.
|
|
14065
14337
|
workInProgress.effectTag |= PerformedWork;
|
|
14066
14338
|
reconcileChildren(current$$1, workInProgress, newChildren, renderExpirationTime);
|
|
14067
|
-
workInProgress.memoizedProps = newProps;
|
|
14068
14339
|
return workInProgress.child;
|
|
14069
14340
|
}
|
|
14070
14341
|
|
|
@@ -14115,17 +14386,6 @@ function bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirati
|
|
|
14115
14386
|
}
|
|
14116
14387
|
}
|
|
14117
14388
|
|
|
14118
|
-
// TODO: Delete memoizeProps/State and move to reconcile/bailout instead
|
|
14119
|
-
function memoizeProps(workInProgress, nextProps) {
|
|
14120
|
-
workInProgress.memoizedProps = nextProps;
|
|
14121
|
-
}
|
|
14122
|
-
|
|
14123
|
-
function memoizeState(workInProgress, nextState) {
|
|
14124
|
-
workInProgress.memoizedState = nextState;
|
|
14125
|
-
// Don't reset the updateQueue, in case there are pending updates. Resetting
|
|
14126
|
-
// is handled by processUpdateQueue.
|
|
14127
|
-
}
|
|
14128
|
-
|
|
14129
14389
|
function beginWork(current$$1, workInProgress, renderExpirationTime) {
|
|
14130
14390
|
var updateExpirationTime = workInProgress.expirationTime;
|
|
14131
14391
|
|
|
@@ -14152,15 +14412,6 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
|
|
|
14152
14412
|
}
|
|
14153
14413
|
break;
|
|
14154
14414
|
}
|
|
14155
|
-
case ClassComponentLazy:
|
|
14156
|
-
{
|
|
14157
|
-
var thenable = workInProgress.type;
|
|
14158
|
-
var _Component = getResultFromResolvedThenable(thenable);
|
|
14159
|
-
if (isContextProvider(_Component)) {
|
|
14160
|
-
pushContextProvider(workInProgress);
|
|
14161
|
-
}
|
|
14162
|
-
break;
|
|
14163
|
-
}
|
|
14164
14415
|
case HostPortal:
|
|
14165
14416
|
pushHostContainer(workInProgress, workInProgress.stateNode.containerInfo);
|
|
14166
14417
|
break;
|
|
@@ -14175,6 +14426,35 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
|
|
|
14175
14426
|
workInProgress.effectTag |= Update;
|
|
14176
14427
|
}
|
|
14177
14428
|
break;
|
|
14429
|
+
case SuspenseComponent:
|
|
14430
|
+
{
|
|
14431
|
+
var state = workInProgress.memoizedState;
|
|
14432
|
+
var didTimeout = state !== null && state.didTimeout;
|
|
14433
|
+
if (didTimeout) {
|
|
14434
|
+
// If this boundary is currently timed out, we need to decide
|
|
14435
|
+
// whether to retry the primary children, or to skip over it and
|
|
14436
|
+
// go straight to the fallback. Check the priority of the primary
|
|
14437
|
+
var primaryChildFragment = workInProgress.child;
|
|
14438
|
+
var primaryChildExpirationTime = primaryChildFragment.childExpirationTime;
|
|
14439
|
+
if (primaryChildExpirationTime !== NoWork && primaryChildExpirationTime <= renderExpirationTime) {
|
|
14440
|
+
// The primary children have pending work. Use the normal path
|
|
14441
|
+
// to attempt to render the primary children again.
|
|
14442
|
+
return updateSuspenseComponent(current$$1, workInProgress, renderExpirationTime);
|
|
14443
|
+
} else {
|
|
14444
|
+
// The primary children do not have pending work with sufficient
|
|
14445
|
+
// priority. Bailout.
|
|
14446
|
+
var child = bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
|
|
14447
|
+
if (child !== null) {
|
|
14448
|
+
// The fallback children have pending work. Skip over the
|
|
14449
|
+
// primary children and work on the fallback.
|
|
14450
|
+
return child.sibling;
|
|
14451
|
+
} else {
|
|
14452
|
+
return null;
|
|
14453
|
+
}
|
|
14454
|
+
}
|
|
14455
|
+
}
|
|
14456
|
+
break;
|
|
14457
|
+
}
|
|
14178
14458
|
}
|
|
14179
14459
|
return bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
|
|
14180
14460
|
}
|
|
@@ -14186,38 +14466,27 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
|
|
|
14186
14466
|
switch (workInProgress.tag) {
|
|
14187
14467
|
case IndeterminateComponent:
|
|
14188
14468
|
{
|
|
14189
|
-
var
|
|
14190
|
-
return mountIndeterminateComponent(current$$1, workInProgress,
|
|
14469
|
+
var elementType = workInProgress.elementType;
|
|
14470
|
+
return mountIndeterminateComponent(current$$1, workInProgress, elementType, renderExpirationTime);
|
|
14191
14471
|
}
|
|
14192
|
-
case
|
|
14472
|
+
case LazyComponent:
|
|
14193
14473
|
{
|
|
14194
|
-
var
|
|
14195
|
-
|
|
14196
|
-
return updateFunctionComponent(current$$1, workInProgress, _Component3, unresolvedProps, renderExpirationTime);
|
|
14474
|
+
var _elementType = workInProgress.elementType;
|
|
14475
|
+
return mountLazyComponent(current$$1, workInProgress, _elementType, updateExpirationTime, renderExpirationTime);
|
|
14197
14476
|
}
|
|
14198
|
-
case
|
|
14477
|
+
case FunctionComponent:
|
|
14199
14478
|
{
|
|
14200
|
-
var
|
|
14201
|
-
var
|
|
14202
|
-
var
|
|
14203
|
-
|
|
14204
|
-
workInProgress.memoizedProps = _unresolvedProps;
|
|
14205
|
-
return child;
|
|
14479
|
+
var _Component = workInProgress.type;
|
|
14480
|
+
var unresolvedProps = workInProgress.pendingProps;
|
|
14481
|
+
var resolvedProps = workInProgress.elementType === _Component ? unresolvedProps : resolveDefaultProps(_Component, unresolvedProps);
|
|
14482
|
+
return updateFunctionComponent(current$$1, workInProgress, _Component, resolvedProps, renderExpirationTime);
|
|
14206
14483
|
}
|
|
14207
14484
|
case ClassComponent:
|
|
14208
14485
|
{
|
|
14209
|
-
var
|
|
14210
|
-
var
|
|
14211
|
-
|
|
14212
|
-
|
|
14213
|
-
case ClassComponentLazy:
|
|
14214
|
-
{
|
|
14215
|
-
var _thenable2 = workInProgress.type;
|
|
14216
|
-
var _Component6 = getResultFromResolvedThenable(_thenable2);
|
|
14217
|
-
var _unresolvedProps3 = workInProgress.pendingProps;
|
|
14218
|
-
var _child = updateClassComponent(current$$1, workInProgress, _Component6, resolveDefaultProps(_Component6, _unresolvedProps3), renderExpirationTime);
|
|
14219
|
-
workInProgress.memoizedProps = _unresolvedProps3;
|
|
14220
|
-
return _child;
|
|
14486
|
+
var _Component2 = workInProgress.type;
|
|
14487
|
+
var _unresolvedProps = workInProgress.pendingProps;
|
|
14488
|
+
var _resolvedProps = workInProgress.elementType === _Component2 ? _unresolvedProps : resolveDefaultProps(_Component2, _unresolvedProps);
|
|
14489
|
+
return updateClassComponent(current$$1, workInProgress, _Component2, _resolvedProps, renderExpirationTime);
|
|
14221
14490
|
}
|
|
14222
14491
|
case HostRoot:
|
|
14223
14492
|
return updateHostRoot(current$$1, workInProgress, renderExpirationTime);
|
|
@@ -14232,16 +14501,9 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
|
|
|
14232
14501
|
case ForwardRef:
|
|
14233
14502
|
{
|
|
14234
14503
|
var type = workInProgress.type;
|
|
14235
|
-
|
|
14236
|
-
|
|
14237
|
-
|
|
14238
|
-
{
|
|
14239
|
-
var _thenable3 = workInProgress.type;
|
|
14240
|
-
var _Component7 = getResultFromResolvedThenable(_thenable3);
|
|
14241
|
-
var _unresolvedProps4 = workInProgress.pendingProps;
|
|
14242
|
-
var _child2 = updateForwardRef(current$$1, workInProgress, _Component7, resolveDefaultProps(_Component7, _unresolvedProps4), renderExpirationTime);
|
|
14243
|
-
workInProgress.memoizedProps = _unresolvedProps4;
|
|
14244
|
-
return _child2;
|
|
14504
|
+
var _unresolvedProps2 = workInProgress.pendingProps;
|
|
14505
|
+
var _resolvedProps2 = workInProgress.elementType === type ? _unresolvedProps2 : resolveDefaultProps(type, _unresolvedProps2);
|
|
14506
|
+
return updateForwardRef(current$$1, workInProgress, type, _resolvedProps2, renderExpirationTime);
|
|
14245
14507
|
}
|
|
14246
14508
|
case Fragment:
|
|
14247
14509
|
return updateFragment(current$$1, workInProgress, renderExpirationTime);
|
|
@@ -14253,19 +14515,23 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
|
|
|
14253
14515
|
return updateContextProvider(current$$1, workInProgress, renderExpirationTime);
|
|
14254
14516
|
case ContextConsumer:
|
|
14255
14517
|
return updateContextConsumer(current$$1, workInProgress, renderExpirationTime);
|
|
14256
|
-
case
|
|
14518
|
+
case MemoComponent:
|
|
14257
14519
|
{
|
|
14258
14520
|
var _type = workInProgress.type;
|
|
14259
|
-
|
|
14521
|
+
var _unresolvedProps3 = workInProgress.pendingProps;
|
|
14522
|
+
var _resolvedProps3 = resolveDefaultProps(_type.type, _unresolvedProps3);
|
|
14523
|
+
return updateMemoComponent(current$$1, workInProgress, _type, _resolvedProps3, updateExpirationTime, renderExpirationTime);
|
|
14524
|
+
}
|
|
14525
|
+
case SimpleMemoComponent:
|
|
14526
|
+
{
|
|
14527
|
+
return updateSimpleMemoComponent(current$$1, workInProgress, workInProgress.type, workInProgress.pendingProps, updateExpirationTime, renderExpirationTime);
|
|
14260
14528
|
}
|
|
14261
|
-
case
|
|
14529
|
+
case IncompleteClassComponent:
|
|
14262
14530
|
{
|
|
14263
|
-
var
|
|
14264
|
-
var
|
|
14265
|
-
var
|
|
14266
|
-
|
|
14267
|
-
workInProgress.memoizedProps = _unresolvedProps5;
|
|
14268
|
-
return _child3;
|
|
14531
|
+
var _Component3 = workInProgress.type;
|
|
14532
|
+
var _unresolvedProps4 = workInProgress.pendingProps;
|
|
14533
|
+
var _resolvedProps4 = workInProgress.elementType === _Component3 ? _unresolvedProps4 : resolveDefaultProps(_Component3, _unresolvedProps4);
|
|
14534
|
+
return mountIncompleteClassComponent(current$$1, workInProgress, _Component3, _resolvedProps4, renderExpirationTime);
|
|
14269
14535
|
}
|
|
14270
14536
|
default:
|
|
14271
14537
|
invariant(false, 'Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue.');
|
|
@@ -14282,42 +14548,43 @@ function markRef$1(workInProgress) {
|
|
|
14282
14548
|
workInProgress.effectTag |= Ref;
|
|
14283
14549
|
}
|
|
14284
14550
|
|
|
14285
|
-
|
|
14286
|
-
// We only have the top Fiber that was created but we need recurse down its
|
|
14287
|
-
// children to find all the terminal nodes.
|
|
14288
|
-
var node = workInProgress.child;
|
|
14289
|
-
while (node !== null) {
|
|
14290
|
-
if (node.tag === HostComponent || node.tag === HostText) {
|
|
14291
|
-
appendInitialChild(parent, node.stateNode);
|
|
14292
|
-
} else if (node.tag === HostPortal) {
|
|
14293
|
-
// If we have a portal child, then we don't want to traverse
|
|
14294
|
-
// down its children. Instead, we'll get insertions from each child in
|
|
14295
|
-
// the portal directly.
|
|
14296
|
-
} else if (node.child !== null) {
|
|
14297
|
-
node.child.return = node;
|
|
14298
|
-
node = node.child;
|
|
14299
|
-
continue;
|
|
14300
|
-
}
|
|
14301
|
-
if (node === workInProgress) {
|
|
14302
|
-
return;
|
|
14303
|
-
}
|
|
14304
|
-
while (node.sibling === null) {
|
|
14305
|
-
if (node.return === null || node.return === workInProgress) {
|
|
14306
|
-
return;
|
|
14307
|
-
}
|
|
14308
|
-
node = node.return;
|
|
14309
|
-
}
|
|
14310
|
-
node.sibling.return = node.return;
|
|
14311
|
-
node = node.sibling;
|
|
14312
|
-
}
|
|
14313
|
-
}
|
|
14314
|
-
|
|
14551
|
+
var appendAllChildren = void 0;
|
|
14315
14552
|
var updateHostContainer = void 0;
|
|
14316
14553
|
var updateHostComponent$1 = void 0;
|
|
14317
14554
|
var updateHostText$1 = void 0;
|
|
14318
14555
|
if (supportsMutation) {
|
|
14319
14556
|
// Mutation mode
|
|
14320
14557
|
|
|
14558
|
+
appendAllChildren = function (parent, workInProgress, needsVisibilityToggle, isHidden) {
|
|
14559
|
+
// We only have the top Fiber that was created but we need recurse down its
|
|
14560
|
+
// children to find all the terminal nodes.
|
|
14561
|
+
var node = workInProgress.child;
|
|
14562
|
+
while (node !== null) {
|
|
14563
|
+
if (node.tag === HostComponent || node.tag === HostText) {
|
|
14564
|
+
appendInitialChild(parent, node.stateNode);
|
|
14565
|
+
} else if (node.tag === HostPortal) {
|
|
14566
|
+
// If we have a portal child, then we don't want to traverse
|
|
14567
|
+
// down its children. Instead, we'll get insertions from each child in
|
|
14568
|
+
// the portal directly.
|
|
14569
|
+
} else if (node.child !== null) {
|
|
14570
|
+
node.child.return = node;
|
|
14571
|
+
node = node.child;
|
|
14572
|
+
continue;
|
|
14573
|
+
}
|
|
14574
|
+
if (node === workInProgress) {
|
|
14575
|
+
return;
|
|
14576
|
+
}
|
|
14577
|
+
while (node.sibling === null) {
|
|
14578
|
+
if (node.return === null || node.return === workInProgress) {
|
|
14579
|
+
return;
|
|
14580
|
+
}
|
|
14581
|
+
node = node.return;
|
|
14582
|
+
}
|
|
14583
|
+
node.sibling.return = node.return;
|
|
14584
|
+
node = node.sibling;
|
|
14585
|
+
}
|
|
14586
|
+
};
|
|
14587
|
+
|
|
14321
14588
|
updateHostContainer = function (workInProgress) {
|
|
14322
14589
|
// Noop
|
|
14323
14590
|
};
|
|
@@ -14358,23 +14625,167 @@ if (supportsMutation) {
|
|
|
14358
14625
|
} else if (supportsPersistence) {
|
|
14359
14626
|
// Persistent host tree mode
|
|
14360
14627
|
|
|
14628
|
+
appendAllChildren = function (parent, workInProgress, needsVisibilityToggle, isHidden) {
|
|
14629
|
+
// We only have the top Fiber that was created but we need recurse down its
|
|
14630
|
+
// children to find all the terminal nodes.
|
|
14631
|
+
var node = workInProgress.child;
|
|
14632
|
+
while (node !== null) {
|
|
14633
|
+
// eslint-disable-next-line no-labels
|
|
14634
|
+
branches: if (node.tag === HostComponent) {
|
|
14635
|
+
var instance = node.stateNode;
|
|
14636
|
+
if (needsVisibilityToggle) {
|
|
14637
|
+
var props = node.memoizedProps;
|
|
14638
|
+
var type = node.type;
|
|
14639
|
+
if (isHidden) {
|
|
14640
|
+
// This child is inside a timed out tree. Hide it.
|
|
14641
|
+
instance = cloneHiddenInstance(instance, type, props, node);
|
|
14642
|
+
} else {
|
|
14643
|
+
// This child was previously inside a timed out tree. If it was not
|
|
14644
|
+
// updated during this render, it may need to be unhidden. Clone
|
|
14645
|
+
// again to be sure.
|
|
14646
|
+
instance = cloneUnhiddenInstance(instance, type, props, node);
|
|
14647
|
+
}
|
|
14648
|
+
node.stateNode = instance;
|
|
14649
|
+
}
|
|
14650
|
+
appendInitialChild(parent, instance);
|
|
14651
|
+
} else if (node.tag === HostText) {
|
|
14652
|
+
var _instance = node.stateNode;
|
|
14653
|
+
if (needsVisibilityToggle) {
|
|
14654
|
+
var text = node.memoizedProps;
|
|
14655
|
+
var rootContainerInstance = getRootHostContainer();
|
|
14656
|
+
var currentHostContext = getHostContext();
|
|
14657
|
+
if (isHidden) {
|
|
14658
|
+
_instance = createHiddenTextInstance(text, rootContainerInstance, currentHostContext, workInProgress);
|
|
14659
|
+
} else {
|
|
14660
|
+
_instance = createTextInstance(text, rootContainerInstance, currentHostContext, workInProgress);
|
|
14661
|
+
}
|
|
14662
|
+
node.stateNode = _instance;
|
|
14663
|
+
}
|
|
14664
|
+
appendInitialChild(parent, _instance);
|
|
14665
|
+
} else if (node.tag === HostPortal) {
|
|
14666
|
+
// If we have a portal child, then we don't want to traverse
|
|
14667
|
+
// down its children. Instead, we'll get insertions from each child in
|
|
14668
|
+
// the portal directly.
|
|
14669
|
+
} else if (node.tag === SuspenseComponent) {
|
|
14670
|
+
var current = node.alternate;
|
|
14671
|
+
if (current !== null) {
|
|
14672
|
+
var oldState = current.memoizedState;
|
|
14673
|
+
var newState = node.memoizedState;
|
|
14674
|
+
var oldIsHidden = oldState !== null && oldState.didTimeout;
|
|
14675
|
+
var newIsHidden = newState !== null && newState.didTimeout;
|
|
14676
|
+
if (oldIsHidden !== newIsHidden) {
|
|
14677
|
+
// The placeholder either just timed out or switched back to the normal
|
|
14678
|
+
// children after having previously timed out. Toggle the visibility of
|
|
14679
|
+
// the direct host children.
|
|
14680
|
+
var primaryChildParent = newIsHidden ? node.child : node;
|
|
14681
|
+
if (primaryChildParent !== null) {
|
|
14682
|
+
appendAllChildren(parent, primaryChildParent, true, newIsHidden);
|
|
14683
|
+
}
|
|
14684
|
+
// eslint-disable-next-line no-labels
|
|
14685
|
+
break branches;
|
|
14686
|
+
}
|
|
14687
|
+
}
|
|
14688
|
+
if (node.child !== null) {
|
|
14689
|
+
// Continue traversing like normal
|
|
14690
|
+
node.child.return = node;
|
|
14691
|
+
node = node.child;
|
|
14692
|
+
continue;
|
|
14693
|
+
}
|
|
14694
|
+
} else if (node.child !== null) {
|
|
14695
|
+
node.child.return = node;
|
|
14696
|
+
node = node.child;
|
|
14697
|
+
continue;
|
|
14698
|
+
}
|
|
14699
|
+
// $FlowFixMe This is correct but Flow is confused by the labeled break.
|
|
14700
|
+
node = node;
|
|
14701
|
+
if (node === workInProgress) {
|
|
14702
|
+
return;
|
|
14703
|
+
}
|
|
14704
|
+
while (node.sibling === null) {
|
|
14705
|
+
if (node.return === null || node.return === workInProgress) {
|
|
14706
|
+
return;
|
|
14707
|
+
}
|
|
14708
|
+
node = node.return;
|
|
14709
|
+
}
|
|
14710
|
+
node.sibling.return = node.return;
|
|
14711
|
+
node = node.sibling;
|
|
14712
|
+
}
|
|
14713
|
+
};
|
|
14714
|
+
|
|
14361
14715
|
// An unfortunate fork of appendAllChildren because we have two different parent types.
|
|
14362
|
-
var appendAllChildrenToContainer = function (containerChildSet, workInProgress) {
|
|
14716
|
+
var appendAllChildrenToContainer = function (containerChildSet, workInProgress, needsVisibilityToggle, isHidden) {
|
|
14363
14717
|
// We only have the top Fiber that was created but we need recurse down its
|
|
14364
14718
|
// children to find all the terminal nodes.
|
|
14365
14719
|
var node = workInProgress.child;
|
|
14366
14720
|
while (node !== null) {
|
|
14367
|
-
|
|
14368
|
-
|
|
14721
|
+
// eslint-disable-next-line no-labels
|
|
14722
|
+
branches: if (node.tag === HostComponent) {
|
|
14723
|
+
var instance = node.stateNode;
|
|
14724
|
+
if (needsVisibilityToggle) {
|
|
14725
|
+
var props = node.memoizedProps;
|
|
14726
|
+
var type = node.type;
|
|
14727
|
+
if (isHidden) {
|
|
14728
|
+
// This child is inside a timed out tree. Hide it.
|
|
14729
|
+
instance = cloneHiddenInstance(instance, type, props, node);
|
|
14730
|
+
} else {
|
|
14731
|
+
// This child was previously inside a timed out tree. If it was not
|
|
14732
|
+
// updated during this render, it may need to be unhidden. Clone
|
|
14733
|
+
// again to be sure.
|
|
14734
|
+
instance = cloneUnhiddenInstance(instance, type, props, node);
|
|
14735
|
+
}
|
|
14736
|
+
node.stateNode = instance;
|
|
14737
|
+
}
|
|
14738
|
+
appendChildToContainerChildSet(containerChildSet, instance);
|
|
14739
|
+
} else if (node.tag === HostText) {
|
|
14740
|
+
var _instance2 = node.stateNode;
|
|
14741
|
+
if (needsVisibilityToggle) {
|
|
14742
|
+
var text = node.memoizedProps;
|
|
14743
|
+
var rootContainerInstance = getRootHostContainer();
|
|
14744
|
+
var currentHostContext = getHostContext();
|
|
14745
|
+
if (isHidden) {
|
|
14746
|
+
_instance2 = createHiddenTextInstance(text, rootContainerInstance, currentHostContext, workInProgress);
|
|
14747
|
+
} else {
|
|
14748
|
+
_instance2 = createTextInstance(text, rootContainerInstance, currentHostContext, workInProgress);
|
|
14749
|
+
}
|
|
14750
|
+
node.stateNode = _instance2;
|
|
14751
|
+
}
|
|
14752
|
+
appendChildToContainerChildSet(containerChildSet, _instance2);
|
|
14369
14753
|
} else if (node.tag === HostPortal) {
|
|
14370
14754
|
// If we have a portal child, then we don't want to traverse
|
|
14371
14755
|
// down its children. Instead, we'll get insertions from each child in
|
|
14372
14756
|
// the portal directly.
|
|
14757
|
+
} else if (node.tag === SuspenseComponent) {
|
|
14758
|
+
var current = node.alternate;
|
|
14759
|
+
if (current !== null) {
|
|
14760
|
+
var oldState = current.memoizedState;
|
|
14761
|
+
var newState = node.memoizedState;
|
|
14762
|
+
var oldIsHidden = oldState !== null && oldState.didTimeout;
|
|
14763
|
+
var newIsHidden = newState !== null && newState.didTimeout;
|
|
14764
|
+
if (oldIsHidden !== newIsHidden) {
|
|
14765
|
+
// The placeholder either just timed out or switched back to the normal
|
|
14766
|
+
// children after having previously timed out. Toggle the visibility of
|
|
14767
|
+
// the direct host children.
|
|
14768
|
+
var primaryChildParent = newIsHidden ? node.child : node;
|
|
14769
|
+
if (primaryChildParent !== null) {
|
|
14770
|
+
appendAllChildrenToContainer(containerChildSet, primaryChildParent, true, newIsHidden);
|
|
14771
|
+
}
|
|
14772
|
+
// eslint-disable-next-line no-labels
|
|
14773
|
+
break branches;
|
|
14774
|
+
}
|
|
14775
|
+
}
|
|
14776
|
+
if (node.child !== null) {
|
|
14777
|
+
// Continue traversing like normal
|
|
14778
|
+
node.child.return = node;
|
|
14779
|
+
node = node.child;
|
|
14780
|
+
continue;
|
|
14781
|
+
}
|
|
14373
14782
|
} else if (node.child !== null) {
|
|
14374
14783
|
node.child.return = node;
|
|
14375
14784
|
node = node.child;
|
|
14376
14785
|
continue;
|
|
14377
14786
|
}
|
|
14787
|
+
// $FlowFixMe This is correct but Flow is confused by the labeled break.
|
|
14788
|
+
node = node;
|
|
14378
14789
|
if (node === workInProgress) {
|
|
14379
14790
|
return;
|
|
14380
14791
|
}
|
|
@@ -14397,7 +14808,7 @@ if (supportsMutation) {
|
|
|
14397
14808
|
var container = portalOrRoot.containerInfo;
|
|
14398
14809
|
var newChildSet = createContainerChildSet(container);
|
|
14399
14810
|
// If children might have changed, we have to add them all to the set.
|
|
14400
|
-
appendAllChildrenToContainer(newChildSet, workInProgress);
|
|
14811
|
+
appendAllChildrenToContainer(newChildSet, workInProgress, false, false);
|
|
14401
14812
|
portalOrRoot.pendingChildren = newChildSet;
|
|
14402
14813
|
// Schedule an update on the container to swap out the container.
|
|
14403
14814
|
markUpdate(workInProgress);
|
|
@@ -14440,7 +14851,7 @@ if (supportsMutation) {
|
|
|
14440
14851
|
markUpdate(workInProgress);
|
|
14441
14852
|
} else {
|
|
14442
14853
|
// If children might have changed, we have to add them all to the set.
|
|
14443
|
-
appendAllChildren(newInstance, workInProgress);
|
|
14854
|
+
appendAllChildren(newInstance, workInProgress, false, false);
|
|
14444
14855
|
}
|
|
14445
14856
|
};
|
|
14446
14857
|
updateHostText$1 = function (current, workInProgress, oldText, newText) {
|
|
@@ -14471,8 +14882,12 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
14471
14882
|
var newProps = workInProgress.pendingProps;
|
|
14472
14883
|
|
|
14473
14884
|
switch (workInProgress.tag) {
|
|
14885
|
+
case IndeterminateComponent:
|
|
14886
|
+
break;
|
|
14887
|
+
case LazyComponent:
|
|
14888
|
+
break;
|
|
14889
|
+
case SimpleMemoComponent:
|
|
14474
14890
|
case FunctionComponent:
|
|
14475
|
-
case FunctionComponentLazy:
|
|
14476
14891
|
break;
|
|
14477
14892
|
case ClassComponent:
|
|
14478
14893
|
{
|
|
@@ -14482,14 +14897,6 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
14482
14897
|
}
|
|
14483
14898
|
break;
|
|
14484
14899
|
}
|
|
14485
|
-
case ClassComponentLazy:
|
|
14486
|
-
{
|
|
14487
|
-
var _Component = getResultFromResolvedThenable(workInProgress.type);
|
|
14488
|
-
if (isContextProvider(_Component)) {
|
|
14489
|
-
popContext(workInProgress);
|
|
14490
|
-
}
|
|
14491
|
-
break;
|
|
14492
|
-
}
|
|
14493
14900
|
case HostRoot:
|
|
14494
14901
|
{
|
|
14495
14902
|
popHostContainer(workInProgress);
|
|
@@ -14545,7 +14952,7 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
14545
14952
|
} else {
|
|
14546
14953
|
var instance = createInstance(type, newProps, rootContainerInstance, currentHostContext, workInProgress);
|
|
14547
14954
|
|
|
14548
|
-
appendAllChildren(instance, workInProgress);
|
|
14955
|
+
appendAllChildren(instance, workInProgress, false, false);
|
|
14549
14956
|
|
|
14550
14957
|
// Certain renderers require commit-time effects for initial mount.
|
|
14551
14958
|
// (eg DOM renderer supports auto-focus for certain elements).
|
|
@@ -14590,10 +14997,20 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
14590
14997
|
break;
|
|
14591
14998
|
}
|
|
14592
14999
|
case ForwardRef:
|
|
14593
|
-
case ForwardRefLazy:
|
|
14594
15000
|
break;
|
|
14595
15001
|
case SuspenseComponent:
|
|
14596
|
-
|
|
15002
|
+
{
|
|
15003
|
+
var nextState = workInProgress.memoizedState;
|
|
15004
|
+
var prevState = current !== null ? current.memoizedState : null;
|
|
15005
|
+
var nextDidTimeout = nextState !== null && nextState.didTimeout;
|
|
15006
|
+
var prevDidTimeout = prevState !== null && prevState.didTimeout;
|
|
15007
|
+
if (nextDidTimeout !== prevDidTimeout) {
|
|
15008
|
+
// If this render commits, and it switches between the normal state
|
|
15009
|
+
// and the timed-out state, schedule an effect.
|
|
15010
|
+
workInProgress.effectTag |= Update;
|
|
15011
|
+
}
|
|
15012
|
+
break;
|
|
15013
|
+
}
|
|
14597
15014
|
case Fragment:
|
|
14598
15015
|
break;
|
|
14599
15016
|
case Mode:
|
|
@@ -14610,13 +15027,18 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
14610
15027
|
break;
|
|
14611
15028
|
case ContextConsumer:
|
|
14612
15029
|
break;
|
|
14613
|
-
case
|
|
14614
|
-
case PureComponentLazy:
|
|
15030
|
+
case MemoComponent:
|
|
14615
15031
|
break;
|
|
14616
|
-
|
|
14617
|
-
|
|
14618
|
-
|
|
14619
|
-
|
|
15032
|
+
case IncompleteClassComponent:
|
|
15033
|
+
{
|
|
15034
|
+
// Same as class component case. I put it down here so that the tags are
|
|
15035
|
+
// sequential to ensure this switch is compiled to a jump table.
|
|
15036
|
+
var _Component = workInProgress.type;
|
|
15037
|
+
if (isContextProvider(_Component)) {
|
|
15038
|
+
popContext(workInProgress);
|
|
15039
|
+
}
|
|
15040
|
+
break;
|
|
15041
|
+
}
|
|
14620
15042
|
default:
|
|
14621
15043
|
invariant(false, 'Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue.');
|
|
14622
15044
|
}
|
|
@@ -14624,6 +15046,17 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
14624
15046
|
return null;
|
|
14625
15047
|
}
|
|
14626
15048
|
|
|
15049
|
+
function shouldCaptureSuspense(current, workInProgress) {
|
|
15050
|
+
// In order to capture, the Suspense component must have a fallback prop.
|
|
15051
|
+
if (workInProgress.memoizedProps.fallback === undefined) {
|
|
15052
|
+
return false;
|
|
15053
|
+
}
|
|
15054
|
+
// If it was the primary children that just suspended, capture and render the
|
|
15055
|
+
// fallback. Otherwise, don't capture and bubble to the next boundary.
|
|
15056
|
+
var nextState = workInProgress.memoizedState;
|
|
15057
|
+
return nextState === null || !nextState.didTimeout;
|
|
15058
|
+
}
|
|
15059
|
+
|
|
14627
15060
|
// This module is forked in different environments.
|
|
14628
15061
|
// By default, return `true` to log errors to the console.
|
|
14629
15062
|
// Forks can return `false` if this isn't desirable.
|
|
@@ -14691,8 +15124,6 @@ function logCapturedError(capturedError) {
|
|
|
14691
15124
|
}
|
|
14692
15125
|
}
|
|
14693
15126
|
|
|
14694
|
-
var emptyObject = {};
|
|
14695
|
-
|
|
14696
15127
|
var didWarnAboutUndefinedSnapshotBeforeUpdate = null;
|
|
14697
15128
|
{
|
|
14698
15129
|
didWarnAboutUndefinedSnapshotBeforeUpdate = new Set();
|
|
@@ -14774,7 +15205,6 @@ function safelyDetachRef(current$$1) {
|
|
|
14774
15205
|
function commitBeforeMutationLifeCycles(current$$1, finishedWork) {
|
|
14775
15206
|
switch (finishedWork.tag) {
|
|
14776
15207
|
case ClassComponent:
|
|
14777
|
-
case ClassComponentLazy:
|
|
14778
15208
|
{
|
|
14779
15209
|
if (finishedWork.effectTag & Snapshot) {
|
|
14780
15210
|
if (current$$1 !== null) {
|
|
@@ -14802,6 +15232,7 @@ function commitBeforeMutationLifeCycles(current$$1, finishedWork) {
|
|
|
14802
15232
|
case HostComponent:
|
|
14803
15233
|
case HostText:
|
|
14804
15234
|
case HostPortal:
|
|
15235
|
+
case IncompleteClassComponent:
|
|
14805
15236
|
// Nothing to do for these component types
|
|
14806
15237
|
return;
|
|
14807
15238
|
default:
|
|
@@ -14814,7 +15245,6 @@ function commitBeforeMutationLifeCycles(current$$1, finishedWork) {
|
|
|
14814
15245
|
function commitLifeCycles(finishedRoot, current$$1, finishedWork, committedExpirationTime) {
|
|
14815
15246
|
switch (finishedWork.tag) {
|
|
14816
15247
|
case ClassComponent:
|
|
14817
|
-
case ClassComponentLazy:
|
|
14818
15248
|
{
|
|
14819
15249
|
var instance = finishedWork.stateNode;
|
|
14820
15250
|
if (finishedWork.effectTag & Update) {
|
|
@@ -14853,7 +15283,6 @@ function commitLifeCycles(finishedRoot, current$$1, finishedWork, committedExpir
|
|
|
14853
15283
|
_instance = getPublicInstance(finishedWork.child.stateNode);
|
|
14854
15284
|
break;
|
|
14855
15285
|
case ClassComponent:
|
|
14856
|
-
case ClassComponentLazy:
|
|
14857
15286
|
_instance = finishedWork.child.stateNode;
|
|
14858
15287
|
break;
|
|
14859
15288
|
}
|
|
@@ -14903,22 +15332,48 @@ function commitLifeCycles(finishedRoot, current$$1, finishedWork, committedExpir
|
|
|
14903
15332
|
}
|
|
14904
15333
|
case SuspenseComponent:
|
|
14905
15334
|
{
|
|
14906
|
-
if (
|
|
14907
|
-
// In
|
|
14908
|
-
//
|
|
14909
|
-
//
|
|
14910
|
-
|
|
14911
|
-
|
|
14912
|
-
|
|
15335
|
+
if (finishedWork.effectTag & Callback) {
|
|
15336
|
+
// In non-strict mode, a suspense boundary times out by commiting
|
|
15337
|
+
// twice: first, by committing the children in an inconsistent state,
|
|
15338
|
+
// then hiding them and showing the fallback children in a subsequent
|
|
15339
|
+
var _newState = {
|
|
15340
|
+
alreadyCaptured: true,
|
|
15341
|
+
didTimeout: false,
|
|
15342
|
+
timedOutAt: NoWork
|
|
15343
|
+
};
|
|
15344
|
+
finishedWork.memoizedState = _newState;
|
|
14913
15345
|
scheduleWork(finishedWork, Sync);
|
|
15346
|
+
return;
|
|
15347
|
+
}
|
|
15348
|
+
var oldState = current$$1 !== null ? current$$1.memoizedState : null;
|
|
15349
|
+
var newState = finishedWork.memoizedState;
|
|
15350
|
+
var oldDidTimeout = oldState !== null ? oldState.didTimeout : false;
|
|
15351
|
+
|
|
15352
|
+
var newDidTimeout = void 0;
|
|
15353
|
+
var primaryChildParent = finishedWork;
|
|
15354
|
+
if (newState === null) {
|
|
15355
|
+
newDidTimeout = false;
|
|
14914
15356
|
} else {
|
|
14915
|
-
|
|
14916
|
-
|
|
14917
|
-
|
|
14918
|
-
|
|
15357
|
+
newDidTimeout = newState.didTimeout;
|
|
15358
|
+
if (newDidTimeout) {
|
|
15359
|
+
primaryChildParent = finishedWork.child;
|
|
15360
|
+
newState.alreadyCaptured = false;
|
|
15361
|
+
if (newState.timedOutAt === NoWork) {
|
|
15362
|
+
// If the children had not already timed out, record the time.
|
|
15363
|
+
// This is used to compute the elapsed time during subsequent
|
|
15364
|
+
// attempts to render the children.
|
|
15365
|
+
newState.timedOutAt = requestCurrentTime();
|
|
15366
|
+
}
|
|
15367
|
+
}
|
|
15368
|
+
}
|
|
15369
|
+
|
|
15370
|
+
if (newDidTimeout !== oldDidTimeout && primaryChildParent !== null) {
|
|
15371
|
+
hideOrUnhideAllChildren(primaryChildParent, newDidTimeout);
|
|
14919
15372
|
}
|
|
14920
15373
|
return;
|
|
14921
15374
|
}
|
|
15375
|
+
case IncompleteClassComponent:
|
|
15376
|
+
break;
|
|
14922
15377
|
default:
|
|
14923
15378
|
{
|
|
14924
15379
|
invariant(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.');
|
|
@@ -14926,6 +15381,45 @@ function commitLifeCycles(finishedRoot, current$$1, finishedWork, committedExpir
|
|
|
14926
15381
|
}
|
|
14927
15382
|
}
|
|
14928
15383
|
|
|
15384
|
+
function hideOrUnhideAllChildren(finishedWork, isHidden) {
|
|
15385
|
+
if (supportsMutation) {
|
|
15386
|
+
// We only have the top Fiber that was inserted but we need recurse down its
|
|
15387
|
+
var node = finishedWork;
|
|
15388
|
+
while (true) {
|
|
15389
|
+
if (node.tag === HostComponent) {
|
|
15390
|
+
var instance = node.stateNode;
|
|
15391
|
+
if (isHidden) {
|
|
15392
|
+
hideInstance(instance);
|
|
15393
|
+
} else {
|
|
15394
|
+
unhideInstance(node.stateNode, node.memoizedProps);
|
|
15395
|
+
}
|
|
15396
|
+
} else if (node.tag === HostText) {
|
|
15397
|
+
var _instance3 = node.stateNode;
|
|
15398
|
+
if (isHidden) {
|
|
15399
|
+
hideTextInstance(_instance3);
|
|
15400
|
+
} else {
|
|
15401
|
+
unhideTextInstance(_instance3, node.memoizedProps);
|
|
15402
|
+
}
|
|
15403
|
+
} else if (node.child !== null) {
|
|
15404
|
+
node.child.return = node;
|
|
15405
|
+
node = node.child;
|
|
15406
|
+
continue;
|
|
15407
|
+
}
|
|
15408
|
+
if (node === finishedWork) {
|
|
15409
|
+
return;
|
|
15410
|
+
}
|
|
15411
|
+
while (node.sibling === null) {
|
|
15412
|
+
if (node.return === null || node.return === finishedWork) {
|
|
15413
|
+
return;
|
|
15414
|
+
}
|
|
15415
|
+
node = node.return;
|
|
15416
|
+
}
|
|
15417
|
+
node.sibling.return = node.return;
|
|
15418
|
+
node = node.sibling;
|
|
15419
|
+
}
|
|
15420
|
+
}
|
|
15421
|
+
}
|
|
15422
|
+
|
|
14929
15423
|
function commitAttachRef(finishedWork) {
|
|
14930
15424
|
var ref = finishedWork.ref;
|
|
14931
15425
|
if (ref !== null) {
|
|
@@ -14971,7 +15465,6 @@ function commitUnmount(current$$1) {
|
|
|
14971
15465
|
|
|
14972
15466
|
switch (current$$1.tag) {
|
|
14973
15467
|
case ClassComponent:
|
|
14974
|
-
case ClassComponentLazy:
|
|
14975
15468
|
{
|
|
14976
15469
|
safelyDetachRef(current$$1);
|
|
14977
15470
|
var instance = current$$1.stateNode;
|
|
@@ -15065,7 +15558,6 @@ function commitContainer(finishedWork) {
|
|
|
15065
15558
|
|
|
15066
15559
|
switch (finishedWork.tag) {
|
|
15067
15560
|
case ClassComponent:
|
|
15068
|
-
case ClassComponentLazy:
|
|
15069
15561
|
{
|
|
15070
15562
|
return;
|
|
15071
15563
|
}
|
|
@@ -15332,7 +15824,6 @@ function commitWork(current$$1, finishedWork) {
|
|
|
15332
15824
|
|
|
15333
15825
|
switch (finishedWork.tag) {
|
|
15334
15826
|
case ClassComponent:
|
|
15335
|
-
case ClassComponentLazy:
|
|
15336
15827
|
{
|
|
15337
15828
|
return;
|
|
15338
15829
|
}
|
|
@@ -15380,6 +15871,10 @@ function commitWork(current$$1, finishedWork) {
|
|
|
15380
15871
|
{
|
|
15381
15872
|
return;
|
|
15382
15873
|
}
|
|
15874
|
+
case IncompleteClassComponent:
|
|
15875
|
+
{
|
|
15876
|
+
return;
|
|
15877
|
+
}
|
|
15383
15878
|
default:
|
|
15384
15879
|
{
|
|
15385
15880
|
invariant(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.');
|
|
@@ -15394,10 +15889,6 @@ function commitResetTextContent(current$$1) {
|
|
|
15394
15889
|
resetTextContent(current$$1.stateNode);
|
|
15395
15890
|
}
|
|
15396
15891
|
|
|
15397
|
-
function NoopComponent() {
|
|
15398
|
-
return null;
|
|
15399
|
-
}
|
|
15400
|
-
|
|
15401
15892
|
function createRootErrorUpdate(fiber, errorInfo, expirationTime) {
|
|
15402
15893
|
var update = createUpdate(expirationTime);
|
|
15403
15894
|
// Unmount the root by rendering null.
|
|
@@ -15475,17 +15966,16 @@ function throwException(root, returnFiber, sourceFiber, value, renderExpirationT
|
|
|
15475
15966
|
do {
|
|
15476
15967
|
if (_workInProgress.tag === SuspenseComponent) {
|
|
15477
15968
|
var current = _workInProgress.alternate;
|
|
15478
|
-
if (current !== null
|
|
15479
|
-
|
|
15480
|
-
|
|
15481
|
-
|
|
15482
|
-
|
|
15483
|
-
|
|
15484
|
-
|
|
15485
|
-
|
|
15486
|
-
|
|
15487
|
-
|
|
15488
|
-
break;
|
|
15969
|
+
if (current !== null) {
|
|
15970
|
+
var currentState = current.memoizedState;
|
|
15971
|
+
if (currentState !== null && currentState.didTimeout) {
|
|
15972
|
+
// Reached a boundary that already timed out. Do not search
|
|
15973
|
+
// any further.
|
|
15974
|
+
var timedOutAt = currentState.timedOutAt;
|
|
15975
|
+
startTimeMs = expirationTimeToMs(timedOutAt);
|
|
15976
|
+
// Do not search any further.
|
|
15977
|
+
break;
|
|
15978
|
+
}
|
|
15489
15979
|
}
|
|
15490
15980
|
var timeoutPropMs = _workInProgress.pendingProps.maxDuration;
|
|
15491
15981
|
if (typeof timeoutPropMs === 'number') {
|
|
@@ -15502,103 +15992,93 @@ function throwException(root, returnFiber, sourceFiber, value, renderExpirationT
|
|
|
15502
15992
|
// Schedule the nearest Suspense to re-render the timed out view.
|
|
15503
15993
|
_workInProgress = returnFiber;
|
|
15504
15994
|
do {
|
|
15505
|
-
if (_workInProgress.tag === SuspenseComponent) {
|
|
15506
|
-
|
|
15507
|
-
if (!didTimeout) {
|
|
15508
|
-
// Found the nearest boundary.
|
|
15995
|
+
if (_workInProgress.tag === SuspenseComponent && shouldCaptureSuspense(_workInProgress.alternate, _workInProgress)) {
|
|
15996
|
+
// Found the nearest boundary.
|
|
15509
15997
|
|
|
15510
|
-
|
|
15511
|
-
|
|
15512
|
-
|
|
15998
|
+
// If the boundary is not in concurrent mode, we should not suspend, and
|
|
15999
|
+
// likewise, when the promise resolves, we should ping synchronously.
|
|
16000
|
+
var pingTime = (_workInProgress.mode & ConcurrentMode) === NoEffect ? Sync : renderExpirationTime;
|
|
15513
16001
|
|
|
15514
|
-
|
|
15515
|
-
|
|
15516
|
-
|
|
15517
|
-
|
|
15518
|
-
|
|
15519
|
-
|
|
15520
|
-
|
|
15521
|
-
// If the boundary is outside of strict mode, we should *not* suspend
|
|
15522
|
-
// the commit. Pretend as if the suspended component rendered null and
|
|
15523
|
-
// keep rendering. In the commit phase, we'll schedule a subsequent
|
|
15524
|
-
// synchronous update to re-render the Suspense.
|
|
15525
|
-
//
|
|
15526
|
-
// Note: It doesn't matter whether the component that suspended was
|
|
15527
|
-
// inside a strict mode tree. If the Suspense is outside of it, we
|
|
15528
|
-
// should *not* suspend the commit.
|
|
15529
|
-
if ((_workInProgress.mode & StrictMode) === NoEffect) {
|
|
15530
|
-
_workInProgress.effectTag |= Update;
|
|
15531
|
-
|
|
15532
|
-
// Unmount the source fiber's children
|
|
15533
|
-
var nextChildren = null;
|
|
15534
|
-
reconcileChildren(sourceFiber.alternate, sourceFiber, nextChildren, renderExpirationTime);
|
|
15535
|
-
sourceFiber.effectTag &= ~Incomplete;
|
|
15536
|
-
if (sourceFiber.tag === IndeterminateComponent) {
|
|
15537
|
-
// Let's just assume it's a function component. This fiber will
|
|
15538
|
-
// be unmounted in the immediate next commit, anyway.
|
|
15539
|
-
sourceFiber.tag = FunctionComponent;
|
|
15540
|
-
}
|
|
16002
|
+
// Attach a listener to the promise to "ping" the root and retry.
|
|
16003
|
+
var onResolveOrReject = retrySuspendedRoot.bind(null, root, _workInProgress, sourceFiber, pingTime);
|
|
16004
|
+
if (enableSchedulerTracing) {
|
|
16005
|
+
onResolveOrReject = tracing.unstable_wrap(onResolveOrReject);
|
|
16006
|
+
}
|
|
16007
|
+
thenable.then(onResolveOrReject, onResolveOrReject);
|
|
15541
16008
|
|
|
15542
|
-
|
|
15543
|
-
|
|
15544
|
-
|
|
15545
|
-
|
|
15546
|
-
|
|
15547
|
-
|
|
15548
|
-
|
|
15549
|
-
|
|
15550
|
-
|
|
15551
|
-
|
|
15552
|
-
|
|
15553
|
-
|
|
15554
|
-
|
|
15555
|
-
|
|
16009
|
+
// If the boundary is outside of concurrent mode, we should *not*
|
|
16010
|
+
// suspend the commit. Pretend as if the suspended component rendered
|
|
16011
|
+
// null and keep rendering. In the commit phase, we'll schedule a
|
|
16012
|
+
// subsequent synchronous update to re-render the Suspense.
|
|
16013
|
+
//
|
|
16014
|
+
// Note: It doesn't matter whether the component that suspended was
|
|
16015
|
+
// inside a concurrent mode tree. If the Suspense is outside of it, we
|
|
16016
|
+
// should *not* suspend the commit.
|
|
16017
|
+
if ((_workInProgress.mode & ConcurrentMode) === NoEffect) {
|
|
16018
|
+
_workInProgress.effectTag |= Callback;
|
|
16019
|
+
|
|
16020
|
+
// Unmount the source fiber's children
|
|
16021
|
+
var nextChildren = null;
|
|
16022
|
+
reconcileChildren(sourceFiber.alternate, sourceFiber, nextChildren, renderExpirationTime);
|
|
16023
|
+
sourceFiber.effectTag &= ~Incomplete;
|
|
16024
|
+
|
|
16025
|
+
if (sourceFiber.tag === ClassComponent) {
|
|
16026
|
+
// We're going to commit this fiber even though it didn't complete.
|
|
16027
|
+
// But we shouldn't call any lifecycle methods or callbacks. Remove
|
|
16028
|
+
// all lifecycle effect tags.
|
|
16029
|
+
sourceFiber.effectTag &= ~LifecycleEffectMask;
|
|
16030
|
+
var _current = sourceFiber.alternate;
|
|
16031
|
+
if (_current === null) {
|
|
16032
|
+
// This is a new mount. Change the tag so it's not mistaken for a
|
|
16033
|
+
// completed component. For example, we should not call
|
|
16034
|
+
// componentWillUnmount if it is deleted.
|
|
16035
|
+
sourceFiber.tag = IncompleteClassComponent;
|
|
15556
16036
|
}
|
|
15557
|
-
|
|
15558
|
-
// Exit without suspending.
|
|
15559
|
-
return;
|
|
15560
16037
|
}
|
|
15561
16038
|
|
|
15562
|
-
//
|
|
15563
|
-
|
|
16039
|
+
// Exit without suspending.
|
|
16040
|
+
return;
|
|
16041
|
+
}
|
|
16042
|
+
|
|
16043
|
+
// Confirmed that the boundary is in a concurrent mode tree. Continue
|
|
16044
|
+
// with the normal suspend path.
|
|
15564
16045
|
|
|
15565
|
-
|
|
15566
|
-
|
|
15567
|
-
|
|
15568
|
-
|
|
15569
|
-
|
|
15570
|
-
|
|
15571
|
-
|
|
15572
|
-
|
|
15573
|
-
|
|
15574
|
-
|
|
15575
|
-
|
|
15576
|
-
|
|
15577
|
-
|
|
15578
|
-
|
|
15579
|
-
|
|
15580
|
-
|
|
15581
|
-
|
|
15582
|
-
|
|
15583
|
-
|
|
15584
|
-
|
|
15585
|
-
}
|
|
15586
|
-
absoluteTimeoutMs = startTimeMs + earliestTimeoutMs;
|
|
16046
|
+
var absoluteTimeoutMs = void 0;
|
|
16047
|
+
if (earliestTimeoutMs === -1) {
|
|
16048
|
+
// If no explicit threshold is given, default to an abitrarily large
|
|
16049
|
+
// value. The actual size doesn't matter because the threshold for the
|
|
16050
|
+
// whole tree will be clamped to the expiration time.
|
|
16051
|
+
absoluteTimeoutMs = maxSigned31BitInt;
|
|
16052
|
+
} else {
|
|
16053
|
+
if (startTimeMs === -1) {
|
|
16054
|
+
// This suspend happened outside of any already timed-out
|
|
16055
|
+
// placeholders. We don't know exactly when the update was
|
|
16056
|
+
// scheduled, but we can infer an approximate start time from the
|
|
16057
|
+
// expiration time. First, find the earliest uncommitted expiration
|
|
16058
|
+
// time in the tree, including work that is suspended. Then subtract
|
|
16059
|
+
// the offset used to compute an async update's expiration time.
|
|
16060
|
+
// This will cause high priority (interactive) work to expire
|
|
16061
|
+
// earlier than necessary, but we can account for this by adjusting
|
|
16062
|
+
// for the Just Noticeable Difference.
|
|
16063
|
+
var earliestExpirationTime = findEarliestOutstandingPriorityLevel(root, renderExpirationTime);
|
|
16064
|
+
var earliestExpirationTimeMs = expirationTimeToMs(earliestExpirationTime);
|
|
16065
|
+
startTimeMs = earliestExpirationTimeMs - LOW_PRIORITY_EXPIRATION;
|
|
15587
16066
|
}
|
|
16067
|
+
absoluteTimeoutMs = startTimeMs + earliestTimeoutMs;
|
|
16068
|
+
}
|
|
15588
16069
|
|
|
15589
|
-
|
|
15590
|
-
|
|
15591
|
-
|
|
15592
|
-
|
|
15593
|
-
|
|
16070
|
+
// Mark the earliest timeout in the suspended fiber's ancestor path.
|
|
16071
|
+
// After completing the root, we'll take the largest of all the
|
|
16072
|
+
// suspended fiber's timeouts and use it to compute a timeout for the
|
|
16073
|
+
// whole tree.
|
|
16074
|
+
renderDidSuspend(root, absoluteTimeoutMs, renderExpirationTime);
|
|
15594
16075
|
|
|
15595
|
-
|
|
15596
|
-
|
|
15597
|
-
|
|
15598
|
-
}
|
|
15599
|
-
// This boundary already captured during this render. Continue to the
|
|
15600
|
-
// next boundary.
|
|
16076
|
+
_workInProgress.effectTag |= ShouldCapture;
|
|
16077
|
+
_workInProgress.expirationTime = renderExpirationTime;
|
|
16078
|
+
return;
|
|
15601
16079
|
}
|
|
16080
|
+
// This boundary already captured during this render. Continue to the next
|
|
16081
|
+
// boundary.
|
|
15602
16082
|
_workInProgress = _workInProgress.return;
|
|
15603
16083
|
} while (_workInProgress !== null);
|
|
15604
16084
|
// No boundary was found. Fallthrough to error mode.
|
|
@@ -15623,7 +16103,6 @@ function throwException(root, returnFiber, sourceFiber, value, renderExpirationT
|
|
|
15623
16103
|
return;
|
|
15624
16104
|
}
|
|
15625
16105
|
case ClassComponent:
|
|
15626
|
-
case ClassComponentLazy:
|
|
15627
16106
|
// Capture and retry
|
|
15628
16107
|
var errorInfo = value;
|
|
15629
16108
|
var ctor = workInProgress.type;
|
|
@@ -15659,26 +16138,13 @@ function unwindWork(workInProgress, renderExpirationTime) {
|
|
|
15659
16138
|
}
|
|
15660
16139
|
return null;
|
|
15661
16140
|
}
|
|
15662
|
-
case ClassComponentLazy:
|
|
15663
|
-
{
|
|
15664
|
-
var _Component = workInProgress.type._reactResult;
|
|
15665
|
-
if (isContextProvider(_Component)) {
|
|
15666
|
-
popContext(workInProgress);
|
|
15667
|
-
}
|
|
15668
|
-
var _effectTag = workInProgress.effectTag;
|
|
15669
|
-
if (_effectTag & ShouldCapture) {
|
|
15670
|
-
workInProgress.effectTag = _effectTag & ~ShouldCapture | DidCapture;
|
|
15671
|
-
return workInProgress;
|
|
15672
|
-
}
|
|
15673
|
-
return null;
|
|
15674
|
-
}
|
|
15675
16141
|
case HostRoot:
|
|
15676
16142
|
{
|
|
15677
16143
|
popHostContainer(workInProgress);
|
|
15678
16144
|
popTopLevelContextObject(workInProgress);
|
|
15679
|
-
var
|
|
15680
|
-
!((
|
|
15681
|
-
workInProgress.effectTag =
|
|
16145
|
+
var _effectTag = workInProgress.effectTag;
|
|
16146
|
+
!((_effectTag & DidCapture) === NoEffect) ? invariant(false, 'The root failed to unmount after an error. This is likely a bug in React. Please file an issue.') : void 0;
|
|
16147
|
+
workInProgress.effectTag = _effectTag & ~ShouldCapture | DidCapture;
|
|
15682
16148
|
return workInProgress;
|
|
15683
16149
|
}
|
|
15684
16150
|
case HostComponent:
|
|
@@ -15688,9 +16154,35 @@ function unwindWork(workInProgress, renderExpirationTime) {
|
|
|
15688
16154
|
}
|
|
15689
16155
|
case SuspenseComponent:
|
|
15690
16156
|
{
|
|
15691
|
-
var
|
|
15692
|
-
if (
|
|
15693
|
-
workInProgress.effectTag =
|
|
16157
|
+
var _effectTag2 = workInProgress.effectTag;
|
|
16158
|
+
if (_effectTag2 & ShouldCapture) {
|
|
16159
|
+
workInProgress.effectTag = _effectTag2 & ~ShouldCapture | DidCapture;
|
|
16160
|
+
// Captured a suspense effect. Set the boundary's `alreadyCaptured`
|
|
16161
|
+
// state to true so we know to render the fallback.
|
|
16162
|
+
var current = workInProgress.alternate;
|
|
16163
|
+
var currentState = current !== null ? current.memoizedState : null;
|
|
16164
|
+
var nextState = workInProgress.memoizedState;
|
|
16165
|
+
if (nextState === null) {
|
|
16166
|
+
// No existing state. Create a new object.
|
|
16167
|
+
nextState = {
|
|
16168
|
+
alreadyCaptured: true,
|
|
16169
|
+
didTimeout: false,
|
|
16170
|
+
timedOutAt: NoWork
|
|
16171
|
+
};
|
|
16172
|
+
} else if (currentState === nextState) {
|
|
16173
|
+
// There is an existing state but it's the same as the current tree's.
|
|
16174
|
+
// Clone the object.
|
|
16175
|
+
nextState = {
|
|
16176
|
+
alreadyCaptured: true,
|
|
16177
|
+
didTimeout: nextState.didTimeout,
|
|
16178
|
+
timedOutAt: nextState.timedOutAt
|
|
16179
|
+
};
|
|
16180
|
+
} else {
|
|
16181
|
+
// Already have a clone, so it's safe to mutate.
|
|
16182
|
+
nextState.alreadyCaptured = true;
|
|
16183
|
+
}
|
|
16184
|
+
workInProgress.memoizedState = nextState;
|
|
16185
|
+
// Re-render the boundary.
|
|
15694
16186
|
return workInProgress;
|
|
15695
16187
|
}
|
|
15696
16188
|
return null;
|
|
@@ -15716,14 +16208,6 @@ function unwindInterruptedWork(interruptedWork) {
|
|
|
15716
16208
|
}
|
|
15717
16209
|
break;
|
|
15718
16210
|
}
|
|
15719
|
-
case ClassComponentLazy:
|
|
15720
|
-
{
|
|
15721
|
-
var _childContextTypes = interruptedWork.type._reactResult.childContextTypes;
|
|
15722
|
-
if (_childContextTypes !== null && _childContextTypes !== undefined) {
|
|
15723
|
-
popContext(interruptedWork);
|
|
15724
|
-
}
|
|
15725
|
-
break;
|
|
15726
|
-
}
|
|
15727
16211
|
case HostRoot:
|
|
15728
16212
|
{
|
|
15729
16213
|
popHostContainer(interruptedWork);
|
|
@@ -15869,14 +16353,6 @@ if (true && replayFailedUnitOfWorkWithInvokeGuardedCallback) {
|
|
|
15869
16353
|
}
|
|
15870
16354
|
break;
|
|
15871
16355
|
}
|
|
15872
|
-
case ClassComponentLazy:
|
|
15873
|
-
{
|
|
15874
|
-
var _Component = getResultFromResolvedThenable(failedUnitOfWork.type);
|
|
15875
|
-
if (isContextProvider(_Component)) {
|
|
15876
|
-
popContext(failedUnitOfWork);
|
|
15877
|
-
}
|
|
15878
|
-
break;
|
|
15879
|
-
}
|
|
15880
16356
|
case HostPortal:
|
|
15881
16357
|
popHostContainer(failedUnitOfWork);
|
|
15882
16358
|
break;
|
|
@@ -16536,6 +17012,7 @@ function performUnitOfWork(workInProgress) {
|
|
|
16536
17012
|
}
|
|
16537
17013
|
|
|
16538
17014
|
next = beginWork(current$$1, workInProgress, nextRenderExpirationTime);
|
|
17015
|
+
workInProgress.memoizedProps = workInProgress.pendingProps;
|
|
16539
17016
|
|
|
16540
17017
|
if (workInProgress.mode & ProfileMode) {
|
|
16541
17018
|
// Record the render duration assuming we didn't bailout (or error).
|
|
@@ -16543,6 +17020,7 @@ function performUnitOfWork(workInProgress) {
|
|
|
16543
17020
|
}
|
|
16544
17021
|
} else {
|
|
16545
17022
|
next = beginWork(current$$1, workInProgress, nextRenderExpirationTime);
|
|
17023
|
+
workInProgress.memoizedProps = workInProgress.pendingProps;
|
|
16546
17024
|
}
|
|
16547
17025
|
|
|
16548
17026
|
{
|
|
@@ -16816,7 +17294,6 @@ function dispatch(sourceFiber, value, expirationTime) {
|
|
|
16816
17294
|
while (fiber !== null) {
|
|
16817
17295
|
switch (fiber.tag) {
|
|
16818
17296
|
case ClassComponent:
|
|
16819
|
-
case ClassComponentLazy:
|
|
16820
17297
|
var ctor = fiber.type;
|
|
16821
17298
|
var instance = fiber.stateNode;
|
|
16822
17299
|
if (typeof ctor.getDerivedStateFromError === 'function' || typeof instance.componentDidCatch === 'function' && !isAlreadyFailedLegacyErrorBoundary(instance)) {
|
|
@@ -16931,7 +17408,7 @@ function renderDidError() {
|
|
|
16931
17408
|
nextRenderDidError = true;
|
|
16932
17409
|
}
|
|
16933
17410
|
|
|
16934
|
-
function retrySuspendedRoot(root,
|
|
17411
|
+
function retrySuspendedRoot(root, boundaryFiber, sourceFiber, suspendedTime) {
|
|
16935
17412
|
var retryTime = void 0;
|
|
16936
17413
|
|
|
16937
17414
|
if (isPriorityLevelSuspended(root, suspendedTime)) {
|
|
@@ -16942,18 +17419,18 @@ function retrySuspendedRoot(root, fiber, suspendedTime) {
|
|
|
16942
17419
|
} else {
|
|
16943
17420
|
// Suspense already timed out. Compute a new expiration time
|
|
16944
17421
|
var currentTime = requestCurrentTime();
|
|
16945
|
-
retryTime = computeExpirationForFiber(currentTime,
|
|
17422
|
+
retryTime = computeExpirationForFiber(currentTime, boundaryFiber);
|
|
16946
17423
|
markPendingPriorityLevel(root, retryTime);
|
|
16947
17424
|
}
|
|
16948
17425
|
|
|
16949
|
-
// TODO: If the
|
|
17426
|
+
// TODO: If the suspense fiber has already rendered the primary children
|
|
16950
17427
|
// without suspending (that is, all of the promises have already resolved),
|
|
16951
17428
|
// we should not trigger another update here. One case this happens is when
|
|
16952
17429
|
// we are in sync mode and a single promise is thrown both on initial render
|
|
16953
17430
|
// and on update; we attach two .then(retrySuspendedRoot) callbacks and each
|
|
16954
17431
|
// one performs Sync work, rerendering the Suspense.
|
|
16955
17432
|
|
|
16956
|
-
if ((
|
|
17433
|
+
if ((boundaryFiber.mode & ConcurrentMode) !== NoContext) {
|
|
16957
17434
|
if (root === nextRoot && nextRenderExpirationTime === suspendedTime) {
|
|
16958
17435
|
// Received a ping at the same priority level at which we're currently
|
|
16959
17436
|
// rendering. Restart from the root.
|
|
@@ -16961,7 +17438,23 @@ function retrySuspendedRoot(root, fiber, suspendedTime) {
|
|
|
16961
17438
|
}
|
|
16962
17439
|
}
|
|
16963
17440
|
|
|
16964
|
-
scheduleWorkToRoot(
|
|
17441
|
+
scheduleWorkToRoot(boundaryFiber, retryTime);
|
|
17442
|
+
if ((boundaryFiber.mode & ConcurrentMode) === NoContext) {
|
|
17443
|
+
// Outside of concurrent mode, we must schedule an update on the source
|
|
17444
|
+
// fiber, too, since it already committed in an inconsistent state and
|
|
17445
|
+
// therefore does not have any pending work.
|
|
17446
|
+
scheduleWorkToRoot(sourceFiber, retryTime);
|
|
17447
|
+
var sourceTag = sourceFiber.tag;
|
|
17448
|
+
if (sourceTag === ClassComponent && sourceFiber.stateNode !== null) {
|
|
17449
|
+
// When we try rendering again, we should not reuse the current fiber,
|
|
17450
|
+
// since it's known to be in an inconsistent state. Use a force updte to
|
|
17451
|
+
// prevent a bail out.
|
|
17452
|
+
var update = createUpdate(retryTime);
|
|
17453
|
+
update.tag = ForceUpdate;
|
|
17454
|
+
enqueueUpdate(sourceFiber, update);
|
|
17455
|
+
}
|
|
17456
|
+
}
|
|
17457
|
+
|
|
16965
17458
|
var rootExpirationTime = root.expirationTime;
|
|
16966
17459
|
if (rootExpirationTime !== NoWork) {
|
|
16967
17460
|
requestWork(root, rootExpirationTime);
|
|
@@ -16972,7 +17465,7 @@ function scheduleWorkToRoot(fiber, expirationTime) {
|
|
|
16972
17465
|
recordScheduleUpdate();
|
|
16973
17466
|
|
|
16974
17467
|
{
|
|
16975
|
-
if (fiber.tag === ClassComponent
|
|
17468
|
+
if (fiber.tag === ClassComponent) {
|
|
16976
17469
|
var instance = fiber.stateNode;
|
|
16977
17470
|
warnAboutInvalidUpdates(instance);
|
|
16978
17471
|
}
|
|
@@ -17011,7 +17504,7 @@ function scheduleWorkToRoot(fiber, expirationTime) {
|
|
|
17011
17504
|
}
|
|
17012
17505
|
|
|
17013
17506
|
if (root === null) {
|
|
17014
|
-
if (true &&
|
|
17507
|
+
if (true && fiber.tag === ClassComponent) {
|
|
17015
17508
|
warnAboutUpdateOnUnmounted(fiber);
|
|
17016
17509
|
}
|
|
17017
17510
|
return null;
|
|
@@ -17699,9 +18192,11 @@ function flushControlled(fn) {
|
|
|
17699
18192
|
|
|
17700
18193
|
|
|
17701
18194
|
var didWarnAboutNestedUpdates = void 0;
|
|
18195
|
+
var didWarnAboutFindNodeInStrictMode = void 0;
|
|
17702
18196
|
|
|
17703
18197
|
{
|
|
17704
18198
|
didWarnAboutNestedUpdates = false;
|
|
18199
|
+
didWarnAboutFindNodeInStrictMode = {};
|
|
17705
18200
|
}
|
|
17706
18201
|
|
|
17707
18202
|
function getContextForSubtree(parentComponent) {
|
|
@@ -17717,11 +18212,6 @@ function getContextForSubtree(parentComponent) {
|
|
|
17717
18212
|
if (isContextProvider(Component)) {
|
|
17718
18213
|
return processChildContext(fiber, Component, parentContext);
|
|
17719
18214
|
}
|
|
17720
|
-
} else if (fiber.tag === ClassComponentLazy) {
|
|
17721
|
-
var _Component = getResultFromResolvedThenable(fiber.type);
|
|
17722
|
-
if (isContextProvider(_Component)) {
|
|
17723
|
-
return processChildContext(fiber, _Component, parentContext);
|
|
17724
|
-
}
|
|
17725
18215
|
}
|
|
17726
18216
|
|
|
17727
18217
|
return parentContext;
|
|
@@ -17793,6 +18283,36 @@ function findHostInstance(component) {
|
|
|
17793
18283
|
return hostFiber.stateNode;
|
|
17794
18284
|
}
|
|
17795
18285
|
|
|
18286
|
+
function findHostInstanceWithWarning(component, methodName) {
|
|
18287
|
+
{
|
|
18288
|
+
var fiber = get(component);
|
|
18289
|
+
if (fiber === undefined) {
|
|
18290
|
+
if (typeof component.render === 'function') {
|
|
18291
|
+
invariant(false, 'Unable to find node on an unmounted component.');
|
|
18292
|
+
} else {
|
|
18293
|
+
invariant(false, 'Argument appears to not be a ReactComponent. Keys: %s', Object.keys(component));
|
|
18294
|
+
}
|
|
18295
|
+
}
|
|
18296
|
+
var hostFiber = findCurrentHostFiber(fiber);
|
|
18297
|
+
if (hostFiber === null) {
|
|
18298
|
+
return null;
|
|
18299
|
+
}
|
|
18300
|
+
if (hostFiber.mode & StrictMode) {
|
|
18301
|
+
var componentName = getComponentName(fiber.type) || 'Component';
|
|
18302
|
+
if (!didWarnAboutFindNodeInStrictMode[componentName]) {
|
|
18303
|
+
didWarnAboutFindNodeInStrictMode[componentName] = true;
|
|
18304
|
+
if (fiber.mode & StrictMode) {
|
|
18305
|
+
warningWithoutStack$1(false, '%s is deprecated in StrictMode. ' + '%s was passed an instance of %s which is inside StrictMode. ' + 'Instead, add a ref directly to the element you want to reference.' + '\n%s' + '\n\nLearn more about using refs safely here:' + '\nhttps://fb.me/react-strict-mode-find-node', methodName, methodName, componentName, getStackByFiberInDevAndProd(hostFiber));
|
|
18306
|
+
} else {
|
|
18307
|
+
warningWithoutStack$1(false, '%s is deprecated in StrictMode. ' + '%s was passed an instance of %s which renders StrictMode children. ' + 'Instead, add a ref directly to the element you want to reference.' + '\n%s' + '\n\nLearn more about using refs safely here:' + '\nhttps://fb.me/react-strict-mode-find-node', methodName, methodName, componentName, getStackByFiberInDevAndProd(hostFiber));
|
|
18308
|
+
}
|
|
18309
|
+
}
|
|
18310
|
+
}
|
|
18311
|
+
return hostFiber.stateNode;
|
|
18312
|
+
}
|
|
18313
|
+
return findHostInstance(component);
|
|
18314
|
+
}
|
|
18315
|
+
|
|
17796
18316
|
function createContainer(containerInfo, isConcurrent, hydrate) {
|
|
17797
18317
|
return createFiberRoot(containerInfo, isConcurrent, hydrate);
|
|
17798
18318
|
}
|
|
@@ -17866,7 +18386,7 @@ implementation) {
|
|
|
17866
18386
|
|
|
17867
18387
|
// TODO: this is special because it gets imported during build.
|
|
17868
18388
|
|
|
17869
|
-
var ReactVersion = '16.6.0
|
|
18389
|
+
var ReactVersion = '16.6.0';
|
|
17870
18390
|
|
|
17871
18391
|
// TODO: This type is shared between the reconciler and ReactDOM, but will
|
|
17872
18392
|
// eventually be lifted out to the renderer.
|
|
@@ -18250,7 +18770,9 @@ var ReactDOM = {
|
|
|
18250
18770
|
if (componentOrElement.nodeType === ELEMENT_NODE) {
|
|
18251
18771
|
return componentOrElement;
|
|
18252
18772
|
}
|
|
18253
|
-
|
|
18773
|
+
{
|
|
18774
|
+
return findHostInstanceWithWarning(componentOrElement, 'findDOMNode');
|
|
18775
|
+
}
|
|
18254
18776
|
return findHostInstance(componentOrElement);
|
|
18255
18777
|
},
|
|
18256
18778
|
hydrate: function (element, container, callback) {
|