react-dom 16.5.2 → 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 +124 -82
- package/cjs/react-dom-server.browser.production.min.js +35 -33
- package/cjs/react-dom-server.node.development.js +126 -84
- package/cjs/react-dom-server.node.production.min.js +38 -36
- package/cjs/react-dom-test-utils.development.js +8 -10
- package/cjs/react-dom-test-utils.production.min.js +4 -4
- package/cjs/react-dom-unstable-native-dependencies.development.js +3 -3
- package/cjs/react-dom-unstable-native-dependencies.production.min.js +2 -2
- package/cjs/react-dom.development.js +1468 -837
- package/cjs/react-dom.production.min.js +236 -221
- package/cjs/react-dom.profiling.min.js +240 -229
- package/package.json +2 -2
- package/umd/react-dom-server.browser.development.js +124 -82
- package/umd/react-dom-server.browser.production.min.js +31 -29
- package/umd/react-dom-test-utils.development.js +8 -10
- package/umd/react-dom-test-utils.production.min.js +8 -8
- package/umd/react-dom-unstable-native-dependencies.development.js +3 -3
- package/umd/react-dom-unstable-native-dependencies.production.min.js +2 -2
- package/umd/react-dom.development.js +1463 -832
- package/umd/react-dom.production.min.js +193 -182
- package/umd/react-dom.profiling.min.js +197 -187
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license React v16.
|
|
1
|
+
/** @license React v16.6.0
|
|
2
2
|
* react-dom.development.js
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
@@ -18,8 +18,8 @@ if (process.env.NODE_ENV !== "production") {
|
|
|
18
18
|
var React = require('react');
|
|
19
19
|
var _assign = require('object-assign');
|
|
20
20
|
var checkPropTypes = require('prop-types/checkPropTypes');
|
|
21
|
-
var
|
|
22
|
-
var tracing = require('
|
|
21
|
+
var scheduler = require('scheduler');
|
|
22
|
+
var tracing = require('scheduler/tracing');
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
25
|
* Use invariant() to assert state which your program assumes to be true.
|
|
@@ -123,6 +123,10 @@ var invokeGuardedCallbackImpl = function (name, func, context, a, b, c, d, e, f)
|
|
|
123
123
|
// browsers that support it.
|
|
124
124
|
var windowEvent = window.event;
|
|
125
125
|
|
|
126
|
+
// Keeps track of the descriptor of window.event to restore it after event
|
|
127
|
+
// dispatching: https://github.com/facebook/react/issues/13688
|
|
128
|
+
var windowEventDescriptor = Object.getOwnPropertyDescriptor(window, 'event');
|
|
129
|
+
|
|
126
130
|
// Create an event handler for our fake event. We will synchronously
|
|
127
131
|
// dispatch our fake event using `dispatchEvent`. Inside the handler, we
|
|
128
132
|
// call the user-provided callback.
|
|
@@ -194,6 +198,10 @@ var invokeGuardedCallbackImpl = function (name, func, context, a, b, c, d, e, f)
|
|
|
194
198
|
evt.initEvent(evtType, false, false);
|
|
195
199
|
fakeNode.dispatchEvent(evt);
|
|
196
200
|
|
|
201
|
+
if (windowEventDescriptor) {
|
|
202
|
+
Object.defineProperty(window, 'event', windowEventDescriptor);
|
|
203
|
+
}
|
|
204
|
+
|
|
197
205
|
if (didError) {
|
|
198
206
|
if (!didSetError) {
|
|
199
207
|
// The callback errored, but the error event never fired.
|
|
@@ -864,23 +872,24 @@ function runExtractedEventsInBatch(topLevelType, targetInst, nativeEvent, native
|
|
|
864
872
|
runEventsInBatch(events, false);
|
|
865
873
|
}
|
|
866
874
|
|
|
867
|
-
var
|
|
868
|
-
var
|
|
869
|
-
var
|
|
870
|
-
var
|
|
871
|
-
var
|
|
872
|
-
var
|
|
873
|
-
var
|
|
874
|
-
var
|
|
875
|
-
var
|
|
876
|
-
var
|
|
877
|
-
var
|
|
878
|
-
var
|
|
879
|
-
var
|
|
880
|
-
var
|
|
881
|
-
var
|
|
882
|
-
var
|
|
883
|
-
var
|
|
875
|
+
var FunctionComponent = 0;
|
|
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;
|
|
884
893
|
|
|
885
894
|
var randomKey = Math.random().toString(36).slice(2);
|
|
886
895
|
var internalInstanceKey = '__reactInternalInstance$' + randomKey;
|
|
@@ -2462,9 +2471,11 @@ var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeac
|
|
|
2462
2471
|
var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
|
|
2463
2472
|
var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
|
|
2464
2473
|
var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace;
|
|
2465
|
-
var
|
|
2474
|
+
var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
|
|
2466
2475
|
var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
|
|
2467
|
-
var
|
|
2476
|
+
var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
|
|
2477
|
+
var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
|
|
2478
|
+
var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
|
|
2468
2479
|
|
|
2469
2480
|
var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
|
|
2470
2481
|
var FAUX_ITERATOR_SYMBOL = '@@iterator';
|
|
@@ -2484,12 +2495,13 @@ var Pending = 0;
|
|
|
2484
2495
|
var Resolved = 1;
|
|
2485
2496
|
var Rejected = 2;
|
|
2486
2497
|
|
|
2487
|
-
function
|
|
2488
|
-
return
|
|
2498
|
+
function refineResolvedLazyComponent(lazyComponent) {
|
|
2499
|
+
return lazyComponent._status === Resolved ? lazyComponent._result : null;
|
|
2489
2500
|
}
|
|
2490
2501
|
|
|
2491
|
-
function
|
|
2492
|
-
|
|
2502
|
+
function getWrappedName(outerType, innerType, wrapperName) {
|
|
2503
|
+
var functionName = innerType.displayName || innerType.name || '';
|
|
2504
|
+
return outerType.displayName || (functionName !== '' ? wrapperName + '(' + functionName + ')' : wrapperName);
|
|
2493
2505
|
}
|
|
2494
2506
|
|
|
2495
2507
|
function getComponentName(type) {
|
|
@@ -2509,8 +2521,8 @@ function getComponentName(type) {
|
|
|
2509
2521
|
return type;
|
|
2510
2522
|
}
|
|
2511
2523
|
switch (type) {
|
|
2512
|
-
case
|
|
2513
|
-
return '
|
|
2524
|
+
case REACT_CONCURRENT_MODE_TYPE:
|
|
2525
|
+
return 'ConcurrentMode';
|
|
2514
2526
|
case REACT_FRAGMENT_TYPE:
|
|
2515
2527
|
return 'Fragment';
|
|
2516
2528
|
case REACT_PORTAL_TYPE:
|
|
@@ -2519,8 +2531,8 @@ function getComponentName(type) {
|
|
|
2519
2531
|
return 'Profiler';
|
|
2520
2532
|
case REACT_STRICT_MODE_TYPE:
|
|
2521
2533
|
return 'StrictMode';
|
|
2522
|
-
case
|
|
2523
|
-
return '
|
|
2534
|
+
case REACT_SUSPENSE_TYPE:
|
|
2535
|
+
return 'Suspense';
|
|
2524
2536
|
}
|
|
2525
2537
|
if (typeof type === 'object') {
|
|
2526
2538
|
switch (type.$$typeof) {
|
|
@@ -2529,16 +2541,17 @@ function getComponentName(type) {
|
|
|
2529
2541
|
case REACT_PROVIDER_TYPE:
|
|
2530
2542
|
return 'Context.Provider';
|
|
2531
2543
|
case REACT_FORWARD_REF_TYPE:
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
return type.
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
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
|
+
}
|
|
2542
2555
|
}
|
|
2543
2556
|
}
|
|
2544
2557
|
return null;
|
|
@@ -2549,10 +2562,9 @@ var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
|
2549
2562
|
function describeFiber(fiber) {
|
|
2550
2563
|
switch (fiber.tag) {
|
|
2551
2564
|
case IndeterminateComponent:
|
|
2552
|
-
case
|
|
2553
|
-
case
|
|
2565
|
+
case LazyComponent:
|
|
2566
|
+
case FunctionComponent:
|
|
2554
2567
|
case ClassComponent:
|
|
2555
|
-
case ClassComponentLazy:
|
|
2556
2568
|
case HostComponent:
|
|
2557
2569
|
case Mode:
|
|
2558
2570
|
var owner = fiber._debugOwner;
|
|
@@ -3148,14 +3160,8 @@ var ReactControlledValuePropTypes = {
|
|
|
3148
3160
|
};
|
|
3149
3161
|
}
|
|
3150
3162
|
|
|
3151
|
-
// Exports ReactDOM.createRoot
|
|
3152
3163
|
var enableUserTimingAPI = true;
|
|
3153
3164
|
|
|
3154
|
-
// Experimental error-boundary API that can recover from errors within a single
|
|
3155
|
-
// render phase
|
|
3156
|
-
var enableGetDerivedStateFromCatch = false;
|
|
3157
|
-
// Suspense
|
|
3158
|
-
var enableSuspense = false;
|
|
3159
3165
|
// Helps identify side effects in begin-phase lifecycle hooks and setState reducers:
|
|
3160
3166
|
var debugRenderPhaseSideEffects = false;
|
|
3161
3167
|
|
|
@@ -3172,9 +3178,6 @@ var replayFailedUnitOfWorkWithInvokeGuardedCallback = true;
|
|
|
3172
3178
|
// Warn about deprecated, async-unsafe lifecycles; relates to RFC #6:
|
|
3173
3179
|
var warnAboutDeprecatedLifecycles = false;
|
|
3174
3180
|
|
|
3175
|
-
// Warn about legacy context API
|
|
3176
|
-
var warnAboutLegacyContextAPI = false;
|
|
3177
|
-
|
|
3178
3181
|
// Gather advanced timing metrics for Profiler subtrees.
|
|
3179
3182
|
var enableProfilerTimer = true;
|
|
3180
3183
|
|
|
@@ -3381,7 +3384,7 @@ function postMountWrapper(element, props, isHydrating) {
|
|
|
3381
3384
|
}
|
|
3382
3385
|
} else {
|
|
3383
3386
|
// When syncing the value attribute, the value property should use
|
|
3384
|
-
// the
|
|
3387
|
+
// the wrapperState._initialValue property. This uses:
|
|
3385
3388
|
//
|
|
3386
3389
|
// 1. The value React property when present
|
|
3387
3390
|
// 2. The defaultValue React property when present
|
|
@@ -3434,7 +3437,7 @@ function postMountWrapper(element, props, isHydrating) {
|
|
|
3434
3437
|
node.defaultChecked = !!props.defaultChecked;
|
|
3435
3438
|
}
|
|
3436
3439
|
} else {
|
|
3437
|
-
// When syncing the checked attribute, both the
|
|
3440
|
+
// When syncing the checked attribute, both the checked property and
|
|
3438
3441
|
// attribute are assigned at the same time using defaultChecked. This uses:
|
|
3439
3442
|
//
|
|
3440
3443
|
// 1. The checked React property when present
|
|
@@ -3770,11 +3773,6 @@ var SyntheticUIEvent = SyntheticEvent.extend({
|
|
|
3770
3773
|
detail: null
|
|
3771
3774
|
});
|
|
3772
3775
|
|
|
3773
|
-
/**
|
|
3774
|
-
* Translation from modifier key to the associated property in the event.
|
|
3775
|
-
* @see http://www.w3.org/TR/DOM-Level-3-Events/#keys-Modifiers
|
|
3776
|
-
*/
|
|
3777
|
-
|
|
3778
3776
|
var modifierKeyToProp = {
|
|
3779
3777
|
Alt: 'altKey',
|
|
3780
3778
|
Control: 'ctrlKey',
|
|
@@ -3785,6 +3783,11 @@ var modifierKeyToProp = {
|
|
|
3785
3783
|
// IE8 does not implement getModifierState so we simply map it to the only
|
|
3786
3784
|
// modifier keys exposed by the event itself, does not support Lock-keys.
|
|
3787
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
|
+
|
|
3788
3791
|
function modifierStateGetter(keyArg) {
|
|
3789
3792
|
var syntheticEvent = this;
|
|
3790
3793
|
var nativeEvent = syntheticEvent.nativeEvent;
|
|
@@ -4131,7 +4134,7 @@ function isFiberMounted(fiber) {
|
|
|
4131
4134
|
function isMounted(component) {
|
|
4132
4135
|
{
|
|
4133
4136
|
var owner = ReactCurrentOwner$1.current;
|
|
4134
|
-
if (owner !== null &&
|
|
4137
|
+
if (owner !== null && owner.tag === ClassComponent) {
|
|
4135
4138
|
var ownerFiber = owner;
|
|
4136
4139
|
var instance = ownerFiber.stateNode;
|
|
4137
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;
|
|
@@ -7283,7 +7286,7 @@ var SUPPRESS_CONTENT_EDITABLE_WARNING = 'suppressContentEditableWarning';
|
|
|
7283
7286
|
var SUPPRESS_HYDRATION_WARNING$1 = 'suppressHydrationWarning';
|
|
7284
7287
|
var AUTOFOCUS = 'autoFocus';
|
|
7285
7288
|
var CHILDREN = 'children';
|
|
7286
|
-
var STYLE = 'style';
|
|
7289
|
+
var STYLE$1 = 'style';
|
|
7287
7290
|
var HTML = '__html';
|
|
7288
7291
|
|
|
7289
7292
|
var HTML_NAMESPACE = Namespaces.html;
|
|
@@ -7438,7 +7441,7 @@ function setInitialDOMProperties(tag, domElement, rootContainerElement, nextProp
|
|
|
7438
7441
|
continue;
|
|
7439
7442
|
}
|
|
7440
7443
|
var nextProp = nextProps[propKey];
|
|
7441
|
-
if (propKey === STYLE) {
|
|
7444
|
+
if (propKey === STYLE$1) {
|
|
7442
7445
|
{
|
|
7443
7446
|
if (nextProp) {
|
|
7444
7447
|
// Freeze the next style object so that we can assume it won't be
|
|
@@ -7491,7 +7494,7 @@ function updateDOMProperties(domElement, updatePayload, wasCustomComponentTag, i
|
|
|
7491
7494
|
for (var i = 0; i < updatePayload.length; i += 2) {
|
|
7492
7495
|
var propKey = updatePayload[i];
|
|
7493
7496
|
var propValue = updatePayload[i + 1];
|
|
7494
|
-
if (propKey === STYLE) {
|
|
7497
|
+
if (propKey === STYLE$1) {
|
|
7495
7498
|
setValueForStyles(domElement, propValue);
|
|
7496
7499
|
} else if (propKey === DANGEROUSLY_SET_INNER_HTML) {
|
|
7497
7500
|
setInnerHTML(domElement, propValue);
|
|
@@ -7728,7 +7731,7 @@ function diffProperties(domElement, tag, lastRawProps, nextRawProps, rootContain
|
|
|
7728
7731
|
if (nextProps.hasOwnProperty(propKey) || !lastProps.hasOwnProperty(propKey) || lastProps[propKey] == null) {
|
|
7729
7732
|
continue;
|
|
7730
7733
|
}
|
|
7731
|
-
if (propKey === STYLE) {
|
|
7734
|
+
if (propKey === STYLE$1) {
|
|
7732
7735
|
var lastStyle = lastProps[propKey];
|
|
7733
7736
|
for (styleName in lastStyle) {
|
|
7734
7737
|
if (lastStyle.hasOwnProperty(styleName)) {
|
|
@@ -7763,7 +7766,7 @@ function diffProperties(domElement, tag, lastRawProps, nextRawProps, rootContain
|
|
|
7763
7766
|
if (!nextProps.hasOwnProperty(propKey) || nextProp === lastProp || nextProp == null && lastProp == null) {
|
|
7764
7767
|
continue;
|
|
7765
7768
|
}
|
|
7766
|
-
if (propKey === STYLE) {
|
|
7769
|
+
if (propKey === STYLE$1) {
|
|
7767
7770
|
{
|
|
7768
7771
|
if (nextProp) {
|
|
7769
7772
|
// Freeze the next style object so that we can assume it won't be
|
|
@@ -7838,7 +7841,7 @@ function diffProperties(domElement, tag, lastRawProps, nextRawProps, rootContain
|
|
|
7838
7841
|
}
|
|
7839
7842
|
}
|
|
7840
7843
|
if (styleUpdates) {
|
|
7841
|
-
(updatePayload = updatePayload || []).push(STYLE, styleUpdates);
|
|
7844
|
+
(updatePayload = updatePayload || []).push(STYLE$1, styleUpdates);
|
|
7842
7845
|
}
|
|
7843
7846
|
return updatePayload;
|
|
7844
7847
|
}
|
|
@@ -8042,7 +8045,7 @@ function diffHydratedProperties(domElement, tag, rawProps, parentNamespace, root
|
|
|
8042
8045
|
if (expectedHTML !== serverHTML) {
|
|
8043
8046
|
warnForPropDifference(propKey, serverHTML, expectedHTML);
|
|
8044
8047
|
}
|
|
8045
|
-
} else if (propKey === STYLE) {
|
|
8048
|
+
} else if (propKey === STYLE$1) {
|
|
8046
8049
|
// $FlowFixMe - Should be inferred as not undefined.
|
|
8047
8050
|
extraAttributeNames.delete(propKey);
|
|
8048
8051
|
|
|
@@ -8522,12 +8525,17 @@ var createContainerChildSet = shim;
|
|
|
8522
8525
|
var appendChildToContainerChildSet = shim;
|
|
8523
8526
|
var finalizeContainerChildren = shim;
|
|
8524
8527
|
var replaceContainerChildren = shim;
|
|
8528
|
+
var cloneHiddenInstance = shim;
|
|
8529
|
+
var cloneUnhiddenInstance = shim;
|
|
8530
|
+
var createHiddenTextInstance = shim;
|
|
8525
8531
|
|
|
8526
8532
|
var SUPPRESS_HYDRATION_WARNING = void 0;
|
|
8527
8533
|
{
|
|
8528
8534
|
SUPPRESS_HYDRATION_WARNING = 'suppressHydrationWarning';
|
|
8529
8535
|
}
|
|
8530
8536
|
|
|
8537
|
+
var STYLE = 'style';
|
|
8538
|
+
|
|
8531
8539
|
var eventsEnabled = null;
|
|
8532
8540
|
var selectionInformation = null;
|
|
8533
8541
|
|
|
@@ -8715,9 +8723,11 @@ function appendChildToContainer(container, child) {
|
|
|
8715
8723
|
// through the React tree. However, on Mobile Safari the click would
|
|
8716
8724
|
// never bubble through the *DOM* tree unless an ancestor with onclick
|
|
8717
8725
|
// event exists. So we wouldn't see it and dispatch it.
|
|
8718
|
-
// This is why we ensure that containers have inline onclick
|
|
8726
|
+
// This is why we ensure that non React root containers have inline onclick
|
|
8727
|
+
// defined.
|
|
8719
8728
|
// https://github.com/facebook/react/issues/11918
|
|
8720
|
-
|
|
8729
|
+
var reactRootContainer = container._reactRootContainer;
|
|
8730
|
+
if ((reactRootContainer === null || reactRootContainer === undefined) && parentNode.onclick === null) {
|
|
8721
8731
|
// TODO: This cast may not be sound for SVG, MathML or custom elements.
|
|
8722
8732
|
trapClickOnNonInteractiveElement(parentNode);
|
|
8723
8733
|
}
|
|
@@ -8747,6 +8757,29 @@ function removeChildFromContainer(container, child) {
|
|
|
8747
8757
|
}
|
|
8748
8758
|
}
|
|
8749
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
|
+
|
|
8750
8783
|
// -------------------
|
|
8751
8784
|
// Hydration
|
|
8752
8785
|
// -------------------
|
|
@@ -9117,7 +9150,7 @@ function stopFailedWorkTimer(fiber) {
|
|
|
9117
9150
|
return;
|
|
9118
9151
|
}
|
|
9119
9152
|
fiber._debugIsCurrentlyTiming = false;
|
|
9120
|
-
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';
|
|
9121
9154
|
endFiberMark(fiber, null, warning);
|
|
9122
9155
|
}
|
|
9123
9156
|
}
|
|
@@ -9539,7 +9572,7 @@ function invalidateContextProvider(workInProgress, type, didChange) {
|
|
|
9539
9572
|
function findCurrentUnmaskedContext(fiber) {
|
|
9540
9573
|
// Currently this is only used with renderSubtreeIntoContainer; not sure if it
|
|
9541
9574
|
// makes sense elsewhere
|
|
9542
|
-
!(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;
|
|
9543
9576
|
|
|
9544
9577
|
var node = fiber;
|
|
9545
9578
|
do {
|
|
@@ -9554,14 +9587,6 @@ function findCurrentUnmaskedContext(fiber) {
|
|
|
9554
9587
|
}
|
|
9555
9588
|
break;
|
|
9556
9589
|
}
|
|
9557
|
-
case ClassComponentLazy:
|
|
9558
|
-
{
|
|
9559
|
-
var _Component = getResultFromResolvedThenable(node.type);
|
|
9560
|
-
if (isContextProvider(_Component)) {
|
|
9561
|
-
return node.stateNode.__reactInternalMemoizedMergedChildContext;
|
|
9562
|
-
}
|
|
9563
|
-
break;
|
|
9564
|
-
}
|
|
9565
9590
|
}
|
|
9566
9591
|
node = node.return;
|
|
9567
9592
|
} while (node !== null);
|
|
@@ -9693,7 +9718,7 @@ function computeInteractiveExpiration(currentTime) {
|
|
|
9693
9718
|
}
|
|
9694
9719
|
|
|
9695
9720
|
var NoContext = 0;
|
|
9696
|
-
var
|
|
9721
|
+
var ConcurrentMode = 1;
|
|
9697
9722
|
var StrictMode = 2;
|
|
9698
9723
|
var ProfileMode = 4;
|
|
9699
9724
|
|
|
@@ -9730,6 +9755,7 @@ function FiberNode(tag, pendingProps, key, mode) {
|
|
|
9730
9755
|
// Instance
|
|
9731
9756
|
this.tag = tag;
|
|
9732
9757
|
this.key = key;
|
|
9758
|
+
this.elementType = null;
|
|
9733
9759
|
this.type = null;
|
|
9734
9760
|
this.stateNode = null;
|
|
9735
9761
|
|
|
@@ -9802,11 +9828,21 @@ function shouldConstruct(Component) {
|
|
|
9802
9828
|
return !!(prototype && prototype.isReactComponent);
|
|
9803
9829
|
}
|
|
9804
9830
|
|
|
9805
|
-
function
|
|
9831
|
+
function isSimpleFunctionComponent(type) {
|
|
9832
|
+
return typeof type === 'function' && !shouldConstruct(type) && type.defaultProps === undefined;
|
|
9833
|
+
}
|
|
9834
|
+
|
|
9835
|
+
function resolveLazyComponentTag(Component) {
|
|
9806
9836
|
if (typeof Component === 'function') {
|
|
9807
|
-
return shouldConstruct(Component) ?
|
|
9808
|
-
} else if (Component !== undefined && Component !== null
|
|
9809
|
-
|
|
9837
|
+
return shouldConstruct(Component) ? ClassComponent : FunctionComponent;
|
|
9838
|
+
} else if (Component !== undefined && Component !== null) {
|
|
9839
|
+
var $$typeof = Component.$$typeof;
|
|
9840
|
+
if ($$typeof === REACT_FORWARD_REF_TYPE) {
|
|
9841
|
+
return ForwardRef;
|
|
9842
|
+
}
|
|
9843
|
+
if ($$typeof === REACT_MEMO_TYPE) {
|
|
9844
|
+
return MemoComponent;
|
|
9845
|
+
}
|
|
9810
9846
|
}
|
|
9811
9847
|
return IndeterminateComponent;
|
|
9812
9848
|
}
|
|
@@ -9821,6 +9857,7 @@ function createWorkInProgress(current, pendingProps, expirationTime) {
|
|
|
9821
9857
|
// extra objects for things that are never updated. It also allow us to
|
|
9822
9858
|
// reclaim the extra memory if needed.
|
|
9823
9859
|
workInProgress = createFiber(current.tag, pendingProps, current.key, current.mode);
|
|
9860
|
+
workInProgress.elementType = current.elementType;
|
|
9824
9861
|
workInProgress.type = current.type;
|
|
9825
9862
|
workInProgress.stateNode = current.stateNode;
|
|
9826
9863
|
|
|
@@ -9855,15 +9892,8 @@ function createWorkInProgress(current, pendingProps, expirationTime) {
|
|
|
9855
9892
|
}
|
|
9856
9893
|
}
|
|
9857
9894
|
|
|
9858
|
-
// Don't touching the subtree's expiration time, which has not changed.
|
|
9859
9895
|
workInProgress.childExpirationTime = current.childExpirationTime;
|
|
9860
|
-
|
|
9861
|
-
// This fiber has new props.
|
|
9862
|
-
workInProgress.expirationTime = expirationTime;
|
|
9863
|
-
} else {
|
|
9864
|
-
// This fiber's props have not changed.
|
|
9865
|
-
workInProgress.expirationTime = current.expirationTime;
|
|
9866
|
-
}
|
|
9896
|
+
workInProgress.expirationTime = current.expirationTime;
|
|
9867
9897
|
|
|
9868
9898
|
workInProgress.child = current.child;
|
|
9869
9899
|
workInProgress.memoizedProps = current.memoizedProps;
|
|
@@ -9884,8 +9914,8 @@ function createWorkInProgress(current, pendingProps, expirationTime) {
|
|
|
9884
9914
|
return workInProgress;
|
|
9885
9915
|
}
|
|
9886
9916
|
|
|
9887
|
-
function createHostRootFiber(
|
|
9888
|
-
var mode =
|
|
9917
|
+
function createHostRootFiber(isConcurrent) {
|
|
9918
|
+
var mode = isConcurrent ? ConcurrentMode | StrictMode : NoContext;
|
|
9889
9919
|
|
|
9890
9920
|
if (enableProfilerTimer && isDevToolsPresent) {
|
|
9891
9921
|
// Always collect profile timings when DevTools are present.
|
|
@@ -9897,39 +9927,31 @@ function createHostRootFiber(isAsync) {
|
|
|
9897
9927
|
return createFiber(HostRoot, null, null, mode);
|
|
9898
9928
|
}
|
|
9899
9929
|
|
|
9900
|
-
function
|
|
9901
|
-
|
|
9902
|
-
{
|
|
9903
|
-
owner = element._owner;
|
|
9904
|
-
}
|
|
9905
|
-
|
|
9930
|
+
function createFiberFromTypeAndProps(type, // React$ElementType
|
|
9931
|
+
key, pendingProps, owner, mode, expirationTime) {
|
|
9906
9932
|
var fiber = void 0;
|
|
9907
|
-
var type = element.type;
|
|
9908
|
-
var key = element.key;
|
|
9909
|
-
var pendingProps = element.props;
|
|
9910
9933
|
|
|
9911
|
-
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;
|
|
9912
9937
|
if (typeof type === 'function') {
|
|
9913
|
-
|
|
9938
|
+
if (shouldConstruct(type)) {
|
|
9939
|
+
fiberTag = ClassComponent;
|
|
9940
|
+
}
|
|
9914
9941
|
} else if (typeof type === 'string') {
|
|
9915
9942
|
fiberTag = HostComponent;
|
|
9916
9943
|
} else {
|
|
9917
9944
|
getTag: switch (type) {
|
|
9918
9945
|
case REACT_FRAGMENT_TYPE:
|
|
9919
9946
|
return createFiberFromFragment(pendingProps.children, mode, expirationTime, key);
|
|
9920
|
-
case
|
|
9921
|
-
|
|
9922
|
-
mode |= AsyncMode | StrictMode;
|
|
9923
|
-
break;
|
|
9947
|
+
case REACT_CONCURRENT_MODE_TYPE:
|
|
9948
|
+
return createFiberFromMode(pendingProps, mode | ConcurrentMode | StrictMode, expirationTime, key);
|
|
9924
9949
|
case REACT_STRICT_MODE_TYPE:
|
|
9925
|
-
|
|
9926
|
-
mode |= StrictMode;
|
|
9927
|
-
break;
|
|
9950
|
+
return createFiberFromMode(pendingProps, mode | StrictMode, expirationTime, key);
|
|
9928
9951
|
case REACT_PROFILER_TYPE:
|
|
9929
9952
|
return createFiberFromProfiler(pendingProps, mode, expirationTime, key);
|
|
9930
|
-
case
|
|
9931
|
-
|
|
9932
|
-
break;
|
|
9953
|
+
case REACT_SUSPENSE_TYPE:
|
|
9954
|
+
return createFiberFromSuspense(pendingProps, mode, expirationTime, key);
|
|
9933
9955
|
default:
|
|
9934
9956
|
{
|
|
9935
9957
|
if (typeof type === 'object' && type !== null) {
|
|
@@ -9944,13 +9966,13 @@ function createFiberFromElement(element, mode, expirationTime) {
|
|
|
9944
9966
|
case REACT_FORWARD_REF_TYPE:
|
|
9945
9967
|
fiberTag = ForwardRef;
|
|
9946
9968
|
break getTag;
|
|
9947
|
-
|
|
9948
|
-
|
|
9949
|
-
|
|
9950
|
-
|
|
9951
|
-
|
|
9952
|
-
|
|
9953
|
-
|
|
9969
|
+
case REACT_MEMO_TYPE:
|
|
9970
|
+
fiberTag = MemoComponent;
|
|
9971
|
+
break getTag;
|
|
9972
|
+
case REACT_LAZY_TYPE:
|
|
9973
|
+
fiberTag = LazyComponent;
|
|
9974
|
+
resolvedType = null;
|
|
9975
|
+
break getTag;
|
|
9954
9976
|
}
|
|
9955
9977
|
}
|
|
9956
9978
|
var info = '';
|
|
@@ -9969,14 +9991,26 @@ function createFiberFromElement(element, mode, expirationTime) {
|
|
|
9969
9991
|
}
|
|
9970
9992
|
|
|
9971
9993
|
fiber = createFiber(fiberTag, pendingProps, key, mode);
|
|
9972
|
-
fiber.
|
|
9994
|
+
fiber.elementType = type;
|
|
9995
|
+
fiber.type = resolvedType;
|
|
9973
9996
|
fiber.expirationTime = expirationTime;
|
|
9974
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);
|
|
9975
10010
|
{
|
|
9976
10011
|
fiber._debugSource = element._source;
|
|
9977
10012
|
fiber._debugOwner = element._owner;
|
|
9978
10013
|
}
|
|
9979
|
-
|
|
9980
10014
|
return fiber;
|
|
9981
10015
|
}
|
|
9982
10016
|
|
|
@@ -9994,12 +10028,38 @@ function createFiberFromProfiler(pendingProps, mode, expirationTime, key) {
|
|
|
9994
10028
|
}
|
|
9995
10029
|
|
|
9996
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;
|
|
9997
10033
|
fiber.type = REACT_PROFILER_TYPE;
|
|
9998
10034
|
fiber.expirationTime = expirationTime;
|
|
9999
10035
|
|
|
10000
10036
|
return fiber;
|
|
10001
10037
|
}
|
|
10002
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
|
+
|
|
10003
10063
|
function createFiberFromText(content, mode, expirationTime) {
|
|
10004
10064
|
var fiber = createFiber(HostText, content, null, mode);
|
|
10005
10065
|
fiber.expirationTime = expirationTime;
|
|
@@ -10008,6 +10068,8 @@ function createFiberFromText(content, mode, expirationTime) {
|
|
|
10008
10068
|
|
|
10009
10069
|
function createFiberFromHostInstanceForDeletion() {
|
|
10010
10070
|
var fiber = createFiber(HostComponent, null, null, NoContext);
|
|
10071
|
+
// TODO: These should not need a type.
|
|
10072
|
+
fiber.elementType = 'DELETED';
|
|
10011
10073
|
fiber.type = 'DELETED';
|
|
10012
10074
|
return fiber;
|
|
10013
10075
|
}
|
|
@@ -10040,6 +10102,7 @@ function assignFiberPropertiesInDEV(target, source) {
|
|
|
10040
10102
|
|
|
10041
10103
|
target.tag = source.tag;
|
|
10042
10104
|
target.key = source.key;
|
|
10105
|
+
target.elementType = source.elementType;
|
|
10043
10106
|
target.type = source.type;
|
|
10044
10107
|
target.stateNode = source.stateNode;
|
|
10045
10108
|
target.return = source.return;
|
|
@@ -10073,7 +10136,6 @@ function assignFiberPropertiesInDEV(target, source) {
|
|
|
10073
10136
|
return target;
|
|
10074
10137
|
}
|
|
10075
10138
|
|
|
10076
|
-
/* eslint-disable no-use-before-define */
|
|
10077
10139
|
// TODO: This should be lifted into the renderer.
|
|
10078
10140
|
|
|
10079
10141
|
|
|
@@ -10089,12 +10151,11 @@ function assignFiberPropertiesInDEV(target, source) {
|
|
|
10089
10151
|
// The types are defined separately within this file to ensure they stay in sync.
|
|
10090
10152
|
// (We don't have to use an inline :any cast when enableSchedulerTracing is disabled.)
|
|
10091
10153
|
|
|
10092
|
-
/* eslint-enable no-use-before-define */
|
|
10093
10154
|
|
|
10094
|
-
function createFiberRoot(containerInfo,
|
|
10155
|
+
function createFiberRoot(containerInfo, isConcurrent, hydrate) {
|
|
10095
10156
|
// Cyclic construction. This cheats the type system right now because
|
|
10096
10157
|
// stateNode is any.
|
|
10097
|
-
var uninitializedFiber = createHostRootFiber(
|
|
10158
|
+
var uninitializedFiber = createHostRootFiber(isConcurrent);
|
|
10098
10159
|
|
|
10099
10160
|
var root = void 0;
|
|
10100
10161
|
if (enableSchedulerTracing) {
|
|
@@ -10902,7 +10963,7 @@ function enqueueUpdate(fiber, update) {
|
|
|
10902
10963
|
}
|
|
10903
10964
|
|
|
10904
10965
|
{
|
|
10905
|
-
if (
|
|
10966
|
+
if (fiber.tag === ClassComponent && (currentlyProcessingQueue === queue1 || queue2 !== null && currentlyProcessingQueue === queue2) && !didWarnUpdateInsideUpdate) {
|
|
10906
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.');
|
|
10907
10968
|
didWarnUpdateInsideUpdate = true;
|
|
10908
10969
|
}
|
|
@@ -11275,7 +11336,7 @@ function propagateContextChange(workInProgress, context, changedBits, renderExpi
|
|
|
11275
11336
|
if (dependency.context === context && (dependency.observedBits & changedBits) !== 0) {
|
|
11276
11337
|
// Match! Schedule an update on this fiber.
|
|
11277
11338
|
|
|
11278
|
-
if (fiber.tag === ClassComponent
|
|
11339
|
+
if (fiber.tag === ClassComponent) {
|
|
11279
11340
|
// Schedule a force update on the work-in-progress.
|
|
11280
11341
|
var update = createUpdate(renderExpirationTime);
|
|
11281
11342
|
update.tag = ForceUpdate;
|
|
@@ -11382,7 +11443,7 @@ function readContext(context, observedBits) {
|
|
|
11382
11443
|
};
|
|
11383
11444
|
|
|
11384
11445
|
if (lastContextDependency === null) {
|
|
11385
|
-
!(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;
|
|
11386
11447
|
// This is the first dependency in the list
|
|
11387
11448
|
currentlyRenderingFiber.firstContextDependency = lastContextDependency = contextItem;
|
|
11388
11449
|
} else {
|
|
@@ -11478,7 +11539,7 @@ function recordCommitTime() {
|
|
|
11478
11539
|
if (!enableProfilerTimer) {
|
|
11479
11540
|
return;
|
|
11480
11541
|
}
|
|
11481
|
-
commitTime =
|
|
11542
|
+
commitTime = scheduler.unstable_now();
|
|
11482
11543
|
}
|
|
11483
11544
|
|
|
11484
11545
|
function startProfilerTimer(fiber) {
|
|
@@ -11486,10 +11547,10 @@ function startProfilerTimer(fiber) {
|
|
|
11486
11547
|
return;
|
|
11487
11548
|
}
|
|
11488
11549
|
|
|
11489
|
-
profilerStartTime =
|
|
11550
|
+
profilerStartTime = scheduler.unstable_now();
|
|
11490
11551
|
|
|
11491
11552
|
if (fiber.actualStartTime < 0) {
|
|
11492
|
-
fiber.actualStartTime =
|
|
11553
|
+
fiber.actualStartTime = scheduler.unstable_now();
|
|
11493
11554
|
}
|
|
11494
11555
|
}
|
|
11495
11556
|
|
|
@@ -11506,7 +11567,7 @@ function stopProfilerTimerIfRunningAndRecordDelta(fiber, overrideBaseTime) {
|
|
|
11506
11567
|
}
|
|
11507
11568
|
|
|
11508
11569
|
if (profilerStartTime >= 0) {
|
|
11509
|
-
var elapsedTime =
|
|
11570
|
+
var elapsedTime = scheduler.unstable_now() - profilerStartTime;
|
|
11510
11571
|
fiber.actualDuration += elapsedTime;
|
|
11511
11572
|
if (overrideBaseTime) {
|
|
11512
11573
|
fiber.selfBaseDuration = elapsedTime;
|
|
@@ -11515,8 +11576,15 @@ function stopProfilerTimerIfRunningAndRecordDelta(fiber, overrideBaseTime) {
|
|
|
11515
11576
|
}
|
|
11516
11577
|
}
|
|
11517
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
|
+
|
|
11518
11586
|
var fakeInternalInstance = {};
|
|
11519
|
-
var isArray = Array.isArray;
|
|
11587
|
+
var isArray$1 = Array.isArray;
|
|
11520
11588
|
|
|
11521
11589
|
// React.Component uses a shared frozen object by default.
|
|
11522
11590
|
// We'll use it to determine whether we need to initialize legacy refs.
|
|
@@ -11530,6 +11598,8 @@ var didWarnAboutUndefinedDerivedState = void 0;
|
|
|
11530
11598
|
var warnOnUndefinedDerivedState = void 0;
|
|
11531
11599
|
var warnOnInvalidCallback$1 = void 0;
|
|
11532
11600
|
var didWarnAboutDirectlyAssigningPropsToState = void 0;
|
|
11601
|
+
var didWarnAboutContextTypeAndContextTypes = void 0;
|
|
11602
|
+
var didWarnAboutInvalidateContextType = void 0;
|
|
11533
11603
|
|
|
11534
11604
|
{
|
|
11535
11605
|
didWarnAboutStateAssignmentForComponent = new Set();
|
|
@@ -11538,6 +11608,8 @@ var didWarnAboutDirectlyAssigningPropsToState = void 0;
|
|
|
11538
11608
|
didWarnAboutLegacyLifecyclesAndDerivedState = new Set();
|
|
11539
11609
|
didWarnAboutDirectlyAssigningPropsToState = new Set();
|
|
11540
11610
|
didWarnAboutUndefinedDerivedState = new Set();
|
|
11611
|
+
didWarnAboutContextTypeAndContextTypes = new Set();
|
|
11612
|
+
didWarnAboutInvalidateContextType = new Set();
|
|
11541
11613
|
|
|
11542
11614
|
var didWarnOnInvalidCallback = new Set();
|
|
11543
11615
|
|
|
@@ -11661,11 +11733,11 @@ var classComponentUpdater = {
|
|
|
11661
11733
|
}
|
|
11662
11734
|
};
|
|
11663
11735
|
|
|
11664
|
-
function checkShouldComponentUpdate(workInProgress, ctor, oldProps, newProps, oldState, newState,
|
|
11736
|
+
function checkShouldComponentUpdate(workInProgress, ctor, oldProps, newProps, oldState, newState, nextContext) {
|
|
11665
11737
|
var instance = workInProgress.stateNode;
|
|
11666
11738
|
if (typeof instance.shouldComponentUpdate === 'function') {
|
|
11667
11739
|
startPhaseTimer(workInProgress, 'shouldComponentUpdate');
|
|
11668
|
-
var shouldUpdate = instance.shouldComponentUpdate(newProps, newState,
|
|
11740
|
+
var shouldUpdate = instance.shouldComponentUpdate(newProps, newState, nextContext);
|
|
11669
11741
|
stopPhaseTimer();
|
|
11670
11742
|
|
|
11671
11743
|
{
|
|
@@ -11702,8 +11774,16 @@ function checkClassInstance(workInProgress, ctor, newProps) {
|
|
|
11702
11774
|
!noGetDefaultPropsOnES6 ? warningWithoutStack$1(false, 'getDefaultProps was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Use a static property to define defaultProps instead.', name) : void 0;
|
|
11703
11775
|
var noInstancePropTypes = !instance.propTypes;
|
|
11704
11776
|
!noInstancePropTypes ? warningWithoutStack$1(false, 'propTypes was defined as an instance property on %s. Use a static ' + 'property to define propTypes instead.', name) : void 0;
|
|
11777
|
+
var noInstanceContextType = !instance.contextType;
|
|
11778
|
+
!noInstanceContextType ? warningWithoutStack$1(false, 'contextType was defined as an instance property on %s. Use a static ' + 'property to define contextType instead.', name) : void 0;
|
|
11705
11779
|
var noInstanceContextTypes = !instance.contextTypes;
|
|
11706
11780
|
!noInstanceContextTypes ? warningWithoutStack$1(false, 'contextTypes was defined as an instance property on %s. Use a static ' + 'property to define contextTypes instead.', name) : void 0;
|
|
11781
|
+
|
|
11782
|
+
if (ctor.contextType && ctor.contextTypes && !didWarnAboutContextTypeAndContextTypes.has(ctor)) {
|
|
11783
|
+
didWarnAboutContextTypeAndContextTypes.add(ctor);
|
|
11784
|
+
warningWithoutStack$1(false, '%s declares both contextTypes and contextType static properties. ' + 'The legacy contextTypes property will be ignored.', name);
|
|
11785
|
+
}
|
|
11786
|
+
|
|
11707
11787
|
var noComponentShouldUpdate = typeof instance.componentShouldUpdate !== 'function';
|
|
11708
11788
|
!noComponentShouldUpdate ? warningWithoutStack$1(false, '%s has a method called ' + 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + 'The name is phrased as a question because the function is ' + 'expected to return a value.', name) : void 0;
|
|
11709
11789
|
if (ctor.prototype && ctor.prototype.isPureReactComponent && typeof instance.shouldComponentUpdate !== 'undefined') {
|
|
@@ -11729,12 +11809,12 @@ function checkClassInstance(workInProgress, ctor, newProps) {
|
|
|
11729
11809
|
|
|
11730
11810
|
var noInstanceGetDerivedStateFromProps = typeof instance.getDerivedStateFromProps !== 'function';
|
|
11731
11811
|
!noInstanceGetDerivedStateFromProps ? warningWithoutStack$1(false, '%s: getDerivedStateFromProps() is defined as an instance method ' + 'and will be ignored. Instead, declare it as a static method.', name) : void 0;
|
|
11732
|
-
var noInstanceGetDerivedStateFromCatch = typeof instance.
|
|
11733
|
-
!noInstanceGetDerivedStateFromCatch ? warningWithoutStack$1(false, '%s:
|
|
11812
|
+
var noInstanceGetDerivedStateFromCatch = typeof instance.getDerivedStateFromError !== 'function';
|
|
11813
|
+
!noInstanceGetDerivedStateFromCatch ? warningWithoutStack$1(false, '%s: getDerivedStateFromError() is defined as an instance method ' + 'and will be ignored. Instead, declare it as a static method.', name) : void 0;
|
|
11734
11814
|
var noStaticGetSnapshotBeforeUpdate = typeof ctor.getSnapshotBeforeUpdate !== 'function';
|
|
11735
11815
|
!noStaticGetSnapshotBeforeUpdate ? warningWithoutStack$1(false, '%s: getSnapshotBeforeUpdate() is defined as a static method ' + 'and will be ignored. Instead, declare it as an instance method.', name) : void 0;
|
|
11736
11816
|
var _state = instance.state;
|
|
11737
|
-
if (_state && (typeof _state !== 'object' || isArray(_state))) {
|
|
11817
|
+
if (_state && (typeof _state !== 'object' || isArray$1(_state))) {
|
|
11738
11818
|
warningWithoutStack$1(false, '%s.state: must be set to an object or null', name);
|
|
11739
11819
|
}
|
|
11740
11820
|
if (typeof instance.getChildContext === 'function') {
|
|
@@ -11754,10 +11834,25 @@ function adoptClassInstance(workInProgress, instance) {
|
|
|
11754
11834
|
}
|
|
11755
11835
|
|
|
11756
11836
|
function constructClassInstance(workInProgress, ctor, props, renderExpirationTime) {
|
|
11757
|
-
var
|
|
11758
|
-
var
|
|
11759
|
-
var
|
|
11760
|
-
var
|
|
11837
|
+
var isLegacyContextConsumer = false;
|
|
11838
|
+
var unmaskedContext = emptyContextObject;
|
|
11839
|
+
var context = null;
|
|
11840
|
+
var contextType = ctor.contextType;
|
|
11841
|
+
if (typeof contextType === 'object' && contextType !== null) {
|
|
11842
|
+
{
|
|
11843
|
+
if (contextType.$$typeof !== REACT_CONTEXT_TYPE && !didWarnAboutInvalidateContextType.has(ctor)) {
|
|
11844
|
+
didWarnAboutInvalidateContextType.add(ctor);
|
|
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');
|
|
11846
|
+
}
|
|
11847
|
+
}
|
|
11848
|
+
|
|
11849
|
+
context = readContext$1(contextType);
|
|
11850
|
+
} else {
|
|
11851
|
+
unmaskedContext = getUnmaskedContext(workInProgress, ctor, true);
|
|
11852
|
+
var contextTypes = ctor.contextTypes;
|
|
11853
|
+
isLegacyContextConsumer = contextTypes !== null && contextTypes !== undefined;
|
|
11854
|
+
context = isLegacyContextConsumer ? getMaskedContext(workInProgress, unmaskedContext) : emptyContextObject;
|
|
11855
|
+
}
|
|
11761
11856
|
|
|
11762
11857
|
// Instantiate twice to help detect side-effects.
|
|
11763
11858
|
{
|
|
@@ -11814,7 +11909,7 @@ function constructClassInstance(workInProgress, ctor, props, renderExpirationTim
|
|
|
11814
11909
|
|
|
11815
11910
|
// Cache unmasked context so we can avoid recreating masked context unless necessary.
|
|
11816
11911
|
// ReactFiberContext usually updates this cache but can't for newly-created instances.
|
|
11817
|
-
if (
|
|
11912
|
+
if (isLegacyContextConsumer) {
|
|
11818
11913
|
cacheContext(workInProgress, unmaskedContext, context);
|
|
11819
11914
|
}
|
|
11820
11915
|
|
|
@@ -11842,14 +11937,14 @@ function callComponentWillMount(workInProgress, instance) {
|
|
|
11842
11937
|
}
|
|
11843
11938
|
}
|
|
11844
11939
|
|
|
11845
|
-
function callComponentWillReceiveProps(workInProgress, instance, newProps,
|
|
11940
|
+
function callComponentWillReceiveProps(workInProgress, instance, newProps, nextContext) {
|
|
11846
11941
|
var oldState = instance.state;
|
|
11847
11942
|
startPhaseTimer(workInProgress, 'componentWillReceiveProps');
|
|
11848
11943
|
if (typeof instance.componentWillReceiveProps === 'function') {
|
|
11849
|
-
instance.componentWillReceiveProps(newProps,
|
|
11944
|
+
instance.componentWillReceiveProps(newProps, nextContext);
|
|
11850
11945
|
}
|
|
11851
11946
|
if (typeof instance.UNSAFE_componentWillReceiveProps === 'function') {
|
|
11852
|
-
instance.UNSAFE_componentWillReceiveProps(newProps,
|
|
11947
|
+
instance.UNSAFE_componentWillReceiveProps(newProps, nextContext);
|
|
11853
11948
|
}
|
|
11854
11949
|
stopPhaseTimer();
|
|
11855
11950
|
|
|
@@ -11872,12 +11967,17 @@ function mountClassInstance(workInProgress, ctor, newProps, renderExpirationTime
|
|
|
11872
11967
|
}
|
|
11873
11968
|
|
|
11874
11969
|
var instance = workInProgress.stateNode;
|
|
11875
|
-
var unmaskedContext = getUnmaskedContext(workInProgress, ctor, true);
|
|
11876
|
-
|
|
11877
11970
|
instance.props = newProps;
|
|
11878
11971
|
instance.state = workInProgress.memoizedState;
|
|
11879
11972
|
instance.refs = emptyRefsObject;
|
|
11880
|
-
|
|
11973
|
+
|
|
11974
|
+
var contextType = ctor.contextType;
|
|
11975
|
+
if (typeof contextType === 'object' && contextType !== null) {
|
|
11976
|
+
instance.context = readContext$1(contextType);
|
|
11977
|
+
} else {
|
|
11978
|
+
var unmaskedContext = getUnmaskedContext(workInProgress, ctor, true);
|
|
11979
|
+
instance.context = getMaskedContext(workInProgress, unmaskedContext);
|
|
11980
|
+
}
|
|
11881
11981
|
|
|
11882
11982
|
{
|
|
11883
11983
|
if (instance.state === newProps) {
|
|
@@ -11936,8 +12036,14 @@ function resumeMountClassInstance(workInProgress, ctor, newProps, renderExpirati
|
|
|
11936
12036
|
instance.props = oldProps;
|
|
11937
12037
|
|
|
11938
12038
|
var oldContext = instance.context;
|
|
11939
|
-
var
|
|
11940
|
-
var
|
|
12039
|
+
var contextType = ctor.contextType;
|
|
12040
|
+
var nextContext = void 0;
|
|
12041
|
+
if (typeof contextType === 'object' && contextType !== null) {
|
|
12042
|
+
nextContext = readContext$1(contextType);
|
|
12043
|
+
} else {
|
|
12044
|
+
var nextLegacyUnmaskedContext = getUnmaskedContext(workInProgress, ctor, true);
|
|
12045
|
+
nextContext = getMaskedContext(workInProgress, nextLegacyUnmaskedContext);
|
|
12046
|
+
}
|
|
11941
12047
|
|
|
11942
12048
|
var getDerivedStateFromProps = ctor.getDerivedStateFromProps;
|
|
11943
12049
|
var hasNewLifecycles = typeof getDerivedStateFromProps === 'function' || typeof instance.getSnapshotBeforeUpdate === 'function';
|
|
@@ -11949,8 +12055,8 @@ function resumeMountClassInstance(workInProgress, ctor, newProps, renderExpirati
|
|
|
11949
12055
|
// In order to support react-lifecycles-compat polyfilled components,
|
|
11950
12056
|
// Unsafe lifecycles should not be invoked for components using the new APIs.
|
|
11951
12057
|
if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillReceiveProps === 'function' || typeof instance.componentWillReceiveProps === 'function')) {
|
|
11952
|
-
if (oldProps !== newProps || oldContext !==
|
|
11953
|
-
callComponentWillReceiveProps(workInProgress, instance, newProps,
|
|
12058
|
+
if (oldProps !== newProps || oldContext !== nextContext) {
|
|
12059
|
+
callComponentWillReceiveProps(workInProgress, instance, newProps, nextContext);
|
|
11954
12060
|
}
|
|
11955
12061
|
}
|
|
11956
12062
|
|
|
@@ -11977,7 +12083,7 @@ function resumeMountClassInstance(workInProgress, ctor, newProps, renderExpirati
|
|
|
11977
12083
|
newState = workInProgress.memoizedState;
|
|
11978
12084
|
}
|
|
11979
12085
|
|
|
11980
|
-
var shouldUpdate = checkHasForceUpdateAfterProcessing() || checkShouldComponentUpdate(workInProgress, ctor, oldProps, newProps, oldState, newState,
|
|
12086
|
+
var shouldUpdate = checkHasForceUpdateAfterProcessing() || checkShouldComponentUpdate(workInProgress, ctor, oldProps, newProps, oldState, newState, nextContext);
|
|
11981
12087
|
|
|
11982
12088
|
if (shouldUpdate) {
|
|
11983
12089
|
// In order to support react-lifecycles-compat polyfilled components,
|
|
@@ -12012,7 +12118,7 @@ function resumeMountClassInstance(workInProgress, ctor, newProps, renderExpirati
|
|
|
12012
12118
|
// if shouldComponentUpdate returns false.
|
|
12013
12119
|
instance.props = newProps;
|
|
12014
12120
|
instance.state = newState;
|
|
12015
|
-
instance.context =
|
|
12121
|
+
instance.context = nextContext;
|
|
12016
12122
|
|
|
12017
12123
|
return shouldUpdate;
|
|
12018
12124
|
}
|
|
@@ -12025,8 +12131,14 @@ function updateClassInstance(current, workInProgress, ctor, newProps, renderExpi
|
|
|
12025
12131
|
instance.props = oldProps;
|
|
12026
12132
|
|
|
12027
12133
|
var oldContext = instance.context;
|
|
12028
|
-
var
|
|
12029
|
-
var
|
|
12134
|
+
var contextType = ctor.contextType;
|
|
12135
|
+
var nextContext = void 0;
|
|
12136
|
+
if (typeof contextType === 'object' && contextType !== null) {
|
|
12137
|
+
nextContext = readContext$1(contextType);
|
|
12138
|
+
} else {
|
|
12139
|
+
var nextUnmaskedContext = getUnmaskedContext(workInProgress, ctor, true);
|
|
12140
|
+
nextContext = getMaskedContext(workInProgress, nextUnmaskedContext);
|
|
12141
|
+
}
|
|
12030
12142
|
|
|
12031
12143
|
var getDerivedStateFromProps = ctor.getDerivedStateFromProps;
|
|
12032
12144
|
var hasNewLifecycles = typeof getDerivedStateFromProps === 'function' || typeof instance.getSnapshotBeforeUpdate === 'function';
|
|
@@ -12038,8 +12150,8 @@ function updateClassInstance(current, workInProgress, ctor, newProps, renderExpi
|
|
|
12038
12150
|
// In order to support react-lifecycles-compat polyfilled components,
|
|
12039
12151
|
// Unsafe lifecycles should not be invoked for components using the new APIs.
|
|
12040
12152
|
if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillReceiveProps === 'function' || typeof instance.componentWillReceiveProps === 'function')) {
|
|
12041
|
-
if (oldProps !== newProps || oldContext !==
|
|
12042
|
-
callComponentWillReceiveProps(workInProgress, instance, newProps,
|
|
12153
|
+
if (oldProps !== newProps || oldContext !== nextContext) {
|
|
12154
|
+
callComponentWillReceiveProps(workInProgress, instance, newProps, nextContext);
|
|
12043
12155
|
}
|
|
12044
12156
|
}
|
|
12045
12157
|
|
|
@@ -12074,7 +12186,7 @@ function updateClassInstance(current, workInProgress, ctor, newProps, renderExpi
|
|
|
12074
12186
|
newState = workInProgress.memoizedState;
|
|
12075
12187
|
}
|
|
12076
12188
|
|
|
12077
|
-
var shouldUpdate = checkHasForceUpdateAfterProcessing() || checkShouldComponentUpdate(workInProgress, ctor, oldProps, newProps, oldState, newState,
|
|
12189
|
+
var shouldUpdate = checkHasForceUpdateAfterProcessing() || checkShouldComponentUpdate(workInProgress, ctor, oldProps, newProps, oldState, newState, nextContext);
|
|
12078
12190
|
|
|
12079
12191
|
if (shouldUpdate) {
|
|
12080
12192
|
// In order to support react-lifecycles-compat polyfilled components,
|
|
@@ -12082,10 +12194,10 @@ function updateClassInstance(current, workInProgress, ctor, newProps, renderExpi
|
|
|
12082
12194
|
if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillUpdate === 'function' || typeof instance.componentWillUpdate === 'function')) {
|
|
12083
12195
|
startPhaseTimer(workInProgress, 'componentWillUpdate');
|
|
12084
12196
|
if (typeof instance.componentWillUpdate === 'function') {
|
|
12085
|
-
instance.componentWillUpdate(newProps, newState,
|
|
12197
|
+
instance.componentWillUpdate(newProps, newState, nextContext);
|
|
12086
12198
|
}
|
|
12087
12199
|
if (typeof instance.UNSAFE_componentWillUpdate === 'function') {
|
|
12088
|
-
instance.UNSAFE_componentWillUpdate(newProps, newState,
|
|
12200
|
+
instance.UNSAFE_componentWillUpdate(newProps, newState, nextContext);
|
|
12089
12201
|
}
|
|
12090
12202
|
stopPhaseTimer();
|
|
12091
12203
|
}
|
|
@@ -12119,7 +12231,7 @@ function updateClassInstance(current, workInProgress, ctor, newProps, renderExpi
|
|
|
12119
12231
|
// if shouldComponentUpdate returns false.
|
|
12120
12232
|
instance.props = newProps;
|
|
12121
12233
|
instance.state = newState;
|
|
12122
|
-
instance.context =
|
|
12234
|
+
instance.context = nextContext;
|
|
12123
12235
|
|
|
12124
12236
|
return shouldUpdate;
|
|
12125
12237
|
}
|
|
@@ -12164,7 +12276,7 @@ var warnForMissingKey = function (child) {};
|
|
|
12164
12276
|
};
|
|
12165
12277
|
}
|
|
12166
12278
|
|
|
12167
|
-
var isArray
|
|
12279
|
+
var isArray = Array.isArray;
|
|
12168
12280
|
|
|
12169
12281
|
function coerceRef(returnFiber, current$$1, element) {
|
|
12170
12282
|
var mixedRef = element.ref;
|
|
@@ -12184,7 +12296,7 @@ function coerceRef(returnFiber, current$$1, element) {
|
|
|
12184
12296
|
var inst = void 0;
|
|
12185
12297
|
if (owner) {
|
|
12186
12298
|
var ownerFiber = owner;
|
|
12187
|
-
!(ownerFiber.tag === ClassComponent
|
|
12299
|
+
!(ownerFiber.tag === ClassComponent) ? invariant(false, 'Function components cannot have refs.') : void 0;
|
|
12188
12300
|
inst = ownerFiber.stateNode;
|
|
12189
12301
|
}
|
|
12190
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;
|
|
@@ -12209,7 +12321,7 @@ function coerceRef(returnFiber, current$$1, element) {
|
|
|
12209
12321
|
return ref;
|
|
12210
12322
|
} else {
|
|
12211
12323
|
!(typeof mixedRef === 'string') ? invariant(false, 'Expected ref to be a function, a string, an object returned by React.createRef(), or null.') : void 0;
|
|
12212
|
-
!element._owner ? invariant(false, 'Element ref was specified as a string (%s) but no owner was set. This could happen for one of the following reasons:\n1. You may be adding a ref to a
|
|
12324
|
+
!element._owner ? invariant(false, 'Element ref was specified as a string (%s) but no owner was set. This could happen for one of the following reasons:\n1. You may be adding a ref to a function component\n2. You may be adding a ref to a component that was not created inside a component\'s render method\n3. You have multiple copies of React loaded\nSee https://fb.me/react-refs-must-have-owner for more information.', mixedRef) : void 0;
|
|
12213
12325
|
}
|
|
12214
12326
|
}
|
|
12215
12327
|
return mixedRef;
|
|
@@ -12352,7 +12464,7 @@ function ChildReconciler(shouldTrackSideEffects) {
|
|
|
12352
12464
|
}
|
|
12353
12465
|
|
|
12354
12466
|
function updateElement(returnFiber, current$$1, element, expirationTime) {
|
|
12355
|
-
if (current$$1 !== null && current$$1.
|
|
12467
|
+
if (current$$1 !== null && current$$1.elementType === element.type) {
|
|
12356
12468
|
// Move based on index
|
|
12357
12469
|
var existing = useFiber(current$$1, element.props, expirationTime);
|
|
12358
12470
|
existing.ref = coerceRef(returnFiber, current$$1, element);
|
|
@@ -12426,7 +12538,7 @@ function ChildReconciler(shouldTrackSideEffects) {
|
|
|
12426
12538
|
}
|
|
12427
12539
|
}
|
|
12428
12540
|
|
|
12429
|
-
if (isArray
|
|
12541
|
+
if (isArray(newChild) || getIteratorFn(newChild)) {
|
|
12430
12542
|
var _created3 = createFiberFromFragment(newChild, returnFiber.mode, expirationTime, null);
|
|
12431
12543
|
_created3.return = returnFiber;
|
|
12432
12544
|
return _created3;
|
|
@@ -12482,7 +12594,7 @@ function ChildReconciler(shouldTrackSideEffects) {
|
|
|
12482
12594
|
}
|
|
12483
12595
|
}
|
|
12484
12596
|
|
|
12485
|
-
if (isArray
|
|
12597
|
+
if (isArray(newChild) || getIteratorFn(newChild)) {
|
|
12486
12598
|
if (key !== null) {
|
|
12487
12599
|
return null;
|
|
12488
12600
|
}
|
|
@@ -12527,7 +12639,7 @@ function ChildReconciler(shouldTrackSideEffects) {
|
|
|
12527
12639
|
}
|
|
12528
12640
|
}
|
|
12529
12641
|
|
|
12530
|
-
if (isArray
|
|
12642
|
+
if (isArray(newChild) || getIteratorFn(newChild)) {
|
|
12531
12643
|
var _matchedFiber3 = existingChildren.get(newIdx) || null;
|
|
12532
12644
|
return updateFragment(returnFiber, _matchedFiber3, newChild, expirationTime, null);
|
|
12533
12645
|
}
|
|
@@ -12894,7 +13006,7 @@ function ChildReconciler(shouldTrackSideEffects) {
|
|
|
12894
13006
|
// TODO: If key === null and child.key === null, then this only applies to
|
|
12895
13007
|
// the first item in the list.
|
|
12896
13008
|
if (child.key === key) {
|
|
12897
|
-
if (child.tag === Fragment ? element.type === REACT_FRAGMENT_TYPE : child.
|
|
13009
|
+
if (child.tag === Fragment ? element.type === REACT_FRAGMENT_TYPE : child.elementType === element.type) {
|
|
12898
13010
|
deleteRemainingChildren(returnFiber, child.sibling);
|
|
12899
13011
|
var existing = useFiber(child, element.type === REACT_FRAGMENT_TYPE ? element.props.children : element.props, expirationTime);
|
|
12900
13012
|
existing.ref = coerceRef(returnFiber, child, element);
|
|
@@ -12986,7 +13098,7 @@ function ChildReconciler(shouldTrackSideEffects) {
|
|
|
12986
13098
|
return placeSingleChild(reconcileSingleTextNode(returnFiber, currentFirstChild, '' + newChild, expirationTime));
|
|
12987
13099
|
}
|
|
12988
13100
|
|
|
12989
|
-
if (isArray
|
|
13101
|
+
if (isArray(newChild)) {
|
|
12990
13102
|
return reconcileChildrenArray(returnFiber, currentFirstChild, newChild, expirationTime);
|
|
12991
13103
|
}
|
|
12992
13104
|
|
|
@@ -13009,7 +13121,6 @@ function ChildReconciler(shouldTrackSideEffects) {
|
|
|
13009
13121
|
// we already threw above.
|
|
13010
13122
|
switch (returnFiber.tag) {
|
|
13011
13123
|
case ClassComponent:
|
|
13012
|
-
case ClassComponentLazy:
|
|
13013
13124
|
{
|
|
13014
13125
|
{
|
|
13015
13126
|
var instance = returnFiber.stateNode;
|
|
@@ -13022,7 +13133,7 @@ function ChildReconciler(shouldTrackSideEffects) {
|
|
|
13022
13133
|
// Intentionally fall through to the next case, which handles both
|
|
13023
13134
|
// functions and classes
|
|
13024
13135
|
// eslint-disable-next-lined no-fallthrough
|
|
13025
|
-
case
|
|
13136
|
+
case FunctionComponent:
|
|
13026
13137
|
{
|
|
13027
13138
|
var Component = returnFiber.type;
|
|
13028
13139
|
invariant(false, '%s(...): Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null.', Component.displayName || Component.name || 'Component');
|
|
@@ -13324,40 +13435,49 @@ function resetHydrationState() {
|
|
|
13324
13435
|
isHydrating = false;
|
|
13325
13436
|
}
|
|
13326
13437
|
|
|
13327
|
-
function readLazyComponentType(
|
|
13328
|
-
var status =
|
|
13438
|
+
function readLazyComponentType(lazyComponent) {
|
|
13439
|
+
var status = lazyComponent._status;
|
|
13440
|
+
var result = lazyComponent._result;
|
|
13329
13441
|
switch (status) {
|
|
13330
13442
|
case Resolved:
|
|
13331
|
-
|
|
13332
|
-
|
|
13443
|
+
{
|
|
13444
|
+
var Component = result;
|
|
13445
|
+
return Component;
|
|
13446
|
+
}
|
|
13333
13447
|
case Rejected:
|
|
13334
|
-
|
|
13448
|
+
{
|
|
13449
|
+
var error = result;
|
|
13450
|
+
throw error;
|
|
13451
|
+
}
|
|
13335
13452
|
case Pending:
|
|
13336
|
-
|
|
13453
|
+
{
|
|
13454
|
+
var thenable = result;
|
|
13455
|
+
throw thenable;
|
|
13456
|
+
}
|
|
13337
13457
|
default:
|
|
13338
13458
|
{
|
|
13339
|
-
|
|
13340
|
-
|
|
13341
|
-
|
|
13342
|
-
|
|
13343
|
-
|
|
13344
|
-
|
|
13345
|
-
|
|
13346
|
-
|
|
13347
|
-
|
|
13348
|
-
|
|
13349
|
-
} else {
|
|
13350
|
-
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
|
+
}
|
|
13351
13469
|
}
|
|
13352
|
-
|
|
13470
|
+
lazyComponent._status = Resolved;
|
|
13471
|
+
lazyComponent._result = defaultExport;
|
|
13353
13472
|
}
|
|
13354
13473
|
}, function (error) {
|
|
13355
|
-
if (
|
|
13356
|
-
|
|
13357
|
-
|
|
13474
|
+
if (lazyComponent._status === Pending) {
|
|
13475
|
+
lazyComponent._status = Rejected;
|
|
13476
|
+
lazyComponent._result = error;
|
|
13358
13477
|
}
|
|
13359
13478
|
});
|
|
13360
|
-
|
|
13479
|
+
lazyComponent._result = _thenable;
|
|
13480
|
+
throw _thenable;
|
|
13361
13481
|
}
|
|
13362
13482
|
}
|
|
13363
13483
|
}
|
|
@@ -13365,13 +13485,15 @@ function readLazyComponentType(thenable) {
|
|
|
13365
13485
|
var ReactCurrentOwner$3 = ReactSharedInternals.ReactCurrentOwner;
|
|
13366
13486
|
|
|
13367
13487
|
var didWarnAboutBadClass = void 0;
|
|
13368
|
-
var
|
|
13369
|
-
var
|
|
13488
|
+
var didWarnAboutContextTypeOnFunctionComponent = void 0;
|
|
13489
|
+
var didWarnAboutGetDerivedStateOnFunctionComponent = void 0;
|
|
13490
|
+
var didWarnAboutFunctionRefs = void 0;
|
|
13370
13491
|
|
|
13371
13492
|
{
|
|
13372
13493
|
didWarnAboutBadClass = {};
|
|
13373
|
-
|
|
13374
|
-
|
|
13494
|
+
didWarnAboutContextTypeOnFunctionComponent = {};
|
|
13495
|
+
didWarnAboutGetDerivedStateOnFunctionComponent = {};
|
|
13496
|
+
didWarnAboutFunctionRefs = {};
|
|
13375
13497
|
}
|
|
13376
13498
|
|
|
13377
13499
|
function reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime) {
|
|
@@ -13392,6 +13514,23 @@ function reconcileChildren(current$$1, workInProgress, nextChildren, renderExpir
|
|
|
13392
13514
|
}
|
|
13393
13515
|
}
|
|
13394
13516
|
|
|
13517
|
+
function forceUnmountCurrentAndReconcile(current$$1, workInProgress, nextChildren, renderExpirationTime) {
|
|
13518
|
+
// This function is fork of reconcileChildren. It's used in cases where we
|
|
13519
|
+
// want to reconcile without matching against the existing set. This has the
|
|
13520
|
+
// effect of all current children being unmounted; even if the type and key
|
|
13521
|
+
// are the same, the old child is unmounted and a new child is created.
|
|
13522
|
+
//
|
|
13523
|
+
// To do this, we're going to go through the reconcile algorithm twice. In
|
|
13524
|
+
// the first pass, we schedule a deletion for all the current children by
|
|
13525
|
+
// passing null.
|
|
13526
|
+
workInProgress.child = reconcileChildFibers(workInProgress, current$$1.child, null, renderExpirationTime);
|
|
13527
|
+
// In the second pass, we mount the new children. The trick here is that we
|
|
13528
|
+
// pass null in place of where we usually pass the current child set. This has
|
|
13529
|
+
// the effect of remounting all children regardless of whether their their
|
|
13530
|
+
// identity matches.
|
|
13531
|
+
workInProgress.child = reconcileChildFibers(workInProgress, null, nextChildren, renderExpirationTime);
|
|
13532
|
+
}
|
|
13533
|
+
|
|
13395
13534
|
function updateForwardRef(current$$1, workInProgress, type, nextProps, renderExpirationTime) {
|
|
13396
13535
|
var render = type.render;
|
|
13397
13536
|
var ref = workInProgress.ref;
|
|
@@ -13414,21 +13553,64 @@ function updateForwardRef(current$$1, workInProgress, type, nextProps, renderExp
|
|
|
13414
13553
|
}
|
|
13415
13554
|
|
|
13416
13555
|
reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
|
|
13417
|
-
memoizeProps(workInProgress, nextProps);
|
|
13418
13556
|
return workInProgress.child;
|
|
13419
13557
|
}
|
|
13420
13558
|
|
|
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;
|
|
13581
|
+
// Default to shallow comparison
|
|
13582
|
+
var compare = Component.compare;
|
|
13583
|
+
compare = compare !== null ? compare : shallowEqual;
|
|
13584
|
+
if (compare(prevProps, nextProps) && current$$1.ref === workInProgress.ref) {
|
|
13585
|
+
return bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
|
|
13586
|
+
}
|
|
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
|
+
}
|
|
13594
|
+
|
|
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
|
+
}
|
|
13601
|
+
}
|
|
13602
|
+
return updateFunctionComponent(current$$1, workInProgress, Component, nextProps, renderExpirationTime);
|
|
13603
|
+
}
|
|
13604
|
+
|
|
13421
13605
|
function updateFragment(current$$1, workInProgress, renderExpirationTime) {
|
|
13422
13606
|
var nextChildren = workInProgress.pendingProps;
|
|
13423
13607
|
reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
|
|
13424
|
-
memoizeProps(workInProgress, nextChildren);
|
|
13425
13608
|
return workInProgress.child;
|
|
13426
13609
|
}
|
|
13427
13610
|
|
|
13428
13611
|
function updateMode(current$$1, workInProgress, renderExpirationTime) {
|
|
13429
13612
|
var nextChildren = workInProgress.pendingProps.children;
|
|
13430
13613
|
reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
|
|
13431
|
-
memoizeProps(workInProgress, nextChildren);
|
|
13432
13614
|
return workInProgress.child;
|
|
13433
13615
|
}
|
|
13434
13616
|
|
|
@@ -13439,7 +13621,6 @@ function updateProfiler(current$$1, workInProgress, renderExpirationTime) {
|
|
|
13439
13621
|
var nextProps = workInProgress.pendingProps;
|
|
13440
13622
|
var nextChildren = nextProps.children;
|
|
13441
13623
|
reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
|
|
13442
|
-
memoizeProps(workInProgress, nextProps);
|
|
13443
13624
|
return workInProgress.child;
|
|
13444
13625
|
}
|
|
13445
13626
|
|
|
@@ -13451,7 +13632,7 @@ function markRef(current$$1, workInProgress) {
|
|
|
13451
13632
|
}
|
|
13452
13633
|
}
|
|
13453
13634
|
|
|
13454
|
-
function
|
|
13635
|
+
function updateFunctionComponent(current$$1, workInProgress, Component, nextProps, renderExpirationTime) {
|
|
13455
13636
|
var unmaskedContext = getUnmaskedContext(workInProgress, Component, true);
|
|
13456
13637
|
var context = getMaskedContext(workInProgress, unmaskedContext);
|
|
13457
13638
|
|
|
@@ -13467,7 +13648,6 @@ function updateFunctionalComponent(current$$1, workInProgress, Component, nextPr
|
|
|
13467
13648
|
// React DevTools reads this flag.
|
|
13468
13649
|
workInProgress.effectTag |= PerformedWork;
|
|
13469
13650
|
reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
|
|
13470
|
-
memoizeProps(workInProgress, nextProps);
|
|
13471
13651
|
return workInProgress.child;
|
|
13472
13652
|
}
|
|
13473
13653
|
|
|
@@ -13484,17 +13664,26 @@ function updateClassComponent(current$$1, workInProgress, Component, nextProps,
|
|
|
13484
13664
|
}
|
|
13485
13665
|
prepareToReadContext(workInProgress, renderExpirationTime);
|
|
13486
13666
|
|
|
13667
|
+
var instance = workInProgress.stateNode;
|
|
13487
13668
|
var shouldUpdate = void 0;
|
|
13488
|
-
if (
|
|
13489
|
-
if (
|
|
13490
|
-
//
|
|
13491
|
-
|
|
13492
|
-
|
|
13493
|
-
|
|
13494
|
-
|
|
13495
|
-
|
|
13496
|
-
|
|
13497
|
-
|
|
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);
|
|
13498
13687
|
} else {
|
|
13499
13688
|
shouldUpdate = updateClassInstance(current$$1, workInProgress, Component, nextProps, renderExpirationTime);
|
|
13500
13689
|
}
|
|
@@ -13521,7 +13710,7 @@ function finishClassComponent(current$$1, workInProgress, Component, shouldUpdat
|
|
|
13521
13710
|
// Rerender
|
|
13522
13711
|
ReactCurrentOwner$3.current = workInProgress;
|
|
13523
13712
|
var nextChildren = void 0;
|
|
13524
|
-
if (didCaptureError &&
|
|
13713
|
+
if (didCaptureError && typeof Component.getDerivedStateFromError !== 'function') {
|
|
13525
13714
|
// If we captured an error, but getDerivedStateFrom catch is not defined,
|
|
13526
13715
|
// unmount all the children. componentDidCatch will schedule an update to
|
|
13527
13716
|
// re-render a fallback. This is temporary until we migrate everyone to
|
|
@@ -13546,19 +13735,18 @@ function finishClassComponent(current$$1, workInProgress, Component, shouldUpdat
|
|
|
13546
13735
|
// React DevTools reads this flag.
|
|
13547
13736
|
workInProgress.effectTag |= PerformedWork;
|
|
13548
13737
|
if (current$$1 !== null && didCaptureError) {
|
|
13549
|
-
// If we're recovering from an error, reconcile
|
|
13550
|
-
//
|
|
13551
|
-
|
|
13552
|
-
|
|
13553
|
-
|
|
13554
|
-
|
|
13555
|
-
|
|
13738
|
+
// If we're recovering from an error, reconcile without reusing any of
|
|
13739
|
+
// the existing children. Conceptually, the normal children and the children
|
|
13740
|
+
// that are shown on error are two different sets, so we shouldn't reuse
|
|
13741
|
+
// normal children even if their identities match.
|
|
13742
|
+
forceUnmountCurrentAndReconcile(current$$1, workInProgress, nextChildren, renderExpirationTime);
|
|
13743
|
+
} else {
|
|
13744
|
+
reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
|
|
13556
13745
|
}
|
|
13557
|
-
|
|
13558
|
-
// Memoize
|
|
13746
|
+
|
|
13747
|
+
// Memoize state using the values we just used to render.
|
|
13559
13748
|
// TODO: Restructure so we never read values from the instance.
|
|
13560
|
-
|
|
13561
|
-
memoizeProps(workInProgress, instance.props);
|
|
13749
|
+
workInProgress.memoizedState = instance.state;
|
|
13562
13750
|
|
|
13563
13751
|
// The context might have changed so we need to recalculate it.
|
|
13564
13752
|
if (hasContext) {
|
|
@@ -13652,15 +13840,13 @@ function updateHostComponent(current$$1, workInProgress, renderExpirationTime) {
|
|
|
13652
13840
|
markRef(current$$1, workInProgress);
|
|
13653
13841
|
|
|
13654
13842
|
// Check the host config to see if the children are offscreen/hidden.
|
|
13655
|
-
if (renderExpirationTime !== Never && workInProgress.mode &
|
|
13843
|
+
if (renderExpirationTime !== Never && workInProgress.mode & ConcurrentMode && shouldDeprioritizeSubtree(type, nextProps)) {
|
|
13656
13844
|
// Schedule this fiber to re-render at offscreen priority. Then bailout.
|
|
13657
13845
|
workInProgress.expirationTime = Never;
|
|
13658
|
-
workInProgress.memoizedProps = nextProps;
|
|
13659
13846
|
return null;
|
|
13660
13847
|
}
|
|
13661
13848
|
|
|
13662
13849
|
reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
|
|
13663
|
-
memoizeProps(workInProgress, nextProps);
|
|
13664
13850
|
return workInProgress.child;
|
|
13665
13851
|
}
|
|
13666
13852
|
|
|
@@ -13668,8 +13854,6 @@ function updateHostText(current$$1, workInProgress) {
|
|
|
13668
13854
|
if (current$$1 === null) {
|
|
13669
13855
|
tryToClaimNextHydratableInstance(workInProgress);
|
|
13670
13856
|
}
|
|
13671
|
-
var nextProps = workInProgress.pendingProps;
|
|
13672
|
-
memoizeProps(workInProgress, nextProps);
|
|
13673
13857
|
// Nothing to do here. This is terminal. We'll do the completion step
|
|
13674
13858
|
// immediately after.
|
|
13675
13859
|
return null;
|
|
@@ -13690,36 +13874,110 @@ function resolveDefaultProps(Component, baseProps) {
|
|
|
13690
13874
|
return baseProps;
|
|
13691
13875
|
}
|
|
13692
13876
|
|
|
13693
|
-
function
|
|
13694
|
-
|
|
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
|
+
}
|
|
13695
13888
|
|
|
13696
13889
|
var props = workInProgress.pendingProps;
|
|
13697
|
-
|
|
13698
|
-
|
|
13699
|
-
|
|
13700
|
-
|
|
13701
|
-
|
|
13702
|
-
|
|
13703
|
-
|
|
13704
|
-
|
|
13705
|
-
|
|
13706
|
-
|
|
13707
|
-
|
|
13708
|
-
|
|
13709
|
-
|
|
13710
|
-
|
|
13711
|
-
|
|
13712
|
-
|
|
13713
|
-
|
|
13714
|
-
|
|
13715
|
-
|
|
13716
|
-
|
|
13717
|
-
|
|
13718
|
-
|
|
13719
|
-
|
|
13720
|
-
|
|
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;
|
|
13943
|
+
}
|
|
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;
|
|
13721
13978
|
}
|
|
13722
13979
|
|
|
13980
|
+
var props = workInProgress.pendingProps;
|
|
13723
13981
|
var unmaskedContext = getUnmaskedContext(workInProgress, Component, false);
|
|
13724
13982
|
var context = getMaskedContext(workInProgress, unmaskedContext);
|
|
13725
13983
|
|
|
@@ -13771,13 +14029,13 @@ function mountIndeterminateComponent(current$$1, workInProgress, Component, rend
|
|
|
13771
14029
|
|
|
13772
14030
|
adoptClassInstance(workInProgress, value);
|
|
13773
14031
|
mountClassInstance(workInProgress, Component, props, renderExpirationTime);
|
|
13774
|
-
return finishClassComponent(
|
|
14032
|
+
return finishClassComponent(null, workInProgress, Component, true, hasContext, renderExpirationTime);
|
|
13775
14033
|
} else {
|
|
13776
|
-
// Proceed under the assumption that this is a
|
|
13777
|
-
workInProgress.tag =
|
|
14034
|
+
// Proceed under the assumption that this is a function component
|
|
14035
|
+
workInProgress.tag = FunctionComponent;
|
|
13778
14036
|
{
|
|
13779
14037
|
if (Component) {
|
|
13780
|
-
!!Component.childContextTypes ? warningWithoutStack$1(false, '%s(...): childContextTypes cannot be defined on a
|
|
14038
|
+
!!Component.childContextTypes ? warningWithoutStack$1(false, '%s(...): childContextTypes cannot be defined on a function component.', Component.displayName || Component.name || 'Component') : void 0;
|
|
13781
14039
|
}
|
|
13782
14040
|
if (workInProgress.ref !== null) {
|
|
13783
14041
|
var info = '';
|
|
@@ -13791,81 +14049,190 @@ function mountIndeterminateComponent(current$$1, workInProgress, Component, rend
|
|
|
13791
14049
|
if (debugSource) {
|
|
13792
14050
|
warningKey = debugSource.fileName + ':' + debugSource.lineNumber;
|
|
13793
14051
|
}
|
|
13794
|
-
if (!
|
|
13795
|
-
|
|
13796
|
-
warning$1(false, '
|
|
14052
|
+
if (!didWarnAboutFunctionRefs[warningKey]) {
|
|
14053
|
+
didWarnAboutFunctionRefs[warningKey] = true;
|
|
14054
|
+
warning$1(false, 'Function components cannot be given refs. ' + 'Attempts to access this ref will fail.%s', info);
|
|
13797
14055
|
}
|
|
13798
14056
|
}
|
|
13799
14057
|
|
|
13800
14058
|
if (typeof Component.getDerivedStateFromProps === 'function') {
|
|
13801
14059
|
var _componentName = getComponentName(Component) || 'Unknown';
|
|
13802
14060
|
|
|
13803
|
-
if (!
|
|
13804
|
-
warningWithoutStack$1(false, '%s:
|
|
13805
|
-
|
|
14061
|
+
if (!didWarnAboutGetDerivedStateOnFunctionComponent[_componentName]) {
|
|
14062
|
+
warningWithoutStack$1(false, '%s: Function components do not support getDerivedStateFromProps.', _componentName);
|
|
14063
|
+
didWarnAboutGetDerivedStateOnFunctionComponent[_componentName] = true;
|
|
14064
|
+
}
|
|
14065
|
+
}
|
|
14066
|
+
|
|
14067
|
+
if (typeof Component.contextType === 'object' && Component.contextType !== null) {
|
|
14068
|
+
var _componentName2 = getComponentName(Component) || 'Unknown';
|
|
14069
|
+
|
|
14070
|
+
if (!didWarnAboutContextTypeOnFunctionComponent[_componentName2]) {
|
|
14071
|
+
warningWithoutStack$1(false, '%s: Function components do not support contextType.', _componentName2);
|
|
14072
|
+
didWarnAboutContextTypeOnFunctionComponent[_componentName2] = true;
|
|
13806
14073
|
}
|
|
13807
14074
|
}
|
|
13808
14075
|
}
|
|
13809
|
-
reconcileChildren(
|
|
13810
|
-
memoizeProps(workInProgress, props);
|
|
14076
|
+
reconcileChildren(null, workInProgress, value, renderExpirationTime);
|
|
13811
14077
|
return workInProgress.child;
|
|
13812
14078
|
}
|
|
13813
14079
|
}
|
|
13814
14080
|
|
|
13815
|
-
function
|
|
13816
|
-
|
|
13817
|
-
|
|
13818
|
-
|
|
13819
|
-
// Check if we already attempted to render the normal state. If we did,
|
|
13820
|
-
// and we timed out, render the placeholder state.
|
|
13821
|
-
var alreadyCaptured = (workInProgress.effectTag & DidCapture) === NoEffect;
|
|
13822
|
-
|
|
13823
|
-
var nextDidTimeout = void 0;
|
|
13824
|
-
if (current$$1 !== null && workInProgress.updateQueue !== null) {
|
|
13825
|
-
// We're outside strict mode. Something inside this Placeholder boundary
|
|
13826
|
-
// suspended during the last commit. Switch to the placholder.
|
|
13827
|
-
workInProgress.updateQueue = null;
|
|
13828
|
-
nextDidTimeout = true;
|
|
13829
|
-
// If we're recovering from an error, reconcile twice: first to delete
|
|
13830
|
-
// all the existing children.
|
|
13831
|
-
reconcileChildren(current$$1, workInProgress, null, renderExpirationTime);
|
|
13832
|
-
current$$1.child = null;
|
|
13833
|
-
// Now we can continue reconciling like normal. This has the effect of
|
|
13834
|
-
// remounting all children regardless of whether their their
|
|
13835
|
-
// identity matches.
|
|
13836
|
-
} else {
|
|
13837
|
-
nextDidTimeout = !alreadyCaptured;
|
|
13838
|
-
}
|
|
14081
|
+
function updateSuspenseComponent(current$$1, workInProgress, renderExpirationTime) {
|
|
14082
|
+
var mode = workInProgress.mode;
|
|
14083
|
+
var nextProps = workInProgress.pendingProps;
|
|
13839
14084
|
|
|
13840
|
-
|
|
13841
|
-
|
|
13842
|
-
|
|
13843
|
-
|
|
13844
|
-
|
|
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.
|
|
14090
|
+
} else {
|
|
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
|
+
};
|
|
13845
14105
|
} else {
|
|
13846
|
-
//
|
|
13847
|
-
|
|
13848
|
-
|
|
14106
|
+
// Already have a clone, so it's safe to mutate.
|
|
14107
|
+
nextState.alreadyCaptured = true;
|
|
14108
|
+
nextState.didTimeout = true;
|
|
13849
14109
|
}
|
|
13850
14110
|
}
|
|
14111
|
+
}
|
|
14112
|
+
var nextDidTimeout = nextState !== null && nextState.didTimeout;
|
|
13851
14113
|
|
|
13852
|
-
|
|
13853
|
-
|
|
13854
|
-
|
|
13855
|
-
|
|
13856
|
-
|
|
13857
|
-
|
|
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.
|
|
14148
|
+
if (nextDidTimeout) {
|
|
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;
|
|
13858
14159
|
} else {
|
|
13859
|
-
|
|
14160
|
+
// Mount the primary children without an intermediate fragment fiber.
|
|
14161
|
+
var nextPrimaryChildren = nextProps.children;
|
|
14162
|
+
child = next = mountChildFibers(workInProgress, null, nextPrimaryChildren, renderExpirationTime);
|
|
13860
14163
|
}
|
|
13861
|
-
|
|
13862
|
-
workInProgress.memoizedProps = nextProps;
|
|
13863
|
-
workInProgress.memoizedState = nextDidTimeout;
|
|
13864
|
-
reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
|
|
13865
|
-
return workInProgress.child;
|
|
13866
14164
|
} else {
|
|
13867
|
-
|
|
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
|
+
}
|
|
13868
14231
|
}
|
|
14232
|
+
|
|
14233
|
+
workInProgress.memoizedState = nextState;
|
|
14234
|
+
workInProgress.child = child;
|
|
14235
|
+
return next;
|
|
13869
14236
|
}
|
|
13870
14237
|
|
|
13871
14238
|
function updatePortalComponent(current$$1, workInProgress, renderExpirationTime) {
|
|
@@ -13878,10 +14245,8 @@ function updatePortalComponent(current$$1, workInProgress, renderExpirationTime)
|
|
|
13878
14245
|
// the root always starts with a "current" with a null child.
|
|
13879
14246
|
// TODO: Consider unifying this with how the root works.
|
|
13880
14247
|
workInProgress.child = reconcileChildFibers(workInProgress, null, nextChildren, renderExpirationTime);
|
|
13881
|
-
memoizeProps(workInProgress, nextChildren);
|
|
13882
14248
|
} else {
|
|
13883
14249
|
reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
|
|
13884
|
-
memoizeProps(workInProgress, nextChildren);
|
|
13885
14250
|
}
|
|
13886
14251
|
return workInProgress.child;
|
|
13887
14252
|
}
|
|
@@ -13894,7 +14259,6 @@ function updateContextProvider(current$$1, workInProgress, renderExpirationTime)
|
|
|
13894
14259
|
var oldProps = workInProgress.memoizedProps;
|
|
13895
14260
|
|
|
13896
14261
|
var newValue = newProps.value;
|
|
13897
|
-
workInProgress.memoizedProps = newProps;
|
|
13898
14262
|
|
|
13899
14263
|
{
|
|
13900
14264
|
var providerPropTypes = workInProgress.type.propTypes;
|
|
@@ -13926,8 +14290,32 @@ function updateContextProvider(current$$1, workInProgress, renderExpirationTime)
|
|
|
13926
14290
|
return workInProgress.child;
|
|
13927
14291
|
}
|
|
13928
14292
|
|
|
14293
|
+
var hasWarnedAboutUsingContextAsConsumer = false;
|
|
14294
|
+
|
|
13929
14295
|
function updateContextConsumer(current$$1, workInProgress, renderExpirationTime) {
|
|
13930
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
|
+
}
|
|
13931
14319
|
var newProps = workInProgress.pendingProps;
|
|
13932
14320
|
var render = newProps.children;
|
|
13933
14321
|
|
|
@@ -13948,7 +14336,6 @@ function updateContextConsumer(current$$1, workInProgress, renderExpirationTime)
|
|
|
13948
14336
|
// React DevTools reads this flag.
|
|
13949
14337
|
workInProgress.effectTag |= PerformedWork;
|
|
13950
14338
|
reconcileChildren(current$$1, workInProgress, newChildren, renderExpirationTime);
|
|
13951
|
-
workInProgress.memoizedProps = newProps;
|
|
13952
14339
|
return workInProgress.child;
|
|
13953
14340
|
}
|
|
13954
14341
|
|
|
@@ -13999,64 +14386,78 @@ function bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirati
|
|
|
13999
14386
|
}
|
|
14000
14387
|
}
|
|
14001
14388
|
|
|
14002
|
-
// TODO: Delete memoizeProps/State and move to reconcile/bailout instead
|
|
14003
|
-
function memoizeProps(workInProgress, nextProps) {
|
|
14004
|
-
workInProgress.memoizedProps = nextProps;
|
|
14005
|
-
}
|
|
14006
|
-
|
|
14007
|
-
function memoizeState(workInProgress, nextState) {
|
|
14008
|
-
workInProgress.memoizedState = nextState;
|
|
14009
|
-
// Don't reset the updateQueue, in case there are pending updates. Resetting
|
|
14010
|
-
// is handled by processUpdateQueue.
|
|
14011
|
-
}
|
|
14012
|
-
|
|
14013
14389
|
function beginWork(current$$1, workInProgress, renderExpirationTime) {
|
|
14014
14390
|
var updateExpirationTime = workInProgress.expirationTime;
|
|
14015
|
-
|
|
14016
|
-
|
|
14017
|
-
|
|
14018
|
-
|
|
14019
|
-
|
|
14020
|
-
|
|
14021
|
-
|
|
14022
|
-
|
|
14023
|
-
|
|
14024
|
-
|
|
14025
|
-
|
|
14026
|
-
|
|
14027
|
-
case ClassComponent:
|
|
14028
|
-
{
|
|
14029
|
-
var Component = workInProgress.type;
|
|
14030
|
-
if (isContextProvider(Component)) {
|
|
14031
|
-
pushContextProvider(workInProgress);
|
|
14032
|
-
}
|
|
14391
|
+
|
|
14392
|
+
if (current$$1 !== null) {
|
|
14393
|
+
var oldProps = current$$1.memoizedProps;
|
|
14394
|
+
var newProps = workInProgress.pendingProps;
|
|
14395
|
+
if (oldProps === newProps && !hasContextChanged() && (updateExpirationTime === NoWork || updateExpirationTime > renderExpirationTime)) {
|
|
14396
|
+
// This fiber does not have any pending work. Bailout without entering
|
|
14397
|
+
// the begin phase. There's still some bookkeeping we that needs to be done
|
|
14398
|
+
// in this optimized path, mostly pushing stuff onto the stack.
|
|
14399
|
+
switch (workInProgress.tag) {
|
|
14400
|
+
case HostRoot:
|
|
14401
|
+
pushHostRootContext(workInProgress);
|
|
14402
|
+
resetHydrationState();
|
|
14033
14403
|
break;
|
|
14034
|
-
|
|
14035
|
-
|
|
14036
|
-
|
|
14037
|
-
|
|
14038
|
-
|
|
14039
|
-
|
|
14040
|
-
|
|
14404
|
+
case HostComponent:
|
|
14405
|
+
pushHostContext(workInProgress);
|
|
14406
|
+
break;
|
|
14407
|
+
case ClassComponent:
|
|
14408
|
+
{
|
|
14409
|
+
var Component = workInProgress.type;
|
|
14410
|
+
if (isContextProvider(Component)) {
|
|
14411
|
+
pushContextProvider(workInProgress);
|
|
14412
|
+
}
|
|
14413
|
+
break;
|
|
14041
14414
|
}
|
|
14415
|
+
case HostPortal:
|
|
14416
|
+
pushHostContainer(workInProgress, workInProgress.stateNode.containerInfo);
|
|
14042
14417
|
break;
|
|
14043
|
-
|
|
14044
|
-
|
|
14045
|
-
|
|
14046
|
-
|
|
14047
|
-
|
|
14048
|
-
|
|
14049
|
-
|
|
14050
|
-
|
|
14418
|
+
case ContextProvider:
|
|
14419
|
+
{
|
|
14420
|
+
var newValue = workInProgress.memoizedProps.value;
|
|
14421
|
+
pushProvider(workInProgress, newValue);
|
|
14422
|
+
break;
|
|
14423
|
+
}
|
|
14424
|
+
case Profiler:
|
|
14425
|
+
if (enableProfilerTimer) {
|
|
14426
|
+
workInProgress.effectTag |= Update;
|
|
14427
|
+
}
|
|
14051
14428
|
break;
|
|
14052
|
-
|
|
14053
|
-
|
|
14054
|
-
|
|
14055
|
-
|
|
14056
|
-
|
|
14057
|
-
|
|
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
|
+
}
|
|
14458
|
+
}
|
|
14459
|
+
return bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
|
|
14058
14460
|
}
|
|
14059
|
-
return bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
|
|
14060
14461
|
}
|
|
14061
14462
|
|
|
14062
14463
|
// Before entering the begin phase, clear the expiration time.
|
|
@@ -14065,38 +14466,27 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
|
|
|
14065
14466
|
switch (workInProgress.tag) {
|
|
14066
14467
|
case IndeterminateComponent:
|
|
14067
14468
|
{
|
|
14068
|
-
var
|
|
14069
|
-
return mountIndeterminateComponent(current$$1, workInProgress,
|
|
14469
|
+
var elementType = workInProgress.elementType;
|
|
14470
|
+
return mountIndeterminateComponent(current$$1, workInProgress, elementType, renderExpirationTime);
|
|
14070
14471
|
}
|
|
14071
|
-
case
|
|
14472
|
+
case LazyComponent:
|
|
14072
14473
|
{
|
|
14073
|
-
var
|
|
14074
|
-
|
|
14075
|
-
return updateFunctionalComponent(current$$1, workInProgress, _Component4, _unresolvedProps, renderExpirationTime);
|
|
14474
|
+
var _elementType = workInProgress.elementType;
|
|
14475
|
+
return mountLazyComponent(current$$1, workInProgress, _elementType, updateExpirationTime, renderExpirationTime);
|
|
14076
14476
|
}
|
|
14077
|
-
case
|
|
14477
|
+
case FunctionComponent:
|
|
14078
14478
|
{
|
|
14079
|
-
var
|
|
14080
|
-
var
|
|
14081
|
-
var
|
|
14082
|
-
|
|
14083
|
-
workInProgress.memoizedProps = _unresolvedProps2;
|
|
14084
|
-
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);
|
|
14085
14483
|
}
|
|
14086
14484
|
case ClassComponent:
|
|
14087
14485
|
{
|
|
14088
|
-
var
|
|
14089
|
-
var
|
|
14090
|
-
|
|
14091
|
-
|
|
14092
|
-
case ClassComponentLazy:
|
|
14093
|
-
{
|
|
14094
|
-
var _thenable3 = workInProgress.type;
|
|
14095
|
-
var _Component7 = getResultFromResolvedThenable(_thenable3);
|
|
14096
|
-
var _unresolvedProps4 = workInProgress.pendingProps;
|
|
14097
|
-
var _child2 = updateClassComponent(current$$1, workInProgress, _Component7, resolveDefaultProps(_Component7, _unresolvedProps4), renderExpirationTime);
|
|
14098
|
-
workInProgress.memoizedProps = _unresolvedProps4;
|
|
14099
|
-
return _child2;
|
|
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);
|
|
14100
14490
|
}
|
|
14101
14491
|
case HostRoot:
|
|
14102
14492
|
return updateHostRoot(current$$1, workInProgress, renderExpirationTime);
|
|
@@ -14104,22 +14494,17 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
|
|
|
14104
14494
|
return updateHostComponent(current$$1, workInProgress, renderExpirationTime);
|
|
14105
14495
|
case HostText:
|
|
14106
14496
|
return updateHostText(current$$1, workInProgress);
|
|
14107
|
-
case
|
|
14108
|
-
return
|
|
14497
|
+
case SuspenseComponent:
|
|
14498
|
+
return updateSuspenseComponent(current$$1, workInProgress, renderExpirationTime);
|
|
14109
14499
|
case HostPortal:
|
|
14110
14500
|
return updatePortalComponent(current$$1, workInProgress, renderExpirationTime);
|
|
14111
14501
|
case ForwardRef:
|
|
14112
14502
|
{
|
|
14113
14503
|
var type = workInProgress.type;
|
|
14114
|
-
|
|
14115
|
-
|
|
14116
|
-
|
|
14117
|
-
|
|
14118
|
-
var _Component2 = getResultFromResolvedThenable(_thenable);
|
|
14119
|
-
var unresolvedProps = workInProgress.pendingProps;
|
|
14120
|
-
var child = updateForwardRef(current$$1, workInProgress, _Component2, resolveDefaultProps(_Component2, unresolvedProps), renderExpirationTime);
|
|
14121
|
-
workInProgress.memoizedProps = unresolvedProps;
|
|
14122
|
-
return child;
|
|
14504
|
+
var _unresolvedProps2 = workInProgress.pendingProps;
|
|
14505
|
+
var _resolvedProps2 = workInProgress.elementType === type ? _unresolvedProps2 : resolveDefaultProps(type, _unresolvedProps2);
|
|
14506
|
+
return updateForwardRef(current$$1, workInProgress, type, _resolvedProps2, renderExpirationTime);
|
|
14507
|
+
}
|
|
14123
14508
|
case Fragment:
|
|
14124
14509
|
return updateFragment(current$$1, workInProgress, renderExpirationTime);
|
|
14125
14510
|
case Mode:
|
|
@@ -14130,6 +14515,24 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
|
|
|
14130
14515
|
return updateContextProvider(current$$1, workInProgress, renderExpirationTime);
|
|
14131
14516
|
case ContextConsumer:
|
|
14132
14517
|
return updateContextConsumer(current$$1, workInProgress, renderExpirationTime);
|
|
14518
|
+
case MemoComponent:
|
|
14519
|
+
{
|
|
14520
|
+
var _type = workInProgress.type;
|
|
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);
|
|
14528
|
+
}
|
|
14529
|
+
case IncompleteClassComponent:
|
|
14530
|
+
{
|
|
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);
|
|
14535
|
+
}
|
|
14133
14536
|
default:
|
|
14134
14537
|
invariant(false, 'Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue.');
|
|
14135
14538
|
}
|
|
@@ -14145,42 +14548,43 @@ function markRef$1(workInProgress) {
|
|
|
14145
14548
|
workInProgress.effectTag |= Ref;
|
|
14146
14549
|
}
|
|
14147
14550
|
|
|
14148
|
-
|
|
14149
|
-
// We only have the top Fiber that was created but we need recurse down its
|
|
14150
|
-
// children to find all the terminal nodes.
|
|
14151
|
-
var node = workInProgress.child;
|
|
14152
|
-
while (node !== null) {
|
|
14153
|
-
if (node.tag === HostComponent || node.tag === HostText) {
|
|
14154
|
-
appendInitialChild(parent, node.stateNode);
|
|
14155
|
-
} else if (node.tag === HostPortal) {
|
|
14156
|
-
// If we have a portal child, then we don't want to traverse
|
|
14157
|
-
// down its children. Instead, we'll get insertions from each child in
|
|
14158
|
-
// the portal directly.
|
|
14159
|
-
} else if (node.child !== null) {
|
|
14160
|
-
node.child.return = node;
|
|
14161
|
-
node = node.child;
|
|
14162
|
-
continue;
|
|
14163
|
-
}
|
|
14164
|
-
if (node === workInProgress) {
|
|
14165
|
-
return;
|
|
14166
|
-
}
|
|
14167
|
-
while (node.sibling === null) {
|
|
14168
|
-
if (node.return === null || node.return === workInProgress) {
|
|
14169
|
-
return;
|
|
14170
|
-
}
|
|
14171
|
-
node = node.return;
|
|
14172
|
-
}
|
|
14173
|
-
node.sibling.return = node.return;
|
|
14174
|
-
node = node.sibling;
|
|
14175
|
-
}
|
|
14176
|
-
}
|
|
14177
|
-
|
|
14551
|
+
var appendAllChildren = void 0;
|
|
14178
14552
|
var updateHostContainer = void 0;
|
|
14179
14553
|
var updateHostComponent$1 = void 0;
|
|
14180
14554
|
var updateHostText$1 = void 0;
|
|
14181
14555
|
if (supportsMutation) {
|
|
14182
14556
|
// Mutation mode
|
|
14183
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
|
+
|
|
14184
14588
|
updateHostContainer = function (workInProgress) {
|
|
14185
14589
|
// Noop
|
|
14186
14590
|
};
|
|
@@ -14221,23 +14625,167 @@ if (supportsMutation) {
|
|
|
14221
14625
|
} else if (supportsPersistence) {
|
|
14222
14626
|
// Persistent host tree mode
|
|
14223
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
|
+
|
|
14224
14715
|
// An unfortunate fork of appendAllChildren because we have two different parent types.
|
|
14225
|
-
var appendAllChildrenToContainer = function (containerChildSet, workInProgress) {
|
|
14716
|
+
var appendAllChildrenToContainer = function (containerChildSet, workInProgress, needsVisibilityToggle, isHidden) {
|
|
14226
14717
|
// We only have the top Fiber that was created but we need recurse down its
|
|
14227
14718
|
// children to find all the terminal nodes.
|
|
14228
14719
|
var node = workInProgress.child;
|
|
14229
14720
|
while (node !== null) {
|
|
14230
|
-
|
|
14231
|
-
|
|
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);
|
|
14232
14753
|
} else if (node.tag === HostPortal) {
|
|
14233
14754
|
// If we have a portal child, then we don't want to traverse
|
|
14234
14755
|
// down its children. Instead, we'll get insertions from each child in
|
|
14235
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
|
+
}
|
|
14236
14782
|
} else if (node.child !== null) {
|
|
14237
14783
|
node.child.return = node;
|
|
14238
14784
|
node = node.child;
|
|
14239
14785
|
continue;
|
|
14240
14786
|
}
|
|
14787
|
+
// $FlowFixMe This is correct but Flow is confused by the labeled break.
|
|
14788
|
+
node = node;
|
|
14241
14789
|
if (node === workInProgress) {
|
|
14242
14790
|
return;
|
|
14243
14791
|
}
|
|
@@ -14260,7 +14808,7 @@ if (supportsMutation) {
|
|
|
14260
14808
|
var container = portalOrRoot.containerInfo;
|
|
14261
14809
|
var newChildSet = createContainerChildSet(container);
|
|
14262
14810
|
// If children might have changed, we have to add them all to the set.
|
|
14263
|
-
appendAllChildrenToContainer(newChildSet, workInProgress);
|
|
14811
|
+
appendAllChildrenToContainer(newChildSet, workInProgress, false, false);
|
|
14264
14812
|
portalOrRoot.pendingChildren = newChildSet;
|
|
14265
14813
|
// Schedule an update on the container to swap out the container.
|
|
14266
14814
|
markUpdate(workInProgress);
|
|
@@ -14303,7 +14851,7 @@ if (supportsMutation) {
|
|
|
14303
14851
|
markUpdate(workInProgress);
|
|
14304
14852
|
} else {
|
|
14305
14853
|
// If children might have changed, we have to add them all to the set.
|
|
14306
|
-
appendAllChildren(newInstance, workInProgress);
|
|
14854
|
+
appendAllChildren(newInstance, workInProgress, false, false);
|
|
14307
14855
|
}
|
|
14308
14856
|
};
|
|
14309
14857
|
updateHostText$1 = function (current, workInProgress, oldText, newText) {
|
|
@@ -14334,8 +14882,12 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
14334
14882
|
var newProps = workInProgress.pendingProps;
|
|
14335
14883
|
|
|
14336
14884
|
switch (workInProgress.tag) {
|
|
14337
|
-
case
|
|
14338
|
-
|
|
14885
|
+
case IndeterminateComponent:
|
|
14886
|
+
break;
|
|
14887
|
+
case LazyComponent:
|
|
14888
|
+
break;
|
|
14889
|
+
case SimpleMemoComponent:
|
|
14890
|
+
case FunctionComponent:
|
|
14339
14891
|
break;
|
|
14340
14892
|
case ClassComponent:
|
|
14341
14893
|
{
|
|
@@ -14345,14 +14897,6 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
14345
14897
|
}
|
|
14346
14898
|
break;
|
|
14347
14899
|
}
|
|
14348
|
-
case ClassComponentLazy:
|
|
14349
|
-
{
|
|
14350
|
-
var _Component = getResultFromResolvedThenable(workInProgress.type);
|
|
14351
|
-
if (isContextProvider(_Component)) {
|
|
14352
|
-
popContext(workInProgress);
|
|
14353
|
-
}
|
|
14354
|
-
break;
|
|
14355
|
-
}
|
|
14356
14900
|
case HostRoot:
|
|
14357
14901
|
{
|
|
14358
14902
|
popHostContainer(workInProgress);
|
|
@@ -14408,7 +14952,7 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
14408
14952
|
} else {
|
|
14409
14953
|
var instance = createInstance(type, newProps, rootContainerInstance, currentHostContext, workInProgress);
|
|
14410
14954
|
|
|
14411
|
-
appendAllChildren(instance, workInProgress);
|
|
14955
|
+
appendAllChildren(instance, workInProgress, false, false);
|
|
14412
14956
|
|
|
14413
14957
|
// Certain renderers require commit-time effects for initial mount.
|
|
14414
14958
|
// (eg DOM renderer supports auto-focus for certain elements).
|
|
@@ -14453,10 +14997,20 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
14453
14997
|
break;
|
|
14454
14998
|
}
|
|
14455
14999
|
case ForwardRef:
|
|
14456
|
-
case ForwardRefLazy:
|
|
14457
|
-
break;
|
|
14458
|
-
case PlaceholderComponent:
|
|
14459
15000
|
break;
|
|
15001
|
+
case SuspenseComponent:
|
|
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
|
+
}
|
|
14460
15014
|
case Fragment:
|
|
14461
15015
|
break;
|
|
14462
15016
|
case Mode:
|
|
@@ -14473,10 +15027,18 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
14473
15027
|
break;
|
|
14474
15028
|
case ContextConsumer:
|
|
14475
15029
|
break;
|
|
14476
|
-
|
|
14477
|
-
|
|
14478
|
-
|
|
14479
|
-
|
|
15030
|
+
case MemoComponent:
|
|
15031
|
+
break;
|
|
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
|
+
}
|
|
14480
15042
|
default:
|
|
14481
15043
|
invariant(false, 'Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue.');
|
|
14482
15044
|
}
|
|
@@ -14484,6 +15046,17 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
14484
15046
|
return null;
|
|
14485
15047
|
}
|
|
14486
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
|
+
|
|
14487
15060
|
// This module is forked in different environments.
|
|
14488
15061
|
// By default, return `true` to log errors to the console.
|
|
14489
15062
|
// Forks can return `false` if this isn't desirable.
|
|
@@ -14551,8 +15124,6 @@ function logCapturedError(capturedError) {
|
|
|
14551
15124
|
}
|
|
14552
15125
|
}
|
|
14553
15126
|
|
|
14554
|
-
var emptyObject = {};
|
|
14555
|
-
|
|
14556
15127
|
var didWarnAboutUndefinedSnapshotBeforeUpdate = null;
|
|
14557
15128
|
{
|
|
14558
15129
|
didWarnAboutUndefinedSnapshotBeforeUpdate = new Set();
|
|
@@ -14634,7 +15205,6 @@ function safelyDetachRef(current$$1) {
|
|
|
14634
15205
|
function commitBeforeMutationLifeCycles(current$$1, finishedWork) {
|
|
14635
15206
|
switch (finishedWork.tag) {
|
|
14636
15207
|
case ClassComponent:
|
|
14637
|
-
case ClassComponentLazy:
|
|
14638
15208
|
{
|
|
14639
15209
|
if (finishedWork.effectTag & Snapshot) {
|
|
14640
15210
|
if (current$$1 !== null) {
|
|
@@ -14662,6 +15232,7 @@ function commitBeforeMutationLifeCycles(current$$1, finishedWork) {
|
|
|
14662
15232
|
case HostComponent:
|
|
14663
15233
|
case HostText:
|
|
14664
15234
|
case HostPortal:
|
|
15235
|
+
case IncompleteClassComponent:
|
|
14665
15236
|
// Nothing to do for these component types
|
|
14666
15237
|
return;
|
|
14667
15238
|
default:
|
|
@@ -14674,7 +15245,6 @@ function commitBeforeMutationLifeCycles(current$$1, finishedWork) {
|
|
|
14674
15245
|
function commitLifeCycles(finishedRoot, current$$1, finishedWork, committedExpirationTime) {
|
|
14675
15246
|
switch (finishedWork.tag) {
|
|
14676
15247
|
case ClassComponent:
|
|
14677
|
-
case ClassComponentLazy:
|
|
14678
15248
|
{
|
|
14679
15249
|
var instance = finishedWork.stateNode;
|
|
14680
15250
|
if (finishedWork.effectTag & Update) {
|
|
@@ -14713,7 +15283,6 @@ function commitLifeCycles(finishedRoot, current$$1, finishedWork, committedExpir
|
|
|
14713
15283
|
_instance = getPublicInstance(finishedWork.child.stateNode);
|
|
14714
15284
|
break;
|
|
14715
15285
|
case ClassComponent:
|
|
14716
|
-
case ClassComponentLazy:
|
|
14717
15286
|
_instance = finishedWork.child.stateNode;
|
|
14718
15287
|
break;
|
|
14719
15288
|
}
|
|
@@ -14761,26 +15330,50 @@ function commitLifeCycles(finishedRoot, current$$1, finishedWork, committedExpir
|
|
|
14761
15330
|
}
|
|
14762
15331
|
return;
|
|
14763
15332
|
}
|
|
14764
|
-
case
|
|
15333
|
+
case SuspenseComponent:
|
|
14765
15334
|
{
|
|
14766
|
-
if (
|
|
14767
|
-
|
|
14768
|
-
|
|
14769
|
-
|
|
14770
|
-
|
|
14771
|
-
|
|
14772
|
-
|
|
14773
|
-
|
|
14774
|
-
|
|
14775
|
-
|
|
14776
|
-
|
|
14777
|
-
|
|
14778
|
-
|
|
14779
|
-
|
|
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;
|
|
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;
|
|
15356
|
+
} else {
|
|
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
|
+
}
|
|
14780
15367
|
}
|
|
14781
15368
|
}
|
|
15369
|
+
|
|
15370
|
+
if (newDidTimeout !== oldDidTimeout && primaryChildParent !== null) {
|
|
15371
|
+
hideOrUnhideAllChildren(primaryChildParent, newDidTimeout);
|
|
15372
|
+
}
|
|
14782
15373
|
return;
|
|
14783
15374
|
}
|
|
15375
|
+
case IncompleteClassComponent:
|
|
15376
|
+
break;
|
|
14784
15377
|
default:
|
|
14785
15378
|
{
|
|
14786
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.');
|
|
@@ -14788,6 +15381,45 @@ function commitLifeCycles(finishedRoot, current$$1, finishedWork, committedExpir
|
|
|
14788
15381
|
}
|
|
14789
15382
|
}
|
|
14790
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
|
+
|
|
14791
15423
|
function commitAttachRef(finishedWork) {
|
|
14792
15424
|
var ref = finishedWork.ref;
|
|
14793
15425
|
if (ref !== null) {
|
|
@@ -14833,7 +15465,6 @@ function commitUnmount(current$$1) {
|
|
|
14833
15465
|
|
|
14834
15466
|
switch (current$$1.tag) {
|
|
14835
15467
|
case ClassComponent:
|
|
14836
|
-
case ClassComponentLazy:
|
|
14837
15468
|
{
|
|
14838
15469
|
safelyDetachRef(current$$1);
|
|
14839
15470
|
var instance = current$$1.stateNode;
|
|
@@ -14927,7 +15558,6 @@ function commitContainer(finishedWork) {
|
|
|
14927
15558
|
|
|
14928
15559
|
switch (finishedWork.tag) {
|
|
14929
15560
|
case ClassComponent:
|
|
14930
|
-
case ClassComponentLazy:
|
|
14931
15561
|
{
|
|
14932
15562
|
return;
|
|
14933
15563
|
}
|
|
@@ -15194,7 +15824,6 @@ function commitWork(current$$1, finishedWork) {
|
|
|
15194
15824
|
|
|
15195
15825
|
switch (finishedWork.tag) {
|
|
15196
15826
|
case ClassComponent:
|
|
15197
|
-
case ClassComponentLazy:
|
|
15198
15827
|
{
|
|
15199
15828
|
return;
|
|
15200
15829
|
}
|
|
@@ -15238,7 +15867,11 @@ function commitWork(current$$1, finishedWork) {
|
|
|
15238
15867
|
{
|
|
15239
15868
|
return;
|
|
15240
15869
|
}
|
|
15241
|
-
case
|
|
15870
|
+
case SuspenseComponent:
|
|
15871
|
+
{
|
|
15872
|
+
return;
|
|
15873
|
+
}
|
|
15874
|
+
case IncompleteClassComponent:
|
|
15242
15875
|
{
|
|
15243
15876
|
return;
|
|
15244
15877
|
}
|
|
@@ -15256,10 +15889,6 @@ function commitResetTextContent(current$$1) {
|
|
|
15256
15889
|
resetTextContent(current$$1.stateNode);
|
|
15257
15890
|
}
|
|
15258
15891
|
|
|
15259
|
-
function NoopComponent() {
|
|
15260
|
-
return null;
|
|
15261
|
-
}
|
|
15262
|
-
|
|
15263
15892
|
function createRootErrorUpdate(fiber, errorInfo, expirationTime) {
|
|
15264
15893
|
var update = createUpdate(expirationTime);
|
|
15265
15894
|
// Unmount the root by rendering null.
|
|
@@ -15278,22 +15907,22 @@ function createRootErrorUpdate(fiber, errorInfo, expirationTime) {
|
|
|
15278
15907
|
function createClassErrorUpdate(fiber, errorInfo, expirationTime) {
|
|
15279
15908
|
var update = createUpdate(expirationTime);
|
|
15280
15909
|
update.tag = CaptureUpdate;
|
|
15281
|
-
var
|
|
15282
|
-
if (
|
|
15910
|
+
var getDerivedStateFromError = fiber.type.getDerivedStateFromError;
|
|
15911
|
+
if (typeof getDerivedStateFromError === 'function') {
|
|
15283
15912
|
var error = errorInfo.value;
|
|
15284
15913
|
update.payload = function () {
|
|
15285
|
-
return
|
|
15914
|
+
return getDerivedStateFromError(error);
|
|
15286
15915
|
};
|
|
15287
15916
|
}
|
|
15288
15917
|
|
|
15289
15918
|
var inst = fiber.stateNode;
|
|
15290
15919
|
if (inst !== null && typeof inst.componentDidCatch === 'function') {
|
|
15291
15920
|
update.callback = function callback() {
|
|
15292
|
-
if (
|
|
15921
|
+
if (typeof getDerivedStateFromError !== 'function') {
|
|
15293
15922
|
// To preserve the preexisting retry behavior of error boundaries,
|
|
15294
15923
|
// we keep track of which ones already failed during this batch.
|
|
15295
15924
|
// This gets reset before we yield back to the browser.
|
|
15296
|
-
// TODO: Warn in strict mode if
|
|
15925
|
+
// TODO: Warn in strict mode if getDerivedStateFromError is
|
|
15297
15926
|
// not defined.
|
|
15298
15927
|
markLegacyErrorBoundaryAsFailed(this);
|
|
15299
15928
|
}
|
|
@@ -15303,6 +15932,14 @@ function createClassErrorUpdate(fiber, errorInfo, expirationTime) {
|
|
|
15303
15932
|
this.componentDidCatch(error, {
|
|
15304
15933
|
componentStack: stack !== null ? stack : ''
|
|
15305
15934
|
});
|
|
15935
|
+
{
|
|
15936
|
+
if (typeof getDerivedStateFromError !== 'function') {
|
|
15937
|
+
// If componentDidCatch is the only error boundary method defined,
|
|
15938
|
+
// then it needs to call setState to recover from errors.
|
|
15939
|
+
// If no state update is scheduled then the boundary will swallow the error.
|
|
15940
|
+
!(fiber.expirationTime === Sync) ? warningWithoutStack$1(false, '%s: Error boundaries should implement getDerivedStateFromError(). ' + 'In that method, return a state update to display an error message or fallback UI.', getComponentName(fiber.type) || 'Unknown') : void 0;
|
|
15941
|
+
}
|
|
15942
|
+
}
|
|
15306
15943
|
};
|
|
15307
15944
|
}
|
|
15308
15945
|
return update;
|
|
@@ -15314,7 +15951,7 @@ function throwException(root, returnFiber, sourceFiber, value, renderExpirationT
|
|
|
15314
15951
|
// Its effect list is no longer valid.
|
|
15315
15952
|
sourceFiber.firstEffect = sourceFiber.lastEffect = null;
|
|
15316
15953
|
|
|
15317
|
-
if (
|
|
15954
|
+
if (value !== null && typeof value === 'object' && typeof value.then === 'function') {
|
|
15318
15955
|
// This is a thenable.
|
|
15319
15956
|
var thenable = value;
|
|
15320
15957
|
|
|
@@ -15327,21 +15964,20 @@ function throwException(root, returnFiber, sourceFiber, value, renderExpirationT
|
|
|
15327
15964
|
var earliestTimeoutMs = -1;
|
|
15328
15965
|
var startTimeMs = -1;
|
|
15329
15966
|
do {
|
|
15330
|
-
if (_workInProgress.tag ===
|
|
15967
|
+
if (_workInProgress.tag === SuspenseComponent) {
|
|
15331
15968
|
var current = _workInProgress.alternate;
|
|
15332
|
-
if (current !== null
|
|
15333
|
-
|
|
15334
|
-
|
|
15335
|
-
|
|
15336
|
-
|
|
15337
|
-
|
|
15338
|
-
|
|
15339
|
-
|
|
15340
|
-
|
|
15341
|
-
|
|
15342
|
-
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
|
+
}
|
|
15343
15979
|
}
|
|
15344
|
-
var timeoutPropMs = _workInProgress.pendingProps.
|
|
15980
|
+
var timeoutPropMs = _workInProgress.pendingProps.maxDuration;
|
|
15345
15981
|
if (typeof timeoutPropMs === 'number') {
|
|
15346
15982
|
if (timeoutPropMs <= 0) {
|
|
15347
15983
|
earliestTimeoutMs = 0;
|
|
@@ -15353,103 +15989,96 @@ function throwException(root, returnFiber, sourceFiber, value, renderExpirationT
|
|
|
15353
15989
|
_workInProgress = _workInProgress.return;
|
|
15354
15990
|
} while (_workInProgress !== null);
|
|
15355
15991
|
|
|
15356
|
-
// Schedule the nearest
|
|
15992
|
+
// Schedule the nearest Suspense to re-render the timed out view.
|
|
15357
15993
|
_workInProgress = returnFiber;
|
|
15358
15994
|
do {
|
|
15359
|
-
if (_workInProgress.tag ===
|
|
15360
|
-
|
|
15361
|
-
if (!didTimeout) {
|
|
15362
|
-
// Found the nearest boundary.
|
|
15363
|
-
|
|
15364
|
-
// If the boundary is not in async mode, we should not suspend, and
|
|
15365
|
-
// likewise, when the promise resolves, we should ping synchronously.
|
|
15366
|
-
var pingTime = (_workInProgress.mode & AsyncMode) === NoEffect ? Sync : renderExpirationTime;
|
|
15367
|
-
|
|
15368
|
-
// Attach a listener to the promise to "ping" the root and retry.
|
|
15369
|
-
var onResolveOrReject = retrySuspendedRoot.bind(null, root, _workInProgress, pingTime);
|
|
15370
|
-
thenable.then(onResolveOrReject, onResolveOrReject);
|
|
15371
|
-
|
|
15372
|
-
// If the boundary is outside of strict mode, we should *not* suspend
|
|
15373
|
-
// the commit. Pretend as if the suspended component rendered null and
|
|
15374
|
-
// keep rendering. In the commit phase, we'll schedule a subsequent
|
|
15375
|
-
// synchronous update to re-render the Placeholder.
|
|
15376
|
-
//
|
|
15377
|
-
// Note: It doesn't matter whether the component that suspended was
|
|
15378
|
-
// inside a strict mode tree. If the Placeholder is outside of it, we
|
|
15379
|
-
// should *not* suspend the commit.
|
|
15380
|
-
if ((_workInProgress.mode & StrictMode) === NoEffect) {
|
|
15381
|
-
_workInProgress.effectTag |= Update;
|
|
15382
|
-
|
|
15383
|
-
// Unmount the source fiber's children
|
|
15384
|
-
var nextChildren = null;
|
|
15385
|
-
reconcileChildren(sourceFiber.alternate, sourceFiber, nextChildren, renderExpirationTime);
|
|
15386
|
-
sourceFiber.effectTag &= ~Incomplete;
|
|
15387
|
-
if (sourceFiber.tag === IndeterminateComponent) {
|
|
15388
|
-
// Let's just assume it's a functional component. This fiber will
|
|
15389
|
-
// be unmounted in the immediate next commit, anyway.
|
|
15390
|
-
sourceFiber.tag = FunctionalComponent;
|
|
15391
|
-
}
|
|
15995
|
+
if (_workInProgress.tag === SuspenseComponent && shouldCaptureSuspense(_workInProgress.alternate, _workInProgress)) {
|
|
15996
|
+
// Found the nearest boundary.
|
|
15392
15997
|
|
|
15393
|
-
|
|
15394
|
-
|
|
15395
|
-
|
|
15396
|
-
// callbacks. Remove all lifecycle effect tags.
|
|
15397
|
-
sourceFiber.effectTag &= ~LifecycleEffectMask;
|
|
15398
|
-
if (sourceFiber.alternate === null) {
|
|
15399
|
-
// We're about to mount a class component that doesn't have an
|
|
15400
|
-
// instance. Turn this into a dummy functional component instead,
|
|
15401
|
-
// to prevent type errors. This is a bit weird but it's an edge
|
|
15402
|
-
// case and we're about to synchronously delete this
|
|
15403
|
-
// component, anyway.
|
|
15404
|
-
sourceFiber.tag = FunctionalComponent;
|
|
15405
|
-
sourceFiber.type = NoopComponent;
|
|
15406
|
-
}
|
|
15407
|
-
}
|
|
15408
|
-
|
|
15409
|
-
// Exit without suspending.
|
|
15410
|
-
return;
|
|
15411
|
-
}
|
|
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;
|
|
15412
16001
|
|
|
15413
|
-
|
|
15414
|
-
|
|
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);
|
|
15415
16008
|
|
|
15416
|
-
|
|
15417
|
-
|
|
15418
|
-
|
|
15419
|
-
|
|
15420
|
-
|
|
15421
|
-
|
|
15422
|
-
|
|
15423
|
-
|
|
15424
|
-
|
|
15425
|
-
|
|
15426
|
-
|
|
15427
|
-
|
|
15428
|
-
|
|
15429
|
-
|
|
15430
|
-
|
|
15431
|
-
|
|
15432
|
-
|
|
15433
|
-
|
|
15434
|
-
|
|
15435
|
-
|
|
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;
|
|
15436
16036
|
}
|
|
15437
|
-
absoluteTimeoutMs = startTimeMs + earliestTimeoutMs;
|
|
15438
16037
|
}
|
|
15439
16038
|
|
|
15440
|
-
//
|
|
15441
|
-
// After completing the root, we'll take the largest of all the
|
|
15442
|
-
// suspended fiber's timeouts and use it to compute a timeout for the
|
|
15443
|
-
// whole tree.
|
|
15444
|
-
renderDidSuspend(root, absoluteTimeoutMs, renderExpirationTime);
|
|
15445
|
-
|
|
15446
|
-
_workInProgress.effectTag |= ShouldCapture;
|
|
15447
|
-
_workInProgress.expirationTime = renderExpirationTime;
|
|
16039
|
+
// Exit without suspending.
|
|
15448
16040
|
return;
|
|
15449
16041
|
}
|
|
15450
|
-
|
|
15451
|
-
//
|
|
16042
|
+
|
|
16043
|
+
// Confirmed that the boundary is in a concurrent mode tree. Continue
|
|
16044
|
+
// with the normal suspend path.
|
|
16045
|
+
|
|
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;
|
|
16066
|
+
}
|
|
16067
|
+
absoluteTimeoutMs = startTimeMs + earliestTimeoutMs;
|
|
16068
|
+
}
|
|
16069
|
+
|
|
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);
|
|
16075
|
+
|
|
16076
|
+
_workInProgress.effectTag |= ShouldCapture;
|
|
16077
|
+
_workInProgress.expirationTime = renderExpirationTime;
|
|
16078
|
+
return;
|
|
15452
16079
|
}
|
|
16080
|
+
// This boundary already captured during this render. Continue to the next
|
|
16081
|
+
// boundary.
|
|
15453
16082
|
_workInProgress = _workInProgress.return;
|
|
15454
16083
|
} while (_workInProgress !== null);
|
|
15455
16084
|
// No boundary was found. Fallthrough to error mode.
|
|
@@ -15474,12 +16103,11 @@ function throwException(root, returnFiber, sourceFiber, value, renderExpirationT
|
|
|
15474
16103
|
return;
|
|
15475
16104
|
}
|
|
15476
16105
|
case ClassComponent:
|
|
15477
|
-
case ClassComponentLazy:
|
|
15478
16106
|
// Capture and retry
|
|
15479
16107
|
var errorInfo = value;
|
|
15480
16108
|
var ctor = workInProgress.type;
|
|
15481
16109
|
var instance = workInProgress.stateNode;
|
|
15482
|
-
if ((workInProgress.effectTag & DidCapture) === NoEffect && (typeof ctor.
|
|
16110
|
+
if ((workInProgress.effectTag & DidCapture) === NoEffect && (typeof ctor.getDerivedStateFromError === 'function' || instance !== null && typeof instance.componentDidCatch === 'function' && !isAlreadyFailedLegacyErrorBoundary(instance))) {
|
|
15483
16111
|
workInProgress.effectTag |= ShouldCapture;
|
|
15484
16112
|
workInProgress.expirationTime = renderExpirationTime;
|
|
15485
16113
|
// Schedule the error boundary to re-render using updated state
|
|
@@ -15510,26 +16138,13 @@ function unwindWork(workInProgress, renderExpirationTime) {
|
|
|
15510
16138
|
}
|
|
15511
16139
|
return null;
|
|
15512
16140
|
}
|
|
15513
|
-
case ClassComponentLazy:
|
|
15514
|
-
{
|
|
15515
|
-
var _Component = workInProgress.type._reactResult;
|
|
15516
|
-
if (isContextProvider(_Component)) {
|
|
15517
|
-
popContext(workInProgress);
|
|
15518
|
-
}
|
|
15519
|
-
var _effectTag = workInProgress.effectTag;
|
|
15520
|
-
if (_effectTag & ShouldCapture) {
|
|
15521
|
-
workInProgress.effectTag = _effectTag & ~ShouldCapture | DidCapture;
|
|
15522
|
-
return workInProgress;
|
|
15523
|
-
}
|
|
15524
|
-
return null;
|
|
15525
|
-
}
|
|
15526
16141
|
case HostRoot:
|
|
15527
16142
|
{
|
|
15528
16143
|
popHostContainer(workInProgress);
|
|
15529
16144
|
popTopLevelContextObject(workInProgress);
|
|
15530
|
-
var
|
|
15531
|
-
!((
|
|
15532
|
-
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;
|
|
15533
16148
|
return workInProgress;
|
|
15534
16149
|
}
|
|
15535
16150
|
case HostComponent:
|
|
@@ -15537,11 +16152,37 @@ function unwindWork(workInProgress, renderExpirationTime) {
|
|
|
15537
16152
|
popHostContext(workInProgress);
|
|
15538
16153
|
return null;
|
|
15539
16154
|
}
|
|
15540
|
-
case
|
|
16155
|
+
case SuspenseComponent:
|
|
15541
16156
|
{
|
|
15542
|
-
var
|
|
15543
|
-
if (
|
|
15544
|
-
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.
|
|
15545
16186
|
return workInProgress;
|
|
15546
16187
|
}
|
|
15547
16188
|
return null;
|
|
@@ -15567,14 +16208,6 @@ function unwindInterruptedWork(interruptedWork) {
|
|
|
15567
16208
|
}
|
|
15568
16209
|
break;
|
|
15569
16210
|
}
|
|
15570
|
-
case ClassComponentLazy:
|
|
15571
|
-
{
|
|
15572
|
-
var _childContextTypes = interruptedWork.type._reactResult.childContextTypes;
|
|
15573
|
-
if (_childContextTypes !== null && _childContextTypes !== undefined) {
|
|
15574
|
-
popContext(interruptedWork);
|
|
15575
|
-
}
|
|
15576
|
-
break;
|
|
15577
|
-
}
|
|
15578
16211
|
case HostRoot:
|
|
15579
16212
|
{
|
|
15580
16213
|
popHostContainer(interruptedWork);
|
|
@@ -15679,10 +16312,6 @@ var legacyErrorBoundariesThatAlreadyFailed = null;
|
|
|
15679
16312
|
// Used for performance tracking.
|
|
15680
16313
|
var interruptedBy = null;
|
|
15681
16314
|
|
|
15682
|
-
// Do not decrement interaction counts in the event of suspense timeouts.
|
|
15683
|
-
// This would lead to prematurely calling the interaction-complete hook.
|
|
15684
|
-
var suspenseDidTimeout = false;
|
|
15685
|
-
|
|
15686
16315
|
var stashedWorkInProgressProperties = void 0;
|
|
15687
16316
|
var replayUnitOfWork = void 0;
|
|
15688
16317
|
var isReplayingFailedUnitOfWork = void 0;
|
|
@@ -15724,14 +16353,6 @@ if (true && replayFailedUnitOfWorkWithInvokeGuardedCallback) {
|
|
|
15724
16353
|
}
|
|
15725
16354
|
break;
|
|
15726
16355
|
}
|
|
15727
|
-
case ClassComponentLazy:
|
|
15728
|
-
{
|
|
15729
|
-
var _Component = getResultFromResolvedThenable(failedUnitOfWork.type);
|
|
15730
|
-
if (isContextProvider(_Component)) {
|
|
15731
|
-
popContext(failedUnitOfWork);
|
|
15732
|
-
}
|
|
15733
|
-
break;
|
|
15734
|
-
}
|
|
15735
16356
|
case HostPortal:
|
|
15736
16357
|
popHostContainer(failedUnitOfWork);
|
|
15737
16358
|
break;
|
|
@@ -15887,14 +16508,11 @@ function commitBeforeMutationLifecycles() {
|
|
|
15887
16508
|
function commitAllLifeCycles(finishedRoot, committedExpirationTime) {
|
|
15888
16509
|
{
|
|
15889
16510
|
ReactStrictModeWarnings.flushPendingUnsafeLifecycleWarnings();
|
|
16511
|
+
ReactStrictModeWarnings.flushLegacyContextWarning();
|
|
15890
16512
|
|
|
15891
16513
|
if (warnAboutDeprecatedLifecycles) {
|
|
15892
16514
|
ReactStrictModeWarnings.flushPendingDeprecationWarnings();
|
|
15893
16515
|
}
|
|
15894
|
-
|
|
15895
|
-
if (warnAboutLegacyContextAPI) {
|
|
15896
|
-
ReactStrictModeWarnings.flushLegacyContextWarning();
|
|
15897
|
-
}
|
|
15898
16516
|
}
|
|
15899
16517
|
while (nextEffect !== null) {
|
|
15900
16518
|
var effectTag = nextEffect.effectTag;
|
|
@@ -15953,27 +16571,11 @@ function commitRoot(root, finishedWork) {
|
|
|
15953
16571
|
markCommittedPriorityLevels(root, earliestRemainingTimeBeforeCommit);
|
|
15954
16572
|
|
|
15955
16573
|
var prevInteractions = null;
|
|
15956
|
-
var committedInteractions = enableSchedulerTracing ? [] : null;
|
|
15957
16574
|
if (enableSchedulerTracing) {
|
|
15958
16575
|
// Restore any pending interactions at this point,
|
|
15959
16576
|
// So that cascading work triggered during the render phase will be accounted for.
|
|
15960
16577
|
prevInteractions = tracing.__interactionsRef.current;
|
|
15961
16578
|
tracing.__interactionsRef.current = root.memoizedInteractions;
|
|
15962
|
-
|
|
15963
|
-
// We are potentially finished with the current batch of interactions.
|
|
15964
|
-
// So we should clear them out of the pending interaction map.
|
|
15965
|
-
// We do this at the start of commit in case cascading work is scheduled by commit phase lifecycles.
|
|
15966
|
-
// In that event, interaction data may be added back into the pending map for a future commit.
|
|
15967
|
-
// We also store the interactions we are about to commit so that we can notify subscribers after we're done.
|
|
15968
|
-
// These are stored as an Array rather than a Set,
|
|
15969
|
-
// Because the same interaction may be pending for multiple expiration times,
|
|
15970
|
-
// In which case it's important that we decrement the count the right number of times after finishing.
|
|
15971
|
-
root.pendingInteractionMap.forEach(function (scheduledInteractions, scheduledExpirationTime) {
|
|
15972
|
-
if (scheduledExpirationTime <= committedExpirationTime) {
|
|
15973
|
-
committedInteractions.push.apply(committedInteractions, Array.from(scheduledInteractions));
|
|
15974
|
-
root.pendingInteractionMap.delete(scheduledExpirationTime);
|
|
15975
|
-
}
|
|
15976
|
-
});
|
|
15977
16579
|
}
|
|
15978
16580
|
|
|
15979
16581
|
// Reset this to null before calling lifecycles
|
|
@@ -16125,28 +16727,35 @@ function commitRoot(root, finishedWork) {
|
|
|
16125
16727
|
unhandledError = error;
|
|
16126
16728
|
}
|
|
16127
16729
|
} finally {
|
|
16128
|
-
//
|
|
16129
|
-
//
|
|
16130
|
-
|
|
16131
|
-
|
|
16132
|
-
|
|
16133
|
-
//
|
|
16134
|
-
|
|
16135
|
-
|
|
16136
|
-
|
|
16137
|
-
|
|
16138
|
-
|
|
16139
|
-
|
|
16140
|
-
|
|
16141
|
-
|
|
16142
|
-
|
|
16143
|
-
|
|
16144
|
-
|
|
16730
|
+
// Clear completed interactions from the pending Map.
|
|
16731
|
+
// Unless the render was suspended or cascading work was scheduled,
|
|
16732
|
+
// In which case– leave pending interactions until the subsequent render.
|
|
16733
|
+
var pendingInteractionMap = root.pendingInteractionMap;
|
|
16734
|
+
pendingInteractionMap.forEach(function (scheduledInteractions, scheduledExpirationTime) {
|
|
16735
|
+
// Only decrement the pending interaction count if we're done.
|
|
16736
|
+
// If there's still work at the current priority,
|
|
16737
|
+
// That indicates that we are waiting for suspense data.
|
|
16738
|
+
if (earliestRemainingTimeAfterCommit === NoWork || scheduledExpirationTime < earliestRemainingTimeAfterCommit) {
|
|
16739
|
+
pendingInteractionMap.delete(scheduledExpirationTime);
|
|
16740
|
+
|
|
16741
|
+
scheduledInteractions.forEach(function (interaction) {
|
|
16742
|
+
interaction.__count--;
|
|
16743
|
+
|
|
16744
|
+
if (subscriber !== null && interaction.__count === 0) {
|
|
16745
|
+
try {
|
|
16746
|
+
subscriber.onInteractionScheduledWorkCompleted(interaction);
|
|
16747
|
+
} catch (error) {
|
|
16748
|
+
// It's not safe for commitRoot() to throw.
|
|
16749
|
+
// Store the error for now and we'll re-throw in finishRendering().
|
|
16750
|
+
if (!hasUnhandledError) {
|
|
16751
|
+
hasUnhandledError = true;
|
|
16752
|
+
unhandledError = error;
|
|
16753
|
+
}
|
|
16145
16754
|
}
|
|
16146
16755
|
}
|
|
16147
|
-
}
|
|
16148
|
-
}
|
|
16149
|
-
}
|
|
16756
|
+
});
|
|
16757
|
+
}
|
|
16758
|
+
});
|
|
16150
16759
|
}
|
|
16151
16760
|
}
|
|
16152
16761
|
}
|
|
@@ -16245,23 +16854,12 @@ function completeUnitOfWork(workInProgress) {
|
|
|
16245
16854
|
} else {
|
|
16246
16855
|
nextUnitOfWork = completeWork(current$$1, workInProgress, nextRenderExpirationTime);
|
|
16247
16856
|
}
|
|
16248
|
-
var next = nextUnitOfWork;
|
|
16249
16857
|
stopWorkTimer(workInProgress);
|
|
16250
16858
|
resetChildExpirationTime(workInProgress, nextRenderExpirationTime);
|
|
16251
16859
|
{
|
|
16252
16860
|
resetCurrentFiber();
|
|
16253
16861
|
}
|
|
16254
16862
|
|
|
16255
|
-
if (next !== null) {
|
|
16256
|
-
stopWorkTimer(workInProgress);
|
|
16257
|
-
if (true && ReactFiberInstrumentation_1.debugTool) {
|
|
16258
|
-
ReactFiberInstrumentation_1.debugTool.onCompleteWork(workInProgress);
|
|
16259
|
-
}
|
|
16260
|
-
// If completing this work spawned new work, do that next. We'll come
|
|
16261
|
-
// back here again.
|
|
16262
|
-
return next;
|
|
16263
|
-
}
|
|
16264
|
-
|
|
16265
16863
|
if (returnFiber !== null &&
|
|
16266
16864
|
// Do not append effects to parents if a sibling failed to complete
|
|
16267
16865
|
(returnFiber.effectTag & Incomplete) === NoEffect) {
|
|
@@ -16321,7 +16919,7 @@ function completeUnitOfWork(workInProgress) {
|
|
|
16321
16919
|
// This fiber did not complete because something threw. Pop values off
|
|
16322
16920
|
// the stack without entering the complete phase. If this is a boundary,
|
|
16323
16921
|
// capture values if possible.
|
|
16324
|
-
var
|
|
16922
|
+
var next = unwindWork(workInProgress, nextRenderExpirationTime);
|
|
16325
16923
|
// Because this fiber did not complete, don't reset its expiration time.
|
|
16326
16924
|
if (workInProgress.effectTag & DidCapture) {
|
|
16327
16925
|
// Restarting an error boundary
|
|
@@ -16334,7 +16932,7 @@ function completeUnitOfWork(workInProgress) {
|
|
|
16334
16932
|
resetCurrentFiber();
|
|
16335
16933
|
}
|
|
16336
16934
|
|
|
16337
|
-
if (
|
|
16935
|
+
if (next !== null) {
|
|
16338
16936
|
stopWorkTimer(workInProgress);
|
|
16339
16937
|
if (true && ReactFiberInstrumentation_1.debugTool) {
|
|
16340
16938
|
ReactFiberInstrumentation_1.debugTool.onCompleteWork(workInProgress);
|
|
@@ -16342,14 +16940,14 @@ function completeUnitOfWork(workInProgress) {
|
|
|
16342
16940
|
|
|
16343
16941
|
if (enableProfilerTimer) {
|
|
16344
16942
|
// Include the time spent working on failed children before continuing.
|
|
16345
|
-
if (
|
|
16346
|
-
var actualDuration =
|
|
16347
|
-
var child =
|
|
16943
|
+
if (next.mode & ProfileMode) {
|
|
16944
|
+
var actualDuration = next.actualDuration;
|
|
16945
|
+
var child = next.child;
|
|
16348
16946
|
while (child !== null) {
|
|
16349
16947
|
actualDuration += child.actualDuration;
|
|
16350
16948
|
child = child.sibling;
|
|
16351
16949
|
}
|
|
16352
|
-
|
|
16950
|
+
next.actualDuration = actualDuration;
|
|
16353
16951
|
}
|
|
16354
16952
|
}
|
|
16355
16953
|
|
|
@@ -16357,8 +16955,8 @@ function completeUnitOfWork(workInProgress) {
|
|
|
16357
16955
|
// back here again.
|
|
16358
16956
|
// Since we're restarting, remove anything that is not a host effect
|
|
16359
16957
|
// from the effect tag.
|
|
16360
|
-
|
|
16361
|
-
return
|
|
16958
|
+
next.effectTag &= HostEffectMask;
|
|
16959
|
+
return next;
|
|
16362
16960
|
}
|
|
16363
16961
|
|
|
16364
16962
|
if (returnFiber !== null) {
|
|
@@ -16414,6 +17012,7 @@ function performUnitOfWork(workInProgress) {
|
|
|
16414
17012
|
}
|
|
16415
17013
|
|
|
16416
17014
|
next = beginWork(current$$1, workInProgress, nextRenderExpirationTime);
|
|
17015
|
+
workInProgress.memoizedProps = workInProgress.pendingProps;
|
|
16417
17016
|
|
|
16418
17017
|
if (workInProgress.mode & ProfileMode) {
|
|
16419
17018
|
// Record the render duration assuming we didn't bailout (or error).
|
|
@@ -16421,6 +17020,7 @@ function performUnitOfWork(workInProgress) {
|
|
|
16421
17020
|
}
|
|
16422
17021
|
} else {
|
|
16423
17022
|
next = beginWork(current$$1, workInProgress, nextRenderExpirationTime);
|
|
17023
|
+
workInProgress.memoizedProps = workInProgress.pendingProps;
|
|
16424
17024
|
}
|
|
16425
17025
|
|
|
16426
17026
|
{
|
|
@@ -16468,14 +17068,6 @@ function renderRoot(root, isYieldy, isExpired) {
|
|
|
16468
17068
|
|
|
16469
17069
|
var expirationTime = root.nextExpirationTimeToWorkOn;
|
|
16470
17070
|
|
|
16471
|
-
var prevInteractions = null;
|
|
16472
|
-
if (enableSchedulerTracing) {
|
|
16473
|
-
// We're about to start new traced work.
|
|
16474
|
-
// Restore pending interactions so cascading work triggered during the render phase will be accounted for.
|
|
16475
|
-
prevInteractions = tracing.__interactionsRef.current;
|
|
16476
|
-
tracing.__interactionsRef.current = root.memoizedInteractions;
|
|
16477
|
-
}
|
|
16478
|
-
|
|
16479
17071
|
// Check if we're starting from a fresh stack, or if we're resuming from
|
|
16480
17072
|
// previously yielded work.
|
|
16481
17073
|
if (expirationTime !== nextRenderExpirationTime || root !== nextRoot || nextUnitOfWork === null) {
|
|
@@ -16524,6 +17116,14 @@ function renderRoot(root, isYieldy, isExpired) {
|
|
|
16524
17116
|
}
|
|
16525
17117
|
}
|
|
16526
17118
|
|
|
17119
|
+
var prevInteractions = null;
|
|
17120
|
+
if (enableSchedulerTracing) {
|
|
17121
|
+
// We're about to start new traced work.
|
|
17122
|
+
// Restore pending interactions so cascading work triggered during the render phase will be accounted for.
|
|
17123
|
+
prevInteractions = tracing.__interactionsRef.current;
|
|
17124
|
+
tracing.__interactionsRef.current = root.memoizedInteractions;
|
|
17125
|
+
}
|
|
17126
|
+
|
|
16527
17127
|
var didFatal = false;
|
|
16528
17128
|
|
|
16529
17129
|
startWorkLoopTimer(nextUnitOfWork);
|
|
@@ -16654,7 +17254,7 @@ function renderRoot(root, isYieldy, isExpired) {
|
|
|
16654
17254
|
}
|
|
16655
17255
|
}
|
|
16656
17256
|
|
|
16657
|
-
if (
|
|
17257
|
+
if (!isExpired && nextLatestAbsoluteTimeoutMs !== -1) {
|
|
16658
17258
|
// The tree was suspended.
|
|
16659
17259
|
var _suspendedExpirationTime2 = expirationTime;
|
|
16660
17260
|
markSuspendedPriorityLevel(root, _suspendedExpirationTime2);
|
|
@@ -16694,10 +17294,9 @@ function dispatch(sourceFiber, value, expirationTime) {
|
|
|
16694
17294
|
while (fiber !== null) {
|
|
16695
17295
|
switch (fiber.tag) {
|
|
16696
17296
|
case ClassComponent:
|
|
16697
|
-
case ClassComponentLazy:
|
|
16698
17297
|
var ctor = fiber.type;
|
|
16699
17298
|
var instance = fiber.stateNode;
|
|
16700
|
-
if (typeof ctor.
|
|
17299
|
+
if (typeof ctor.getDerivedStateFromError === 'function' || typeof instance.componentDidCatch === 'function' && !isAlreadyFailedLegacyErrorBoundary(instance)) {
|
|
16701
17300
|
var errorInfo = createCapturedValue(value, sourceFiber);
|
|
16702
17301
|
var update = createClassErrorUpdate(fiber, errorInfo, expirationTime);
|
|
16703
17302
|
enqueueUpdate(fiber, update);
|
|
@@ -16769,7 +17368,7 @@ function computeExpirationForFiber(currentTime, fiber) {
|
|
|
16769
17368
|
} else {
|
|
16770
17369
|
// No explicit expiration context was set, and we're not currently
|
|
16771
17370
|
// performing work. Calculate a new expiration time.
|
|
16772
|
-
if (fiber.mode &
|
|
17371
|
+
if (fiber.mode & ConcurrentMode) {
|
|
16773
17372
|
if (isBatchingInteractiveUpdates) {
|
|
16774
17373
|
// This is an interactive update
|
|
16775
17374
|
expirationTime = computeInteractiveExpiration(currentTime);
|
|
@@ -16791,7 +17390,7 @@ function computeExpirationForFiber(currentTime, fiber) {
|
|
|
16791
17390
|
// This is an interactive update. Keep track of the lowest pending
|
|
16792
17391
|
// interactive expiration time. This allows us to synchronously flush
|
|
16793
17392
|
// all interactive updates when needed.
|
|
16794
|
-
if (
|
|
17393
|
+
if (expirationTime > lowestPriorityPendingInteractiveExpirationTime) {
|
|
16795
17394
|
lowestPriorityPendingInteractiveExpirationTime = expirationTime;
|
|
16796
17395
|
}
|
|
16797
17396
|
}
|
|
@@ -16809,41 +17408,69 @@ function renderDidError() {
|
|
|
16809
17408
|
nextRenderDidError = true;
|
|
16810
17409
|
}
|
|
16811
17410
|
|
|
16812
|
-
function retrySuspendedRoot(root,
|
|
16813
|
-
|
|
16814
|
-
var retryTime = void 0;
|
|
17411
|
+
function retrySuspendedRoot(root, boundaryFiber, sourceFiber, suspendedTime) {
|
|
17412
|
+
var retryTime = void 0;
|
|
16815
17413
|
|
|
16816
|
-
|
|
16817
|
-
|
|
16818
|
-
|
|
16819
|
-
|
|
16820
|
-
|
|
16821
|
-
|
|
16822
|
-
|
|
16823
|
-
|
|
16824
|
-
|
|
17414
|
+
if (isPriorityLevelSuspended(root, suspendedTime)) {
|
|
17415
|
+
// Ping at the original level
|
|
17416
|
+
retryTime = suspendedTime;
|
|
17417
|
+
|
|
17418
|
+
markPingedPriorityLevel(root, retryTime);
|
|
17419
|
+
} else {
|
|
17420
|
+
// Suspense already timed out. Compute a new expiration time
|
|
17421
|
+
var currentTime = requestCurrentTime();
|
|
17422
|
+
retryTime = computeExpirationForFiber(currentTime, boundaryFiber);
|
|
17423
|
+
markPendingPriorityLevel(root, retryTime);
|
|
17424
|
+
}
|
|
17425
|
+
|
|
17426
|
+
// TODO: If the suspense fiber has already rendered the primary children
|
|
17427
|
+
// without suspending (that is, all of the promises have already resolved),
|
|
17428
|
+
// we should not trigger another update here. One case this happens is when
|
|
17429
|
+
// we are in sync mode and a single promise is thrown both on initial render
|
|
17430
|
+
// and on update; we attach two .then(retrySuspendedRoot) callbacks and each
|
|
17431
|
+
// one performs Sync work, rerendering the Suspense.
|
|
17432
|
+
|
|
17433
|
+
if ((boundaryFiber.mode & ConcurrentMode) !== NoContext) {
|
|
17434
|
+
if (root === nextRoot && nextRenderExpirationTime === suspendedTime) {
|
|
17435
|
+
// Received a ping at the same priority level at which we're currently
|
|
17436
|
+
// rendering. Restart from the root.
|
|
17437
|
+
nextRoot = null;
|
|
16825
17438
|
}
|
|
17439
|
+
}
|
|
16826
17440
|
|
|
16827
|
-
|
|
16828
|
-
|
|
16829
|
-
|
|
16830
|
-
|
|
16831
|
-
|
|
16832
|
-
|
|
16833
|
-
|
|
16834
|
-
|
|
16835
|
-
|
|
16836
|
-
|
|
16837
|
-
|
|
16838
|
-
|
|
16839
|
-
|
|
16840
|
-
|
|
16841
|
-
}
|
|
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);
|
|
16842
17455
|
}
|
|
16843
17456
|
}
|
|
17457
|
+
|
|
17458
|
+
var rootExpirationTime = root.expirationTime;
|
|
17459
|
+
if (rootExpirationTime !== NoWork) {
|
|
17460
|
+
requestWork(root, rootExpirationTime);
|
|
17461
|
+
}
|
|
16844
17462
|
}
|
|
16845
17463
|
|
|
16846
17464
|
function scheduleWorkToRoot(fiber, expirationTime) {
|
|
17465
|
+
recordScheduleUpdate();
|
|
17466
|
+
|
|
17467
|
+
{
|
|
17468
|
+
if (fiber.tag === ClassComponent) {
|
|
17469
|
+
var instance = fiber.stateNode;
|
|
17470
|
+
warnAboutInvalidUpdates(instance);
|
|
17471
|
+
}
|
|
17472
|
+
}
|
|
17473
|
+
|
|
16847
17474
|
// Update the source fiber's expiration time
|
|
16848
17475
|
if (fiber.expirationTime === NoWork || fiber.expirationTime > expirationTime) {
|
|
16849
17476
|
fiber.expirationTime = expirationTime;
|
|
@@ -16854,85 +17481,75 @@ function scheduleWorkToRoot(fiber, expirationTime) {
|
|
|
16854
17481
|
}
|
|
16855
17482
|
// Walk the parent path to the root and update the child expiration time.
|
|
16856
17483
|
var node = fiber.return;
|
|
17484
|
+
var root = null;
|
|
16857
17485
|
if (node === null && fiber.tag === HostRoot) {
|
|
16858
|
-
|
|
16859
|
-
}
|
|
16860
|
-
|
|
16861
|
-
|
|
16862
|
-
|
|
16863
|
-
|
|
16864
|
-
|
|
17486
|
+
root = fiber.stateNode;
|
|
17487
|
+
} else {
|
|
17488
|
+
while (node !== null) {
|
|
17489
|
+
alternate = node.alternate;
|
|
17490
|
+
if (node.childExpirationTime === NoWork || node.childExpirationTime > expirationTime) {
|
|
17491
|
+
node.childExpirationTime = expirationTime;
|
|
17492
|
+
if (alternate !== null && (alternate.childExpirationTime === NoWork || alternate.childExpirationTime > expirationTime)) {
|
|
17493
|
+
alternate.childExpirationTime = expirationTime;
|
|
17494
|
+
}
|
|
17495
|
+
} else if (alternate !== null && (alternate.childExpirationTime === NoWork || alternate.childExpirationTime > expirationTime)) {
|
|
16865
17496
|
alternate.childExpirationTime = expirationTime;
|
|
16866
17497
|
}
|
|
16867
|
-
|
|
16868
|
-
|
|
16869
|
-
|
|
16870
|
-
|
|
16871
|
-
|
|
17498
|
+
if (node.return === null && node.tag === HostRoot) {
|
|
17499
|
+
root = node.stateNode;
|
|
17500
|
+
break;
|
|
17501
|
+
}
|
|
17502
|
+
node = node.return;
|
|
16872
17503
|
}
|
|
16873
|
-
node = node.return;
|
|
16874
17504
|
}
|
|
16875
|
-
return null;
|
|
16876
|
-
}
|
|
16877
17505
|
|
|
16878
|
-
|
|
16879
|
-
|
|
16880
|
-
|
|
17506
|
+
if (root === null) {
|
|
17507
|
+
if (true && fiber.tag === ClassComponent) {
|
|
17508
|
+
warnAboutUpdateOnUnmounted(fiber);
|
|
17509
|
+
}
|
|
17510
|
+
return null;
|
|
16881
17511
|
}
|
|
16882
17512
|
|
|
16883
|
-
|
|
16884
|
-
|
|
16885
|
-
|
|
16886
|
-
|
|
16887
|
-
|
|
16888
|
-
|
|
16889
|
-
|
|
16890
|
-
interaction
|
|
16891
|
-
|
|
17513
|
+
if (enableSchedulerTracing) {
|
|
17514
|
+
var interactions = tracing.__interactionsRef.current;
|
|
17515
|
+
if (interactions.size > 0) {
|
|
17516
|
+
var pendingInteractionMap = root.pendingInteractionMap;
|
|
17517
|
+
var pendingInteractions = pendingInteractionMap.get(expirationTime);
|
|
17518
|
+
if (pendingInteractions != null) {
|
|
17519
|
+
interactions.forEach(function (interaction) {
|
|
17520
|
+
if (!pendingInteractions.has(interaction)) {
|
|
17521
|
+
// Update the pending async work count for previously unscheduled interaction.
|
|
17522
|
+
interaction.__count++;
|
|
17523
|
+
}
|
|
16892
17524
|
|
|
16893
|
-
|
|
16894
|
-
|
|
16895
|
-
|
|
16896
|
-
|
|
17525
|
+
pendingInteractions.add(interaction);
|
|
17526
|
+
});
|
|
17527
|
+
} else {
|
|
17528
|
+
pendingInteractionMap.set(expirationTime, new Set(interactions));
|
|
16897
17529
|
|
|
16898
|
-
|
|
16899
|
-
if (updateInteractionCounts) {
|
|
17530
|
+
// Update the pending async work count for the current interactions.
|
|
16900
17531
|
interactions.forEach(function (interaction) {
|
|
16901
17532
|
interaction.__count++;
|
|
16902
17533
|
});
|
|
16903
17534
|
}
|
|
16904
|
-
}
|
|
16905
17535
|
|
|
16906
|
-
|
|
16907
|
-
|
|
16908
|
-
|
|
16909
|
-
|
|
17536
|
+
var subscriber = tracing.__subscriberRef.current;
|
|
17537
|
+
if (subscriber !== null) {
|
|
17538
|
+
var threadID = computeThreadID(expirationTime, root.interactionThreadID);
|
|
17539
|
+
subscriber.onWorkScheduled(interactions, threadID);
|
|
17540
|
+
}
|
|
16910
17541
|
}
|
|
16911
17542
|
}
|
|
17543
|
+
|
|
17544
|
+
return root;
|
|
16912
17545
|
}
|
|
16913
17546
|
|
|
16914
17547
|
function scheduleWork(fiber, expirationTime) {
|
|
16915
|
-
recordScheduleUpdate();
|
|
16916
|
-
|
|
16917
|
-
{
|
|
16918
|
-
if (fiber.tag === ClassComponent || fiber.tag === ClassComponentLazy) {
|
|
16919
|
-
var instance = fiber.stateNode;
|
|
16920
|
-
warnAboutInvalidUpdates(instance);
|
|
16921
|
-
}
|
|
16922
|
-
}
|
|
16923
|
-
|
|
16924
17548
|
var root = scheduleWorkToRoot(fiber, expirationTime);
|
|
16925
17549
|
if (root === null) {
|
|
16926
|
-
if (true && (fiber.tag === ClassComponent || fiber.tag === ClassComponentLazy)) {
|
|
16927
|
-
warnAboutUpdateOnUnmounted(fiber);
|
|
16928
|
-
}
|
|
16929
17550
|
return;
|
|
16930
17551
|
}
|
|
16931
17552
|
|
|
16932
|
-
if (enableSchedulerTracing) {
|
|
16933
|
-
storeInteractionsForExpirationTime(root, expirationTime, true);
|
|
16934
|
-
}
|
|
16935
|
-
|
|
16936
17553
|
if (!isWorking && nextRenderExpirationTime !== NoWork && expirationTime < nextRenderExpirationTime) {
|
|
16937
17554
|
// This is an interruption. (Used for performance tracking.)
|
|
16938
17555
|
interruptedBy = fiber;
|
|
@@ -16989,7 +17606,7 @@ var isBatchingInteractiveUpdates = false;
|
|
|
16989
17606
|
|
|
16990
17607
|
var completedBatches = null;
|
|
16991
17608
|
|
|
16992
|
-
var originalStartTimeMs =
|
|
17609
|
+
var originalStartTimeMs = scheduler.unstable_now();
|
|
16993
17610
|
var currentRendererTime = msToExpirationTime(originalStartTimeMs);
|
|
16994
17611
|
var currentSchedulerTime = currentRendererTime;
|
|
16995
17612
|
|
|
@@ -17001,7 +17618,7 @@ var lastCommittedRootDuringThisBatch = null;
|
|
|
17001
17618
|
var timeHeuristicForUnitOfWork = 1;
|
|
17002
17619
|
|
|
17003
17620
|
function recomputeCurrentRendererTime() {
|
|
17004
|
-
var currentTimeMs =
|
|
17621
|
+
var currentTimeMs = scheduler.unstable_now() - originalStartTimeMs;
|
|
17005
17622
|
currentRendererTime = msToExpirationTime(currentTimeMs);
|
|
17006
17623
|
}
|
|
17007
17624
|
|
|
@@ -17015,7 +17632,7 @@ function scheduleCallbackWithExpirationTime(root, expirationTime) {
|
|
|
17015
17632
|
if (callbackID !== null) {
|
|
17016
17633
|
// Existing callback has insufficient timeout. Cancel and schedule a
|
|
17017
17634
|
// new one.
|
|
17018
|
-
|
|
17635
|
+
scheduler.unstable_cancelCallback(callbackID);
|
|
17019
17636
|
}
|
|
17020
17637
|
}
|
|
17021
17638
|
// The request callback timer is already running. Don't start a new one.
|
|
@@ -17024,10 +17641,10 @@ function scheduleCallbackWithExpirationTime(root, expirationTime) {
|
|
|
17024
17641
|
}
|
|
17025
17642
|
|
|
17026
17643
|
callbackExpirationTime = expirationTime;
|
|
17027
|
-
var currentMs =
|
|
17644
|
+
var currentMs = scheduler.unstable_now() - originalStartTimeMs;
|
|
17028
17645
|
var expirationTimeMs = expirationTimeToMs(expirationTime);
|
|
17029
17646
|
var timeout = expirationTimeMs - currentMs;
|
|
17030
|
-
callbackID =
|
|
17647
|
+
callbackID = scheduler.unstable_scheduleCallback(performAsyncWork, { timeout: timeout });
|
|
17031
17648
|
}
|
|
17032
17649
|
|
|
17033
17650
|
// For every call to renderRoot, one of onFatal, onComplete, onSuspend, and
|
|
@@ -17045,7 +17662,7 @@ function onComplete(root, finishedWork, expirationTime) {
|
|
|
17045
17662
|
|
|
17046
17663
|
function onSuspend(root, finishedWork, suspendedExpirationTime, rootExpirationTime, msUntilTimeout) {
|
|
17047
17664
|
root.expirationTime = rootExpirationTime;
|
|
17048
|
-
if (
|
|
17665
|
+
if (msUntilTimeout === 0 && !shouldYield()) {
|
|
17049
17666
|
// Don't wait an additional tick. Commit the tree immediately.
|
|
17050
17667
|
root.pendingCommitExpirationTime = suspendedExpirationTime;
|
|
17051
17668
|
root.finishedWork = finishedWork;
|
|
@@ -17060,26 +17677,15 @@ function onYield(root) {
|
|
|
17060
17677
|
}
|
|
17061
17678
|
|
|
17062
17679
|
function onTimeout(root, finishedWork, suspendedExpirationTime) {
|
|
17063
|
-
|
|
17064
|
-
|
|
17065
|
-
|
|
17066
|
-
|
|
17067
|
-
|
|
17068
|
-
|
|
17069
|
-
|
|
17070
|
-
|
|
17071
|
-
|
|
17072
|
-
|
|
17073
|
-
if (enableSchedulerTracing) {
|
|
17074
|
-
// Don't update pending interaction counts for suspense timeouts,
|
|
17075
|
-
// Because we know we still need to do more work in this case.
|
|
17076
|
-
suspenseDidTimeout = true;
|
|
17077
|
-
flushRoot(root, suspendedExpirationTime);
|
|
17078
|
-
suspenseDidTimeout = false;
|
|
17079
|
-
} else {
|
|
17080
|
-
flushRoot(root, suspendedExpirationTime);
|
|
17081
|
-
}
|
|
17082
|
-
}
|
|
17680
|
+
// The root timed out. Commit it.
|
|
17681
|
+
root.pendingCommitExpirationTime = suspendedExpirationTime;
|
|
17682
|
+
root.finishedWork = finishedWork;
|
|
17683
|
+
// Read the current time before entering the commit phase. We can be
|
|
17684
|
+
// certain this won't cause tearing related to batching of event updates
|
|
17685
|
+
// because we're at the top of a timer event.
|
|
17686
|
+
recomputeCurrentRendererTime();
|
|
17687
|
+
currentSchedulerTime = currentRendererTime;
|
|
17688
|
+
flushRoot(root, suspendedExpirationTime);
|
|
17083
17689
|
}
|
|
17084
17690
|
|
|
17085
17691
|
function onCommit(root, expirationTime) {
|
|
@@ -17378,7 +17984,7 @@ function performWorkOnRoot(root, expirationTime, isExpired) {
|
|
|
17378
17984
|
// If this root previously suspended, clear its existing timeout, since
|
|
17379
17985
|
// we're about to try rendering again.
|
|
17380
17986
|
var timeoutHandle = root.timeoutHandle;
|
|
17381
|
-
if (
|
|
17987
|
+
if (timeoutHandle !== noTimeout) {
|
|
17382
17988
|
root.timeoutHandle = noTimeout;
|
|
17383
17989
|
// $FlowFixMe Complains noTimeout is not a TimeoutID, despite the check above
|
|
17384
17990
|
cancelTimeout(timeoutHandle);
|
|
@@ -17402,7 +18008,7 @@ function performWorkOnRoot(root, expirationTime, isExpired) {
|
|
|
17402
18008
|
// If this root previously suspended, clear its existing timeout, since
|
|
17403
18009
|
// we're about to try rendering again.
|
|
17404
18010
|
var _timeoutHandle = root.timeoutHandle;
|
|
17405
|
-
if (
|
|
18011
|
+
if (_timeoutHandle !== noTimeout) {
|
|
17406
18012
|
root.timeoutHandle = noTimeout;
|
|
17407
18013
|
// $FlowFixMe Complains noTimeout is not a TimeoutID, despite the check above
|
|
17408
18014
|
cancelTimeout(_timeoutHandle);
|
|
@@ -17586,9 +18192,11 @@ function flushControlled(fn) {
|
|
|
17586
18192
|
|
|
17587
18193
|
|
|
17588
18194
|
var didWarnAboutNestedUpdates = void 0;
|
|
18195
|
+
var didWarnAboutFindNodeInStrictMode = void 0;
|
|
17589
18196
|
|
|
17590
18197
|
{
|
|
17591
18198
|
didWarnAboutNestedUpdates = false;
|
|
18199
|
+
didWarnAboutFindNodeInStrictMode = {};
|
|
17592
18200
|
}
|
|
17593
18201
|
|
|
17594
18202
|
function getContextForSubtree(parentComponent) {
|
|
@@ -17604,11 +18212,6 @@ function getContextForSubtree(parentComponent) {
|
|
|
17604
18212
|
if (isContextProvider(Component)) {
|
|
17605
18213
|
return processChildContext(fiber, Component, parentContext);
|
|
17606
18214
|
}
|
|
17607
|
-
} else if (fiber.tag === ClassComponentLazy) {
|
|
17608
|
-
var _Component = getResultFromResolvedThenable(fiber.type);
|
|
17609
|
-
if (isContextProvider(_Component)) {
|
|
17610
|
-
return processChildContext(fiber, _Component, parentContext);
|
|
17611
|
-
}
|
|
17612
18215
|
}
|
|
17613
18216
|
|
|
17614
18217
|
return parentContext;
|
|
@@ -17680,8 +18283,38 @@ function findHostInstance(component) {
|
|
|
17680
18283
|
return hostFiber.stateNode;
|
|
17681
18284
|
}
|
|
17682
18285
|
|
|
17683
|
-
function
|
|
17684
|
-
|
|
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
|
+
|
|
18316
|
+
function createContainer(containerInfo, isConcurrent, hydrate) {
|
|
18317
|
+
return createFiberRoot(containerInfo, isConcurrent, hydrate);
|
|
17685
18318
|
}
|
|
17686
18319
|
|
|
17687
18320
|
function updateContainer(element, container, parentComponent, callback) {
|
|
@@ -17753,7 +18386,7 @@ implementation) {
|
|
|
17753
18386
|
|
|
17754
18387
|
// TODO: this is special because it gets imported during build.
|
|
17755
18388
|
|
|
17756
|
-
var ReactVersion = '16.
|
|
18389
|
+
var ReactVersion = '16.6.0';
|
|
17757
18390
|
|
|
17758
18391
|
// TODO: This type is shared between the reconciler and ReactDOM, but will
|
|
17759
18392
|
// eventually be lifted out to the renderer.
|
|
@@ -17796,10 +18429,6 @@ var didWarnAboutUnstableCreatePortal = false;
|
|
|
17796
18429
|
|
|
17797
18430
|
setRestoreImplementation(restoreControlledState$1);
|
|
17798
18431
|
|
|
17799
|
-
/* eslint-disable no-use-before-define */
|
|
17800
|
-
|
|
17801
|
-
/* eslint-enable no-use-before-define */
|
|
17802
|
-
|
|
17803
18432
|
function ReactBatch(root) {
|
|
17804
18433
|
var expirationTime = computeUniqueAsyncExpiration();
|
|
17805
18434
|
this._expirationTime = expirationTime;
|
|
@@ -17940,8 +18569,8 @@ ReactWork.prototype._onCommit = function () {
|
|
|
17940
18569
|
}
|
|
17941
18570
|
};
|
|
17942
18571
|
|
|
17943
|
-
function ReactRoot(container,
|
|
17944
|
-
var root = createContainer(container,
|
|
18572
|
+
function ReactRoot(container, isConcurrent, hydrate) {
|
|
18573
|
+
var root = createContainer(container, isConcurrent, hydrate);
|
|
17945
18574
|
this._internalRoot = root;
|
|
17946
18575
|
}
|
|
17947
18576
|
ReactRoot.prototype.render = function (children, callback) {
|
|
@@ -18064,8 +18693,8 @@ function legacyCreateRootFromDOMContainer(container, forceHydrate) {
|
|
|
18064
18693
|
}
|
|
18065
18694
|
}
|
|
18066
18695
|
// Legacy roots are not async by default.
|
|
18067
|
-
var
|
|
18068
|
-
return new ReactRoot(container,
|
|
18696
|
+
var isConcurrent = false;
|
|
18697
|
+
return new ReactRoot(container, isConcurrent, shouldHydrate);
|
|
18069
18698
|
}
|
|
18070
18699
|
|
|
18071
18700
|
function legacyRenderSubtreeIntoContainer(parentComponent, children, container, forceHydrate, callback) {
|
|
@@ -18141,7 +18770,9 @@ var ReactDOM = {
|
|
|
18141
18770
|
if (componentOrElement.nodeType === ELEMENT_NODE) {
|
|
18142
18771
|
return componentOrElement;
|
|
18143
18772
|
}
|
|
18144
|
-
|
|
18773
|
+
{
|
|
18774
|
+
return findHostInstanceWithWarning(componentOrElement, 'findDOMNode');
|
|
18775
|
+
}
|
|
18145
18776
|
return findHostInstance(componentOrElement);
|
|
18146
18777
|
},
|
|
18147
18778
|
hydrate: function (element, container, callback) {
|