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.
|
|
@@ -117,6 +117,10 @@ var invokeGuardedCallbackImpl = function (name, func, context, a, b, c, d, e, f)
|
|
|
117
117
|
// browsers that support it.
|
|
118
118
|
var windowEvent = window.event;
|
|
119
119
|
|
|
120
|
+
// Keeps track of the descriptor of window.event to restore it after event
|
|
121
|
+
// dispatching: https://github.com/facebook/react/issues/13688
|
|
122
|
+
var windowEventDescriptor = Object.getOwnPropertyDescriptor(window, 'event');
|
|
123
|
+
|
|
120
124
|
// Create an event handler for our fake event. We will synchronously
|
|
121
125
|
// dispatch our fake event using `dispatchEvent`. Inside the handler, we
|
|
122
126
|
// call the user-provided callback.
|
|
@@ -188,6 +192,10 @@ var invokeGuardedCallbackImpl = function (name, func, context, a, b, c, d, e, f)
|
|
|
188
192
|
evt.initEvent(evtType, false, false);
|
|
189
193
|
fakeNode.dispatchEvent(evt);
|
|
190
194
|
|
|
195
|
+
if (windowEventDescriptor) {
|
|
196
|
+
Object.defineProperty(window, 'event', windowEventDescriptor);
|
|
197
|
+
}
|
|
198
|
+
|
|
191
199
|
if (didError) {
|
|
192
200
|
if (!didSetError) {
|
|
193
201
|
// The callback errored, but the error event never fired.
|
|
@@ -858,23 +866,24 @@ function runExtractedEventsInBatch(topLevelType, targetInst, nativeEvent, native
|
|
|
858
866
|
runEventsInBatch(events, false);
|
|
859
867
|
}
|
|
860
868
|
|
|
861
|
-
var
|
|
862
|
-
var
|
|
863
|
-
var
|
|
864
|
-
var
|
|
865
|
-
var
|
|
866
|
-
var
|
|
867
|
-
var
|
|
868
|
-
var
|
|
869
|
-
var
|
|
870
|
-
var
|
|
871
|
-
var
|
|
872
|
-
var
|
|
873
|
-
var
|
|
874
|
-
var
|
|
875
|
-
var
|
|
876
|
-
var
|
|
877
|
-
var
|
|
869
|
+
var FunctionComponent = 0;
|
|
870
|
+
var ClassComponent = 1;
|
|
871
|
+
var IndeterminateComponent = 2; // Before we know whether it is function or class
|
|
872
|
+
var HostRoot = 3; // Root of a host tree. Could be nested inside another node.
|
|
873
|
+
var HostPortal = 4; // A subtree. Could be an entry point to a different renderer.
|
|
874
|
+
var HostComponent = 5;
|
|
875
|
+
var HostText = 6;
|
|
876
|
+
var Fragment = 7;
|
|
877
|
+
var Mode = 8;
|
|
878
|
+
var ContextConsumer = 9;
|
|
879
|
+
var ContextProvider = 10;
|
|
880
|
+
var ForwardRef = 11;
|
|
881
|
+
var Profiler = 12;
|
|
882
|
+
var SuspenseComponent = 13;
|
|
883
|
+
var MemoComponent = 14;
|
|
884
|
+
var SimpleMemoComponent = 15;
|
|
885
|
+
var LazyComponent = 16;
|
|
886
|
+
var IncompleteClassComponent = 17;
|
|
878
887
|
|
|
879
888
|
var randomKey = Math.random().toString(36).slice(2);
|
|
880
889
|
var internalInstanceKey = '__reactInternalInstance$' + randomKey;
|
|
@@ -2460,9 +2469,11 @@ var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeac
|
|
|
2460
2469
|
var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
|
|
2461
2470
|
var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
|
|
2462
2471
|
var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace;
|
|
2463
|
-
var
|
|
2472
|
+
var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
|
|
2464
2473
|
var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
|
|
2465
|
-
var
|
|
2474
|
+
var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
|
|
2475
|
+
var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
|
|
2476
|
+
var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
|
|
2466
2477
|
|
|
2467
2478
|
var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
|
|
2468
2479
|
var FAUX_ITERATOR_SYMBOL = '@@iterator';
|
|
@@ -2482,12 +2493,13 @@ var Pending = 0;
|
|
|
2482
2493
|
var Resolved = 1;
|
|
2483
2494
|
var Rejected = 2;
|
|
2484
2495
|
|
|
2485
|
-
function
|
|
2486
|
-
return
|
|
2496
|
+
function refineResolvedLazyComponent(lazyComponent) {
|
|
2497
|
+
return lazyComponent._status === Resolved ? lazyComponent._result : null;
|
|
2487
2498
|
}
|
|
2488
2499
|
|
|
2489
|
-
function
|
|
2490
|
-
|
|
2500
|
+
function getWrappedName(outerType, innerType, wrapperName) {
|
|
2501
|
+
var functionName = innerType.displayName || innerType.name || '';
|
|
2502
|
+
return outerType.displayName || (functionName !== '' ? wrapperName + '(' + functionName + ')' : wrapperName);
|
|
2491
2503
|
}
|
|
2492
2504
|
|
|
2493
2505
|
function getComponentName(type) {
|
|
@@ -2507,8 +2519,8 @@ function getComponentName(type) {
|
|
|
2507
2519
|
return type;
|
|
2508
2520
|
}
|
|
2509
2521
|
switch (type) {
|
|
2510
|
-
case
|
|
2511
|
-
return '
|
|
2522
|
+
case REACT_CONCURRENT_MODE_TYPE:
|
|
2523
|
+
return 'ConcurrentMode';
|
|
2512
2524
|
case REACT_FRAGMENT_TYPE:
|
|
2513
2525
|
return 'Fragment';
|
|
2514
2526
|
case REACT_PORTAL_TYPE:
|
|
@@ -2517,8 +2529,8 @@ function getComponentName(type) {
|
|
|
2517
2529
|
return 'Profiler';
|
|
2518
2530
|
case REACT_STRICT_MODE_TYPE:
|
|
2519
2531
|
return 'StrictMode';
|
|
2520
|
-
case
|
|
2521
|
-
return '
|
|
2532
|
+
case REACT_SUSPENSE_TYPE:
|
|
2533
|
+
return 'Suspense';
|
|
2522
2534
|
}
|
|
2523
2535
|
if (typeof type === 'object') {
|
|
2524
2536
|
switch (type.$$typeof) {
|
|
@@ -2527,16 +2539,17 @@ function getComponentName(type) {
|
|
|
2527
2539
|
case REACT_PROVIDER_TYPE:
|
|
2528
2540
|
return 'Context.Provider';
|
|
2529
2541
|
case REACT_FORWARD_REF_TYPE:
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
return type.
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2542
|
+
return getWrappedName(type, type.render, 'ForwardRef');
|
|
2543
|
+
case REACT_MEMO_TYPE:
|
|
2544
|
+
return getComponentName(type.type);
|
|
2545
|
+
case REACT_LAZY_TYPE:
|
|
2546
|
+
{
|
|
2547
|
+
var thenable = type;
|
|
2548
|
+
var resolvedThenable = refineResolvedLazyComponent(thenable);
|
|
2549
|
+
if (resolvedThenable) {
|
|
2550
|
+
return getComponentName(resolvedThenable);
|
|
2551
|
+
}
|
|
2552
|
+
}
|
|
2540
2553
|
}
|
|
2541
2554
|
}
|
|
2542
2555
|
return null;
|
|
@@ -2547,10 +2560,9 @@ var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
|
2547
2560
|
function describeFiber(fiber) {
|
|
2548
2561
|
switch (fiber.tag) {
|
|
2549
2562
|
case IndeterminateComponent:
|
|
2550
|
-
case
|
|
2551
|
-
case
|
|
2563
|
+
case LazyComponent:
|
|
2564
|
+
case FunctionComponent:
|
|
2552
2565
|
case ClassComponent:
|
|
2553
|
-
case ClassComponentLazy:
|
|
2554
2566
|
case HostComponent:
|
|
2555
2567
|
case Mode:
|
|
2556
2568
|
var owner = fiber._debugOwner;
|
|
@@ -3251,14 +3263,8 @@ var ReactControlledValuePropTypes = {
|
|
|
3251
3263
|
};
|
|
3252
3264
|
}
|
|
3253
3265
|
|
|
3254
|
-
// Exports ReactDOM.createRoot
|
|
3255
3266
|
var enableUserTimingAPI = true;
|
|
3256
3267
|
|
|
3257
|
-
// Experimental error-boundary API that can recover from errors within a single
|
|
3258
|
-
// render phase
|
|
3259
|
-
var enableGetDerivedStateFromCatch = false;
|
|
3260
|
-
// Suspense
|
|
3261
|
-
var enableSuspense = false;
|
|
3262
3268
|
// Helps identify side effects in begin-phase lifecycle hooks and setState reducers:
|
|
3263
3269
|
var debugRenderPhaseSideEffects = false;
|
|
3264
3270
|
|
|
@@ -3275,9 +3281,6 @@ var replayFailedUnitOfWorkWithInvokeGuardedCallback = true;
|
|
|
3275
3281
|
// Warn about deprecated, async-unsafe lifecycles; relates to RFC #6:
|
|
3276
3282
|
var warnAboutDeprecatedLifecycles = false;
|
|
3277
3283
|
|
|
3278
|
-
// Warn about legacy context API
|
|
3279
|
-
var warnAboutLegacyContextAPI = false;
|
|
3280
|
-
|
|
3281
3284
|
// Gather advanced timing metrics for Profiler subtrees.
|
|
3282
3285
|
var enableProfilerTimer = true;
|
|
3283
3286
|
|
|
@@ -3484,7 +3487,7 @@ function postMountWrapper(element, props, isHydrating) {
|
|
|
3484
3487
|
}
|
|
3485
3488
|
} else {
|
|
3486
3489
|
// When syncing the value attribute, the value property should use
|
|
3487
|
-
// the
|
|
3490
|
+
// the wrapperState._initialValue property. This uses:
|
|
3488
3491
|
//
|
|
3489
3492
|
// 1. The value React property when present
|
|
3490
3493
|
// 2. The defaultValue React property when present
|
|
@@ -3537,7 +3540,7 @@ function postMountWrapper(element, props, isHydrating) {
|
|
|
3537
3540
|
node.defaultChecked = !!props.defaultChecked;
|
|
3538
3541
|
}
|
|
3539
3542
|
} else {
|
|
3540
|
-
// When syncing the checked attribute, both the
|
|
3543
|
+
// When syncing the checked attribute, both the checked property and
|
|
3541
3544
|
// attribute are assigned at the same time using defaultChecked. This uses:
|
|
3542
3545
|
//
|
|
3543
3546
|
// 1. The checked React property when present
|
|
@@ -3873,11 +3876,6 @@ var SyntheticUIEvent = SyntheticEvent.extend({
|
|
|
3873
3876
|
detail: null
|
|
3874
3877
|
});
|
|
3875
3878
|
|
|
3876
|
-
/**
|
|
3877
|
-
* Translation from modifier key to the associated property in the event.
|
|
3878
|
-
* @see http://www.w3.org/TR/DOM-Level-3-Events/#keys-Modifiers
|
|
3879
|
-
*/
|
|
3880
|
-
|
|
3881
3879
|
var modifierKeyToProp = {
|
|
3882
3880
|
Alt: 'altKey',
|
|
3883
3881
|
Control: 'ctrlKey',
|
|
@@ -3888,6 +3886,11 @@ var modifierKeyToProp = {
|
|
|
3888
3886
|
// IE8 does not implement getModifierState so we simply map it to the only
|
|
3889
3887
|
// modifier keys exposed by the event itself, does not support Lock-keys.
|
|
3890
3888
|
// Currently, all major browsers except Chrome seems to support Lock-keys.
|
|
3889
|
+
/**
|
|
3890
|
+
* Translation from modifier key to the associated property in the event.
|
|
3891
|
+
* @see http://www.w3.org/TR/DOM-Level-3-Events/#keys-Modifiers
|
|
3892
|
+
*/
|
|
3893
|
+
|
|
3891
3894
|
function modifierStateGetter(keyArg) {
|
|
3892
3895
|
var syntheticEvent = this;
|
|
3893
3896
|
var nativeEvent = syntheticEvent.nativeEvent;
|
|
@@ -4234,7 +4237,7 @@ function isFiberMounted(fiber) {
|
|
|
4234
4237
|
function isMounted(component) {
|
|
4235
4238
|
{
|
|
4236
4239
|
var owner = ReactCurrentOwner$1.current;
|
|
4237
|
-
if (owner !== null &&
|
|
4240
|
+
if (owner !== null && owner.tag === ClassComponent) {
|
|
4238
4241
|
var ownerFiber = owner;
|
|
4239
4242
|
var instance = ownerFiber.stateNode;
|
|
4240
4243
|
!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;
|
|
@@ -7386,7 +7389,7 @@ var SUPPRESS_CONTENT_EDITABLE_WARNING = 'suppressContentEditableWarning';
|
|
|
7386
7389
|
var SUPPRESS_HYDRATION_WARNING$1 = 'suppressHydrationWarning';
|
|
7387
7390
|
var AUTOFOCUS = 'autoFocus';
|
|
7388
7391
|
var CHILDREN = 'children';
|
|
7389
|
-
var STYLE = 'style';
|
|
7392
|
+
var STYLE$1 = 'style';
|
|
7390
7393
|
var HTML = '__html';
|
|
7391
7394
|
|
|
7392
7395
|
var HTML_NAMESPACE = Namespaces.html;
|
|
@@ -7541,7 +7544,7 @@ function setInitialDOMProperties(tag, domElement, rootContainerElement, nextProp
|
|
|
7541
7544
|
continue;
|
|
7542
7545
|
}
|
|
7543
7546
|
var nextProp = nextProps[propKey];
|
|
7544
|
-
if (propKey === STYLE) {
|
|
7547
|
+
if (propKey === STYLE$1) {
|
|
7545
7548
|
{
|
|
7546
7549
|
if (nextProp) {
|
|
7547
7550
|
// Freeze the next style object so that we can assume it won't be
|
|
@@ -7594,7 +7597,7 @@ function updateDOMProperties(domElement, updatePayload, wasCustomComponentTag, i
|
|
|
7594
7597
|
for (var i = 0; i < updatePayload.length; i += 2) {
|
|
7595
7598
|
var propKey = updatePayload[i];
|
|
7596
7599
|
var propValue = updatePayload[i + 1];
|
|
7597
|
-
if (propKey === STYLE) {
|
|
7600
|
+
if (propKey === STYLE$1) {
|
|
7598
7601
|
setValueForStyles(domElement, propValue);
|
|
7599
7602
|
} else if (propKey === DANGEROUSLY_SET_INNER_HTML) {
|
|
7600
7603
|
setInnerHTML(domElement, propValue);
|
|
@@ -7831,7 +7834,7 @@ function diffProperties(domElement, tag, lastRawProps, nextRawProps, rootContain
|
|
|
7831
7834
|
if (nextProps.hasOwnProperty(propKey) || !lastProps.hasOwnProperty(propKey) || lastProps[propKey] == null) {
|
|
7832
7835
|
continue;
|
|
7833
7836
|
}
|
|
7834
|
-
if (propKey === STYLE) {
|
|
7837
|
+
if (propKey === STYLE$1) {
|
|
7835
7838
|
var lastStyle = lastProps[propKey];
|
|
7836
7839
|
for (styleName in lastStyle) {
|
|
7837
7840
|
if (lastStyle.hasOwnProperty(styleName)) {
|
|
@@ -7866,7 +7869,7 @@ function diffProperties(domElement, tag, lastRawProps, nextRawProps, rootContain
|
|
|
7866
7869
|
if (!nextProps.hasOwnProperty(propKey) || nextProp === lastProp || nextProp == null && lastProp == null) {
|
|
7867
7870
|
continue;
|
|
7868
7871
|
}
|
|
7869
|
-
if (propKey === STYLE) {
|
|
7872
|
+
if (propKey === STYLE$1) {
|
|
7870
7873
|
{
|
|
7871
7874
|
if (nextProp) {
|
|
7872
7875
|
// Freeze the next style object so that we can assume it won't be
|
|
@@ -7941,7 +7944,7 @@ function diffProperties(domElement, tag, lastRawProps, nextRawProps, rootContain
|
|
|
7941
7944
|
}
|
|
7942
7945
|
}
|
|
7943
7946
|
if (styleUpdates) {
|
|
7944
|
-
(updatePayload = updatePayload || []).push(STYLE, styleUpdates);
|
|
7947
|
+
(updatePayload = updatePayload || []).push(STYLE$1, styleUpdates);
|
|
7945
7948
|
}
|
|
7946
7949
|
return updatePayload;
|
|
7947
7950
|
}
|
|
@@ -8145,7 +8148,7 @@ function diffHydratedProperties(domElement, tag, rawProps, parentNamespace, root
|
|
|
8145
8148
|
if (expectedHTML !== serverHTML) {
|
|
8146
8149
|
warnForPropDifference(propKey, serverHTML, expectedHTML);
|
|
8147
8150
|
}
|
|
8148
|
-
} else if (propKey === STYLE) {
|
|
8151
|
+
} else if (propKey === STYLE$1) {
|
|
8149
8152
|
// $FlowFixMe - Should be inferred as not undefined.
|
|
8150
8153
|
extraAttributeNames.delete(propKey);
|
|
8151
8154
|
|
|
@@ -8613,10 +8616,10 @@ var updatedAncestorInfo = function () {};
|
|
|
8613
8616
|
|
|
8614
8617
|
var ReactInternals$1 = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
8615
8618
|
|
|
8616
|
-
var _ReactInternals$Sched = ReactInternals$1.
|
|
8617
|
-
var
|
|
8619
|
+
var _ReactInternals$Sched = ReactInternals$1.Scheduler;
|
|
8620
|
+
var unstable_cancelCallback = _ReactInternals$Sched.unstable_cancelCallback;
|
|
8618
8621
|
var unstable_now = _ReactInternals$Sched.unstable_now;
|
|
8619
|
-
var
|
|
8622
|
+
var unstable_scheduleCallback = _ReactInternals$Sched.unstable_scheduleCallback;
|
|
8620
8623
|
|
|
8621
8624
|
// Renderers that don't support persistence
|
|
8622
8625
|
// can re-export everything from this module.
|
|
@@ -8632,12 +8635,17 @@ var createContainerChildSet = shim;
|
|
|
8632
8635
|
var appendChildToContainerChildSet = shim;
|
|
8633
8636
|
var finalizeContainerChildren = shim;
|
|
8634
8637
|
var replaceContainerChildren = shim;
|
|
8638
|
+
var cloneHiddenInstance = shim;
|
|
8639
|
+
var cloneUnhiddenInstance = shim;
|
|
8640
|
+
var createHiddenTextInstance = shim;
|
|
8635
8641
|
|
|
8636
8642
|
var SUPPRESS_HYDRATION_WARNING = void 0;
|
|
8637
8643
|
{
|
|
8638
8644
|
SUPPRESS_HYDRATION_WARNING = 'suppressHydrationWarning';
|
|
8639
8645
|
}
|
|
8640
8646
|
|
|
8647
|
+
var STYLE = 'style';
|
|
8648
|
+
|
|
8641
8649
|
var eventsEnabled = null;
|
|
8642
8650
|
var selectionInformation = null;
|
|
8643
8651
|
|
|
@@ -8825,9 +8833,11 @@ function appendChildToContainer(container, child) {
|
|
|
8825
8833
|
// through the React tree. However, on Mobile Safari the click would
|
|
8826
8834
|
// never bubble through the *DOM* tree unless an ancestor with onclick
|
|
8827
8835
|
// event exists. So we wouldn't see it and dispatch it.
|
|
8828
|
-
// This is why we ensure that containers have inline onclick
|
|
8836
|
+
// This is why we ensure that non React root containers have inline onclick
|
|
8837
|
+
// defined.
|
|
8829
8838
|
// https://github.com/facebook/react/issues/11918
|
|
8830
|
-
|
|
8839
|
+
var reactRootContainer = container._reactRootContainer;
|
|
8840
|
+
if ((reactRootContainer === null || reactRootContainer === undefined) && parentNode.onclick === null) {
|
|
8831
8841
|
// TODO: This cast may not be sound for SVG, MathML or custom elements.
|
|
8832
8842
|
trapClickOnNonInteractiveElement(parentNode);
|
|
8833
8843
|
}
|
|
@@ -8857,6 +8867,29 @@ function removeChildFromContainer(container, child) {
|
|
|
8857
8867
|
}
|
|
8858
8868
|
}
|
|
8859
8869
|
|
|
8870
|
+
function hideInstance(instance) {
|
|
8871
|
+
// TODO: Does this work for all element types? What about MathML? Should we
|
|
8872
|
+
// pass host context to this method?
|
|
8873
|
+
instance = instance;
|
|
8874
|
+
instance.style.display = 'none';
|
|
8875
|
+
}
|
|
8876
|
+
|
|
8877
|
+
function hideTextInstance(textInstance) {
|
|
8878
|
+
textInstance.nodeValue = '';
|
|
8879
|
+
}
|
|
8880
|
+
|
|
8881
|
+
function unhideInstance(instance, props) {
|
|
8882
|
+
instance = instance;
|
|
8883
|
+
var styleProp = props[STYLE];
|
|
8884
|
+
var display = styleProp !== undefined && styleProp !== null && styleProp.hasOwnProperty('display') ? styleProp.display : null;
|
|
8885
|
+
// $FlowFixMe Setting a style property to null is the valid way to reset it.
|
|
8886
|
+
instance.style.display = display;
|
|
8887
|
+
}
|
|
8888
|
+
|
|
8889
|
+
function unhideTextInstance(textInstance, text) {
|
|
8890
|
+
textInstance.nodeValue = text;
|
|
8891
|
+
}
|
|
8892
|
+
|
|
8860
8893
|
// -------------------
|
|
8861
8894
|
// Hydration
|
|
8862
8895
|
// -------------------
|
|
@@ -9227,7 +9260,7 @@ function stopFailedWorkTimer(fiber) {
|
|
|
9227
9260
|
return;
|
|
9228
9261
|
}
|
|
9229
9262
|
fiber._debugIsCurrentlyTiming = false;
|
|
9230
|
-
var warning = 'An error was thrown inside this error boundary';
|
|
9263
|
+
var warning = fiber.tag === SuspenseComponent ? 'Rendering was suspended' : 'An error was thrown inside this error boundary';
|
|
9231
9264
|
endFiberMark(fiber, null, warning);
|
|
9232
9265
|
}
|
|
9233
9266
|
}
|
|
@@ -9649,7 +9682,7 @@ function invalidateContextProvider(workInProgress, type, didChange) {
|
|
|
9649
9682
|
function findCurrentUnmaskedContext(fiber) {
|
|
9650
9683
|
// Currently this is only used with renderSubtreeIntoContainer; not sure if it
|
|
9651
9684
|
// makes sense elsewhere
|
|
9652
|
-
!(isFiberMounted(fiber) &&
|
|
9685
|
+
!(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;
|
|
9653
9686
|
|
|
9654
9687
|
var node = fiber;
|
|
9655
9688
|
do {
|
|
@@ -9664,14 +9697,6 @@ function findCurrentUnmaskedContext(fiber) {
|
|
|
9664
9697
|
}
|
|
9665
9698
|
break;
|
|
9666
9699
|
}
|
|
9667
|
-
case ClassComponentLazy:
|
|
9668
|
-
{
|
|
9669
|
-
var _Component = getResultFromResolvedThenable(node.type);
|
|
9670
|
-
if (isContextProvider(_Component)) {
|
|
9671
|
-
return node.stateNode.__reactInternalMemoizedMergedChildContext;
|
|
9672
|
-
}
|
|
9673
|
-
break;
|
|
9674
|
-
}
|
|
9675
9700
|
}
|
|
9676
9701
|
node = node.return;
|
|
9677
9702
|
} while (node !== null);
|
|
@@ -9803,7 +9828,7 @@ function computeInteractiveExpiration(currentTime) {
|
|
|
9803
9828
|
}
|
|
9804
9829
|
|
|
9805
9830
|
var NoContext = 0;
|
|
9806
|
-
var
|
|
9831
|
+
var ConcurrentMode = 1;
|
|
9807
9832
|
var StrictMode = 2;
|
|
9808
9833
|
var ProfileMode = 4;
|
|
9809
9834
|
|
|
@@ -9840,6 +9865,7 @@ function FiberNode(tag, pendingProps, key, mode) {
|
|
|
9840
9865
|
// Instance
|
|
9841
9866
|
this.tag = tag;
|
|
9842
9867
|
this.key = key;
|
|
9868
|
+
this.elementType = null;
|
|
9843
9869
|
this.type = null;
|
|
9844
9870
|
this.stateNode = null;
|
|
9845
9871
|
|
|
@@ -9912,11 +9938,21 @@ function shouldConstruct(Component) {
|
|
|
9912
9938
|
return !!(prototype && prototype.isReactComponent);
|
|
9913
9939
|
}
|
|
9914
9940
|
|
|
9915
|
-
function
|
|
9941
|
+
function isSimpleFunctionComponent(type) {
|
|
9942
|
+
return typeof type === 'function' && !shouldConstruct(type) && type.defaultProps === undefined;
|
|
9943
|
+
}
|
|
9944
|
+
|
|
9945
|
+
function resolveLazyComponentTag(Component) {
|
|
9916
9946
|
if (typeof Component === 'function') {
|
|
9917
|
-
return shouldConstruct(Component) ?
|
|
9918
|
-
} else if (Component !== undefined && Component !== null
|
|
9919
|
-
|
|
9947
|
+
return shouldConstruct(Component) ? ClassComponent : FunctionComponent;
|
|
9948
|
+
} else if (Component !== undefined && Component !== null) {
|
|
9949
|
+
var $$typeof = Component.$$typeof;
|
|
9950
|
+
if ($$typeof === REACT_FORWARD_REF_TYPE) {
|
|
9951
|
+
return ForwardRef;
|
|
9952
|
+
}
|
|
9953
|
+
if ($$typeof === REACT_MEMO_TYPE) {
|
|
9954
|
+
return MemoComponent;
|
|
9955
|
+
}
|
|
9920
9956
|
}
|
|
9921
9957
|
return IndeterminateComponent;
|
|
9922
9958
|
}
|
|
@@ -9931,6 +9967,7 @@ function createWorkInProgress(current, pendingProps, expirationTime) {
|
|
|
9931
9967
|
// extra objects for things that are never updated. It also allow us to
|
|
9932
9968
|
// reclaim the extra memory if needed.
|
|
9933
9969
|
workInProgress = createFiber(current.tag, pendingProps, current.key, current.mode);
|
|
9970
|
+
workInProgress.elementType = current.elementType;
|
|
9934
9971
|
workInProgress.type = current.type;
|
|
9935
9972
|
workInProgress.stateNode = current.stateNode;
|
|
9936
9973
|
|
|
@@ -9965,15 +10002,8 @@ function createWorkInProgress(current, pendingProps, expirationTime) {
|
|
|
9965
10002
|
}
|
|
9966
10003
|
}
|
|
9967
10004
|
|
|
9968
|
-
// Don't touching the subtree's expiration time, which has not changed.
|
|
9969
10005
|
workInProgress.childExpirationTime = current.childExpirationTime;
|
|
9970
|
-
|
|
9971
|
-
// This fiber has new props.
|
|
9972
|
-
workInProgress.expirationTime = expirationTime;
|
|
9973
|
-
} else {
|
|
9974
|
-
// This fiber's props have not changed.
|
|
9975
|
-
workInProgress.expirationTime = current.expirationTime;
|
|
9976
|
-
}
|
|
10006
|
+
workInProgress.expirationTime = current.expirationTime;
|
|
9977
10007
|
|
|
9978
10008
|
workInProgress.child = current.child;
|
|
9979
10009
|
workInProgress.memoizedProps = current.memoizedProps;
|
|
@@ -9994,8 +10024,8 @@ function createWorkInProgress(current, pendingProps, expirationTime) {
|
|
|
9994
10024
|
return workInProgress;
|
|
9995
10025
|
}
|
|
9996
10026
|
|
|
9997
|
-
function createHostRootFiber(
|
|
9998
|
-
var mode =
|
|
10027
|
+
function createHostRootFiber(isConcurrent) {
|
|
10028
|
+
var mode = isConcurrent ? ConcurrentMode | StrictMode : NoContext;
|
|
9999
10029
|
|
|
10000
10030
|
if (enableProfilerTimer && isDevToolsPresent) {
|
|
10001
10031
|
// Always collect profile timings when DevTools are present.
|
|
@@ -10007,39 +10037,31 @@ function createHostRootFiber(isAsync) {
|
|
|
10007
10037
|
return createFiber(HostRoot, null, null, mode);
|
|
10008
10038
|
}
|
|
10009
10039
|
|
|
10010
|
-
function
|
|
10011
|
-
|
|
10012
|
-
{
|
|
10013
|
-
owner = element._owner;
|
|
10014
|
-
}
|
|
10015
|
-
|
|
10040
|
+
function createFiberFromTypeAndProps(type, // React$ElementType
|
|
10041
|
+
key, pendingProps, owner, mode, expirationTime) {
|
|
10016
10042
|
var fiber = void 0;
|
|
10017
|
-
var type = element.type;
|
|
10018
|
-
var key = element.key;
|
|
10019
|
-
var pendingProps = element.props;
|
|
10020
10043
|
|
|
10021
|
-
var fiberTag =
|
|
10044
|
+
var fiberTag = IndeterminateComponent;
|
|
10045
|
+
// The resolved type is set if we know what the final type will be. I.e. it's not lazy.
|
|
10046
|
+
var resolvedType = type;
|
|
10022
10047
|
if (typeof type === 'function') {
|
|
10023
|
-
|
|
10048
|
+
if (shouldConstruct(type)) {
|
|
10049
|
+
fiberTag = ClassComponent;
|
|
10050
|
+
}
|
|
10024
10051
|
} else if (typeof type === 'string') {
|
|
10025
10052
|
fiberTag = HostComponent;
|
|
10026
10053
|
} else {
|
|
10027
10054
|
getTag: switch (type) {
|
|
10028
10055
|
case REACT_FRAGMENT_TYPE:
|
|
10029
10056
|
return createFiberFromFragment(pendingProps.children, mode, expirationTime, key);
|
|
10030
|
-
case
|
|
10031
|
-
|
|
10032
|
-
mode |= AsyncMode | StrictMode;
|
|
10033
|
-
break;
|
|
10057
|
+
case REACT_CONCURRENT_MODE_TYPE:
|
|
10058
|
+
return createFiberFromMode(pendingProps, mode | ConcurrentMode | StrictMode, expirationTime, key);
|
|
10034
10059
|
case REACT_STRICT_MODE_TYPE:
|
|
10035
|
-
|
|
10036
|
-
mode |= StrictMode;
|
|
10037
|
-
break;
|
|
10060
|
+
return createFiberFromMode(pendingProps, mode | StrictMode, expirationTime, key);
|
|
10038
10061
|
case REACT_PROFILER_TYPE:
|
|
10039
10062
|
return createFiberFromProfiler(pendingProps, mode, expirationTime, key);
|
|
10040
|
-
case
|
|
10041
|
-
|
|
10042
|
-
break;
|
|
10063
|
+
case REACT_SUSPENSE_TYPE:
|
|
10064
|
+
return createFiberFromSuspense(pendingProps, mode, expirationTime, key);
|
|
10043
10065
|
default:
|
|
10044
10066
|
{
|
|
10045
10067
|
if (typeof type === 'object' && type !== null) {
|
|
@@ -10054,13 +10076,13 @@ function createFiberFromElement(element, mode, expirationTime) {
|
|
|
10054
10076
|
case REACT_FORWARD_REF_TYPE:
|
|
10055
10077
|
fiberTag = ForwardRef;
|
|
10056
10078
|
break getTag;
|
|
10057
|
-
|
|
10058
|
-
|
|
10059
|
-
|
|
10060
|
-
|
|
10061
|
-
|
|
10062
|
-
|
|
10063
|
-
|
|
10079
|
+
case REACT_MEMO_TYPE:
|
|
10080
|
+
fiberTag = MemoComponent;
|
|
10081
|
+
break getTag;
|
|
10082
|
+
case REACT_LAZY_TYPE:
|
|
10083
|
+
fiberTag = LazyComponent;
|
|
10084
|
+
resolvedType = null;
|
|
10085
|
+
break getTag;
|
|
10064
10086
|
}
|
|
10065
10087
|
}
|
|
10066
10088
|
var info = '';
|
|
@@ -10079,14 +10101,26 @@ function createFiberFromElement(element, mode, expirationTime) {
|
|
|
10079
10101
|
}
|
|
10080
10102
|
|
|
10081
10103
|
fiber = createFiber(fiberTag, pendingProps, key, mode);
|
|
10082
|
-
fiber.
|
|
10104
|
+
fiber.elementType = type;
|
|
10105
|
+
fiber.type = resolvedType;
|
|
10083
10106
|
fiber.expirationTime = expirationTime;
|
|
10084
10107
|
|
|
10108
|
+
return fiber;
|
|
10109
|
+
}
|
|
10110
|
+
|
|
10111
|
+
function createFiberFromElement(element, mode, expirationTime) {
|
|
10112
|
+
var owner = null;
|
|
10113
|
+
{
|
|
10114
|
+
owner = element._owner;
|
|
10115
|
+
}
|
|
10116
|
+
var type = element.type;
|
|
10117
|
+
var key = element.key;
|
|
10118
|
+
var pendingProps = element.props;
|
|
10119
|
+
var fiber = createFiberFromTypeAndProps(type, key, pendingProps, owner, mode, expirationTime);
|
|
10085
10120
|
{
|
|
10086
10121
|
fiber._debugSource = element._source;
|
|
10087
10122
|
fiber._debugOwner = element._owner;
|
|
10088
10123
|
}
|
|
10089
|
-
|
|
10090
10124
|
return fiber;
|
|
10091
10125
|
}
|
|
10092
10126
|
|
|
@@ -10104,12 +10138,38 @@ function createFiberFromProfiler(pendingProps, mode, expirationTime, key) {
|
|
|
10104
10138
|
}
|
|
10105
10139
|
|
|
10106
10140
|
var fiber = createFiber(Profiler, pendingProps, key, mode | ProfileMode);
|
|
10141
|
+
// TODO: The Profiler fiber shouldn't have a type. It has a tag.
|
|
10142
|
+
fiber.elementType = REACT_PROFILER_TYPE;
|
|
10107
10143
|
fiber.type = REACT_PROFILER_TYPE;
|
|
10108
10144
|
fiber.expirationTime = expirationTime;
|
|
10109
10145
|
|
|
10110
10146
|
return fiber;
|
|
10111
10147
|
}
|
|
10112
10148
|
|
|
10149
|
+
function createFiberFromMode(pendingProps, mode, expirationTime, key) {
|
|
10150
|
+
var fiber = createFiber(Mode, pendingProps, key, mode);
|
|
10151
|
+
|
|
10152
|
+
// TODO: The Mode fiber shouldn't have a type. It has a tag.
|
|
10153
|
+
var type = (mode & ConcurrentMode) === NoContext ? REACT_STRICT_MODE_TYPE : REACT_CONCURRENT_MODE_TYPE;
|
|
10154
|
+
fiber.elementType = type;
|
|
10155
|
+
fiber.type = type;
|
|
10156
|
+
|
|
10157
|
+
fiber.expirationTime = expirationTime;
|
|
10158
|
+
return fiber;
|
|
10159
|
+
}
|
|
10160
|
+
|
|
10161
|
+
function createFiberFromSuspense(pendingProps, mode, expirationTime, key) {
|
|
10162
|
+
var fiber = createFiber(SuspenseComponent, pendingProps, key, mode);
|
|
10163
|
+
|
|
10164
|
+
// TODO: The SuspenseComponent fiber shouldn't have a type. It has a tag.
|
|
10165
|
+
var type = REACT_SUSPENSE_TYPE;
|
|
10166
|
+
fiber.elementType = type;
|
|
10167
|
+
fiber.type = type;
|
|
10168
|
+
|
|
10169
|
+
fiber.expirationTime = expirationTime;
|
|
10170
|
+
return fiber;
|
|
10171
|
+
}
|
|
10172
|
+
|
|
10113
10173
|
function createFiberFromText(content, mode, expirationTime) {
|
|
10114
10174
|
var fiber = createFiber(HostText, content, null, mode);
|
|
10115
10175
|
fiber.expirationTime = expirationTime;
|
|
@@ -10118,6 +10178,8 @@ function createFiberFromText(content, mode, expirationTime) {
|
|
|
10118
10178
|
|
|
10119
10179
|
function createFiberFromHostInstanceForDeletion() {
|
|
10120
10180
|
var fiber = createFiber(HostComponent, null, null, NoContext);
|
|
10181
|
+
// TODO: These should not need a type.
|
|
10182
|
+
fiber.elementType = 'DELETED';
|
|
10121
10183
|
fiber.type = 'DELETED';
|
|
10122
10184
|
return fiber;
|
|
10123
10185
|
}
|
|
@@ -10150,6 +10212,7 @@ function assignFiberPropertiesInDEV(target, source) {
|
|
|
10150
10212
|
|
|
10151
10213
|
target.tag = source.tag;
|
|
10152
10214
|
target.key = source.key;
|
|
10215
|
+
target.elementType = source.elementType;
|
|
10153
10216
|
target.type = source.type;
|
|
10154
10217
|
target.stateNode = source.stateNode;
|
|
10155
10218
|
target.return = source.return;
|
|
@@ -10185,7 +10248,7 @@ function assignFiberPropertiesInDEV(target, source) {
|
|
|
10185
10248
|
|
|
10186
10249
|
var ReactInternals$2 = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
10187
10250
|
|
|
10188
|
-
var _ReactInternals$Sched$1 = ReactInternals$2.
|
|
10251
|
+
var _ReactInternals$Sched$1 = ReactInternals$2.SchedulerTracing;
|
|
10189
10252
|
var __interactionsRef = _ReactInternals$Sched$1.__interactionsRef;
|
|
10190
10253
|
var __subscriberRef = _ReactInternals$Sched$1.__subscriberRef;
|
|
10191
10254
|
var unstable_clear = _ReactInternals$Sched$1.unstable_clear;
|
|
@@ -10196,7 +10259,6 @@ var unstable_trace = _ReactInternals$Sched$1.unstable_trace;
|
|
|
10196
10259
|
var unstable_unsubscribe = _ReactInternals$Sched$1.unstable_unsubscribe;
|
|
10197
10260
|
var unstable_wrap = _ReactInternals$Sched$1.unstable_wrap;
|
|
10198
10261
|
|
|
10199
|
-
/* eslint-disable no-use-before-define */
|
|
10200
10262
|
// TODO: This should be lifted into the renderer.
|
|
10201
10263
|
|
|
10202
10264
|
|
|
@@ -10212,12 +10274,11 @@ var unstable_wrap = _ReactInternals$Sched$1.unstable_wrap;
|
|
|
10212
10274
|
// The types are defined separately within this file to ensure they stay in sync.
|
|
10213
10275
|
// (We don't have to use an inline :any cast when enableSchedulerTracing is disabled.)
|
|
10214
10276
|
|
|
10215
|
-
/* eslint-enable no-use-before-define */
|
|
10216
10277
|
|
|
10217
|
-
function createFiberRoot(containerInfo,
|
|
10278
|
+
function createFiberRoot(containerInfo, isConcurrent, hydrate) {
|
|
10218
10279
|
// Cyclic construction. This cheats the type system right now because
|
|
10219
10280
|
// stateNode is any.
|
|
10220
|
-
var uninitializedFiber = createHostRootFiber(
|
|
10281
|
+
var uninitializedFiber = createHostRootFiber(isConcurrent);
|
|
10221
10282
|
|
|
10222
10283
|
var root = void 0;
|
|
10223
10284
|
if (enableSchedulerTracing) {
|
|
@@ -11025,7 +11086,7 @@ function enqueueUpdate(fiber, update) {
|
|
|
11025
11086
|
}
|
|
11026
11087
|
|
|
11027
11088
|
{
|
|
11028
|
-
if (
|
|
11089
|
+
if (fiber.tag === ClassComponent && (currentlyProcessingQueue === queue1 || queue2 !== null && currentlyProcessingQueue === queue2) && !didWarnUpdateInsideUpdate) {
|
|
11029
11090
|
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.');
|
|
11030
11091
|
didWarnUpdateInsideUpdate = true;
|
|
11031
11092
|
}
|
|
@@ -11398,7 +11459,7 @@ function propagateContextChange(workInProgress, context, changedBits, renderExpi
|
|
|
11398
11459
|
if (dependency.context === context && (dependency.observedBits & changedBits) !== 0) {
|
|
11399
11460
|
// Match! Schedule an update on this fiber.
|
|
11400
11461
|
|
|
11401
|
-
if (fiber.tag === ClassComponent
|
|
11462
|
+
if (fiber.tag === ClassComponent) {
|
|
11402
11463
|
// Schedule a force update on the work-in-progress.
|
|
11403
11464
|
var update = createUpdate(renderExpirationTime);
|
|
11404
11465
|
update.tag = ForceUpdate;
|
|
@@ -11505,7 +11566,7 @@ function readContext(context, observedBits) {
|
|
|
11505
11566
|
};
|
|
11506
11567
|
|
|
11507
11568
|
if (lastContextDependency === null) {
|
|
11508
|
-
!(currentlyRenderingFiber !== null) ? invariant(false, 'Context
|
|
11569
|
+
!(currentlyRenderingFiber !== null) ? invariant(false, 'Context can only be read while React is rendering, e.g. inside the render method or getDerivedStateFromProps.') : void 0;
|
|
11509
11570
|
// This is the first dependency in the list
|
|
11510
11571
|
currentlyRenderingFiber.firstContextDependency = lastContextDependency = contextItem;
|
|
11511
11572
|
} else {
|
|
@@ -11638,8 +11699,15 @@ function stopProfilerTimerIfRunningAndRecordDelta(fiber, overrideBaseTime) {
|
|
|
11638
11699
|
}
|
|
11639
11700
|
}
|
|
11640
11701
|
|
|
11702
|
+
var ReactCurrentOwner$4 = ReactSharedInternals.ReactCurrentOwner;
|
|
11703
|
+
|
|
11704
|
+
function readContext$1(contextType) {
|
|
11705
|
+
var dispatcher = ReactCurrentOwner$4.currentDispatcher;
|
|
11706
|
+
return dispatcher.readContext(contextType);
|
|
11707
|
+
}
|
|
11708
|
+
|
|
11641
11709
|
var fakeInternalInstance = {};
|
|
11642
|
-
var isArray = Array.isArray;
|
|
11710
|
+
var isArray$1 = Array.isArray;
|
|
11643
11711
|
|
|
11644
11712
|
// React.Component uses a shared frozen object by default.
|
|
11645
11713
|
// We'll use it to determine whether we need to initialize legacy refs.
|
|
@@ -11653,6 +11721,8 @@ var didWarnAboutUndefinedDerivedState = void 0;
|
|
|
11653
11721
|
var warnOnUndefinedDerivedState = void 0;
|
|
11654
11722
|
var warnOnInvalidCallback$1 = void 0;
|
|
11655
11723
|
var didWarnAboutDirectlyAssigningPropsToState = void 0;
|
|
11724
|
+
var didWarnAboutContextTypeAndContextTypes = void 0;
|
|
11725
|
+
var didWarnAboutInvalidateContextType = void 0;
|
|
11656
11726
|
|
|
11657
11727
|
{
|
|
11658
11728
|
didWarnAboutStateAssignmentForComponent = new Set();
|
|
@@ -11661,6 +11731,8 @@ var didWarnAboutDirectlyAssigningPropsToState = void 0;
|
|
|
11661
11731
|
didWarnAboutLegacyLifecyclesAndDerivedState = new Set();
|
|
11662
11732
|
didWarnAboutDirectlyAssigningPropsToState = new Set();
|
|
11663
11733
|
didWarnAboutUndefinedDerivedState = new Set();
|
|
11734
|
+
didWarnAboutContextTypeAndContextTypes = new Set();
|
|
11735
|
+
didWarnAboutInvalidateContextType = new Set();
|
|
11664
11736
|
|
|
11665
11737
|
var didWarnOnInvalidCallback = new Set();
|
|
11666
11738
|
|
|
@@ -11784,11 +11856,11 @@ var classComponentUpdater = {
|
|
|
11784
11856
|
}
|
|
11785
11857
|
};
|
|
11786
11858
|
|
|
11787
|
-
function checkShouldComponentUpdate(workInProgress, ctor, oldProps, newProps, oldState, newState,
|
|
11859
|
+
function checkShouldComponentUpdate(workInProgress, ctor, oldProps, newProps, oldState, newState, nextContext) {
|
|
11788
11860
|
var instance = workInProgress.stateNode;
|
|
11789
11861
|
if (typeof instance.shouldComponentUpdate === 'function') {
|
|
11790
11862
|
startPhaseTimer(workInProgress, 'shouldComponentUpdate');
|
|
11791
|
-
var shouldUpdate = instance.shouldComponentUpdate(newProps, newState,
|
|
11863
|
+
var shouldUpdate = instance.shouldComponentUpdate(newProps, newState, nextContext);
|
|
11792
11864
|
stopPhaseTimer();
|
|
11793
11865
|
|
|
11794
11866
|
{
|
|
@@ -11825,8 +11897,16 @@ function checkClassInstance(workInProgress, ctor, newProps) {
|
|
|
11825
11897
|
!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;
|
|
11826
11898
|
var noInstancePropTypes = !instance.propTypes;
|
|
11827
11899
|
!noInstancePropTypes ? warningWithoutStack$1(false, 'propTypes was defined as an instance property on %s. Use a static ' + 'property to define propTypes instead.', name) : void 0;
|
|
11900
|
+
var noInstanceContextType = !instance.contextType;
|
|
11901
|
+
!noInstanceContextType ? warningWithoutStack$1(false, 'contextType was defined as an instance property on %s. Use a static ' + 'property to define contextType instead.', name) : void 0;
|
|
11828
11902
|
var noInstanceContextTypes = !instance.contextTypes;
|
|
11829
11903
|
!noInstanceContextTypes ? warningWithoutStack$1(false, 'contextTypes was defined as an instance property on %s. Use a static ' + 'property to define contextTypes instead.', name) : void 0;
|
|
11904
|
+
|
|
11905
|
+
if (ctor.contextType && ctor.contextTypes && !didWarnAboutContextTypeAndContextTypes.has(ctor)) {
|
|
11906
|
+
didWarnAboutContextTypeAndContextTypes.add(ctor);
|
|
11907
|
+
warningWithoutStack$1(false, '%s declares both contextTypes and contextType static properties. ' + 'The legacy contextTypes property will be ignored.', name);
|
|
11908
|
+
}
|
|
11909
|
+
|
|
11830
11910
|
var noComponentShouldUpdate = typeof instance.componentShouldUpdate !== 'function';
|
|
11831
11911
|
!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;
|
|
11832
11912
|
if (ctor.prototype && ctor.prototype.isPureReactComponent && typeof instance.shouldComponentUpdate !== 'undefined') {
|
|
@@ -11852,12 +11932,12 @@ function checkClassInstance(workInProgress, ctor, newProps) {
|
|
|
11852
11932
|
|
|
11853
11933
|
var noInstanceGetDerivedStateFromProps = typeof instance.getDerivedStateFromProps !== 'function';
|
|
11854
11934
|
!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;
|
|
11855
|
-
var noInstanceGetDerivedStateFromCatch = typeof instance.
|
|
11856
|
-
!noInstanceGetDerivedStateFromCatch ? warningWithoutStack$1(false, '%s:
|
|
11935
|
+
var noInstanceGetDerivedStateFromCatch = typeof instance.getDerivedStateFromError !== 'function';
|
|
11936
|
+
!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;
|
|
11857
11937
|
var noStaticGetSnapshotBeforeUpdate = typeof ctor.getSnapshotBeforeUpdate !== 'function';
|
|
11858
11938
|
!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;
|
|
11859
11939
|
var _state = instance.state;
|
|
11860
|
-
if (_state && (typeof _state !== 'object' || isArray(_state))) {
|
|
11940
|
+
if (_state && (typeof _state !== 'object' || isArray$1(_state))) {
|
|
11861
11941
|
warningWithoutStack$1(false, '%s.state: must be set to an object or null', name);
|
|
11862
11942
|
}
|
|
11863
11943
|
if (typeof instance.getChildContext === 'function') {
|
|
@@ -11877,10 +11957,25 @@ function adoptClassInstance(workInProgress, instance) {
|
|
|
11877
11957
|
}
|
|
11878
11958
|
|
|
11879
11959
|
function constructClassInstance(workInProgress, ctor, props, renderExpirationTime) {
|
|
11880
|
-
var
|
|
11881
|
-
var
|
|
11882
|
-
var
|
|
11883
|
-
var
|
|
11960
|
+
var isLegacyContextConsumer = false;
|
|
11961
|
+
var unmaskedContext = emptyContextObject;
|
|
11962
|
+
var context = null;
|
|
11963
|
+
var contextType = ctor.contextType;
|
|
11964
|
+
if (typeof contextType === 'object' && contextType !== null) {
|
|
11965
|
+
{
|
|
11966
|
+
if (contextType.$$typeof !== REACT_CONTEXT_TYPE && !didWarnAboutInvalidateContextType.has(ctor)) {
|
|
11967
|
+
didWarnAboutInvalidateContextType.add(ctor);
|
|
11968
|
+
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');
|
|
11969
|
+
}
|
|
11970
|
+
}
|
|
11971
|
+
|
|
11972
|
+
context = readContext$1(contextType);
|
|
11973
|
+
} else {
|
|
11974
|
+
unmaskedContext = getUnmaskedContext(workInProgress, ctor, true);
|
|
11975
|
+
var contextTypes = ctor.contextTypes;
|
|
11976
|
+
isLegacyContextConsumer = contextTypes !== null && contextTypes !== undefined;
|
|
11977
|
+
context = isLegacyContextConsumer ? getMaskedContext(workInProgress, unmaskedContext) : emptyContextObject;
|
|
11978
|
+
}
|
|
11884
11979
|
|
|
11885
11980
|
// Instantiate twice to help detect side-effects.
|
|
11886
11981
|
{
|
|
@@ -11937,7 +12032,7 @@ function constructClassInstance(workInProgress, ctor, props, renderExpirationTim
|
|
|
11937
12032
|
|
|
11938
12033
|
// Cache unmasked context so we can avoid recreating masked context unless necessary.
|
|
11939
12034
|
// ReactFiberContext usually updates this cache but can't for newly-created instances.
|
|
11940
|
-
if (
|
|
12035
|
+
if (isLegacyContextConsumer) {
|
|
11941
12036
|
cacheContext(workInProgress, unmaskedContext, context);
|
|
11942
12037
|
}
|
|
11943
12038
|
|
|
@@ -11965,14 +12060,14 @@ function callComponentWillMount(workInProgress, instance) {
|
|
|
11965
12060
|
}
|
|
11966
12061
|
}
|
|
11967
12062
|
|
|
11968
|
-
function callComponentWillReceiveProps(workInProgress, instance, newProps,
|
|
12063
|
+
function callComponentWillReceiveProps(workInProgress, instance, newProps, nextContext) {
|
|
11969
12064
|
var oldState = instance.state;
|
|
11970
12065
|
startPhaseTimer(workInProgress, 'componentWillReceiveProps');
|
|
11971
12066
|
if (typeof instance.componentWillReceiveProps === 'function') {
|
|
11972
|
-
instance.componentWillReceiveProps(newProps,
|
|
12067
|
+
instance.componentWillReceiveProps(newProps, nextContext);
|
|
11973
12068
|
}
|
|
11974
12069
|
if (typeof instance.UNSAFE_componentWillReceiveProps === 'function') {
|
|
11975
|
-
instance.UNSAFE_componentWillReceiveProps(newProps,
|
|
12070
|
+
instance.UNSAFE_componentWillReceiveProps(newProps, nextContext);
|
|
11976
12071
|
}
|
|
11977
12072
|
stopPhaseTimer();
|
|
11978
12073
|
|
|
@@ -11995,12 +12090,17 @@ function mountClassInstance(workInProgress, ctor, newProps, renderExpirationTime
|
|
|
11995
12090
|
}
|
|
11996
12091
|
|
|
11997
12092
|
var instance = workInProgress.stateNode;
|
|
11998
|
-
var unmaskedContext = getUnmaskedContext(workInProgress, ctor, true);
|
|
11999
|
-
|
|
12000
12093
|
instance.props = newProps;
|
|
12001
12094
|
instance.state = workInProgress.memoizedState;
|
|
12002
12095
|
instance.refs = emptyRefsObject;
|
|
12003
|
-
|
|
12096
|
+
|
|
12097
|
+
var contextType = ctor.contextType;
|
|
12098
|
+
if (typeof contextType === 'object' && contextType !== null) {
|
|
12099
|
+
instance.context = readContext$1(contextType);
|
|
12100
|
+
} else {
|
|
12101
|
+
var unmaskedContext = getUnmaskedContext(workInProgress, ctor, true);
|
|
12102
|
+
instance.context = getMaskedContext(workInProgress, unmaskedContext);
|
|
12103
|
+
}
|
|
12004
12104
|
|
|
12005
12105
|
{
|
|
12006
12106
|
if (instance.state === newProps) {
|
|
@@ -12059,8 +12159,14 @@ function resumeMountClassInstance(workInProgress, ctor, newProps, renderExpirati
|
|
|
12059
12159
|
instance.props = oldProps;
|
|
12060
12160
|
|
|
12061
12161
|
var oldContext = instance.context;
|
|
12062
|
-
var
|
|
12063
|
-
var
|
|
12162
|
+
var contextType = ctor.contextType;
|
|
12163
|
+
var nextContext = void 0;
|
|
12164
|
+
if (typeof contextType === 'object' && contextType !== null) {
|
|
12165
|
+
nextContext = readContext$1(contextType);
|
|
12166
|
+
} else {
|
|
12167
|
+
var nextLegacyUnmaskedContext = getUnmaskedContext(workInProgress, ctor, true);
|
|
12168
|
+
nextContext = getMaskedContext(workInProgress, nextLegacyUnmaskedContext);
|
|
12169
|
+
}
|
|
12064
12170
|
|
|
12065
12171
|
var getDerivedStateFromProps = ctor.getDerivedStateFromProps;
|
|
12066
12172
|
var hasNewLifecycles = typeof getDerivedStateFromProps === 'function' || typeof instance.getSnapshotBeforeUpdate === 'function';
|
|
@@ -12072,8 +12178,8 @@ function resumeMountClassInstance(workInProgress, ctor, newProps, renderExpirati
|
|
|
12072
12178
|
// In order to support react-lifecycles-compat polyfilled components,
|
|
12073
12179
|
// Unsafe lifecycles should not be invoked for components using the new APIs.
|
|
12074
12180
|
if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillReceiveProps === 'function' || typeof instance.componentWillReceiveProps === 'function')) {
|
|
12075
|
-
if (oldProps !== newProps || oldContext !==
|
|
12076
|
-
callComponentWillReceiveProps(workInProgress, instance, newProps,
|
|
12181
|
+
if (oldProps !== newProps || oldContext !== nextContext) {
|
|
12182
|
+
callComponentWillReceiveProps(workInProgress, instance, newProps, nextContext);
|
|
12077
12183
|
}
|
|
12078
12184
|
}
|
|
12079
12185
|
|
|
@@ -12100,7 +12206,7 @@ function resumeMountClassInstance(workInProgress, ctor, newProps, renderExpirati
|
|
|
12100
12206
|
newState = workInProgress.memoizedState;
|
|
12101
12207
|
}
|
|
12102
12208
|
|
|
12103
|
-
var shouldUpdate = checkHasForceUpdateAfterProcessing() || checkShouldComponentUpdate(workInProgress, ctor, oldProps, newProps, oldState, newState,
|
|
12209
|
+
var shouldUpdate = checkHasForceUpdateAfterProcessing() || checkShouldComponentUpdate(workInProgress, ctor, oldProps, newProps, oldState, newState, nextContext);
|
|
12104
12210
|
|
|
12105
12211
|
if (shouldUpdate) {
|
|
12106
12212
|
// In order to support react-lifecycles-compat polyfilled components,
|
|
@@ -12135,7 +12241,7 @@ function resumeMountClassInstance(workInProgress, ctor, newProps, renderExpirati
|
|
|
12135
12241
|
// if shouldComponentUpdate returns false.
|
|
12136
12242
|
instance.props = newProps;
|
|
12137
12243
|
instance.state = newState;
|
|
12138
|
-
instance.context =
|
|
12244
|
+
instance.context = nextContext;
|
|
12139
12245
|
|
|
12140
12246
|
return shouldUpdate;
|
|
12141
12247
|
}
|
|
@@ -12148,8 +12254,14 @@ function updateClassInstance(current, workInProgress, ctor, newProps, renderExpi
|
|
|
12148
12254
|
instance.props = oldProps;
|
|
12149
12255
|
|
|
12150
12256
|
var oldContext = instance.context;
|
|
12151
|
-
var
|
|
12152
|
-
var
|
|
12257
|
+
var contextType = ctor.contextType;
|
|
12258
|
+
var nextContext = void 0;
|
|
12259
|
+
if (typeof contextType === 'object' && contextType !== null) {
|
|
12260
|
+
nextContext = readContext$1(contextType);
|
|
12261
|
+
} else {
|
|
12262
|
+
var nextUnmaskedContext = getUnmaskedContext(workInProgress, ctor, true);
|
|
12263
|
+
nextContext = getMaskedContext(workInProgress, nextUnmaskedContext);
|
|
12264
|
+
}
|
|
12153
12265
|
|
|
12154
12266
|
var getDerivedStateFromProps = ctor.getDerivedStateFromProps;
|
|
12155
12267
|
var hasNewLifecycles = typeof getDerivedStateFromProps === 'function' || typeof instance.getSnapshotBeforeUpdate === 'function';
|
|
@@ -12161,8 +12273,8 @@ function updateClassInstance(current, workInProgress, ctor, newProps, renderExpi
|
|
|
12161
12273
|
// In order to support react-lifecycles-compat polyfilled components,
|
|
12162
12274
|
// Unsafe lifecycles should not be invoked for components using the new APIs.
|
|
12163
12275
|
if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillReceiveProps === 'function' || typeof instance.componentWillReceiveProps === 'function')) {
|
|
12164
|
-
if (oldProps !== newProps || oldContext !==
|
|
12165
|
-
callComponentWillReceiveProps(workInProgress, instance, newProps,
|
|
12276
|
+
if (oldProps !== newProps || oldContext !== nextContext) {
|
|
12277
|
+
callComponentWillReceiveProps(workInProgress, instance, newProps, nextContext);
|
|
12166
12278
|
}
|
|
12167
12279
|
}
|
|
12168
12280
|
|
|
@@ -12197,7 +12309,7 @@ function updateClassInstance(current, workInProgress, ctor, newProps, renderExpi
|
|
|
12197
12309
|
newState = workInProgress.memoizedState;
|
|
12198
12310
|
}
|
|
12199
12311
|
|
|
12200
|
-
var shouldUpdate = checkHasForceUpdateAfterProcessing() || checkShouldComponentUpdate(workInProgress, ctor, oldProps, newProps, oldState, newState,
|
|
12312
|
+
var shouldUpdate = checkHasForceUpdateAfterProcessing() || checkShouldComponentUpdate(workInProgress, ctor, oldProps, newProps, oldState, newState, nextContext);
|
|
12201
12313
|
|
|
12202
12314
|
if (shouldUpdate) {
|
|
12203
12315
|
// In order to support react-lifecycles-compat polyfilled components,
|
|
@@ -12205,10 +12317,10 @@ function updateClassInstance(current, workInProgress, ctor, newProps, renderExpi
|
|
|
12205
12317
|
if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillUpdate === 'function' || typeof instance.componentWillUpdate === 'function')) {
|
|
12206
12318
|
startPhaseTimer(workInProgress, 'componentWillUpdate');
|
|
12207
12319
|
if (typeof instance.componentWillUpdate === 'function') {
|
|
12208
|
-
instance.componentWillUpdate(newProps, newState,
|
|
12320
|
+
instance.componentWillUpdate(newProps, newState, nextContext);
|
|
12209
12321
|
}
|
|
12210
12322
|
if (typeof instance.UNSAFE_componentWillUpdate === 'function') {
|
|
12211
|
-
instance.UNSAFE_componentWillUpdate(newProps, newState,
|
|
12323
|
+
instance.UNSAFE_componentWillUpdate(newProps, newState, nextContext);
|
|
12212
12324
|
}
|
|
12213
12325
|
stopPhaseTimer();
|
|
12214
12326
|
}
|
|
@@ -12242,7 +12354,7 @@ function updateClassInstance(current, workInProgress, ctor, newProps, renderExpi
|
|
|
12242
12354
|
// if shouldComponentUpdate returns false.
|
|
12243
12355
|
instance.props = newProps;
|
|
12244
12356
|
instance.state = newState;
|
|
12245
|
-
instance.context =
|
|
12357
|
+
instance.context = nextContext;
|
|
12246
12358
|
|
|
12247
12359
|
return shouldUpdate;
|
|
12248
12360
|
}
|
|
@@ -12287,7 +12399,7 @@ var warnForMissingKey = function (child) {};
|
|
|
12287
12399
|
};
|
|
12288
12400
|
}
|
|
12289
12401
|
|
|
12290
|
-
var isArray
|
|
12402
|
+
var isArray = Array.isArray;
|
|
12291
12403
|
|
|
12292
12404
|
function coerceRef(returnFiber, current$$1, element) {
|
|
12293
12405
|
var mixedRef = element.ref;
|
|
@@ -12307,7 +12419,7 @@ function coerceRef(returnFiber, current$$1, element) {
|
|
|
12307
12419
|
var inst = void 0;
|
|
12308
12420
|
if (owner) {
|
|
12309
12421
|
var ownerFiber = owner;
|
|
12310
|
-
!(ownerFiber.tag === ClassComponent
|
|
12422
|
+
!(ownerFiber.tag === ClassComponent) ? invariant(false, 'Function components cannot have refs.') : void 0;
|
|
12311
12423
|
inst = ownerFiber.stateNode;
|
|
12312
12424
|
}
|
|
12313
12425
|
!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;
|
|
@@ -12332,7 +12444,7 @@ function coerceRef(returnFiber, current$$1, element) {
|
|
|
12332
12444
|
return ref;
|
|
12333
12445
|
} else {
|
|
12334
12446
|
!(typeof mixedRef === 'string') ? invariant(false, 'Expected ref to be a function, a string, an object returned by React.createRef(), or null.') : void 0;
|
|
12335
|
-
!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
|
|
12447
|
+
!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;
|
|
12336
12448
|
}
|
|
12337
12449
|
}
|
|
12338
12450
|
return mixedRef;
|
|
@@ -12475,7 +12587,7 @@ function ChildReconciler(shouldTrackSideEffects) {
|
|
|
12475
12587
|
}
|
|
12476
12588
|
|
|
12477
12589
|
function updateElement(returnFiber, current$$1, element, expirationTime) {
|
|
12478
|
-
if (current$$1 !== null && current$$1.
|
|
12590
|
+
if (current$$1 !== null && current$$1.elementType === element.type) {
|
|
12479
12591
|
// Move based on index
|
|
12480
12592
|
var existing = useFiber(current$$1, element.props, expirationTime);
|
|
12481
12593
|
existing.ref = coerceRef(returnFiber, current$$1, element);
|
|
@@ -12549,7 +12661,7 @@ function ChildReconciler(shouldTrackSideEffects) {
|
|
|
12549
12661
|
}
|
|
12550
12662
|
}
|
|
12551
12663
|
|
|
12552
|
-
if (isArray
|
|
12664
|
+
if (isArray(newChild) || getIteratorFn(newChild)) {
|
|
12553
12665
|
var _created3 = createFiberFromFragment(newChild, returnFiber.mode, expirationTime, null);
|
|
12554
12666
|
_created3.return = returnFiber;
|
|
12555
12667
|
return _created3;
|
|
@@ -12605,7 +12717,7 @@ function ChildReconciler(shouldTrackSideEffects) {
|
|
|
12605
12717
|
}
|
|
12606
12718
|
}
|
|
12607
12719
|
|
|
12608
|
-
if (isArray
|
|
12720
|
+
if (isArray(newChild) || getIteratorFn(newChild)) {
|
|
12609
12721
|
if (key !== null) {
|
|
12610
12722
|
return null;
|
|
12611
12723
|
}
|
|
@@ -12650,7 +12762,7 @@ function ChildReconciler(shouldTrackSideEffects) {
|
|
|
12650
12762
|
}
|
|
12651
12763
|
}
|
|
12652
12764
|
|
|
12653
|
-
if (isArray
|
|
12765
|
+
if (isArray(newChild) || getIteratorFn(newChild)) {
|
|
12654
12766
|
var _matchedFiber3 = existingChildren.get(newIdx) || null;
|
|
12655
12767
|
return updateFragment(returnFiber, _matchedFiber3, newChild, expirationTime, null);
|
|
12656
12768
|
}
|
|
@@ -13017,7 +13129,7 @@ function ChildReconciler(shouldTrackSideEffects) {
|
|
|
13017
13129
|
// TODO: If key === null and child.key === null, then this only applies to
|
|
13018
13130
|
// the first item in the list.
|
|
13019
13131
|
if (child.key === key) {
|
|
13020
|
-
if (child.tag === Fragment ? element.type === REACT_FRAGMENT_TYPE : child.
|
|
13132
|
+
if (child.tag === Fragment ? element.type === REACT_FRAGMENT_TYPE : child.elementType === element.type) {
|
|
13021
13133
|
deleteRemainingChildren(returnFiber, child.sibling);
|
|
13022
13134
|
var existing = useFiber(child, element.type === REACT_FRAGMENT_TYPE ? element.props.children : element.props, expirationTime);
|
|
13023
13135
|
existing.ref = coerceRef(returnFiber, child, element);
|
|
@@ -13109,7 +13221,7 @@ function ChildReconciler(shouldTrackSideEffects) {
|
|
|
13109
13221
|
return placeSingleChild(reconcileSingleTextNode(returnFiber, currentFirstChild, '' + newChild, expirationTime));
|
|
13110
13222
|
}
|
|
13111
13223
|
|
|
13112
|
-
if (isArray
|
|
13224
|
+
if (isArray(newChild)) {
|
|
13113
13225
|
return reconcileChildrenArray(returnFiber, currentFirstChild, newChild, expirationTime);
|
|
13114
13226
|
}
|
|
13115
13227
|
|
|
@@ -13132,7 +13244,6 @@ function ChildReconciler(shouldTrackSideEffects) {
|
|
|
13132
13244
|
// we already threw above.
|
|
13133
13245
|
switch (returnFiber.tag) {
|
|
13134
13246
|
case ClassComponent:
|
|
13135
|
-
case ClassComponentLazy:
|
|
13136
13247
|
{
|
|
13137
13248
|
{
|
|
13138
13249
|
var instance = returnFiber.stateNode;
|
|
@@ -13145,7 +13256,7 @@ function ChildReconciler(shouldTrackSideEffects) {
|
|
|
13145
13256
|
// Intentionally fall through to the next case, which handles both
|
|
13146
13257
|
// functions and classes
|
|
13147
13258
|
// eslint-disable-next-lined no-fallthrough
|
|
13148
|
-
case
|
|
13259
|
+
case FunctionComponent:
|
|
13149
13260
|
{
|
|
13150
13261
|
var Component = returnFiber.type;
|
|
13151
13262
|
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');
|
|
@@ -13447,40 +13558,49 @@ function resetHydrationState() {
|
|
|
13447
13558
|
isHydrating = false;
|
|
13448
13559
|
}
|
|
13449
13560
|
|
|
13450
|
-
function readLazyComponentType(
|
|
13451
|
-
var status =
|
|
13561
|
+
function readLazyComponentType(lazyComponent) {
|
|
13562
|
+
var status = lazyComponent._status;
|
|
13563
|
+
var result = lazyComponent._result;
|
|
13452
13564
|
switch (status) {
|
|
13453
13565
|
case Resolved:
|
|
13454
|
-
|
|
13455
|
-
|
|
13566
|
+
{
|
|
13567
|
+
var Component = result;
|
|
13568
|
+
return Component;
|
|
13569
|
+
}
|
|
13456
13570
|
case Rejected:
|
|
13457
|
-
|
|
13571
|
+
{
|
|
13572
|
+
var error = result;
|
|
13573
|
+
throw error;
|
|
13574
|
+
}
|
|
13458
13575
|
case Pending:
|
|
13459
|
-
|
|
13576
|
+
{
|
|
13577
|
+
var thenable = result;
|
|
13578
|
+
throw thenable;
|
|
13579
|
+
}
|
|
13460
13580
|
default:
|
|
13461
13581
|
{
|
|
13462
|
-
|
|
13463
|
-
|
|
13464
|
-
|
|
13465
|
-
|
|
13466
|
-
|
|
13467
|
-
|
|
13468
|
-
|
|
13469
|
-
|
|
13470
|
-
|
|
13471
|
-
|
|
13472
|
-
} else {
|
|
13473
|
-
resolvedValue = resolvedValue;
|
|
13582
|
+
lazyComponent._status = Pending;
|
|
13583
|
+
var ctor = lazyComponent._ctor;
|
|
13584
|
+
var _thenable = ctor();
|
|
13585
|
+
_thenable.then(function (moduleObject) {
|
|
13586
|
+
if (lazyComponent._status === Pending) {
|
|
13587
|
+
var defaultExport = moduleObject.default;
|
|
13588
|
+
{
|
|
13589
|
+
if (defaultExport === undefined) {
|
|
13590
|
+
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);
|
|
13591
|
+
}
|
|
13474
13592
|
}
|
|
13475
|
-
|
|
13593
|
+
lazyComponent._status = Resolved;
|
|
13594
|
+
lazyComponent._result = defaultExport;
|
|
13476
13595
|
}
|
|
13477
13596
|
}, function (error) {
|
|
13478
|
-
if (
|
|
13479
|
-
|
|
13480
|
-
|
|
13597
|
+
if (lazyComponent._status === Pending) {
|
|
13598
|
+
lazyComponent._status = Rejected;
|
|
13599
|
+
lazyComponent._result = error;
|
|
13481
13600
|
}
|
|
13482
13601
|
});
|
|
13483
|
-
|
|
13602
|
+
lazyComponent._result = _thenable;
|
|
13603
|
+
throw _thenable;
|
|
13484
13604
|
}
|
|
13485
13605
|
}
|
|
13486
13606
|
}
|
|
@@ -13488,13 +13608,15 @@ function readLazyComponentType(thenable) {
|
|
|
13488
13608
|
var ReactCurrentOwner$3 = ReactSharedInternals.ReactCurrentOwner;
|
|
13489
13609
|
|
|
13490
13610
|
var didWarnAboutBadClass = void 0;
|
|
13491
|
-
var
|
|
13492
|
-
var
|
|
13611
|
+
var didWarnAboutContextTypeOnFunctionComponent = void 0;
|
|
13612
|
+
var didWarnAboutGetDerivedStateOnFunctionComponent = void 0;
|
|
13613
|
+
var didWarnAboutFunctionRefs = void 0;
|
|
13493
13614
|
|
|
13494
13615
|
{
|
|
13495
13616
|
didWarnAboutBadClass = {};
|
|
13496
|
-
|
|
13497
|
-
|
|
13617
|
+
didWarnAboutContextTypeOnFunctionComponent = {};
|
|
13618
|
+
didWarnAboutGetDerivedStateOnFunctionComponent = {};
|
|
13619
|
+
didWarnAboutFunctionRefs = {};
|
|
13498
13620
|
}
|
|
13499
13621
|
|
|
13500
13622
|
function reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime) {
|
|
@@ -13515,6 +13637,23 @@ function reconcileChildren(current$$1, workInProgress, nextChildren, renderExpir
|
|
|
13515
13637
|
}
|
|
13516
13638
|
}
|
|
13517
13639
|
|
|
13640
|
+
function forceUnmountCurrentAndReconcile(current$$1, workInProgress, nextChildren, renderExpirationTime) {
|
|
13641
|
+
// This function is fork of reconcileChildren. It's used in cases where we
|
|
13642
|
+
// want to reconcile without matching against the existing set. This has the
|
|
13643
|
+
// effect of all current children being unmounted; even if the type and key
|
|
13644
|
+
// are the same, the old child is unmounted and a new child is created.
|
|
13645
|
+
//
|
|
13646
|
+
// To do this, we're going to go through the reconcile algorithm twice. In
|
|
13647
|
+
// the first pass, we schedule a deletion for all the current children by
|
|
13648
|
+
// passing null.
|
|
13649
|
+
workInProgress.child = reconcileChildFibers(workInProgress, current$$1.child, null, renderExpirationTime);
|
|
13650
|
+
// In the second pass, we mount the new children. The trick here is that we
|
|
13651
|
+
// pass null in place of where we usually pass the current child set. This has
|
|
13652
|
+
// the effect of remounting all children regardless of whether their their
|
|
13653
|
+
// identity matches.
|
|
13654
|
+
workInProgress.child = reconcileChildFibers(workInProgress, null, nextChildren, renderExpirationTime);
|
|
13655
|
+
}
|
|
13656
|
+
|
|
13518
13657
|
function updateForwardRef(current$$1, workInProgress, type, nextProps, renderExpirationTime) {
|
|
13519
13658
|
var render = type.render;
|
|
13520
13659
|
var ref = workInProgress.ref;
|
|
@@ -13537,21 +13676,64 @@ function updateForwardRef(current$$1, workInProgress, type, nextProps, renderExp
|
|
|
13537
13676
|
}
|
|
13538
13677
|
|
|
13539
13678
|
reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
|
|
13540
|
-
memoizeProps(workInProgress, nextProps);
|
|
13541
13679
|
return workInProgress.child;
|
|
13542
13680
|
}
|
|
13543
13681
|
|
|
13682
|
+
function updateMemoComponent(current$$1, workInProgress, Component, nextProps, updateExpirationTime, renderExpirationTime) {
|
|
13683
|
+
if (current$$1 === null) {
|
|
13684
|
+
var type = Component.type;
|
|
13685
|
+
if (isSimpleFunctionComponent(type) && Component.compare === null) {
|
|
13686
|
+
// If this is a plain function component without default props,
|
|
13687
|
+
// and with only the default shallow comparison, we upgrade it
|
|
13688
|
+
// to a SimpleMemoComponent to allow fast path updates.
|
|
13689
|
+
workInProgress.tag = SimpleMemoComponent;
|
|
13690
|
+
workInProgress.type = type;
|
|
13691
|
+
return updateSimpleMemoComponent(current$$1, workInProgress, type, nextProps, updateExpirationTime, renderExpirationTime);
|
|
13692
|
+
}
|
|
13693
|
+
var child = createFiberFromTypeAndProps(Component.type, null, nextProps, null, workInProgress.mode, renderExpirationTime);
|
|
13694
|
+
child.ref = workInProgress.ref;
|
|
13695
|
+
child.return = workInProgress;
|
|
13696
|
+
workInProgress.child = child;
|
|
13697
|
+
return child;
|
|
13698
|
+
}
|
|
13699
|
+
var currentChild = current$$1.child; // This is always exactly one child
|
|
13700
|
+
if (updateExpirationTime === NoWork || updateExpirationTime > renderExpirationTime) {
|
|
13701
|
+
// This will be the props with resolved defaultProps,
|
|
13702
|
+
// unlike current.memoizedProps which will be the unresolved ones.
|
|
13703
|
+
var prevProps = currentChild.memoizedProps;
|
|
13704
|
+
// Default to shallow comparison
|
|
13705
|
+
var compare = Component.compare;
|
|
13706
|
+
compare = compare !== null ? compare : shallowEqual;
|
|
13707
|
+
if (compare(prevProps, nextProps) && current$$1.ref === workInProgress.ref) {
|
|
13708
|
+
return bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
|
|
13709
|
+
}
|
|
13710
|
+
}
|
|
13711
|
+
var newChild = createWorkInProgress(currentChild, nextProps, renderExpirationTime);
|
|
13712
|
+
newChild.ref = workInProgress.ref;
|
|
13713
|
+
newChild.return = workInProgress;
|
|
13714
|
+
workInProgress.child = newChild;
|
|
13715
|
+
return newChild;
|
|
13716
|
+
}
|
|
13717
|
+
|
|
13718
|
+
function updateSimpleMemoComponent(current$$1, workInProgress, Component, nextProps, updateExpirationTime, renderExpirationTime) {
|
|
13719
|
+
if (current$$1 !== null && (updateExpirationTime === NoWork || updateExpirationTime > renderExpirationTime)) {
|
|
13720
|
+
var prevProps = current$$1.memoizedProps;
|
|
13721
|
+
if (shallowEqual(prevProps, nextProps) && current$$1.ref === workInProgress.ref) {
|
|
13722
|
+
return bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
|
|
13723
|
+
}
|
|
13724
|
+
}
|
|
13725
|
+
return updateFunctionComponent(current$$1, workInProgress, Component, nextProps, renderExpirationTime);
|
|
13726
|
+
}
|
|
13727
|
+
|
|
13544
13728
|
function updateFragment(current$$1, workInProgress, renderExpirationTime) {
|
|
13545
13729
|
var nextChildren = workInProgress.pendingProps;
|
|
13546
13730
|
reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
|
|
13547
|
-
memoizeProps(workInProgress, nextChildren);
|
|
13548
13731
|
return workInProgress.child;
|
|
13549
13732
|
}
|
|
13550
13733
|
|
|
13551
13734
|
function updateMode(current$$1, workInProgress, renderExpirationTime) {
|
|
13552
13735
|
var nextChildren = workInProgress.pendingProps.children;
|
|
13553
13736
|
reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
|
|
13554
|
-
memoizeProps(workInProgress, nextChildren);
|
|
13555
13737
|
return workInProgress.child;
|
|
13556
13738
|
}
|
|
13557
13739
|
|
|
@@ -13562,7 +13744,6 @@ function updateProfiler(current$$1, workInProgress, renderExpirationTime) {
|
|
|
13562
13744
|
var nextProps = workInProgress.pendingProps;
|
|
13563
13745
|
var nextChildren = nextProps.children;
|
|
13564
13746
|
reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
|
|
13565
|
-
memoizeProps(workInProgress, nextProps);
|
|
13566
13747
|
return workInProgress.child;
|
|
13567
13748
|
}
|
|
13568
13749
|
|
|
@@ -13574,7 +13755,7 @@ function markRef(current$$1, workInProgress) {
|
|
|
13574
13755
|
}
|
|
13575
13756
|
}
|
|
13576
13757
|
|
|
13577
|
-
function
|
|
13758
|
+
function updateFunctionComponent(current$$1, workInProgress, Component, nextProps, renderExpirationTime) {
|
|
13578
13759
|
var unmaskedContext = getUnmaskedContext(workInProgress, Component, true);
|
|
13579
13760
|
var context = getMaskedContext(workInProgress, unmaskedContext);
|
|
13580
13761
|
|
|
@@ -13590,7 +13771,6 @@ function updateFunctionalComponent(current$$1, workInProgress, Component, nextPr
|
|
|
13590
13771
|
// React DevTools reads this flag.
|
|
13591
13772
|
workInProgress.effectTag |= PerformedWork;
|
|
13592
13773
|
reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
|
|
13593
|
-
memoizeProps(workInProgress, nextProps);
|
|
13594
13774
|
return workInProgress.child;
|
|
13595
13775
|
}
|
|
13596
13776
|
|
|
@@ -13607,17 +13787,26 @@ function updateClassComponent(current$$1, workInProgress, Component, nextProps,
|
|
|
13607
13787
|
}
|
|
13608
13788
|
prepareToReadContext(workInProgress, renderExpirationTime);
|
|
13609
13789
|
|
|
13790
|
+
var instance = workInProgress.stateNode;
|
|
13610
13791
|
var shouldUpdate = void 0;
|
|
13611
|
-
if (
|
|
13612
|
-
if (
|
|
13613
|
-
//
|
|
13614
|
-
|
|
13615
|
-
|
|
13616
|
-
|
|
13617
|
-
|
|
13618
|
-
|
|
13619
|
-
|
|
13620
|
-
|
|
13792
|
+
if (instance === null) {
|
|
13793
|
+
if (current$$1 !== null) {
|
|
13794
|
+
// An class component without an instance only mounts if it suspended
|
|
13795
|
+
// inside a non- concurrent tree, in an inconsistent state. We want to
|
|
13796
|
+
// tree it like a new mount, even though an empty version of it already
|
|
13797
|
+
// committed. Disconnect the alternate pointers.
|
|
13798
|
+
current$$1.alternate = null;
|
|
13799
|
+
workInProgress.alternate = null;
|
|
13800
|
+
// Since this is conceptually a new fiber, schedule a Placement effect
|
|
13801
|
+
workInProgress.effectTag |= Placement;
|
|
13802
|
+
}
|
|
13803
|
+
// In the initial pass we might need to construct the instance.
|
|
13804
|
+
constructClassInstance(workInProgress, Component, nextProps, renderExpirationTime);
|
|
13805
|
+
mountClassInstance(workInProgress, Component, nextProps, renderExpirationTime);
|
|
13806
|
+
shouldUpdate = true;
|
|
13807
|
+
} else if (current$$1 === null) {
|
|
13808
|
+
// In a resume, we'll already have an instance we can reuse.
|
|
13809
|
+
shouldUpdate = resumeMountClassInstance(workInProgress, Component, nextProps, renderExpirationTime);
|
|
13621
13810
|
} else {
|
|
13622
13811
|
shouldUpdate = updateClassInstance(current$$1, workInProgress, Component, nextProps, renderExpirationTime);
|
|
13623
13812
|
}
|
|
@@ -13644,7 +13833,7 @@ function finishClassComponent(current$$1, workInProgress, Component, shouldUpdat
|
|
|
13644
13833
|
// Rerender
|
|
13645
13834
|
ReactCurrentOwner$3.current = workInProgress;
|
|
13646
13835
|
var nextChildren = void 0;
|
|
13647
|
-
if (didCaptureError &&
|
|
13836
|
+
if (didCaptureError && typeof Component.getDerivedStateFromError !== 'function') {
|
|
13648
13837
|
// If we captured an error, but getDerivedStateFrom catch is not defined,
|
|
13649
13838
|
// unmount all the children. componentDidCatch will schedule an update to
|
|
13650
13839
|
// re-render a fallback. This is temporary until we migrate everyone to
|
|
@@ -13669,19 +13858,18 @@ function finishClassComponent(current$$1, workInProgress, Component, shouldUpdat
|
|
|
13669
13858
|
// React DevTools reads this flag.
|
|
13670
13859
|
workInProgress.effectTag |= PerformedWork;
|
|
13671
13860
|
if (current$$1 !== null && didCaptureError) {
|
|
13672
|
-
// If we're recovering from an error, reconcile
|
|
13673
|
-
//
|
|
13674
|
-
|
|
13675
|
-
|
|
13676
|
-
|
|
13677
|
-
|
|
13678
|
-
|
|
13861
|
+
// If we're recovering from an error, reconcile without reusing any of
|
|
13862
|
+
// the existing children. Conceptually, the normal children and the children
|
|
13863
|
+
// that are shown on error are two different sets, so we shouldn't reuse
|
|
13864
|
+
// normal children even if their identities match.
|
|
13865
|
+
forceUnmountCurrentAndReconcile(current$$1, workInProgress, nextChildren, renderExpirationTime);
|
|
13866
|
+
} else {
|
|
13867
|
+
reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
|
|
13679
13868
|
}
|
|
13680
|
-
|
|
13681
|
-
// Memoize
|
|
13869
|
+
|
|
13870
|
+
// Memoize state using the values we just used to render.
|
|
13682
13871
|
// TODO: Restructure so we never read values from the instance.
|
|
13683
|
-
|
|
13684
|
-
memoizeProps(workInProgress, instance.props);
|
|
13872
|
+
workInProgress.memoizedState = instance.state;
|
|
13685
13873
|
|
|
13686
13874
|
// The context might have changed so we need to recalculate it.
|
|
13687
13875
|
if (hasContext) {
|
|
@@ -13775,15 +13963,13 @@ function updateHostComponent(current$$1, workInProgress, renderExpirationTime) {
|
|
|
13775
13963
|
markRef(current$$1, workInProgress);
|
|
13776
13964
|
|
|
13777
13965
|
// Check the host config to see if the children are offscreen/hidden.
|
|
13778
|
-
if (renderExpirationTime !== Never && workInProgress.mode &
|
|
13966
|
+
if (renderExpirationTime !== Never && workInProgress.mode & ConcurrentMode && shouldDeprioritizeSubtree(type, nextProps)) {
|
|
13779
13967
|
// Schedule this fiber to re-render at offscreen priority. Then bailout.
|
|
13780
13968
|
workInProgress.expirationTime = Never;
|
|
13781
|
-
workInProgress.memoizedProps = nextProps;
|
|
13782
13969
|
return null;
|
|
13783
13970
|
}
|
|
13784
13971
|
|
|
13785
13972
|
reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
|
|
13786
|
-
memoizeProps(workInProgress, nextProps);
|
|
13787
13973
|
return workInProgress.child;
|
|
13788
13974
|
}
|
|
13789
13975
|
|
|
@@ -13791,8 +13977,6 @@ function updateHostText(current$$1, workInProgress) {
|
|
|
13791
13977
|
if (current$$1 === null) {
|
|
13792
13978
|
tryToClaimNextHydratableInstance(workInProgress);
|
|
13793
13979
|
}
|
|
13794
|
-
var nextProps = workInProgress.pendingProps;
|
|
13795
|
-
memoizeProps(workInProgress, nextProps);
|
|
13796
13980
|
// Nothing to do here. This is terminal. We'll do the completion step
|
|
13797
13981
|
// immediately after.
|
|
13798
13982
|
return null;
|
|
@@ -13813,36 +13997,110 @@ function resolveDefaultProps(Component, baseProps) {
|
|
|
13813
13997
|
return baseProps;
|
|
13814
13998
|
}
|
|
13815
13999
|
|
|
13816
|
-
function
|
|
13817
|
-
|
|
14000
|
+
function mountLazyComponent(_current, workInProgress, elementType, updateExpirationTime, renderExpirationTime) {
|
|
14001
|
+
if (_current !== null) {
|
|
14002
|
+
// An lazy component only mounts if it suspended inside a non-
|
|
14003
|
+
// concurrent tree, in an inconsistent state. We want to tree it like
|
|
14004
|
+
// a new mount, even though an empty version of it already committed.
|
|
14005
|
+
// Disconnect the alternate pointers.
|
|
14006
|
+
_current.alternate = null;
|
|
14007
|
+
workInProgress.alternate = null;
|
|
14008
|
+
// Since this is conceptually a new fiber, schedule a Placement effect
|
|
14009
|
+
workInProgress.effectTag |= Placement;
|
|
14010
|
+
}
|
|
13818
14011
|
|
|
13819
14012
|
var props = workInProgress.pendingProps;
|
|
13820
|
-
|
|
13821
|
-
|
|
13822
|
-
|
|
13823
|
-
|
|
13824
|
-
|
|
13825
|
-
|
|
13826
|
-
|
|
13827
|
-
|
|
13828
|
-
|
|
13829
|
-
|
|
13830
|
-
|
|
13831
|
-
|
|
13832
|
-
|
|
13833
|
-
|
|
13834
|
-
|
|
13835
|
-
|
|
13836
|
-
|
|
13837
|
-
|
|
13838
|
-
|
|
13839
|
-
|
|
13840
|
-
|
|
13841
|
-
|
|
13842
|
-
|
|
13843
|
-
|
|
14013
|
+
// We can't start a User Timing measurement with correct label yet.
|
|
14014
|
+
// Cancel and resume right after we know the tag.
|
|
14015
|
+
cancelWorkTimer(workInProgress);
|
|
14016
|
+
var Component = readLazyComponentType(elementType);
|
|
14017
|
+
// Store the unwrapped component in the type.
|
|
14018
|
+
workInProgress.type = Component;
|
|
14019
|
+
var resolvedTag = workInProgress.tag = resolveLazyComponentTag(Component);
|
|
14020
|
+
startWorkTimer(workInProgress);
|
|
14021
|
+
var resolvedProps = resolveDefaultProps(Component, props);
|
|
14022
|
+
var child = void 0;
|
|
14023
|
+
switch (resolvedTag) {
|
|
14024
|
+
case FunctionComponent:
|
|
14025
|
+
{
|
|
14026
|
+
child = updateFunctionComponent(null, workInProgress, Component, resolvedProps, renderExpirationTime);
|
|
14027
|
+
break;
|
|
14028
|
+
}
|
|
14029
|
+
case ClassComponent:
|
|
14030
|
+
{
|
|
14031
|
+
child = updateClassComponent(null, workInProgress, Component, resolvedProps, renderExpirationTime);
|
|
14032
|
+
break;
|
|
14033
|
+
}
|
|
14034
|
+
case ForwardRef:
|
|
14035
|
+
{
|
|
14036
|
+
child = updateForwardRef(null, workInProgress, Component, resolvedProps, renderExpirationTime);
|
|
14037
|
+
break;
|
|
14038
|
+
}
|
|
14039
|
+
case MemoComponent:
|
|
14040
|
+
{
|
|
14041
|
+
child = updateMemoComponent(null, workInProgress, Component, resolveDefaultProps(Component.type, resolvedProps), // The inner type can have defaults too
|
|
14042
|
+
updateExpirationTime, renderExpirationTime);
|
|
14043
|
+
break;
|
|
14044
|
+
}
|
|
14045
|
+
default:
|
|
14046
|
+
{
|
|
14047
|
+
// This message intentionally doesn't metion ForwardRef or MemoComponent
|
|
14048
|
+
// because the fact that it's a separate type of work is an
|
|
14049
|
+
// implementation detail.
|
|
14050
|
+
invariant(false, 'Element type is invalid. Received a promise that resolves to: %s. Promise elements must resolve to a class or function.', Component);
|
|
14051
|
+
}
|
|
14052
|
+
}
|
|
14053
|
+
return child;
|
|
14054
|
+
}
|
|
14055
|
+
|
|
14056
|
+
function mountIncompleteClassComponent(_current, workInProgress, Component, nextProps, renderExpirationTime) {
|
|
14057
|
+
if (_current !== null) {
|
|
14058
|
+
// An incomplete component only mounts if it suspended inside a non-
|
|
14059
|
+
// concurrent tree, in an inconsistent state. We want to tree it like
|
|
14060
|
+
// a new mount, even though an empty version of it already committed.
|
|
14061
|
+
// Disconnect the alternate pointers.
|
|
14062
|
+
_current.alternate = null;
|
|
14063
|
+
workInProgress.alternate = null;
|
|
14064
|
+
// Since this is conceptually a new fiber, schedule a Placement effect
|
|
14065
|
+
workInProgress.effectTag |= Placement;
|
|
14066
|
+
}
|
|
14067
|
+
|
|
14068
|
+
// Promote the fiber to a class and try rendering again.
|
|
14069
|
+
workInProgress.tag = ClassComponent;
|
|
14070
|
+
|
|
14071
|
+
// The rest of this function is a fork of `updateClassComponent`
|
|
14072
|
+
|
|
14073
|
+
// Push context providers early to prevent context stack mismatches.
|
|
14074
|
+
// During mounting we don't know the child context yet as the instance doesn't exist.
|
|
14075
|
+
// We will invalidate the child context in finishClassComponent() right after rendering.
|
|
14076
|
+
var hasContext = void 0;
|
|
14077
|
+
if (isContextProvider(Component)) {
|
|
14078
|
+
hasContext = true;
|
|
14079
|
+
pushContextProvider(workInProgress);
|
|
14080
|
+
} else {
|
|
14081
|
+
hasContext = false;
|
|
14082
|
+
}
|
|
14083
|
+
prepareToReadContext(workInProgress, renderExpirationTime);
|
|
14084
|
+
|
|
14085
|
+
constructClassInstance(workInProgress, Component, nextProps, renderExpirationTime);
|
|
14086
|
+
mountClassInstance(workInProgress, Component, nextProps, renderExpirationTime);
|
|
14087
|
+
|
|
14088
|
+
return finishClassComponent(null, workInProgress, Component, true, hasContext, renderExpirationTime);
|
|
14089
|
+
}
|
|
14090
|
+
|
|
14091
|
+
function mountIndeterminateComponent(_current, workInProgress, Component, renderExpirationTime) {
|
|
14092
|
+
if (_current !== null) {
|
|
14093
|
+
// An indeterminate component only mounts if it suspended inside a non-
|
|
14094
|
+
// concurrent tree, in an inconsistent state. We want to tree it like
|
|
14095
|
+
// a new mount, even though an empty version of it already committed.
|
|
14096
|
+
// Disconnect the alternate pointers.
|
|
14097
|
+
_current.alternate = null;
|
|
14098
|
+
workInProgress.alternate = null;
|
|
14099
|
+
// Since this is conceptually a new fiber, schedule a Placement effect
|
|
14100
|
+
workInProgress.effectTag |= Placement;
|
|
13844
14101
|
}
|
|
13845
14102
|
|
|
14103
|
+
var props = workInProgress.pendingProps;
|
|
13846
14104
|
var unmaskedContext = getUnmaskedContext(workInProgress, Component, false);
|
|
13847
14105
|
var context = getMaskedContext(workInProgress, unmaskedContext);
|
|
13848
14106
|
|
|
@@ -13894,13 +14152,13 @@ function mountIndeterminateComponent(current$$1, workInProgress, Component, rend
|
|
|
13894
14152
|
|
|
13895
14153
|
adoptClassInstance(workInProgress, value);
|
|
13896
14154
|
mountClassInstance(workInProgress, Component, props, renderExpirationTime);
|
|
13897
|
-
return finishClassComponent(
|
|
14155
|
+
return finishClassComponent(null, workInProgress, Component, true, hasContext, renderExpirationTime);
|
|
13898
14156
|
} else {
|
|
13899
|
-
// Proceed under the assumption that this is a
|
|
13900
|
-
workInProgress.tag =
|
|
14157
|
+
// Proceed under the assumption that this is a function component
|
|
14158
|
+
workInProgress.tag = FunctionComponent;
|
|
13901
14159
|
{
|
|
13902
14160
|
if (Component) {
|
|
13903
|
-
!!Component.childContextTypes ? warningWithoutStack$1(false, '%s(...): childContextTypes cannot be defined on a
|
|
14161
|
+
!!Component.childContextTypes ? warningWithoutStack$1(false, '%s(...): childContextTypes cannot be defined on a function component.', Component.displayName || Component.name || 'Component') : void 0;
|
|
13904
14162
|
}
|
|
13905
14163
|
if (workInProgress.ref !== null) {
|
|
13906
14164
|
var info = '';
|
|
@@ -13914,81 +14172,190 @@ function mountIndeterminateComponent(current$$1, workInProgress, Component, rend
|
|
|
13914
14172
|
if (debugSource) {
|
|
13915
14173
|
warningKey = debugSource.fileName + ':' + debugSource.lineNumber;
|
|
13916
14174
|
}
|
|
13917
|
-
if (!
|
|
13918
|
-
|
|
13919
|
-
warning$1(false, '
|
|
14175
|
+
if (!didWarnAboutFunctionRefs[warningKey]) {
|
|
14176
|
+
didWarnAboutFunctionRefs[warningKey] = true;
|
|
14177
|
+
warning$1(false, 'Function components cannot be given refs. ' + 'Attempts to access this ref will fail.%s', info);
|
|
13920
14178
|
}
|
|
13921
14179
|
}
|
|
13922
14180
|
|
|
13923
14181
|
if (typeof Component.getDerivedStateFromProps === 'function') {
|
|
13924
14182
|
var _componentName = getComponentName(Component) || 'Unknown';
|
|
13925
14183
|
|
|
13926
|
-
if (!
|
|
13927
|
-
warningWithoutStack$1(false, '%s:
|
|
13928
|
-
|
|
14184
|
+
if (!didWarnAboutGetDerivedStateOnFunctionComponent[_componentName]) {
|
|
14185
|
+
warningWithoutStack$1(false, '%s: Function components do not support getDerivedStateFromProps.', _componentName);
|
|
14186
|
+
didWarnAboutGetDerivedStateOnFunctionComponent[_componentName] = true;
|
|
14187
|
+
}
|
|
14188
|
+
}
|
|
14189
|
+
|
|
14190
|
+
if (typeof Component.contextType === 'object' && Component.contextType !== null) {
|
|
14191
|
+
var _componentName2 = getComponentName(Component) || 'Unknown';
|
|
14192
|
+
|
|
14193
|
+
if (!didWarnAboutContextTypeOnFunctionComponent[_componentName2]) {
|
|
14194
|
+
warningWithoutStack$1(false, '%s: Function components do not support contextType.', _componentName2);
|
|
14195
|
+
didWarnAboutContextTypeOnFunctionComponent[_componentName2] = true;
|
|
13929
14196
|
}
|
|
13930
14197
|
}
|
|
13931
14198
|
}
|
|
13932
|
-
reconcileChildren(
|
|
13933
|
-
memoizeProps(workInProgress, props);
|
|
14199
|
+
reconcileChildren(null, workInProgress, value, renderExpirationTime);
|
|
13934
14200
|
return workInProgress.child;
|
|
13935
14201
|
}
|
|
13936
14202
|
}
|
|
13937
14203
|
|
|
13938
|
-
function
|
|
13939
|
-
|
|
13940
|
-
|
|
13941
|
-
|
|
13942
|
-
// Check if we already attempted to render the normal state. If we did,
|
|
13943
|
-
// and we timed out, render the placeholder state.
|
|
13944
|
-
var alreadyCaptured = (workInProgress.effectTag & DidCapture) === NoEffect;
|
|
13945
|
-
|
|
13946
|
-
var nextDidTimeout = void 0;
|
|
13947
|
-
if (current$$1 !== null && workInProgress.updateQueue !== null) {
|
|
13948
|
-
// We're outside strict mode. Something inside this Placeholder boundary
|
|
13949
|
-
// suspended during the last commit. Switch to the placholder.
|
|
13950
|
-
workInProgress.updateQueue = null;
|
|
13951
|
-
nextDidTimeout = true;
|
|
13952
|
-
// If we're recovering from an error, reconcile twice: first to delete
|
|
13953
|
-
// all the existing children.
|
|
13954
|
-
reconcileChildren(current$$1, workInProgress, null, renderExpirationTime);
|
|
13955
|
-
current$$1.child = null;
|
|
13956
|
-
// Now we can continue reconciling like normal. This has the effect of
|
|
13957
|
-
// remounting all children regardless of whether their their
|
|
13958
|
-
// identity matches.
|
|
13959
|
-
} else {
|
|
13960
|
-
nextDidTimeout = !alreadyCaptured;
|
|
13961
|
-
}
|
|
14204
|
+
function updateSuspenseComponent(current$$1, workInProgress, renderExpirationTime) {
|
|
14205
|
+
var mode = workInProgress.mode;
|
|
14206
|
+
var nextProps = workInProgress.pendingProps;
|
|
13962
14207
|
|
|
13963
|
-
|
|
13964
|
-
|
|
13965
|
-
|
|
13966
|
-
|
|
13967
|
-
|
|
14208
|
+
// We should attempt to render the primary children unless this boundary
|
|
14209
|
+
// already suspended during this render (`alreadyCaptured` is true).
|
|
14210
|
+
var nextState = workInProgress.memoizedState;
|
|
14211
|
+
if (nextState === null) {
|
|
14212
|
+
// An empty suspense state means this boundary has not yet timed out.
|
|
14213
|
+
} else {
|
|
14214
|
+
if (!nextState.alreadyCaptured) {
|
|
14215
|
+
// Since we haven't already suspended during this commit, clear the
|
|
14216
|
+
// existing suspense state. We'll try rendering again.
|
|
14217
|
+
nextState = null;
|
|
14218
|
+
} else {
|
|
14219
|
+
// Something in this boundary's subtree already suspended. Switch to
|
|
14220
|
+
// rendering the fallback children. Set `alreadyCaptured` to true.
|
|
14221
|
+
if (current$$1 !== null && nextState === current$$1.memoizedState) {
|
|
14222
|
+
// Create a new suspense state to avoid mutating the current tree's.
|
|
14223
|
+
nextState = {
|
|
14224
|
+
alreadyCaptured: true,
|
|
14225
|
+
didTimeout: true,
|
|
14226
|
+
timedOutAt: nextState.timedOutAt
|
|
14227
|
+
};
|
|
13968
14228
|
} else {
|
|
13969
|
-
//
|
|
13970
|
-
|
|
13971
|
-
|
|
14229
|
+
// Already have a clone, so it's safe to mutate.
|
|
14230
|
+
nextState.alreadyCaptured = true;
|
|
14231
|
+
nextState.didTimeout = true;
|
|
13972
14232
|
}
|
|
13973
14233
|
}
|
|
14234
|
+
}
|
|
14235
|
+
var nextDidTimeout = nextState !== null && nextState.didTimeout;
|
|
13974
14236
|
|
|
13975
|
-
|
|
13976
|
-
|
|
13977
|
-
|
|
13978
|
-
|
|
13979
|
-
|
|
13980
|
-
|
|
14237
|
+
// This next part is a bit confusing. If the children timeout, we switch to
|
|
14238
|
+
// showing the fallback children in place of the "primary" children.
|
|
14239
|
+
// However, we don't want to delete the primary children because then their
|
|
14240
|
+
// state will be lost (both the React state and the host state, e.g.
|
|
14241
|
+
// uncontrolled form inputs). Instead we keep them mounted and hide them.
|
|
14242
|
+
// Both the fallback children AND the primary children are rendered at the
|
|
14243
|
+
// same time. Once the primary children are un-suspended, we can delete
|
|
14244
|
+
// the fallback children — don't need to preserve their state.
|
|
14245
|
+
//
|
|
14246
|
+
// The two sets of children are siblings in the host environment, but
|
|
14247
|
+
// semantically, for purposes of reconciliation, they are two separate sets.
|
|
14248
|
+
// So we store them using two fragment fibers.
|
|
14249
|
+
//
|
|
14250
|
+
// However, we want to avoid allocating extra fibers for every placeholder.
|
|
14251
|
+
// They're only necessary when the children time out, because that's the
|
|
14252
|
+
// only time when both sets are mounted.
|
|
14253
|
+
//
|
|
14254
|
+
// So, the extra fragment fibers are only used if the children time out.
|
|
14255
|
+
// Otherwise, we render the primary children directly. This requires some
|
|
14256
|
+
// custom reconciliation logic to preserve the state of the primary
|
|
14257
|
+
// children. It's essentially a very basic form of re-parenting.
|
|
14258
|
+
|
|
14259
|
+
// `child` points to the child fiber. In the normal case, this is the first
|
|
14260
|
+
// fiber of the primary children set. In the timed-out case, it's a
|
|
14261
|
+
// a fragment fiber containing the primary children.
|
|
14262
|
+
var child = void 0;
|
|
14263
|
+
// `next` points to the next fiber React should render. In the normal case,
|
|
14264
|
+
// it's the same as `child`: the first fiber of the primary children set.
|
|
14265
|
+
// In the timed-out case, it's a fragment fiber containing the *fallback*
|
|
14266
|
+
// children -- we skip over the primary children entirely.
|
|
14267
|
+
var next = void 0;
|
|
14268
|
+
if (current$$1 === null) {
|
|
14269
|
+
// This is the initial mount. This branch is pretty simple because there's
|
|
14270
|
+
// no previous state that needs to be preserved.
|
|
14271
|
+
if (nextDidTimeout) {
|
|
14272
|
+
// Mount separate fragments for primary and fallback children.
|
|
14273
|
+
var nextFallbackChildren = nextProps.fallback;
|
|
14274
|
+
var primaryChildFragment = createFiberFromFragment(null, mode, NoWork, null);
|
|
14275
|
+
var fallbackChildFragment = createFiberFromFragment(nextFallbackChildren, mode, renderExpirationTime, null);
|
|
14276
|
+
primaryChildFragment.sibling = fallbackChildFragment;
|
|
14277
|
+
child = primaryChildFragment;
|
|
14278
|
+
// Skip the primary children, and continue working on the
|
|
14279
|
+
// fallback children.
|
|
14280
|
+
next = fallbackChildFragment;
|
|
14281
|
+
child.return = next.return = workInProgress;
|
|
13981
14282
|
} else {
|
|
13982
|
-
|
|
14283
|
+
// Mount the primary children without an intermediate fragment fiber.
|
|
14284
|
+
var nextPrimaryChildren = nextProps.children;
|
|
14285
|
+
child = next = mountChildFibers(workInProgress, null, nextPrimaryChildren, renderExpirationTime);
|
|
13983
14286
|
}
|
|
13984
|
-
|
|
13985
|
-
workInProgress.memoizedProps = nextProps;
|
|
13986
|
-
workInProgress.memoizedState = nextDidTimeout;
|
|
13987
|
-
reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
|
|
13988
|
-
return workInProgress.child;
|
|
13989
14287
|
} else {
|
|
13990
|
-
|
|
14288
|
+
// This is an update. This branch is more complicated because we need to
|
|
14289
|
+
// ensure the state of the primary children is preserved.
|
|
14290
|
+
var prevState = current$$1.memoizedState;
|
|
14291
|
+
var prevDidTimeout = prevState !== null && prevState.didTimeout;
|
|
14292
|
+
if (prevDidTimeout) {
|
|
14293
|
+
// The current tree already timed out. That means each child set is
|
|
14294
|
+
var currentPrimaryChildFragment = current$$1.child;
|
|
14295
|
+
var currentFallbackChildFragment = currentPrimaryChildFragment.sibling;
|
|
14296
|
+
if (nextDidTimeout) {
|
|
14297
|
+
// Still timed out. Reuse the current primary children by cloning
|
|
14298
|
+
// its fragment. We're going to skip over these entirely.
|
|
14299
|
+
var _nextFallbackChildren = nextProps.fallback;
|
|
14300
|
+
var _primaryChildFragment = createWorkInProgress(currentPrimaryChildFragment, currentPrimaryChildFragment.pendingProps, NoWork);
|
|
14301
|
+
_primaryChildFragment.effectTag |= Placement;
|
|
14302
|
+
// Clone the fallback child fragment, too. These we'll continue
|
|
14303
|
+
// working on.
|
|
14304
|
+
var _fallbackChildFragment = _primaryChildFragment.sibling = createWorkInProgress(currentFallbackChildFragment, _nextFallbackChildren, currentFallbackChildFragment.expirationTime);
|
|
14305
|
+
_fallbackChildFragment.effectTag |= Placement;
|
|
14306
|
+
child = _primaryChildFragment;
|
|
14307
|
+
_primaryChildFragment.childExpirationTime = NoWork;
|
|
14308
|
+
// Skip the primary children, and continue working on the
|
|
14309
|
+
// fallback children.
|
|
14310
|
+
next = _fallbackChildFragment;
|
|
14311
|
+
child.return = next.return = workInProgress;
|
|
14312
|
+
} else {
|
|
14313
|
+
// No longer suspended. Switch back to showing the primary children,
|
|
14314
|
+
// and remove the intermediate fragment fiber.
|
|
14315
|
+
var _nextPrimaryChildren = nextProps.children;
|
|
14316
|
+
var currentPrimaryChild = currentPrimaryChildFragment.child;
|
|
14317
|
+
var currentFallbackChild = currentFallbackChildFragment.child;
|
|
14318
|
+
var primaryChild = reconcileChildFibers(workInProgress, currentPrimaryChild, _nextPrimaryChildren, renderExpirationTime);
|
|
14319
|
+
// Delete the fallback children.
|
|
14320
|
+
reconcileChildFibers(workInProgress, currentFallbackChild, null, renderExpirationTime);
|
|
14321
|
+
// Continue rendering the children, like we normally do.
|
|
14322
|
+
child = next = primaryChild;
|
|
14323
|
+
}
|
|
14324
|
+
} else {
|
|
14325
|
+
// The current tree has not already timed out. That means the primary
|
|
14326
|
+
var _currentPrimaryChild = current$$1.child;
|
|
14327
|
+
if (nextDidTimeout) {
|
|
14328
|
+
// Timed out. Wrap the children in a fragment fiber to keep them
|
|
14329
|
+
// separate from the fallback children.
|
|
14330
|
+
var _nextFallbackChildren2 = nextProps.fallback;
|
|
14331
|
+
var _primaryChildFragment2 = createFiberFromFragment(
|
|
14332
|
+
// It shouldn't matter what the pending props are because we aren't
|
|
14333
|
+
// going to render this fragment.
|
|
14334
|
+
null, mode, NoWork, null);
|
|
14335
|
+
_primaryChildFragment2.effectTag |= Placement;
|
|
14336
|
+
_primaryChildFragment2.child = _currentPrimaryChild;
|
|
14337
|
+
_currentPrimaryChild.return = _primaryChildFragment2;
|
|
14338
|
+
// Create a fragment from the fallback children, too.
|
|
14339
|
+
var _fallbackChildFragment2 = _primaryChildFragment2.sibling = createFiberFromFragment(_nextFallbackChildren2, mode, renderExpirationTime, null);
|
|
14340
|
+
_fallbackChildFragment2.effectTag |= Placement;
|
|
14341
|
+
child = _primaryChildFragment2;
|
|
14342
|
+
_primaryChildFragment2.childExpirationTime = NoWork;
|
|
14343
|
+
// Skip the primary children, and continue working on the
|
|
14344
|
+
// fallback children.
|
|
14345
|
+
next = _fallbackChildFragment2;
|
|
14346
|
+
child.return = next.return = workInProgress;
|
|
14347
|
+
} else {
|
|
14348
|
+
// Still haven't timed out. Continue rendering the children, like we
|
|
14349
|
+
// normally do.
|
|
14350
|
+
var _nextPrimaryChildren2 = nextProps.children;
|
|
14351
|
+
next = child = reconcileChildFibers(workInProgress, _currentPrimaryChild, _nextPrimaryChildren2, renderExpirationTime);
|
|
14352
|
+
}
|
|
14353
|
+
}
|
|
13991
14354
|
}
|
|
14355
|
+
|
|
14356
|
+
workInProgress.memoizedState = nextState;
|
|
14357
|
+
workInProgress.child = child;
|
|
14358
|
+
return next;
|
|
13992
14359
|
}
|
|
13993
14360
|
|
|
13994
14361
|
function updatePortalComponent(current$$1, workInProgress, renderExpirationTime) {
|
|
@@ -14001,10 +14368,8 @@ function updatePortalComponent(current$$1, workInProgress, renderExpirationTime)
|
|
|
14001
14368
|
// the root always starts with a "current" with a null child.
|
|
14002
14369
|
// TODO: Consider unifying this with how the root works.
|
|
14003
14370
|
workInProgress.child = reconcileChildFibers(workInProgress, null, nextChildren, renderExpirationTime);
|
|
14004
|
-
memoizeProps(workInProgress, nextChildren);
|
|
14005
14371
|
} else {
|
|
14006
14372
|
reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
|
|
14007
|
-
memoizeProps(workInProgress, nextChildren);
|
|
14008
14373
|
}
|
|
14009
14374
|
return workInProgress.child;
|
|
14010
14375
|
}
|
|
@@ -14017,7 +14382,6 @@ function updateContextProvider(current$$1, workInProgress, renderExpirationTime)
|
|
|
14017
14382
|
var oldProps = workInProgress.memoizedProps;
|
|
14018
14383
|
|
|
14019
14384
|
var newValue = newProps.value;
|
|
14020
|
-
workInProgress.memoizedProps = newProps;
|
|
14021
14385
|
|
|
14022
14386
|
{
|
|
14023
14387
|
var providerPropTypes = workInProgress.type.propTypes;
|
|
@@ -14049,8 +14413,32 @@ function updateContextProvider(current$$1, workInProgress, renderExpirationTime)
|
|
|
14049
14413
|
return workInProgress.child;
|
|
14050
14414
|
}
|
|
14051
14415
|
|
|
14416
|
+
var hasWarnedAboutUsingContextAsConsumer = false;
|
|
14417
|
+
|
|
14052
14418
|
function updateContextConsumer(current$$1, workInProgress, renderExpirationTime) {
|
|
14053
14419
|
var context = workInProgress.type;
|
|
14420
|
+
// The logic below for Context differs depending on PROD or DEV mode. In
|
|
14421
|
+
// DEV mode, we create a separate object for Context.Consumer that acts
|
|
14422
|
+
// like a proxy to Context. This proxy object adds unnecessary code in PROD
|
|
14423
|
+
// so we use the old behaviour (Context.Consumer references Context) to
|
|
14424
|
+
// reduce size and overhead. The separate object references context via
|
|
14425
|
+
// a property called "_context", which also gives us the ability to check
|
|
14426
|
+
// in DEV mode if this property exists or not and warn if it does not.
|
|
14427
|
+
{
|
|
14428
|
+
if (context._context === undefined) {
|
|
14429
|
+
// This may be because it's a Context (rather than a Consumer).
|
|
14430
|
+
// Or it may be because it's older React where they're the same thing.
|
|
14431
|
+
// We only want to warn if we're sure it's a new React.
|
|
14432
|
+
if (context !== context.Consumer) {
|
|
14433
|
+
if (!hasWarnedAboutUsingContextAsConsumer) {
|
|
14434
|
+
hasWarnedAboutUsingContextAsConsumer = true;
|
|
14435
|
+
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?');
|
|
14436
|
+
}
|
|
14437
|
+
}
|
|
14438
|
+
} else {
|
|
14439
|
+
context = context._context;
|
|
14440
|
+
}
|
|
14441
|
+
}
|
|
14054
14442
|
var newProps = workInProgress.pendingProps;
|
|
14055
14443
|
var render = newProps.children;
|
|
14056
14444
|
|
|
@@ -14071,7 +14459,6 @@ function updateContextConsumer(current$$1, workInProgress, renderExpirationTime)
|
|
|
14071
14459
|
// React DevTools reads this flag.
|
|
14072
14460
|
workInProgress.effectTag |= PerformedWork;
|
|
14073
14461
|
reconcileChildren(current$$1, workInProgress, newChildren, renderExpirationTime);
|
|
14074
|
-
workInProgress.memoizedProps = newProps;
|
|
14075
14462
|
return workInProgress.child;
|
|
14076
14463
|
}
|
|
14077
14464
|
|
|
@@ -14122,64 +14509,78 @@ function bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirati
|
|
|
14122
14509
|
}
|
|
14123
14510
|
}
|
|
14124
14511
|
|
|
14125
|
-
// TODO: Delete memoizeProps/State and move to reconcile/bailout instead
|
|
14126
|
-
function memoizeProps(workInProgress, nextProps) {
|
|
14127
|
-
workInProgress.memoizedProps = nextProps;
|
|
14128
|
-
}
|
|
14129
|
-
|
|
14130
|
-
function memoizeState(workInProgress, nextState) {
|
|
14131
|
-
workInProgress.memoizedState = nextState;
|
|
14132
|
-
// Don't reset the updateQueue, in case there are pending updates. Resetting
|
|
14133
|
-
// is handled by processUpdateQueue.
|
|
14134
|
-
}
|
|
14135
|
-
|
|
14136
14512
|
function beginWork(current$$1, workInProgress, renderExpirationTime) {
|
|
14137
14513
|
var updateExpirationTime = workInProgress.expirationTime;
|
|
14138
|
-
|
|
14139
|
-
|
|
14140
|
-
|
|
14141
|
-
|
|
14142
|
-
|
|
14143
|
-
|
|
14144
|
-
|
|
14145
|
-
|
|
14146
|
-
|
|
14147
|
-
|
|
14148
|
-
|
|
14149
|
-
|
|
14150
|
-
case ClassComponent:
|
|
14151
|
-
{
|
|
14152
|
-
var Component = workInProgress.type;
|
|
14153
|
-
if (isContextProvider(Component)) {
|
|
14154
|
-
pushContextProvider(workInProgress);
|
|
14155
|
-
}
|
|
14514
|
+
|
|
14515
|
+
if (current$$1 !== null) {
|
|
14516
|
+
var oldProps = current$$1.memoizedProps;
|
|
14517
|
+
var newProps = workInProgress.pendingProps;
|
|
14518
|
+
if (oldProps === newProps && !hasContextChanged() && (updateExpirationTime === NoWork || updateExpirationTime > renderExpirationTime)) {
|
|
14519
|
+
// This fiber does not have any pending work. Bailout without entering
|
|
14520
|
+
// the begin phase. There's still some bookkeeping we that needs to be done
|
|
14521
|
+
// in this optimized path, mostly pushing stuff onto the stack.
|
|
14522
|
+
switch (workInProgress.tag) {
|
|
14523
|
+
case HostRoot:
|
|
14524
|
+
pushHostRootContext(workInProgress);
|
|
14525
|
+
resetHydrationState();
|
|
14156
14526
|
break;
|
|
14157
|
-
|
|
14158
|
-
|
|
14159
|
-
|
|
14160
|
-
|
|
14161
|
-
|
|
14162
|
-
|
|
14163
|
-
|
|
14527
|
+
case HostComponent:
|
|
14528
|
+
pushHostContext(workInProgress);
|
|
14529
|
+
break;
|
|
14530
|
+
case ClassComponent:
|
|
14531
|
+
{
|
|
14532
|
+
var Component = workInProgress.type;
|
|
14533
|
+
if (isContextProvider(Component)) {
|
|
14534
|
+
pushContextProvider(workInProgress);
|
|
14535
|
+
}
|
|
14536
|
+
break;
|
|
14164
14537
|
}
|
|
14538
|
+
case HostPortal:
|
|
14539
|
+
pushHostContainer(workInProgress, workInProgress.stateNode.containerInfo);
|
|
14165
14540
|
break;
|
|
14166
|
-
|
|
14167
|
-
|
|
14168
|
-
|
|
14169
|
-
|
|
14170
|
-
|
|
14171
|
-
|
|
14172
|
-
|
|
14173
|
-
|
|
14541
|
+
case ContextProvider:
|
|
14542
|
+
{
|
|
14543
|
+
var newValue = workInProgress.memoizedProps.value;
|
|
14544
|
+
pushProvider(workInProgress, newValue);
|
|
14545
|
+
break;
|
|
14546
|
+
}
|
|
14547
|
+
case Profiler:
|
|
14548
|
+
if (enableProfilerTimer) {
|
|
14549
|
+
workInProgress.effectTag |= Update;
|
|
14550
|
+
}
|
|
14174
14551
|
break;
|
|
14175
|
-
|
|
14176
|
-
|
|
14177
|
-
|
|
14178
|
-
|
|
14179
|
-
|
|
14180
|
-
|
|
14552
|
+
case SuspenseComponent:
|
|
14553
|
+
{
|
|
14554
|
+
var state = workInProgress.memoizedState;
|
|
14555
|
+
var didTimeout = state !== null && state.didTimeout;
|
|
14556
|
+
if (didTimeout) {
|
|
14557
|
+
// If this boundary is currently timed out, we need to decide
|
|
14558
|
+
// whether to retry the primary children, or to skip over it and
|
|
14559
|
+
// go straight to the fallback. Check the priority of the primary
|
|
14560
|
+
var primaryChildFragment = workInProgress.child;
|
|
14561
|
+
var primaryChildExpirationTime = primaryChildFragment.childExpirationTime;
|
|
14562
|
+
if (primaryChildExpirationTime !== NoWork && primaryChildExpirationTime <= renderExpirationTime) {
|
|
14563
|
+
// The primary children have pending work. Use the normal path
|
|
14564
|
+
// to attempt to render the primary children again.
|
|
14565
|
+
return updateSuspenseComponent(current$$1, workInProgress, renderExpirationTime);
|
|
14566
|
+
} else {
|
|
14567
|
+
// The primary children do not have pending work with sufficient
|
|
14568
|
+
// priority. Bailout.
|
|
14569
|
+
var child = bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
|
|
14570
|
+
if (child !== null) {
|
|
14571
|
+
// The fallback children have pending work. Skip over the
|
|
14572
|
+
// primary children and work on the fallback.
|
|
14573
|
+
return child.sibling;
|
|
14574
|
+
} else {
|
|
14575
|
+
return null;
|
|
14576
|
+
}
|
|
14577
|
+
}
|
|
14578
|
+
}
|
|
14579
|
+
break;
|
|
14580
|
+
}
|
|
14581
|
+
}
|
|
14582
|
+
return bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
|
|
14181
14583
|
}
|
|
14182
|
-
return bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
|
|
14183
14584
|
}
|
|
14184
14585
|
|
|
14185
14586
|
// Before entering the begin phase, clear the expiration time.
|
|
@@ -14188,38 +14589,27 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
|
|
|
14188
14589
|
switch (workInProgress.tag) {
|
|
14189
14590
|
case IndeterminateComponent:
|
|
14190
14591
|
{
|
|
14191
|
-
var
|
|
14192
|
-
return mountIndeterminateComponent(current$$1, workInProgress,
|
|
14592
|
+
var elementType = workInProgress.elementType;
|
|
14593
|
+
return mountIndeterminateComponent(current$$1, workInProgress, elementType, renderExpirationTime);
|
|
14193
14594
|
}
|
|
14194
|
-
case
|
|
14595
|
+
case LazyComponent:
|
|
14195
14596
|
{
|
|
14196
|
-
var
|
|
14197
|
-
|
|
14198
|
-
return updateFunctionalComponent(current$$1, workInProgress, _Component4, _unresolvedProps, renderExpirationTime);
|
|
14597
|
+
var _elementType = workInProgress.elementType;
|
|
14598
|
+
return mountLazyComponent(current$$1, workInProgress, _elementType, updateExpirationTime, renderExpirationTime);
|
|
14199
14599
|
}
|
|
14200
|
-
case
|
|
14600
|
+
case FunctionComponent:
|
|
14201
14601
|
{
|
|
14202
|
-
var
|
|
14203
|
-
var
|
|
14204
|
-
var
|
|
14205
|
-
|
|
14206
|
-
workInProgress.memoizedProps = _unresolvedProps2;
|
|
14207
|
-
return _child;
|
|
14602
|
+
var _Component = workInProgress.type;
|
|
14603
|
+
var unresolvedProps = workInProgress.pendingProps;
|
|
14604
|
+
var resolvedProps = workInProgress.elementType === _Component ? unresolvedProps : resolveDefaultProps(_Component, unresolvedProps);
|
|
14605
|
+
return updateFunctionComponent(current$$1, workInProgress, _Component, resolvedProps, renderExpirationTime);
|
|
14208
14606
|
}
|
|
14209
14607
|
case ClassComponent:
|
|
14210
14608
|
{
|
|
14211
|
-
var
|
|
14212
|
-
var
|
|
14213
|
-
|
|
14214
|
-
|
|
14215
|
-
case ClassComponentLazy:
|
|
14216
|
-
{
|
|
14217
|
-
var _thenable3 = workInProgress.type;
|
|
14218
|
-
var _Component7 = getResultFromResolvedThenable(_thenable3);
|
|
14219
|
-
var _unresolvedProps4 = workInProgress.pendingProps;
|
|
14220
|
-
var _child2 = updateClassComponent(current$$1, workInProgress, _Component7, resolveDefaultProps(_Component7, _unresolvedProps4), renderExpirationTime);
|
|
14221
|
-
workInProgress.memoizedProps = _unresolvedProps4;
|
|
14222
|
-
return _child2;
|
|
14609
|
+
var _Component2 = workInProgress.type;
|
|
14610
|
+
var _unresolvedProps = workInProgress.pendingProps;
|
|
14611
|
+
var _resolvedProps = workInProgress.elementType === _Component2 ? _unresolvedProps : resolveDefaultProps(_Component2, _unresolvedProps);
|
|
14612
|
+
return updateClassComponent(current$$1, workInProgress, _Component2, _resolvedProps, renderExpirationTime);
|
|
14223
14613
|
}
|
|
14224
14614
|
case HostRoot:
|
|
14225
14615
|
return updateHostRoot(current$$1, workInProgress, renderExpirationTime);
|
|
@@ -14227,22 +14617,17 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
|
|
|
14227
14617
|
return updateHostComponent(current$$1, workInProgress, renderExpirationTime);
|
|
14228
14618
|
case HostText:
|
|
14229
14619
|
return updateHostText(current$$1, workInProgress);
|
|
14230
|
-
case
|
|
14231
|
-
return
|
|
14620
|
+
case SuspenseComponent:
|
|
14621
|
+
return updateSuspenseComponent(current$$1, workInProgress, renderExpirationTime);
|
|
14232
14622
|
case HostPortal:
|
|
14233
14623
|
return updatePortalComponent(current$$1, workInProgress, renderExpirationTime);
|
|
14234
14624
|
case ForwardRef:
|
|
14235
14625
|
{
|
|
14236
14626
|
var type = workInProgress.type;
|
|
14237
|
-
|
|
14238
|
-
|
|
14239
|
-
|
|
14240
|
-
|
|
14241
|
-
var _Component2 = getResultFromResolvedThenable(_thenable);
|
|
14242
|
-
var unresolvedProps = workInProgress.pendingProps;
|
|
14243
|
-
var child = updateForwardRef(current$$1, workInProgress, _Component2, resolveDefaultProps(_Component2, unresolvedProps), renderExpirationTime);
|
|
14244
|
-
workInProgress.memoizedProps = unresolvedProps;
|
|
14245
|
-
return child;
|
|
14627
|
+
var _unresolvedProps2 = workInProgress.pendingProps;
|
|
14628
|
+
var _resolvedProps2 = workInProgress.elementType === type ? _unresolvedProps2 : resolveDefaultProps(type, _unresolvedProps2);
|
|
14629
|
+
return updateForwardRef(current$$1, workInProgress, type, _resolvedProps2, renderExpirationTime);
|
|
14630
|
+
}
|
|
14246
14631
|
case Fragment:
|
|
14247
14632
|
return updateFragment(current$$1, workInProgress, renderExpirationTime);
|
|
14248
14633
|
case Mode:
|
|
@@ -14253,6 +14638,24 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
|
|
|
14253
14638
|
return updateContextProvider(current$$1, workInProgress, renderExpirationTime);
|
|
14254
14639
|
case ContextConsumer:
|
|
14255
14640
|
return updateContextConsumer(current$$1, workInProgress, renderExpirationTime);
|
|
14641
|
+
case MemoComponent:
|
|
14642
|
+
{
|
|
14643
|
+
var _type = workInProgress.type;
|
|
14644
|
+
var _unresolvedProps3 = workInProgress.pendingProps;
|
|
14645
|
+
var _resolvedProps3 = resolveDefaultProps(_type.type, _unresolvedProps3);
|
|
14646
|
+
return updateMemoComponent(current$$1, workInProgress, _type, _resolvedProps3, updateExpirationTime, renderExpirationTime);
|
|
14647
|
+
}
|
|
14648
|
+
case SimpleMemoComponent:
|
|
14649
|
+
{
|
|
14650
|
+
return updateSimpleMemoComponent(current$$1, workInProgress, workInProgress.type, workInProgress.pendingProps, updateExpirationTime, renderExpirationTime);
|
|
14651
|
+
}
|
|
14652
|
+
case IncompleteClassComponent:
|
|
14653
|
+
{
|
|
14654
|
+
var _Component3 = workInProgress.type;
|
|
14655
|
+
var _unresolvedProps4 = workInProgress.pendingProps;
|
|
14656
|
+
var _resolvedProps4 = workInProgress.elementType === _Component3 ? _unresolvedProps4 : resolveDefaultProps(_Component3, _unresolvedProps4);
|
|
14657
|
+
return mountIncompleteClassComponent(current$$1, workInProgress, _Component3, _resolvedProps4, renderExpirationTime);
|
|
14658
|
+
}
|
|
14256
14659
|
default:
|
|
14257
14660
|
invariant(false, 'Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue.');
|
|
14258
14661
|
}
|
|
@@ -14268,42 +14671,43 @@ function markRef$1(workInProgress) {
|
|
|
14268
14671
|
workInProgress.effectTag |= Ref;
|
|
14269
14672
|
}
|
|
14270
14673
|
|
|
14271
|
-
|
|
14272
|
-
// We only have the top Fiber that was created but we need recurse down its
|
|
14273
|
-
// children to find all the terminal nodes.
|
|
14274
|
-
var node = workInProgress.child;
|
|
14275
|
-
while (node !== null) {
|
|
14276
|
-
if (node.tag === HostComponent || node.tag === HostText) {
|
|
14277
|
-
appendInitialChild(parent, node.stateNode);
|
|
14278
|
-
} else if (node.tag === HostPortal) {
|
|
14279
|
-
// If we have a portal child, then we don't want to traverse
|
|
14280
|
-
// down its children. Instead, we'll get insertions from each child in
|
|
14281
|
-
// the portal directly.
|
|
14282
|
-
} else if (node.child !== null) {
|
|
14283
|
-
node.child.return = node;
|
|
14284
|
-
node = node.child;
|
|
14285
|
-
continue;
|
|
14286
|
-
}
|
|
14287
|
-
if (node === workInProgress) {
|
|
14288
|
-
return;
|
|
14289
|
-
}
|
|
14290
|
-
while (node.sibling === null) {
|
|
14291
|
-
if (node.return === null || node.return === workInProgress) {
|
|
14292
|
-
return;
|
|
14293
|
-
}
|
|
14294
|
-
node = node.return;
|
|
14295
|
-
}
|
|
14296
|
-
node.sibling.return = node.return;
|
|
14297
|
-
node = node.sibling;
|
|
14298
|
-
}
|
|
14299
|
-
}
|
|
14300
|
-
|
|
14674
|
+
var appendAllChildren = void 0;
|
|
14301
14675
|
var updateHostContainer = void 0;
|
|
14302
14676
|
var updateHostComponent$1 = void 0;
|
|
14303
14677
|
var updateHostText$1 = void 0;
|
|
14304
14678
|
if (supportsMutation) {
|
|
14305
14679
|
// Mutation mode
|
|
14306
14680
|
|
|
14681
|
+
appendAllChildren = function (parent, workInProgress, needsVisibilityToggle, isHidden) {
|
|
14682
|
+
// We only have the top Fiber that was created but we need recurse down its
|
|
14683
|
+
// children to find all the terminal nodes.
|
|
14684
|
+
var node = workInProgress.child;
|
|
14685
|
+
while (node !== null) {
|
|
14686
|
+
if (node.tag === HostComponent || node.tag === HostText) {
|
|
14687
|
+
appendInitialChild(parent, node.stateNode);
|
|
14688
|
+
} else if (node.tag === HostPortal) {
|
|
14689
|
+
// If we have a portal child, then we don't want to traverse
|
|
14690
|
+
// down its children. Instead, we'll get insertions from each child in
|
|
14691
|
+
// the portal directly.
|
|
14692
|
+
} else if (node.child !== null) {
|
|
14693
|
+
node.child.return = node;
|
|
14694
|
+
node = node.child;
|
|
14695
|
+
continue;
|
|
14696
|
+
}
|
|
14697
|
+
if (node === workInProgress) {
|
|
14698
|
+
return;
|
|
14699
|
+
}
|
|
14700
|
+
while (node.sibling === null) {
|
|
14701
|
+
if (node.return === null || node.return === workInProgress) {
|
|
14702
|
+
return;
|
|
14703
|
+
}
|
|
14704
|
+
node = node.return;
|
|
14705
|
+
}
|
|
14706
|
+
node.sibling.return = node.return;
|
|
14707
|
+
node = node.sibling;
|
|
14708
|
+
}
|
|
14709
|
+
};
|
|
14710
|
+
|
|
14307
14711
|
updateHostContainer = function (workInProgress) {
|
|
14308
14712
|
// Noop
|
|
14309
14713
|
};
|
|
@@ -14344,23 +14748,167 @@ if (supportsMutation) {
|
|
|
14344
14748
|
} else if (supportsPersistence) {
|
|
14345
14749
|
// Persistent host tree mode
|
|
14346
14750
|
|
|
14751
|
+
appendAllChildren = function (parent, workInProgress, needsVisibilityToggle, isHidden) {
|
|
14752
|
+
// We only have the top Fiber that was created but we need recurse down its
|
|
14753
|
+
// children to find all the terminal nodes.
|
|
14754
|
+
var node = workInProgress.child;
|
|
14755
|
+
while (node !== null) {
|
|
14756
|
+
// eslint-disable-next-line no-labels
|
|
14757
|
+
branches: if (node.tag === HostComponent) {
|
|
14758
|
+
var instance = node.stateNode;
|
|
14759
|
+
if (needsVisibilityToggle) {
|
|
14760
|
+
var props = node.memoizedProps;
|
|
14761
|
+
var type = node.type;
|
|
14762
|
+
if (isHidden) {
|
|
14763
|
+
// This child is inside a timed out tree. Hide it.
|
|
14764
|
+
instance = cloneHiddenInstance(instance, type, props, node);
|
|
14765
|
+
} else {
|
|
14766
|
+
// This child was previously inside a timed out tree. If it was not
|
|
14767
|
+
// updated during this render, it may need to be unhidden. Clone
|
|
14768
|
+
// again to be sure.
|
|
14769
|
+
instance = cloneUnhiddenInstance(instance, type, props, node);
|
|
14770
|
+
}
|
|
14771
|
+
node.stateNode = instance;
|
|
14772
|
+
}
|
|
14773
|
+
appendInitialChild(parent, instance);
|
|
14774
|
+
} else if (node.tag === HostText) {
|
|
14775
|
+
var _instance = node.stateNode;
|
|
14776
|
+
if (needsVisibilityToggle) {
|
|
14777
|
+
var text = node.memoizedProps;
|
|
14778
|
+
var rootContainerInstance = getRootHostContainer();
|
|
14779
|
+
var currentHostContext = getHostContext();
|
|
14780
|
+
if (isHidden) {
|
|
14781
|
+
_instance = createHiddenTextInstance(text, rootContainerInstance, currentHostContext, workInProgress);
|
|
14782
|
+
} else {
|
|
14783
|
+
_instance = createTextInstance(text, rootContainerInstance, currentHostContext, workInProgress);
|
|
14784
|
+
}
|
|
14785
|
+
node.stateNode = _instance;
|
|
14786
|
+
}
|
|
14787
|
+
appendInitialChild(parent, _instance);
|
|
14788
|
+
} else if (node.tag === HostPortal) {
|
|
14789
|
+
// If we have a portal child, then we don't want to traverse
|
|
14790
|
+
// down its children. Instead, we'll get insertions from each child in
|
|
14791
|
+
// the portal directly.
|
|
14792
|
+
} else if (node.tag === SuspenseComponent) {
|
|
14793
|
+
var current = node.alternate;
|
|
14794
|
+
if (current !== null) {
|
|
14795
|
+
var oldState = current.memoizedState;
|
|
14796
|
+
var newState = node.memoizedState;
|
|
14797
|
+
var oldIsHidden = oldState !== null && oldState.didTimeout;
|
|
14798
|
+
var newIsHidden = newState !== null && newState.didTimeout;
|
|
14799
|
+
if (oldIsHidden !== newIsHidden) {
|
|
14800
|
+
// The placeholder either just timed out or switched back to the normal
|
|
14801
|
+
// children after having previously timed out. Toggle the visibility of
|
|
14802
|
+
// the direct host children.
|
|
14803
|
+
var primaryChildParent = newIsHidden ? node.child : node;
|
|
14804
|
+
if (primaryChildParent !== null) {
|
|
14805
|
+
appendAllChildren(parent, primaryChildParent, true, newIsHidden);
|
|
14806
|
+
}
|
|
14807
|
+
// eslint-disable-next-line no-labels
|
|
14808
|
+
break branches;
|
|
14809
|
+
}
|
|
14810
|
+
}
|
|
14811
|
+
if (node.child !== null) {
|
|
14812
|
+
// Continue traversing like normal
|
|
14813
|
+
node.child.return = node;
|
|
14814
|
+
node = node.child;
|
|
14815
|
+
continue;
|
|
14816
|
+
}
|
|
14817
|
+
} else if (node.child !== null) {
|
|
14818
|
+
node.child.return = node;
|
|
14819
|
+
node = node.child;
|
|
14820
|
+
continue;
|
|
14821
|
+
}
|
|
14822
|
+
// $FlowFixMe This is correct but Flow is confused by the labeled break.
|
|
14823
|
+
node = node;
|
|
14824
|
+
if (node === workInProgress) {
|
|
14825
|
+
return;
|
|
14826
|
+
}
|
|
14827
|
+
while (node.sibling === null) {
|
|
14828
|
+
if (node.return === null || node.return === workInProgress) {
|
|
14829
|
+
return;
|
|
14830
|
+
}
|
|
14831
|
+
node = node.return;
|
|
14832
|
+
}
|
|
14833
|
+
node.sibling.return = node.return;
|
|
14834
|
+
node = node.sibling;
|
|
14835
|
+
}
|
|
14836
|
+
};
|
|
14837
|
+
|
|
14347
14838
|
// An unfortunate fork of appendAllChildren because we have two different parent types.
|
|
14348
|
-
var appendAllChildrenToContainer = function (containerChildSet, workInProgress) {
|
|
14839
|
+
var appendAllChildrenToContainer = function (containerChildSet, workInProgress, needsVisibilityToggle, isHidden) {
|
|
14349
14840
|
// We only have the top Fiber that was created but we need recurse down its
|
|
14350
14841
|
// children to find all the terminal nodes.
|
|
14351
14842
|
var node = workInProgress.child;
|
|
14352
14843
|
while (node !== null) {
|
|
14353
|
-
|
|
14354
|
-
|
|
14844
|
+
// eslint-disable-next-line no-labels
|
|
14845
|
+
branches: if (node.tag === HostComponent) {
|
|
14846
|
+
var instance = node.stateNode;
|
|
14847
|
+
if (needsVisibilityToggle) {
|
|
14848
|
+
var props = node.memoizedProps;
|
|
14849
|
+
var type = node.type;
|
|
14850
|
+
if (isHidden) {
|
|
14851
|
+
// This child is inside a timed out tree. Hide it.
|
|
14852
|
+
instance = cloneHiddenInstance(instance, type, props, node);
|
|
14853
|
+
} else {
|
|
14854
|
+
// This child was previously inside a timed out tree. If it was not
|
|
14855
|
+
// updated during this render, it may need to be unhidden. Clone
|
|
14856
|
+
// again to be sure.
|
|
14857
|
+
instance = cloneUnhiddenInstance(instance, type, props, node);
|
|
14858
|
+
}
|
|
14859
|
+
node.stateNode = instance;
|
|
14860
|
+
}
|
|
14861
|
+
appendChildToContainerChildSet(containerChildSet, instance);
|
|
14862
|
+
} else if (node.tag === HostText) {
|
|
14863
|
+
var _instance2 = node.stateNode;
|
|
14864
|
+
if (needsVisibilityToggle) {
|
|
14865
|
+
var text = node.memoizedProps;
|
|
14866
|
+
var rootContainerInstance = getRootHostContainer();
|
|
14867
|
+
var currentHostContext = getHostContext();
|
|
14868
|
+
if (isHidden) {
|
|
14869
|
+
_instance2 = createHiddenTextInstance(text, rootContainerInstance, currentHostContext, workInProgress);
|
|
14870
|
+
} else {
|
|
14871
|
+
_instance2 = createTextInstance(text, rootContainerInstance, currentHostContext, workInProgress);
|
|
14872
|
+
}
|
|
14873
|
+
node.stateNode = _instance2;
|
|
14874
|
+
}
|
|
14875
|
+
appendChildToContainerChildSet(containerChildSet, _instance2);
|
|
14355
14876
|
} else if (node.tag === HostPortal) {
|
|
14356
14877
|
// If we have a portal child, then we don't want to traverse
|
|
14357
14878
|
// down its children. Instead, we'll get insertions from each child in
|
|
14358
14879
|
// the portal directly.
|
|
14880
|
+
} else if (node.tag === SuspenseComponent) {
|
|
14881
|
+
var current = node.alternate;
|
|
14882
|
+
if (current !== null) {
|
|
14883
|
+
var oldState = current.memoizedState;
|
|
14884
|
+
var newState = node.memoizedState;
|
|
14885
|
+
var oldIsHidden = oldState !== null && oldState.didTimeout;
|
|
14886
|
+
var newIsHidden = newState !== null && newState.didTimeout;
|
|
14887
|
+
if (oldIsHidden !== newIsHidden) {
|
|
14888
|
+
// The placeholder either just timed out or switched back to the normal
|
|
14889
|
+
// children after having previously timed out. Toggle the visibility of
|
|
14890
|
+
// the direct host children.
|
|
14891
|
+
var primaryChildParent = newIsHidden ? node.child : node;
|
|
14892
|
+
if (primaryChildParent !== null) {
|
|
14893
|
+
appendAllChildrenToContainer(containerChildSet, primaryChildParent, true, newIsHidden);
|
|
14894
|
+
}
|
|
14895
|
+
// eslint-disable-next-line no-labels
|
|
14896
|
+
break branches;
|
|
14897
|
+
}
|
|
14898
|
+
}
|
|
14899
|
+
if (node.child !== null) {
|
|
14900
|
+
// Continue traversing like normal
|
|
14901
|
+
node.child.return = node;
|
|
14902
|
+
node = node.child;
|
|
14903
|
+
continue;
|
|
14904
|
+
}
|
|
14359
14905
|
} else if (node.child !== null) {
|
|
14360
14906
|
node.child.return = node;
|
|
14361
14907
|
node = node.child;
|
|
14362
14908
|
continue;
|
|
14363
14909
|
}
|
|
14910
|
+
// $FlowFixMe This is correct but Flow is confused by the labeled break.
|
|
14911
|
+
node = node;
|
|
14364
14912
|
if (node === workInProgress) {
|
|
14365
14913
|
return;
|
|
14366
14914
|
}
|
|
@@ -14383,7 +14931,7 @@ if (supportsMutation) {
|
|
|
14383
14931
|
var container = portalOrRoot.containerInfo;
|
|
14384
14932
|
var newChildSet = createContainerChildSet(container);
|
|
14385
14933
|
// If children might have changed, we have to add them all to the set.
|
|
14386
|
-
appendAllChildrenToContainer(newChildSet, workInProgress);
|
|
14934
|
+
appendAllChildrenToContainer(newChildSet, workInProgress, false, false);
|
|
14387
14935
|
portalOrRoot.pendingChildren = newChildSet;
|
|
14388
14936
|
// Schedule an update on the container to swap out the container.
|
|
14389
14937
|
markUpdate(workInProgress);
|
|
@@ -14426,7 +14974,7 @@ if (supportsMutation) {
|
|
|
14426
14974
|
markUpdate(workInProgress);
|
|
14427
14975
|
} else {
|
|
14428
14976
|
// If children might have changed, we have to add them all to the set.
|
|
14429
|
-
appendAllChildren(newInstance, workInProgress);
|
|
14977
|
+
appendAllChildren(newInstance, workInProgress, false, false);
|
|
14430
14978
|
}
|
|
14431
14979
|
};
|
|
14432
14980
|
updateHostText$1 = function (current, workInProgress, oldText, newText) {
|
|
@@ -14457,8 +15005,12 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
14457
15005
|
var newProps = workInProgress.pendingProps;
|
|
14458
15006
|
|
|
14459
15007
|
switch (workInProgress.tag) {
|
|
14460
|
-
case
|
|
14461
|
-
|
|
15008
|
+
case IndeterminateComponent:
|
|
15009
|
+
break;
|
|
15010
|
+
case LazyComponent:
|
|
15011
|
+
break;
|
|
15012
|
+
case SimpleMemoComponent:
|
|
15013
|
+
case FunctionComponent:
|
|
14462
15014
|
break;
|
|
14463
15015
|
case ClassComponent:
|
|
14464
15016
|
{
|
|
@@ -14468,14 +15020,6 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
14468
15020
|
}
|
|
14469
15021
|
break;
|
|
14470
15022
|
}
|
|
14471
|
-
case ClassComponentLazy:
|
|
14472
|
-
{
|
|
14473
|
-
var _Component = getResultFromResolvedThenable(workInProgress.type);
|
|
14474
|
-
if (isContextProvider(_Component)) {
|
|
14475
|
-
popContext(workInProgress);
|
|
14476
|
-
}
|
|
14477
|
-
break;
|
|
14478
|
-
}
|
|
14479
15023
|
case HostRoot:
|
|
14480
15024
|
{
|
|
14481
15025
|
popHostContainer(workInProgress);
|
|
@@ -14531,7 +15075,7 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
14531
15075
|
} else {
|
|
14532
15076
|
var instance = createInstance(type, newProps, rootContainerInstance, currentHostContext, workInProgress);
|
|
14533
15077
|
|
|
14534
|
-
appendAllChildren(instance, workInProgress);
|
|
15078
|
+
appendAllChildren(instance, workInProgress, false, false);
|
|
14535
15079
|
|
|
14536
15080
|
// Certain renderers require commit-time effects for initial mount.
|
|
14537
15081
|
// (eg DOM renderer supports auto-focus for certain elements).
|
|
@@ -14576,10 +15120,20 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
14576
15120
|
break;
|
|
14577
15121
|
}
|
|
14578
15122
|
case ForwardRef:
|
|
14579
|
-
case ForwardRefLazy:
|
|
14580
|
-
break;
|
|
14581
|
-
case PlaceholderComponent:
|
|
14582
15123
|
break;
|
|
15124
|
+
case SuspenseComponent:
|
|
15125
|
+
{
|
|
15126
|
+
var nextState = workInProgress.memoizedState;
|
|
15127
|
+
var prevState = current !== null ? current.memoizedState : null;
|
|
15128
|
+
var nextDidTimeout = nextState !== null && nextState.didTimeout;
|
|
15129
|
+
var prevDidTimeout = prevState !== null && prevState.didTimeout;
|
|
15130
|
+
if (nextDidTimeout !== prevDidTimeout) {
|
|
15131
|
+
// If this render commits, and it switches between the normal state
|
|
15132
|
+
// and the timed-out state, schedule an effect.
|
|
15133
|
+
workInProgress.effectTag |= Update;
|
|
15134
|
+
}
|
|
15135
|
+
break;
|
|
15136
|
+
}
|
|
14583
15137
|
case Fragment:
|
|
14584
15138
|
break;
|
|
14585
15139
|
case Mode:
|
|
@@ -14596,10 +15150,18 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
14596
15150
|
break;
|
|
14597
15151
|
case ContextConsumer:
|
|
14598
15152
|
break;
|
|
14599
|
-
|
|
14600
|
-
|
|
14601
|
-
|
|
14602
|
-
|
|
15153
|
+
case MemoComponent:
|
|
15154
|
+
break;
|
|
15155
|
+
case IncompleteClassComponent:
|
|
15156
|
+
{
|
|
15157
|
+
// Same as class component case. I put it down here so that the tags are
|
|
15158
|
+
// sequential to ensure this switch is compiled to a jump table.
|
|
15159
|
+
var _Component = workInProgress.type;
|
|
15160
|
+
if (isContextProvider(_Component)) {
|
|
15161
|
+
popContext(workInProgress);
|
|
15162
|
+
}
|
|
15163
|
+
break;
|
|
15164
|
+
}
|
|
14603
15165
|
default:
|
|
14604
15166
|
invariant(false, 'Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue.');
|
|
14605
15167
|
}
|
|
@@ -14607,6 +15169,17 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
14607
15169
|
return null;
|
|
14608
15170
|
}
|
|
14609
15171
|
|
|
15172
|
+
function shouldCaptureSuspense(current, workInProgress) {
|
|
15173
|
+
// In order to capture, the Suspense component must have a fallback prop.
|
|
15174
|
+
if (workInProgress.memoizedProps.fallback === undefined) {
|
|
15175
|
+
return false;
|
|
15176
|
+
}
|
|
15177
|
+
// If it was the primary children that just suspended, capture and render the
|
|
15178
|
+
// fallback. Otherwise, don't capture and bubble to the next boundary.
|
|
15179
|
+
var nextState = workInProgress.memoizedState;
|
|
15180
|
+
return nextState === null || !nextState.didTimeout;
|
|
15181
|
+
}
|
|
15182
|
+
|
|
14610
15183
|
// This module is forked in different environments.
|
|
14611
15184
|
// By default, return `true` to log errors to the console.
|
|
14612
15185
|
// Forks can return `false` if this isn't desirable.
|
|
@@ -14674,8 +15247,6 @@ function logCapturedError(capturedError) {
|
|
|
14674
15247
|
}
|
|
14675
15248
|
}
|
|
14676
15249
|
|
|
14677
|
-
var emptyObject = {};
|
|
14678
|
-
|
|
14679
15250
|
var didWarnAboutUndefinedSnapshotBeforeUpdate = null;
|
|
14680
15251
|
{
|
|
14681
15252
|
didWarnAboutUndefinedSnapshotBeforeUpdate = new Set();
|
|
@@ -14757,7 +15328,6 @@ function safelyDetachRef(current$$1) {
|
|
|
14757
15328
|
function commitBeforeMutationLifeCycles(current$$1, finishedWork) {
|
|
14758
15329
|
switch (finishedWork.tag) {
|
|
14759
15330
|
case ClassComponent:
|
|
14760
|
-
case ClassComponentLazy:
|
|
14761
15331
|
{
|
|
14762
15332
|
if (finishedWork.effectTag & Snapshot) {
|
|
14763
15333
|
if (current$$1 !== null) {
|
|
@@ -14785,6 +15355,7 @@ function commitBeforeMutationLifeCycles(current$$1, finishedWork) {
|
|
|
14785
15355
|
case HostComponent:
|
|
14786
15356
|
case HostText:
|
|
14787
15357
|
case HostPortal:
|
|
15358
|
+
case IncompleteClassComponent:
|
|
14788
15359
|
// Nothing to do for these component types
|
|
14789
15360
|
return;
|
|
14790
15361
|
default:
|
|
@@ -14797,7 +15368,6 @@ function commitBeforeMutationLifeCycles(current$$1, finishedWork) {
|
|
|
14797
15368
|
function commitLifeCycles(finishedRoot, current$$1, finishedWork, committedExpirationTime) {
|
|
14798
15369
|
switch (finishedWork.tag) {
|
|
14799
15370
|
case ClassComponent:
|
|
14800
|
-
case ClassComponentLazy:
|
|
14801
15371
|
{
|
|
14802
15372
|
var instance = finishedWork.stateNode;
|
|
14803
15373
|
if (finishedWork.effectTag & Update) {
|
|
@@ -14836,7 +15406,6 @@ function commitLifeCycles(finishedRoot, current$$1, finishedWork, committedExpir
|
|
|
14836
15406
|
_instance = getPublicInstance(finishedWork.child.stateNode);
|
|
14837
15407
|
break;
|
|
14838
15408
|
case ClassComponent:
|
|
14839
|
-
case ClassComponentLazy:
|
|
14840
15409
|
_instance = finishedWork.child.stateNode;
|
|
14841
15410
|
break;
|
|
14842
15411
|
}
|
|
@@ -14884,26 +15453,50 @@ function commitLifeCycles(finishedRoot, current$$1, finishedWork, committedExpir
|
|
|
14884
15453
|
}
|
|
14885
15454
|
return;
|
|
14886
15455
|
}
|
|
14887
|
-
case
|
|
15456
|
+
case SuspenseComponent:
|
|
14888
15457
|
{
|
|
14889
|
-
if (
|
|
14890
|
-
|
|
14891
|
-
|
|
14892
|
-
|
|
14893
|
-
|
|
14894
|
-
|
|
14895
|
-
|
|
14896
|
-
|
|
14897
|
-
|
|
14898
|
-
|
|
14899
|
-
|
|
14900
|
-
|
|
14901
|
-
|
|
14902
|
-
|
|
15458
|
+
if (finishedWork.effectTag & Callback) {
|
|
15459
|
+
// In non-strict mode, a suspense boundary times out by commiting
|
|
15460
|
+
// twice: first, by committing the children in an inconsistent state,
|
|
15461
|
+
// then hiding them and showing the fallback children in a subsequent
|
|
15462
|
+
var _newState = {
|
|
15463
|
+
alreadyCaptured: true,
|
|
15464
|
+
didTimeout: false,
|
|
15465
|
+
timedOutAt: NoWork
|
|
15466
|
+
};
|
|
15467
|
+
finishedWork.memoizedState = _newState;
|
|
15468
|
+
scheduleWork(finishedWork, Sync);
|
|
15469
|
+
return;
|
|
15470
|
+
}
|
|
15471
|
+
var oldState = current$$1 !== null ? current$$1.memoizedState : null;
|
|
15472
|
+
var newState = finishedWork.memoizedState;
|
|
15473
|
+
var oldDidTimeout = oldState !== null ? oldState.didTimeout : false;
|
|
15474
|
+
|
|
15475
|
+
var newDidTimeout = void 0;
|
|
15476
|
+
var primaryChildParent = finishedWork;
|
|
15477
|
+
if (newState === null) {
|
|
15478
|
+
newDidTimeout = false;
|
|
15479
|
+
} else {
|
|
15480
|
+
newDidTimeout = newState.didTimeout;
|
|
15481
|
+
if (newDidTimeout) {
|
|
15482
|
+
primaryChildParent = finishedWork.child;
|
|
15483
|
+
newState.alreadyCaptured = false;
|
|
15484
|
+
if (newState.timedOutAt === NoWork) {
|
|
15485
|
+
// If the children had not already timed out, record the time.
|
|
15486
|
+
// This is used to compute the elapsed time during subsequent
|
|
15487
|
+
// attempts to render the children.
|
|
15488
|
+
newState.timedOutAt = requestCurrentTime();
|
|
15489
|
+
}
|
|
14903
15490
|
}
|
|
14904
15491
|
}
|
|
15492
|
+
|
|
15493
|
+
if (newDidTimeout !== oldDidTimeout && primaryChildParent !== null) {
|
|
15494
|
+
hideOrUnhideAllChildren(primaryChildParent, newDidTimeout);
|
|
15495
|
+
}
|
|
14905
15496
|
return;
|
|
14906
15497
|
}
|
|
15498
|
+
case IncompleteClassComponent:
|
|
15499
|
+
break;
|
|
14907
15500
|
default:
|
|
14908
15501
|
{
|
|
14909
15502
|
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.');
|
|
@@ -14911,6 +15504,45 @@ function commitLifeCycles(finishedRoot, current$$1, finishedWork, committedExpir
|
|
|
14911
15504
|
}
|
|
14912
15505
|
}
|
|
14913
15506
|
|
|
15507
|
+
function hideOrUnhideAllChildren(finishedWork, isHidden) {
|
|
15508
|
+
if (supportsMutation) {
|
|
15509
|
+
// We only have the top Fiber that was inserted but we need recurse down its
|
|
15510
|
+
var node = finishedWork;
|
|
15511
|
+
while (true) {
|
|
15512
|
+
if (node.tag === HostComponent) {
|
|
15513
|
+
var instance = node.stateNode;
|
|
15514
|
+
if (isHidden) {
|
|
15515
|
+
hideInstance(instance);
|
|
15516
|
+
} else {
|
|
15517
|
+
unhideInstance(node.stateNode, node.memoizedProps);
|
|
15518
|
+
}
|
|
15519
|
+
} else if (node.tag === HostText) {
|
|
15520
|
+
var _instance3 = node.stateNode;
|
|
15521
|
+
if (isHidden) {
|
|
15522
|
+
hideTextInstance(_instance3);
|
|
15523
|
+
} else {
|
|
15524
|
+
unhideTextInstance(_instance3, node.memoizedProps);
|
|
15525
|
+
}
|
|
15526
|
+
} else if (node.child !== null) {
|
|
15527
|
+
node.child.return = node;
|
|
15528
|
+
node = node.child;
|
|
15529
|
+
continue;
|
|
15530
|
+
}
|
|
15531
|
+
if (node === finishedWork) {
|
|
15532
|
+
return;
|
|
15533
|
+
}
|
|
15534
|
+
while (node.sibling === null) {
|
|
15535
|
+
if (node.return === null || node.return === finishedWork) {
|
|
15536
|
+
return;
|
|
15537
|
+
}
|
|
15538
|
+
node = node.return;
|
|
15539
|
+
}
|
|
15540
|
+
node.sibling.return = node.return;
|
|
15541
|
+
node = node.sibling;
|
|
15542
|
+
}
|
|
15543
|
+
}
|
|
15544
|
+
}
|
|
15545
|
+
|
|
14914
15546
|
function commitAttachRef(finishedWork) {
|
|
14915
15547
|
var ref = finishedWork.ref;
|
|
14916
15548
|
if (ref !== null) {
|
|
@@ -14956,7 +15588,6 @@ function commitUnmount(current$$1) {
|
|
|
14956
15588
|
|
|
14957
15589
|
switch (current$$1.tag) {
|
|
14958
15590
|
case ClassComponent:
|
|
14959
|
-
case ClassComponentLazy:
|
|
14960
15591
|
{
|
|
14961
15592
|
safelyDetachRef(current$$1);
|
|
14962
15593
|
var instance = current$$1.stateNode;
|
|
@@ -15050,7 +15681,6 @@ function commitContainer(finishedWork) {
|
|
|
15050
15681
|
|
|
15051
15682
|
switch (finishedWork.tag) {
|
|
15052
15683
|
case ClassComponent:
|
|
15053
|
-
case ClassComponentLazy:
|
|
15054
15684
|
{
|
|
15055
15685
|
return;
|
|
15056
15686
|
}
|
|
@@ -15317,7 +15947,6 @@ function commitWork(current$$1, finishedWork) {
|
|
|
15317
15947
|
|
|
15318
15948
|
switch (finishedWork.tag) {
|
|
15319
15949
|
case ClassComponent:
|
|
15320
|
-
case ClassComponentLazy:
|
|
15321
15950
|
{
|
|
15322
15951
|
return;
|
|
15323
15952
|
}
|
|
@@ -15361,7 +15990,11 @@ function commitWork(current$$1, finishedWork) {
|
|
|
15361
15990
|
{
|
|
15362
15991
|
return;
|
|
15363
15992
|
}
|
|
15364
|
-
case
|
|
15993
|
+
case SuspenseComponent:
|
|
15994
|
+
{
|
|
15995
|
+
return;
|
|
15996
|
+
}
|
|
15997
|
+
case IncompleteClassComponent:
|
|
15365
15998
|
{
|
|
15366
15999
|
return;
|
|
15367
16000
|
}
|
|
@@ -15379,10 +16012,6 @@ function commitResetTextContent(current$$1) {
|
|
|
15379
16012
|
resetTextContent(current$$1.stateNode);
|
|
15380
16013
|
}
|
|
15381
16014
|
|
|
15382
|
-
function NoopComponent() {
|
|
15383
|
-
return null;
|
|
15384
|
-
}
|
|
15385
|
-
|
|
15386
16015
|
function createRootErrorUpdate(fiber, errorInfo, expirationTime) {
|
|
15387
16016
|
var update = createUpdate(expirationTime);
|
|
15388
16017
|
// Unmount the root by rendering null.
|
|
@@ -15401,22 +16030,22 @@ function createRootErrorUpdate(fiber, errorInfo, expirationTime) {
|
|
|
15401
16030
|
function createClassErrorUpdate(fiber, errorInfo, expirationTime) {
|
|
15402
16031
|
var update = createUpdate(expirationTime);
|
|
15403
16032
|
update.tag = CaptureUpdate;
|
|
15404
|
-
var
|
|
15405
|
-
if (
|
|
16033
|
+
var getDerivedStateFromError = fiber.type.getDerivedStateFromError;
|
|
16034
|
+
if (typeof getDerivedStateFromError === 'function') {
|
|
15406
16035
|
var error = errorInfo.value;
|
|
15407
16036
|
update.payload = function () {
|
|
15408
|
-
return
|
|
16037
|
+
return getDerivedStateFromError(error);
|
|
15409
16038
|
};
|
|
15410
16039
|
}
|
|
15411
16040
|
|
|
15412
16041
|
var inst = fiber.stateNode;
|
|
15413
16042
|
if (inst !== null && typeof inst.componentDidCatch === 'function') {
|
|
15414
16043
|
update.callback = function callback() {
|
|
15415
|
-
if (
|
|
16044
|
+
if (typeof getDerivedStateFromError !== 'function') {
|
|
15416
16045
|
// To preserve the preexisting retry behavior of error boundaries,
|
|
15417
16046
|
// we keep track of which ones already failed during this batch.
|
|
15418
16047
|
// This gets reset before we yield back to the browser.
|
|
15419
|
-
// TODO: Warn in strict mode if
|
|
16048
|
+
// TODO: Warn in strict mode if getDerivedStateFromError is
|
|
15420
16049
|
// not defined.
|
|
15421
16050
|
markLegacyErrorBoundaryAsFailed(this);
|
|
15422
16051
|
}
|
|
@@ -15426,6 +16055,14 @@ function createClassErrorUpdate(fiber, errorInfo, expirationTime) {
|
|
|
15426
16055
|
this.componentDidCatch(error, {
|
|
15427
16056
|
componentStack: stack !== null ? stack : ''
|
|
15428
16057
|
});
|
|
16058
|
+
{
|
|
16059
|
+
if (typeof getDerivedStateFromError !== 'function') {
|
|
16060
|
+
// If componentDidCatch is the only error boundary method defined,
|
|
16061
|
+
// then it needs to call setState to recover from errors.
|
|
16062
|
+
// If no state update is scheduled then the boundary will swallow the error.
|
|
16063
|
+
!(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;
|
|
16064
|
+
}
|
|
16065
|
+
}
|
|
15429
16066
|
};
|
|
15430
16067
|
}
|
|
15431
16068
|
return update;
|
|
@@ -15437,7 +16074,7 @@ function throwException(root, returnFiber, sourceFiber, value, renderExpirationT
|
|
|
15437
16074
|
// Its effect list is no longer valid.
|
|
15438
16075
|
sourceFiber.firstEffect = sourceFiber.lastEffect = null;
|
|
15439
16076
|
|
|
15440
|
-
if (
|
|
16077
|
+
if (value !== null && typeof value === 'object' && typeof value.then === 'function') {
|
|
15441
16078
|
// This is a thenable.
|
|
15442
16079
|
var thenable = value;
|
|
15443
16080
|
|
|
@@ -15450,21 +16087,20 @@ function throwException(root, returnFiber, sourceFiber, value, renderExpirationT
|
|
|
15450
16087
|
var earliestTimeoutMs = -1;
|
|
15451
16088
|
var startTimeMs = -1;
|
|
15452
16089
|
do {
|
|
15453
|
-
if (_workInProgress.tag ===
|
|
16090
|
+
if (_workInProgress.tag === SuspenseComponent) {
|
|
15454
16091
|
var current = _workInProgress.alternate;
|
|
15455
|
-
if (current !== null
|
|
15456
|
-
|
|
15457
|
-
|
|
15458
|
-
|
|
15459
|
-
|
|
15460
|
-
|
|
15461
|
-
|
|
15462
|
-
|
|
15463
|
-
|
|
15464
|
-
|
|
15465
|
-
break;
|
|
16092
|
+
if (current !== null) {
|
|
16093
|
+
var currentState = current.memoizedState;
|
|
16094
|
+
if (currentState !== null && currentState.didTimeout) {
|
|
16095
|
+
// Reached a boundary that already timed out. Do not search
|
|
16096
|
+
// any further.
|
|
16097
|
+
var timedOutAt = currentState.timedOutAt;
|
|
16098
|
+
startTimeMs = expirationTimeToMs(timedOutAt);
|
|
16099
|
+
// Do not search any further.
|
|
16100
|
+
break;
|
|
16101
|
+
}
|
|
15466
16102
|
}
|
|
15467
|
-
var timeoutPropMs = _workInProgress.pendingProps.
|
|
16103
|
+
var timeoutPropMs = _workInProgress.pendingProps.maxDuration;
|
|
15468
16104
|
if (typeof timeoutPropMs === 'number') {
|
|
15469
16105
|
if (timeoutPropMs <= 0) {
|
|
15470
16106
|
earliestTimeoutMs = 0;
|
|
@@ -15476,103 +16112,96 @@ function throwException(root, returnFiber, sourceFiber, value, renderExpirationT
|
|
|
15476
16112
|
_workInProgress = _workInProgress.return;
|
|
15477
16113
|
} while (_workInProgress !== null);
|
|
15478
16114
|
|
|
15479
|
-
// Schedule the nearest
|
|
16115
|
+
// Schedule the nearest Suspense to re-render the timed out view.
|
|
15480
16116
|
_workInProgress = returnFiber;
|
|
15481
16117
|
do {
|
|
15482
|
-
if (_workInProgress.tag ===
|
|
15483
|
-
|
|
15484
|
-
if (!didTimeout) {
|
|
15485
|
-
// Found the nearest boundary.
|
|
15486
|
-
|
|
15487
|
-
// If the boundary is not in async mode, we should not suspend, and
|
|
15488
|
-
// likewise, when the promise resolves, we should ping synchronously.
|
|
15489
|
-
var pingTime = (_workInProgress.mode & AsyncMode) === NoEffect ? Sync : renderExpirationTime;
|
|
15490
|
-
|
|
15491
|
-
// Attach a listener to the promise to "ping" the root and retry.
|
|
15492
|
-
var onResolveOrReject = retrySuspendedRoot.bind(null, root, _workInProgress, pingTime);
|
|
15493
|
-
thenable.then(onResolveOrReject, onResolveOrReject);
|
|
15494
|
-
|
|
15495
|
-
// If the boundary is outside of strict mode, we should *not* suspend
|
|
15496
|
-
// the commit. Pretend as if the suspended component rendered null and
|
|
15497
|
-
// keep rendering. In the commit phase, we'll schedule a subsequent
|
|
15498
|
-
// synchronous update to re-render the Placeholder.
|
|
15499
|
-
//
|
|
15500
|
-
// Note: It doesn't matter whether the component that suspended was
|
|
15501
|
-
// inside a strict mode tree. If the Placeholder is outside of it, we
|
|
15502
|
-
// should *not* suspend the commit.
|
|
15503
|
-
if ((_workInProgress.mode & StrictMode) === NoEffect) {
|
|
15504
|
-
_workInProgress.effectTag |= Update;
|
|
15505
|
-
|
|
15506
|
-
// Unmount the source fiber's children
|
|
15507
|
-
var nextChildren = null;
|
|
15508
|
-
reconcileChildren(sourceFiber.alternate, sourceFiber, nextChildren, renderExpirationTime);
|
|
15509
|
-
sourceFiber.effectTag &= ~Incomplete;
|
|
15510
|
-
if (sourceFiber.tag === IndeterminateComponent) {
|
|
15511
|
-
// Let's just assume it's a functional component. This fiber will
|
|
15512
|
-
// be unmounted in the immediate next commit, anyway.
|
|
15513
|
-
sourceFiber.tag = FunctionalComponent;
|
|
15514
|
-
}
|
|
16118
|
+
if (_workInProgress.tag === SuspenseComponent && shouldCaptureSuspense(_workInProgress.alternate, _workInProgress)) {
|
|
16119
|
+
// Found the nearest boundary.
|
|
15515
16120
|
|
|
15516
|
-
|
|
15517
|
-
|
|
15518
|
-
|
|
15519
|
-
// callbacks. Remove all lifecycle effect tags.
|
|
15520
|
-
sourceFiber.effectTag &= ~LifecycleEffectMask;
|
|
15521
|
-
if (sourceFiber.alternate === null) {
|
|
15522
|
-
// We're about to mount a class component that doesn't have an
|
|
15523
|
-
// instance. Turn this into a dummy functional component instead,
|
|
15524
|
-
// to prevent type errors. This is a bit weird but it's an edge
|
|
15525
|
-
// case and we're about to synchronously delete this
|
|
15526
|
-
// component, anyway.
|
|
15527
|
-
sourceFiber.tag = FunctionalComponent;
|
|
15528
|
-
sourceFiber.type = NoopComponent;
|
|
15529
|
-
}
|
|
15530
|
-
}
|
|
15531
|
-
|
|
15532
|
-
// Exit without suspending.
|
|
15533
|
-
return;
|
|
15534
|
-
}
|
|
16121
|
+
// If the boundary is not in concurrent mode, we should not suspend, and
|
|
16122
|
+
// likewise, when the promise resolves, we should ping synchronously.
|
|
16123
|
+
var pingTime = (_workInProgress.mode & ConcurrentMode) === NoEffect ? Sync : renderExpirationTime;
|
|
15535
16124
|
|
|
15536
|
-
|
|
15537
|
-
|
|
16125
|
+
// Attach a listener to the promise to "ping" the root and retry.
|
|
16126
|
+
var onResolveOrReject = retrySuspendedRoot.bind(null, root, _workInProgress, sourceFiber, pingTime);
|
|
16127
|
+
if (enableSchedulerTracing) {
|
|
16128
|
+
onResolveOrReject = unstable_wrap(onResolveOrReject);
|
|
16129
|
+
}
|
|
16130
|
+
thenable.then(onResolveOrReject, onResolveOrReject);
|
|
15538
16131
|
|
|
15539
|
-
|
|
15540
|
-
|
|
15541
|
-
|
|
15542
|
-
|
|
15543
|
-
|
|
15544
|
-
|
|
15545
|
-
|
|
15546
|
-
|
|
15547
|
-
|
|
15548
|
-
|
|
15549
|
-
|
|
15550
|
-
|
|
15551
|
-
|
|
15552
|
-
|
|
15553
|
-
|
|
15554
|
-
|
|
15555
|
-
|
|
15556
|
-
|
|
15557
|
-
|
|
15558
|
-
|
|
16132
|
+
// If the boundary is outside of concurrent mode, we should *not*
|
|
16133
|
+
// suspend the commit. Pretend as if the suspended component rendered
|
|
16134
|
+
// null and keep rendering. In the commit phase, we'll schedule a
|
|
16135
|
+
// subsequent synchronous update to re-render the Suspense.
|
|
16136
|
+
//
|
|
16137
|
+
// Note: It doesn't matter whether the component that suspended was
|
|
16138
|
+
// inside a concurrent mode tree. If the Suspense is outside of it, we
|
|
16139
|
+
// should *not* suspend the commit.
|
|
16140
|
+
if ((_workInProgress.mode & ConcurrentMode) === NoEffect) {
|
|
16141
|
+
_workInProgress.effectTag |= Callback;
|
|
16142
|
+
|
|
16143
|
+
// Unmount the source fiber's children
|
|
16144
|
+
var nextChildren = null;
|
|
16145
|
+
reconcileChildren(sourceFiber.alternate, sourceFiber, nextChildren, renderExpirationTime);
|
|
16146
|
+
sourceFiber.effectTag &= ~Incomplete;
|
|
16147
|
+
|
|
16148
|
+
if (sourceFiber.tag === ClassComponent) {
|
|
16149
|
+
// We're going to commit this fiber even though it didn't complete.
|
|
16150
|
+
// But we shouldn't call any lifecycle methods or callbacks. Remove
|
|
16151
|
+
// all lifecycle effect tags.
|
|
16152
|
+
sourceFiber.effectTag &= ~LifecycleEffectMask;
|
|
16153
|
+
var _current = sourceFiber.alternate;
|
|
16154
|
+
if (_current === null) {
|
|
16155
|
+
// This is a new mount. Change the tag so it's not mistaken for a
|
|
16156
|
+
// completed component. For example, we should not call
|
|
16157
|
+
// componentWillUnmount if it is deleted.
|
|
16158
|
+
sourceFiber.tag = IncompleteClassComponent;
|
|
15559
16159
|
}
|
|
15560
|
-
absoluteTimeoutMs = startTimeMs + earliestTimeoutMs;
|
|
15561
16160
|
}
|
|
15562
16161
|
|
|
15563
|
-
//
|
|
15564
|
-
// After completing the root, we'll take the largest of all the
|
|
15565
|
-
// suspended fiber's timeouts and use it to compute a timeout for the
|
|
15566
|
-
// whole tree.
|
|
15567
|
-
renderDidSuspend(root, absoluteTimeoutMs, renderExpirationTime);
|
|
15568
|
-
|
|
15569
|
-
_workInProgress.effectTag |= ShouldCapture;
|
|
15570
|
-
_workInProgress.expirationTime = renderExpirationTime;
|
|
16162
|
+
// Exit without suspending.
|
|
15571
16163
|
return;
|
|
15572
16164
|
}
|
|
15573
|
-
|
|
15574
|
-
//
|
|
16165
|
+
|
|
16166
|
+
// Confirmed that the boundary is in a concurrent mode tree. Continue
|
|
16167
|
+
// with the normal suspend path.
|
|
16168
|
+
|
|
16169
|
+
var absoluteTimeoutMs = void 0;
|
|
16170
|
+
if (earliestTimeoutMs === -1) {
|
|
16171
|
+
// If no explicit threshold is given, default to an abitrarily large
|
|
16172
|
+
// value. The actual size doesn't matter because the threshold for the
|
|
16173
|
+
// whole tree will be clamped to the expiration time.
|
|
16174
|
+
absoluteTimeoutMs = maxSigned31BitInt;
|
|
16175
|
+
} else {
|
|
16176
|
+
if (startTimeMs === -1) {
|
|
16177
|
+
// This suspend happened outside of any already timed-out
|
|
16178
|
+
// placeholders. We don't know exactly when the update was
|
|
16179
|
+
// scheduled, but we can infer an approximate start time from the
|
|
16180
|
+
// expiration time. First, find the earliest uncommitted expiration
|
|
16181
|
+
// time in the tree, including work that is suspended. Then subtract
|
|
16182
|
+
// the offset used to compute an async update's expiration time.
|
|
16183
|
+
// This will cause high priority (interactive) work to expire
|
|
16184
|
+
// earlier than necessary, but we can account for this by adjusting
|
|
16185
|
+
// for the Just Noticeable Difference.
|
|
16186
|
+
var earliestExpirationTime = findEarliestOutstandingPriorityLevel(root, renderExpirationTime);
|
|
16187
|
+
var earliestExpirationTimeMs = expirationTimeToMs(earliestExpirationTime);
|
|
16188
|
+
startTimeMs = earliestExpirationTimeMs - LOW_PRIORITY_EXPIRATION;
|
|
16189
|
+
}
|
|
16190
|
+
absoluteTimeoutMs = startTimeMs + earliestTimeoutMs;
|
|
16191
|
+
}
|
|
16192
|
+
|
|
16193
|
+
// Mark the earliest timeout in the suspended fiber's ancestor path.
|
|
16194
|
+
// After completing the root, we'll take the largest of all the
|
|
16195
|
+
// suspended fiber's timeouts and use it to compute a timeout for the
|
|
16196
|
+
// whole tree.
|
|
16197
|
+
renderDidSuspend(root, absoluteTimeoutMs, renderExpirationTime);
|
|
16198
|
+
|
|
16199
|
+
_workInProgress.effectTag |= ShouldCapture;
|
|
16200
|
+
_workInProgress.expirationTime = renderExpirationTime;
|
|
16201
|
+
return;
|
|
15575
16202
|
}
|
|
16203
|
+
// This boundary already captured during this render. Continue to the next
|
|
16204
|
+
// boundary.
|
|
15576
16205
|
_workInProgress = _workInProgress.return;
|
|
15577
16206
|
} while (_workInProgress !== null);
|
|
15578
16207
|
// No boundary was found. Fallthrough to error mode.
|
|
@@ -15597,12 +16226,11 @@ function throwException(root, returnFiber, sourceFiber, value, renderExpirationT
|
|
|
15597
16226
|
return;
|
|
15598
16227
|
}
|
|
15599
16228
|
case ClassComponent:
|
|
15600
|
-
case ClassComponentLazy:
|
|
15601
16229
|
// Capture and retry
|
|
15602
16230
|
var errorInfo = value;
|
|
15603
16231
|
var ctor = workInProgress.type;
|
|
15604
16232
|
var instance = workInProgress.stateNode;
|
|
15605
|
-
if ((workInProgress.effectTag & DidCapture) === NoEffect && (typeof ctor.
|
|
16233
|
+
if ((workInProgress.effectTag & DidCapture) === NoEffect && (typeof ctor.getDerivedStateFromError === 'function' || instance !== null && typeof instance.componentDidCatch === 'function' && !isAlreadyFailedLegacyErrorBoundary(instance))) {
|
|
15606
16234
|
workInProgress.effectTag |= ShouldCapture;
|
|
15607
16235
|
workInProgress.expirationTime = renderExpirationTime;
|
|
15608
16236
|
// Schedule the error boundary to re-render using updated state
|
|
@@ -15633,26 +16261,13 @@ function unwindWork(workInProgress, renderExpirationTime) {
|
|
|
15633
16261
|
}
|
|
15634
16262
|
return null;
|
|
15635
16263
|
}
|
|
15636
|
-
case ClassComponentLazy:
|
|
15637
|
-
{
|
|
15638
|
-
var _Component = workInProgress.type._reactResult;
|
|
15639
|
-
if (isContextProvider(_Component)) {
|
|
15640
|
-
popContext(workInProgress);
|
|
15641
|
-
}
|
|
15642
|
-
var _effectTag = workInProgress.effectTag;
|
|
15643
|
-
if (_effectTag & ShouldCapture) {
|
|
15644
|
-
workInProgress.effectTag = _effectTag & ~ShouldCapture | DidCapture;
|
|
15645
|
-
return workInProgress;
|
|
15646
|
-
}
|
|
15647
|
-
return null;
|
|
15648
|
-
}
|
|
15649
16264
|
case HostRoot:
|
|
15650
16265
|
{
|
|
15651
16266
|
popHostContainer(workInProgress);
|
|
15652
16267
|
popTopLevelContextObject(workInProgress);
|
|
15653
|
-
var
|
|
15654
|
-
!((
|
|
15655
|
-
workInProgress.effectTag =
|
|
16268
|
+
var _effectTag = workInProgress.effectTag;
|
|
16269
|
+
!((_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;
|
|
16270
|
+
workInProgress.effectTag = _effectTag & ~ShouldCapture | DidCapture;
|
|
15656
16271
|
return workInProgress;
|
|
15657
16272
|
}
|
|
15658
16273
|
case HostComponent:
|
|
@@ -15660,11 +16275,37 @@ function unwindWork(workInProgress, renderExpirationTime) {
|
|
|
15660
16275
|
popHostContext(workInProgress);
|
|
15661
16276
|
return null;
|
|
15662
16277
|
}
|
|
15663
|
-
case
|
|
16278
|
+
case SuspenseComponent:
|
|
15664
16279
|
{
|
|
15665
|
-
var
|
|
15666
|
-
if (
|
|
15667
|
-
workInProgress.effectTag =
|
|
16280
|
+
var _effectTag2 = workInProgress.effectTag;
|
|
16281
|
+
if (_effectTag2 & ShouldCapture) {
|
|
16282
|
+
workInProgress.effectTag = _effectTag2 & ~ShouldCapture | DidCapture;
|
|
16283
|
+
// Captured a suspense effect. Set the boundary's `alreadyCaptured`
|
|
16284
|
+
// state to true so we know to render the fallback.
|
|
16285
|
+
var current = workInProgress.alternate;
|
|
16286
|
+
var currentState = current !== null ? current.memoizedState : null;
|
|
16287
|
+
var nextState = workInProgress.memoizedState;
|
|
16288
|
+
if (nextState === null) {
|
|
16289
|
+
// No existing state. Create a new object.
|
|
16290
|
+
nextState = {
|
|
16291
|
+
alreadyCaptured: true,
|
|
16292
|
+
didTimeout: false,
|
|
16293
|
+
timedOutAt: NoWork
|
|
16294
|
+
};
|
|
16295
|
+
} else if (currentState === nextState) {
|
|
16296
|
+
// There is an existing state but it's the same as the current tree's.
|
|
16297
|
+
// Clone the object.
|
|
16298
|
+
nextState = {
|
|
16299
|
+
alreadyCaptured: true,
|
|
16300
|
+
didTimeout: nextState.didTimeout,
|
|
16301
|
+
timedOutAt: nextState.timedOutAt
|
|
16302
|
+
};
|
|
16303
|
+
} else {
|
|
16304
|
+
// Already have a clone, so it's safe to mutate.
|
|
16305
|
+
nextState.alreadyCaptured = true;
|
|
16306
|
+
}
|
|
16307
|
+
workInProgress.memoizedState = nextState;
|
|
16308
|
+
// Re-render the boundary.
|
|
15668
16309
|
return workInProgress;
|
|
15669
16310
|
}
|
|
15670
16311
|
return null;
|
|
@@ -15690,14 +16331,6 @@ function unwindInterruptedWork(interruptedWork) {
|
|
|
15690
16331
|
}
|
|
15691
16332
|
break;
|
|
15692
16333
|
}
|
|
15693
|
-
case ClassComponentLazy:
|
|
15694
|
-
{
|
|
15695
|
-
var _childContextTypes = interruptedWork.type._reactResult.childContextTypes;
|
|
15696
|
-
if (_childContextTypes !== null && _childContextTypes !== undefined) {
|
|
15697
|
-
popContext(interruptedWork);
|
|
15698
|
-
}
|
|
15699
|
-
break;
|
|
15700
|
-
}
|
|
15701
16334
|
case HostRoot:
|
|
15702
16335
|
{
|
|
15703
16336
|
popHostContainer(interruptedWork);
|
|
@@ -15802,10 +16435,6 @@ var legacyErrorBoundariesThatAlreadyFailed = null;
|
|
|
15802
16435
|
// Used for performance tracking.
|
|
15803
16436
|
var interruptedBy = null;
|
|
15804
16437
|
|
|
15805
|
-
// Do not decrement interaction counts in the event of suspense timeouts.
|
|
15806
|
-
// This would lead to prematurely calling the interaction-complete hook.
|
|
15807
|
-
var suspenseDidTimeout = false;
|
|
15808
|
-
|
|
15809
16438
|
var stashedWorkInProgressProperties = void 0;
|
|
15810
16439
|
var replayUnitOfWork = void 0;
|
|
15811
16440
|
var isReplayingFailedUnitOfWork = void 0;
|
|
@@ -15847,14 +16476,6 @@ if (true && replayFailedUnitOfWorkWithInvokeGuardedCallback) {
|
|
|
15847
16476
|
}
|
|
15848
16477
|
break;
|
|
15849
16478
|
}
|
|
15850
|
-
case ClassComponentLazy:
|
|
15851
|
-
{
|
|
15852
|
-
var _Component = getResultFromResolvedThenable(failedUnitOfWork.type);
|
|
15853
|
-
if (isContextProvider(_Component)) {
|
|
15854
|
-
popContext(failedUnitOfWork);
|
|
15855
|
-
}
|
|
15856
|
-
break;
|
|
15857
|
-
}
|
|
15858
16479
|
case HostPortal:
|
|
15859
16480
|
popHostContainer(failedUnitOfWork);
|
|
15860
16481
|
break;
|
|
@@ -16010,14 +16631,11 @@ function commitBeforeMutationLifecycles() {
|
|
|
16010
16631
|
function commitAllLifeCycles(finishedRoot, committedExpirationTime) {
|
|
16011
16632
|
{
|
|
16012
16633
|
ReactStrictModeWarnings.flushPendingUnsafeLifecycleWarnings();
|
|
16634
|
+
ReactStrictModeWarnings.flushLegacyContextWarning();
|
|
16013
16635
|
|
|
16014
16636
|
if (warnAboutDeprecatedLifecycles) {
|
|
16015
16637
|
ReactStrictModeWarnings.flushPendingDeprecationWarnings();
|
|
16016
16638
|
}
|
|
16017
|
-
|
|
16018
|
-
if (warnAboutLegacyContextAPI) {
|
|
16019
|
-
ReactStrictModeWarnings.flushLegacyContextWarning();
|
|
16020
|
-
}
|
|
16021
16639
|
}
|
|
16022
16640
|
while (nextEffect !== null) {
|
|
16023
16641
|
var effectTag = nextEffect.effectTag;
|
|
@@ -16076,27 +16694,11 @@ function commitRoot(root, finishedWork) {
|
|
|
16076
16694
|
markCommittedPriorityLevels(root, earliestRemainingTimeBeforeCommit);
|
|
16077
16695
|
|
|
16078
16696
|
var prevInteractions = null;
|
|
16079
|
-
var committedInteractions = enableSchedulerTracing ? [] : null;
|
|
16080
16697
|
if (enableSchedulerTracing) {
|
|
16081
16698
|
// Restore any pending interactions at this point,
|
|
16082
16699
|
// So that cascading work triggered during the render phase will be accounted for.
|
|
16083
16700
|
prevInteractions = __interactionsRef.current;
|
|
16084
16701
|
__interactionsRef.current = root.memoizedInteractions;
|
|
16085
|
-
|
|
16086
|
-
// We are potentially finished with the current batch of interactions.
|
|
16087
|
-
// So we should clear them out of the pending interaction map.
|
|
16088
|
-
// We do this at the start of commit in case cascading work is scheduled by commit phase lifecycles.
|
|
16089
|
-
// In that event, interaction data may be added back into the pending map for a future commit.
|
|
16090
|
-
// We also store the interactions we are about to commit so that we can notify subscribers after we're done.
|
|
16091
|
-
// These are stored as an Array rather than a Set,
|
|
16092
|
-
// Because the same interaction may be pending for multiple expiration times,
|
|
16093
|
-
// In which case it's important that we decrement the count the right number of times after finishing.
|
|
16094
|
-
root.pendingInteractionMap.forEach(function (scheduledInteractions, scheduledExpirationTime) {
|
|
16095
|
-
if (scheduledExpirationTime <= committedExpirationTime) {
|
|
16096
|
-
committedInteractions.push.apply(committedInteractions, Array.from(scheduledInteractions));
|
|
16097
|
-
root.pendingInteractionMap.delete(scheduledExpirationTime);
|
|
16098
|
-
}
|
|
16099
|
-
});
|
|
16100
16702
|
}
|
|
16101
16703
|
|
|
16102
16704
|
// Reset this to null before calling lifecycles
|
|
@@ -16248,28 +16850,35 @@ function commitRoot(root, finishedWork) {
|
|
|
16248
16850
|
unhandledError = error;
|
|
16249
16851
|
}
|
|
16250
16852
|
} finally {
|
|
16251
|
-
//
|
|
16252
|
-
//
|
|
16253
|
-
|
|
16254
|
-
|
|
16255
|
-
|
|
16256
|
-
//
|
|
16257
|
-
|
|
16258
|
-
|
|
16259
|
-
|
|
16260
|
-
|
|
16261
|
-
|
|
16262
|
-
|
|
16263
|
-
|
|
16264
|
-
|
|
16265
|
-
|
|
16266
|
-
|
|
16267
|
-
|
|
16853
|
+
// Clear completed interactions from the pending Map.
|
|
16854
|
+
// Unless the render was suspended or cascading work was scheduled,
|
|
16855
|
+
// In which case– leave pending interactions until the subsequent render.
|
|
16856
|
+
var pendingInteractionMap = root.pendingInteractionMap;
|
|
16857
|
+
pendingInteractionMap.forEach(function (scheduledInteractions, scheduledExpirationTime) {
|
|
16858
|
+
// Only decrement the pending interaction count if we're done.
|
|
16859
|
+
// If there's still work at the current priority,
|
|
16860
|
+
// That indicates that we are waiting for suspense data.
|
|
16861
|
+
if (earliestRemainingTimeAfterCommit === NoWork || scheduledExpirationTime < earliestRemainingTimeAfterCommit) {
|
|
16862
|
+
pendingInteractionMap.delete(scheduledExpirationTime);
|
|
16863
|
+
|
|
16864
|
+
scheduledInteractions.forEach(function (interaction) {
|
|
16865
|
+
interaction.__count--;
|
|
16866
|
+
|
|
16867
|
+
if (subscriber !== null && interaction.__count === 0) {
|
|
16868
|
+
try {
|
|
16869
|
+
subscriber.onInteractionScheduledWorkCompleted(interaction);
|
|
16870
|
+
} catch (error) {
|
|
16871
|
+
// It's not safe for commitRoot() to throw.
|
|
16872
|
+
// Store the error for now and we'll re-throw in finishRendering().
|
|
16873
|
+
if (!hasUnhandledError) {
|
|
16874
|
+
hasUnhandledError = true;
|
|
16875
|
+
unhandledError = error;
|
|
16876
|
+
}
|
|
16268
16877
|
}
|
|
16269
16878
|
}
|
|
16270
|
-
}
|
|
16271
|
-
}
|
|
16272
|
-
}
|
|
16879
|
+
});
|
|
16880
|
+
}
|
|
16881
|
+
});
|
|
16273
16882
|
}
|
|
16274
16883
|
}
|
|
16275
16884
|
}
|
|
@@ -16368,23 +16977,12 @@ function completeUnitOfWork(workInProgress) {
|
|
|
16368
16977
|
} else {
|
|
16369
16978
|
nextUnitOfWork = completeWork(current$$1, workInProgress, nextRenderExpirationTime);
|
|
16370
16979
|
}
|
|
16371
|
-
var next = nextUnitOfWork;
|
|
16372
16980
|
stopWorkTimer(workInProgress);
|
|
16373
16981
|
resetChildExpirationTime(workInProgress, nextRenderExpirationTime);
|
|
16374
16982
|
{
|
|
16375
16983
|
resetCurrentFiber();
|
|
16376
16984
|
}
|
|
16377
16985
|
|
|
16378
|
-
if (next !== null) {
|
|
16379
|
-
stopWorkTimer(workInProgress);
|
|
16380
|
-
if (true && ReactFiberInstrumentation_1.debugTool) {
|
|
16381
|
-
ReactFiberInstrumentation_1.debugTool.onCompleteWork(workInProgress);
|
|
16382
|
-
}
|
|
16383
|
-
// If completing this work spawned new work, do that next. We'll come
|
|
16384
|
-
// back here again.
|
|
16385
|
-
return next;
|
|
16386
|
-
}
|
|
16387
|
-
|
|
16388
16986
|
if (returnFiber !== null &&
|
|
16389
16987
|
// Do not append effects to parents if a sibling failed to complete
|
|
16390
16988
|
(returnFiber.effectTag & Incomplete) === NoEffect) {
|
|
@@ -16444,7 +17042,7 @@ function completeUnitOfWork(workInProgress) {
|
|
|
16444
17042
|
// This fiber did not complete because something threw. Pop values off
|
|
16445
17043
|
// the stack without entering the complete phase. If this is a boundary,
|
|
16446
17044
|
// capture values if possible.
|
|
16447
|
-
var
|
|
17045
|
+
var next = unwindWork(workInProgress, nextRenderExpirationTime);
|
|
16448
17046
|
// Because this fiber did not complete, don't reset its expiration time.
|
|
16449
17047
|
if (workInProgress.effectTag & DidCapture) {
|
|
16450
17048
|
// Restarting an error boundary
|
|
@@ -16457,7 +17055,7 @@ function completeUnitOfWork(workInProgress) {
|
|
|
16457
17055
|
resetCurrentFiber();
|
|
16458
17056
|
}
|
|
16459
17057
|
|
|
16460
|
-
if (
|
|
17058
|
+
if (next !== null) {
|
|
16461
17059
|
stopWorkTimer(workInProgress);
|
|
16462
17060
|
if (true && ReactFiberInstrumentation_1.debugTool) {
|
|
16463
17061
|
ReactFiberInstrumentation_1.debugTool.onCompleteWork(workInProgress);
|
|
@@ -16465,14 +17063,14 @@ function completeUnitOfWork(workInProgress) {
|
|
|
16465
17063
|
|
|
16466
17064
|
if (enableProfilerTimer) {
|
|
16467
17065
|
// Include the time spent working on failed children before continuing.
|
|
16468
|
-
if (
|
|
16469
|
-
var actualDuration =
|
|
16470
|
-
var child =
|
|
17066
|
+
if (next.mode & ProfileMode) {
|
|
17067
|
+
var actualDuration = next.actualDuration;
|
|
17068
|
+
var child = next.child;
|
|
16471
17069
|
while (child !== null) {
|
|
16472
17070
|
actualDuration += child.actualDuration;
|
|
16473
17071
|
child = child.sibling;
|
|
16474
17072
|
}
|
|
16475
|
-
|
|
17073
|
+
next.actualDuration = actualDuration;
|
|
16476
17074
|
}
|
|
16477
17075
|
}
|
|
16478
17076
|
|
|
@@ -16480,8 +17078,8 @@ function completeUnitOfWork(workInProgress) {
|
|
|
16480
17078
|
// back here again.
|
|
16481
17079
|
// Since we're restarting, remove anything that is not a host effect
|
|
16482
17080
|
// from the effect tag.
|
|
16483
|
-
|
|
16484
|
-
return
|
|
17081
|
+
next.effectTag &= HostEffectMask;
|
|
17082
|
+
return next;
|
|
16485
17083
|
}
|
|
16486
17084
|
|
|
16487
17085
|
if (returnFiber !== null) {
|
|
@@ -16537,6 +17135,7 @@ function performUnitOfWork(workInProgress) {
|
|
|
16537
17135
|
}
|
|
16538
17136
|
|
|
16539
17137
|
next = beginWork(current$$1, workInProgress, nextRenderExpirationTime);
|
|
17138
|
+
workInProgress.memoizedProps = workInProgress.pendingProps;
|
|
16540
17139
|
|
|
16541
17140
|
if (workInProgress.mode & ProfileMode) {
|
|
16542
17141
|
// Record the render duration assuming we didn't bailout (or error).
|
|
@@ -16544,6 +17143,7 @@ function performUnitOfWork(workInProgress) {
|
|
|
16544
17143
|
}
|
|
16545
17144
|
} else {
|
|
16546
17145
|
next = beginWork(current$$1, workInProgress, nextRenderExpirationTime);
|
|
17146
|
+
workInProgress.memoizedProps = workInProgress.pendingProps;
|
|
16547
17147
|
}
|
|
16548
17148
|
|
|
16549
17149
|
{
|
|
@@ -16591,14 +17191,6 @@ function renderRoot(root, isYieldy, isExpired) {
|
|
|
16591
17191
|
|
|
16592
17192
|
var expirationTime = root.nextExpirationTimeToWorkOn;
|
|
16593
17193
|
|
|
16594
|
-
var prevInteractions = null;
|
|
16595
|
-
if (enableSchedulerTracing) {
|
|
16596
|
-
// We're about to start new traced work.
|
|
16597
|
-
// Restore pending interactions so cascading work triggered during the render phase will be accounted for.
|
|
16598
|
-
prevInteractions = __interactionsRef.current;
|
|
16599
|
-
__interactionsRef.current = root.memoizedInteractions;
|
|
16600
|
-
}
|
|
16601
|
-
|
|
16602
17194
|
// Check if we're starting from a fresh stack, or if we're resuming from
|
|
16603
17195
|
// previously yielded work.
|
|
16604
17196
|
if (expirationTime !== nextRenderExpirationTime || root !== nextRoot || nextUnitOfWork === null) {
|
|
@@ -16647,6 +17239,14 @@ function renderRoot(root, isYieldy, isExpired) {
|
|
|
16647
17239
|
}
|
|
16648
17240
|
}
|
|
16649
17241
|
|
|
17242
|
+
var prevInteractions = null;
|
|
17243
|
+
if (enableSchedulerTracing) {
|
|
17244
|
+
// We're about to start new traced work.
|
|
17245
|
+
// Restore pending interactions so cascading work triggered during the render phase will be accounted for.
|
|
17246
|
+
prevInteractions = __interactionsRef.current;
|
|
17247
|
+
__interactionsRef.current = root.memoizedInteractions;
|
|
17248
|
+
}
|
|
17249
|
+
|
|
16650
17250
|
var didFatal = false;
|
|
16651
17251
|
|
|
16652
17252
|
startWorkLoopTimer(nextUnitOfWork);
|
|
@@ -16777,7 +17377,7 @@ function renderRoot(root, isYieldy, isExpired) {
|
|
|
16777
17377
|
}
|
|
16778
17378
|
}
|
|
16779
17379
|
|
|
16780
|
-
if (
|
|
17380
|
+
if (!isExpired && nextLatestAbsoluteTimeoutMs !== -1) {
|
|
16781
17381
|
// The tree was suspended.
|
|
16782
17382
|
var _suspendedExpirationTime2 = expirationTime;
|
|
16783
17383
|
markSuspendedPriorityLevel(root, _suspendedExpirationTime2);
|
|
@@ -16817,10 +17417,9 @@ function dispatch(sourceFiber, value, expirationTime) {
|
|
|
16817
17417
|
while (fiber !== null) {
|
|
16818
17418
|
switch (fiber.tag) {
|
|
16819
17419
|
case ClassComponent:
|
|
16820
|
-
case ClassComponentLazy:
|
|
16821
17420
|
var ctor = fiber.type;
|
|
16822
17421
|
var instance = fiber.stateNode;
|
|
16823
|
-
if (typeof ctor.
|
|
17422
|
+
if (typeof ctor.getDerivedStateFromError === 'function' || typeof instance.componentDidCatch === 'function' && !isAlreadyFailedLegacyErrorBoundary(instance)) {
|
|
16824
17423
|
var errorInfo = createCapturedValue(value, sourceFiber);
|
|
16825
17424
|
var update = createClassErrorUpdate(fiber, errorInfo, expirationTime);
|
|
16826
17425
|
enqueueUpdate(fiber, update);
|
|
@@ -16892,7 +17491,7 @@ function computeExpirationForFiber(currentTime, fiber) {
|
|
|
16892
17491
|
} else {
|
|
16893
17492
|
// No explicit expiration context was set, and we're not currently
|
|
16894
17493
|
// performing work. Calculate a new expiration time.
|
|
16895
|
-
if (fiber.mode &
|
|
17494
|
+
if (fiber.mode & ConcurrentMode) {
|
|
16896
17495
|
if (isBatchingInteractiveUpdates) {
|
|
16897
17496
|
// This is an interactive update
|
|
16898
17497
|
expirationTime = computeInteractiveExpiration(currentTime);
|
|
@@ -16914,7 +17513,7 @@ function computeExpirationForFiber(currentTime, fiber) {
|
|
|
16914
17513
|
// This is an interactive update. Keep track of the lowest pending
|
|
16915
17514
|
// interactive expiration time. This allows us to synchronously flush
|
|
16916
17515
|
// all interactive updates when needed.
|
|
16917
|
-
if (
|
|
17516
|
+
if (expirationTime > lowestPriorityPendingInteractiveExpirationTime) {
|
|
16918
17517
|
lowestPriorityPendingInteractiveExpirationTime = expirationTime;
|
|
16919
17518
|
}
|
|
16920
17519
|
}
|
|
@@ -16932,41 +17531,69 @@ function renderDidError() {
|
|
|
16932
17531
|
nextRenderDidError = true;
|
|
16933
17532
|
}
|
|
16934
17533
|
|
|
16935
|
-
function retrySuspendedRoot(root,
|
|
16936
|
-
|
|
16937
|
-
var retryTime = void 0;
|
|
17534
|
+
function retrySuspendedRoot(root, boundaryFiber, sourceFiber, suspendedTime) {
|
|
17535
|
+
var retryTime = void 0;
|
|
16938
17536
|
|
|
16939
|
-
|
|
16940
|
-
|
|
16941
|
-
|
|
16942
|
-
|
|
16943
|
-
|
|
16944
|
-
|
|
16945
|
-
|
|
16946
|
-
|
|
16947
|
-
|
|
17537
|
+
if (isPriorityLevelSuspended(root, suspendedTime)) {
|
|
17538
|
+
// Ping at the original level
|
|
17539
|
+
retryTime = suspendedTime;
|
|
17540
|
+
|
|
17541
|
+
markPingedPriorityLevel(root, retryTime);
|
|
17542
|
+
} else {
|
|
17543
|
+
// Suspense already timed out. Compute a new expiration time
|
|
17544
|
+
var currentTime = requestCurrentTime();
|
|
17545
|
+
retryTime = computeExpirationForFiber(currentTime, boundaryFiber);
|
|
17546
|
+
markPendingPriorityLevel(root, retryTime);
|
|
17547
|
+
}
|
|
17548
|
+
|
|
17549
|
+
// TODO: If the suspense fiber has already rendered the primary children
|
|
17550
|
+
// without suspending (that is, all of the promises have already resolved),
|
|
17551
|
+
// we should not trigger another update here. One case this happens is when
|
|
17552
|
+
// we are in sync mode and a single promise is thrown both on initial render
|
|
17553
|
+
// and on update; we attach two .then(retrySuspendedRoot) callbacks and each
|
|
17554
|
+
// one performs Sync work, rerendering the Suspense.
|
|
17555
|
+
|
|
17556
|
+
if ((boundaryFiber.mode & ConcurrentMode) !== NoContext) {
|
|
17557
|
+
if (root === nextRoot && nextRenderExpirationTime === suspendedTime) {
|
|
17558
|
+
// Received a ping at the same priority level at which we're currently
|
|
17559
|
+
// rendering. Restart from the root.
|
|
17560
|
+
nextRoot = null;
|
|
16948
17561
|
}
|
|
17562
|
+
}
|
|
16949
17563
|
|
|
16950
|
-
|
|
16951
|
-
|
|
16952
|
-
|
|
16953
|
-
|
|
16954
|
-
|
|
16955
|
-
|
|
16956
|
-
|
|
16957
|
-
|
|
16958
|
-
|
|
16959
|
-
|
|
16960
|
-
|
|
16961
|
-
|
|
16962
|
-
|
|
16963
|
-
|
|
16964
|
-
}
|
|
17564
|
+
scheduleWorkToRoot(boundaryFiber, retryTime);
|
|
17565
|
+
if ((boundaryFiber.mode & ConcurrentMode) === NoContext) {
|
|
17566
|
+
// Outside of concurrent mode, we must schedule an update on the source
|
|
17567
|
+
// fiber, too, since it already committed in an inconsistent state and
|
|
17568
|
+
// therefore does not have any pending work.
|
|
17569
|
+
scheduleWorkToRoot(sourceFiber, retryTime);
|
|
17570
|
+
var sourceTag = sourceFiber.tag;
|
|
17571
|
+
if (sourceTag === ClassComponent && sourceFiber.stateNode !== null) {
|
|
17572
|
+
// When we try rendering again, we should not reuse the current fiber,
|
|
17573
|
+
// since it's known to be in an inconsistent state. Use a force updte to
|
|
17574
|
+
// prevent a bail out.
|
|
17575
|
+
var update = createUpdate(retryTime);
|
|
17576
|
+
update.tag = ForceUpdate;
|
|
17577
|
+
enqueueUpdate(sourceFiber, update);
|
|
16965
17578
|
}
|
|
16966
17579
|
}
|
|
17580
|
+
|
|
17581
|
+
var rootExpirationTime = root.expirationTime;
|
|
17582
|
+
if (rootExpirationTime !== NoWork) {
|
|
17583
|
+
requestWork(root, rootExpirationTime);
|
|
17584
|
+
}
|
|
16967
17585
|
}
|
|
16968
17586
|
|
|
16969
17587
|
function scheduleWorkToRoot(fiber, expirationTime) {
|
|
17588
|
+
recordScheduleUpdate();
|
|
17589
|
+
|
|
17590
|
+
{
|
|
17591
|
+
if (fiber.tag === ClassComponent) {
|
|
17592
|
+
var instance = fiber.stateNode;
|
|
17593
|
+
warnAboutInvalidUpdates(instance);
|
|
17594
|
+
}
|
|
17595
|
+
}
|
|
17596
|
+
|
|
16970
17597
|
// Update the source fiber's expiration time
|
|
16971
17598
|
if (fiber.expirationTime === NoWork || fiber.expirationTime > expirationTime) {
|
|
16972
17599
|
fiber.expirationTime = expirationTime;
|
|
@@ -16977,85 +17604,75 @@ function scheduleWorkToRoot(fiber, expirationTime) {
|
|
|
16977
17604
|
}
|
|
16978
17605
|
// Walk the parent path to the root and update the child expiration time.
|
|
16979
17606
|
var node = fiber.return;
|
|
17607
|
+
var root = null;
|
|
16980
17608
|
if (node === null && fiber.tag === HostRoot) {
|
|
16981
|
-
|
|
16982
|
-
}
|
|
16983
|
-
|
|
16984
|
-
|
|
16985
|
-
|
|
16986
|
-
|
|
16987
|
-
|
|
17609
|
+
root = fiber.stateNode;
|
|
17610
|
+
} else {
|
|
17611
|
+
while (node !== null) {
|
|
17612
|
+
alternate = node.alternate;
|
|
17613
|
+
if (node.childExpirationTime === NoWork || node.childExpirationTime > expirationTime) {
|
|
17614
|
+
node.childExpirationTime = expirationTime;
|
|
17615
|
+
if (alternate !== null && (alternate.childExpirationTime === NoWork || alternate.childExpirationTime > expirationTime)) {
|
|
17616
|
+
alternate.childExpirationTime = expirationTime;
|
|
17617
|
+
}
|
|
17618
|
+
} else if (alternate !== null && (alternate.childExpirationTime === NoWork || alternate.childExpirationTime > expirationTime)) {
|
|
16988
17619
|
alternate.childExpirationTime = expirationTime;
|
|
16989
17620
|
}
|
|
16990
|
-
|
|
16991
|
-
|
|
16992
|
-
|
|
16993
|
-
|
|
16994
|
-
|
|
17621
|
+
if (node.return === null && node.tag === HostRoot) {
|
|
17622
|
+
root = node.stateNode;
|
|
17623
|
+
break;
|
|
17624
|
+
}
|
|
17625
|
+
node = node.return;
|
|
16995
17626
|
}
|
|
16996
|
-
node = node.return;
|
|
16997
17627
|
}
|
|
16998
|
-
return null;
|
|
16999
|
-
}
|
|
17000
17628
|
|
|
17001
|
-
|
|
17002
|
-
|
|
17003
|
-
|
|
17629
|
+
if (root === null) {
|
|
17630
|
+
if (true && fiber.tag === ClassComponent) {
|
|
17631
|
+
warnAboutUpdateOnUnmounted(fiber);
|
|
17632
|
+
}
|
|
17633
|
+
return null;
|
|
17004
17634
|
}
|
|
17005
17635
|
|
|
17006
|
-
|
|
17007
|
-
|
|
17008
|
-
|
|
17009
|
-
|
|
17010
|
-
|
|
17011
|
-
|
|
17012
|
-
|
|
17013
|
-
interaction
|
|
17014
|
-
|
|
17636
|
+
if (enableSchedulerTracing) {
|
|
17637
|
+
var interactions = __interactionsRef.current;
|
|
17638
|
+
if (interactions.size > 0) {
|
|
17639
|
+
var pendingInteractionMap = root.pendingInteractionMap;
|
|
17640
|
+
var pendingInteractions = pendingInteractionMap.get(expirationTime);
|
|
17641
|
+
if (pendingInteractions != null) {
|
|
17642
|
+
interactions.forEach(function (interaction) {
|
|
17643
|
+
if (!pendingInteractions.has(interaction)) {
|
|
17644
|
+
// Update the pending async work count for previously unscheduled interaction.
|
|
17645
|
+
interaction.__count++;
|
|
17646
|
+
}
|
|
17015
17647
|
|
|
17016
|
-
|
|
17017
|
-
|
|
17018
|
-
|
|
17019
|
-
|
|
17648
|
+
pendingInteractions.add(interaction);
|
|
17649
|
+
});
|
|
17650
|
+
} else {
|
|
17651
|
+
pendingInteractionMap.set(expirationTime, new Set(interactions));
|
|
17020
17652
|
|
|
17021
|
-
|
|
17022
|
-
if (updateInteractionCounts) {
|
|
17653
|
+
// Update the pending async work count for the current interactions.
|
|
17023
17654
|
interactions.forEach(function (interaction) {
|
|
17024
17655
|
interaction.__count++;
|
|
17025
17656
|
});
|
|
17026
17657
|
}
|
|
17027
|
-
}
|
|
17028
17658
|
|
|
17029
|
-
|
|
17030
|
-
|
|
17031
|
-
|
|
17032
|
-
|
|
17659
|
+
var subscriber = __subscriberRef.current;
|
|
17660
|
+
if (subscriber !== null) {
|
|
17661
|
+
var threadID = computeThreadID(expirationTime, root.interactionThreadID);
|
|
17662
|
+
subscriber.onWorkScheduled(interactions, threadID);
|
|
17663
|
+
}
|
|
17033
17664
|
}
|
|
17034
17665
|
}
|
|
17666
|
+
|
|
17667
|
+
return root;
|
|
17035
17668
|
}
|
|
17036
17669
|
|
|
17037
17670
|
function scheduleWork(fiber, expirationTime) {
|
|
17038
|
-
recordScheduleUpdate();
|
|
17039
|
-
|
|
17040
|
-
{
|
|
17041
|
-
if (fiber.tag === ClassComponent || fiber.tag === ClassComponentLazy) {
|
|
17042
|
-
var instance = fiber.stateNode;
|
|
17043
|
-
warnAboutInvalidUpdates(instance);
|
|
17044
|
-
}
|
|
17045
|
-
}
|
|
17046
|
-
|
|
17047
17671
|
var root = scheduleWorkToRoot(fiber, expirationTime);
|
|
17048
17672
|
if (root === null) {
|
|
17049
|
-
if (true && (fiber.tag === ClassComponent || fiber.tag === ClassComponentLazy)) {
|
|
17050
|
-
warnAboutUpdateOnUnmounted(fiber);
|
|
17051
|
-
}
|
|
17052
17673
|
return;
|
|
17053
17674
|
}
|
|
17054
17675
|
|
|
17055
|
-
if (enableSchedulerTracing) {
|
|
17056
|
-
storeInteractionsForExpirationTime(root, expirationTime, true);
|
|
17057
|
-
}
|
|
17058
|
-
|
|
17059
17676
|
if (!isWorking && nextRenderExpirationTime !== NoWork && expirationTime < nextRenderExpirationTime) {
|
|
17060
17677
|
// This is an interruption. (Used for performance tracking.)
|
|
17061
17678
|
interruptedBy = fiber;
|
|
@@ -17138,7 +17755,7 @@ function scheduleCallbackWithExpirationTime(root, expirationTime) {
|
|
|
17138
17755
|
if (callbackID !== null) {
|
|
17139
17756
|
// Existing callback has insufficient timeout. Cancel and schedule a
|
|
17140
17757
|
// new one.
|
|
17141
|
-
|
|
17758
|
+
unstable_cancelCallback(callbackID);
|
|
17142
17759
|
}
|
|
17143
17760
|
}
|
|
17144
17761
|
// The request callback timer is already running. Don't start a new one.
|
|
@@ -17150,7 +17767,7 @@ function scheduleCallbackWithExpirationTime(root, expirationTime) {
|
|
|
17150
17767
|
var currentMs = unstable_now() - originalStartTimeMs;
|
|
17151
17768
|
var expirationTimeMs = expirationTimeToMs(expirationTime);
|
|
17152
17769
|
var timeout = expirationTimeMs - currentMs;
|
|
17153
|
-
callbackID =
|
|
17770
|
+
callbackID = unstable_scheduleCallback(performAsyncWork, { timeout: timeout });
|
|
17154
17771
|
}
|
|
17155
17772
|
|
|
17156
17773
|
// For every call to renderRoot, one of onFatal, onComplete, onSuspend, and
|
|
@@ -17168,7 +17785,7 @@ function onComplete(root, finishedWork, expirationTime) {
|
|
|
17168
17785
|
|
|
17169
17786
|
function onSuspend(root, finishedWork, suspendedExpirationTime, rootExpirationTime, msUntilTimeout) {
|
|
17170
17787
|
root.expirationTime = rootExpirationTime;
|
|
17171
|
-
if (
|
|
17788
|
+
if (msUntilTimeout === 0 && !shouldYield()) {
|
|
17172
17789
|
// Don't wait an additional tick. Commit the tree immediately.
|
|
17173
17790
|
root.pendingCommitExpirationTime = suspendedExpirationTime;
|
|
17174
17791
|
root.finishedWork = finishedWork;
|
|
@@ -17183,26 +17800,15 @@ function onYield(root) {
|
|
|
17183
17800
|
}
|
|
17184
17801
|
|
|
17185
17802
|
function onTimeout(root, finishedWork, suspendedExpirationTime) {
|
|
17186
|
-
|
|
17187
|
-
|
|
17188
|
-
|
|
17189
|
-
|
|
17190
|
-
|
|
17191
|
-
|
|
17192
|
-
|
|
17193
|
-
|
|
17194
|
-
|
|
17195
|
-
|
|
17196
|
-
if (enableSchedulerTracing) {
|
|
17197
|
-
// Don't update pending interaction counts for suspense timeouts,
|
|
17198
|
-
// Because we know we still need to do more work in this case.
|
|
17199
|
-
suspenseDidTimeout = true;
|
|
17200
|
-
flushRoot(root, suspendedExpirationTime);
|
|
17201
|
-
suspenseDidTimeout = false;
|
|
17202
|
-
} else {
|
|
17203
|
-
flushRoot(root, suspendedExpirationTime);
|
|
17204
|
-
}
|
|
17205
|
-
}
|
|
17803
|
+
// The root timed out. Commit it.
|
|
17804
|
+
root.pendingCommitExpirationTime = suspendedExpirationTime;
|
|
17805
|
+
root.finishedWork = finishedWork;
|
|
17806
|
+
// Read the current time before entering the commit phase. We can be
|
|
17807
|
+
// certain this won't cause tearing related to batching of event updates
|
|
17808
|
+
// because we're at the top of a timer event.
|
|
17809
|
+
recomputeCurrentRendererTime();
|
|
17810
|
+
currentSchedulerTime = currentRendererTime;
|
|
17811
|
+
flushRoot(root, suspendedExpirationTime);
|
|
17206
17812
|
}
|
|
17207
17813
|
|
|
17208
17814
|
function onCommit(root, expirationTime) {
|
|
@@ -17501,7 +18107,7 @@ function performWorkOnRoot(root, expirationTime, isExpired) {
|
|
|
17501
18107
|
// If this root previously suspended, clear its existing timeout, since
|
|
17502
18108
|
// we're about to try rendering again.
|
|
17503
18109
|
var timeoutHandle = root.timeoutHandle;
|
|
17504
|
-
if (
|
|
18110
|
+
if (timeoutHandle !== noTimeout) {
|
|
17505
18111
|
root.timeoutHandle = noTimeout;
|
|
17506
18112
|
// $FlowFixMe Complains noTimeout is not a TimeoutID, despite the check above
|
|
17507
18113
|
cancelTimeout(timeoutHandle);
|
|
@@ -17525,7 +18131,7 @@ function performWorkOnRoot(root, expirationTime, isExpired) {
|
|
|
17525
18131
|
// If this root previously suspended, clear its existing timeout, since
|
|
17526
18132
|
// we're about to try rendering again.
|
|
17527
18133
|
var _timeoutHandle = root.timeoutHandle;
|
|
17528
|
-
if (
|
|
18134
|
+
if (_timeoutHandle !== noTimeout) {
|
|
17529
18135
|
root.timeoutHandle = noTimeout;
|
|
17530
18136
|
// $FlowFixMe Complains noTimeout is not a TimeoutID, despite the check above
|
|
17531
18137
|
cancelTimeout(_timeoutHandle);
|
|
@@ -17709,9 +18315,11 @@ function flushControlled(fn) {
|
|
|
17709
18315
|
|
|
17710
18316
|
|
|
17711
18317
|
var didWarnAboutNestedUpdates = void 0;
|
|
18318
|
+
var didWarnAboutFindNodeInStrictMode = void 0;
|
|
17712
18319
|
|
|
17713
18320
|
{
|
|
17714
18321
|
didWarnAboutNestedUpdates = false;
|
|
18322
|
+
didWarnAboutFindNodeInStrictMode = {};
|
|
17715
18323
|
}
|
|
17716
18324
|
|
|
17717
18325
|
function getContextForSubtree(parentComponent) {
|
|
@@ -17727,11 +18335,6 @@ function getContextForSubtree(parentComponent) {
|
|
|
17727
18335
|
if (isContextProvider(Component)) {
|
|
17728
18336
|
return processChildContext(fiber, Component, parentContext);
|
|
17729
18337
|
}
|
|
17730
|
-
} else if (fiber.tag === ClassComponentLazy) {
|
|
17731
|
-
var _Component = getResultFromResolvedThenable(fiber.type);
|
|
17732
|
-
if (isContextProvider(_Component)) {
|
|
17733
|
-
return processChildContext(fiber, _Component, parentContext);
|
|
17734
|
-
}
|
|
17735
18338
|
}
|
|
17736
18339
|
|
|
17737
18340
|
return parentContext;
|
|
@@ -17803,8 +18406,38 @@ function findHostInstance(component) {
|
|
|
17803
18406
|
return hostFiber.stateNode;
|
|
17804
18407
|
}
|
|
17805
18408
|
|
|
17806
|
-
function
|
|
17807
|
-
|
|
18409
|
+
function findHostInstanceWithWarning(component, methodName) {
|
|
18410
|
+
{
|
|
18411
|
+
var fiber = get(component);
|
|
18412
|
+
if (fiber === undefined) {
|
|
18413
|
+
if (typeof component.render === 'function') {
|
|
18414
|
+
invariant(false, 'Unable to find node on an unmounted component.');
|
|
18415
|
+
} else {
|
|
18416
|
+
invariant(false, 'Argument appears to not be a ReactComponent. Keys: %s', Object.keys(component));
|
|
18417
|
+
}
|
|
18418
|
+
}
|
|
18419
|
+
var hostFiber = findCurrentHostFiber(fiber);
|
|
18420
|
+
if (hostFiber === null) {
|
|
18421
|
+
return null;
|
|
18422
|
+
}
|
|
18423
|
+
if (hostFiber.mode & StrictMode) {
|
|
18424
|
+
var componentName = getComponentName(fiber.type) || 'Component';
|
|
18425
|
+
if (!didWarnAboutFindNodeInStrictMode[componentName]) {
|
|
18426
|
+
didWarnAboutFindNodeInStrictMode[componentName] = true;
|
|
18427
|
+
if (fiber.mode & StrictMode) {
|
|
18428
|
+
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));
|
|
18429
|
+
} else {
|
|
18430
|
+
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));
|
|
18431
|
+
}
|
|
18432
|
+
}
|
|
18433
|
+
}
|
|
18434
|
+
return hostFiber.stateNode;
|
|
18435
|
+
}
|
|
18436
|
+
return findHostInstance(component);
|
|
18437
|
+
}
|
|
18438
|
+
|
|
18439
|
+
function createContainer(containerInfo, isConcurrent, hydrate) {
|
|
18440
|
+
return createFiberRoot(containerInfo, isConcurrent, hydrate);
|
|
17808
18441
|
}
|
|
17809
18442
|
|
|
17810
18443
|
function updateContainer(element, container, parentComponent, callback) {
|
|
@@ -17876,7 +18509,7 @@ implementation) {
|
|
|
17876
18509
|
|
|
17877
18510
|
// TODO: this is special because it gets imported during build.
|
|
17878
18511
|
|
|
17879
|
-
var ReactVersion = '16.
|
|
18512
|
+
var ReactVersion = '16.6.0';
|
|
17880
18513
|
|
|
17881
18514
|
// TODO: This type is shared between the reconciler and ReactDOM, but will
|
|
17882
18515
|
// eventually be lifted out to the renderer.
|
|
@@ -17919,10 +18552,6 @@ var didWarnAboutUnstableCreatePortal = false;
|
|
|
17919
18552
|
|
|
17920
18553
|
setRestoreImplementation(restoreControlledState$1);
|
|
17921
18554
|
|
|
17922
|
-
/* eslint-disable no-use-before-define */
|
|
17923
|
-
|
|
17924
|
-
/* eslint-enable no-use-before-define */
|
|
17925
|
-
|
|
17926
18555
|
function ReactBatch(root) {
|
|
17927
18556
|
var expirationTime = computeUniqueAsyncExpiration();
|
|
17928
18557
|
this._expirationTime = expirationTime;
|
|
@@ -18063,8 +18692,8 @@ ReactWork.prototype._onCommit = function () {
|
|
|
18063
18692
|
}
|
|
18064
18693
|
};
|
|
18065
18694
|
|
|
18066
|
-
function ReactRoot(container,
|
|
18067
|
-
var root = createContainer(container,
|
|
18695
|
+
function ReactRoot(container, isConcurrent, hydrate) {
|
|
18696
|
+
var root = createContainer(container, isConcurrent, hydrate);
|
|
18068
18697
|
this._internalRoot = root;
|
|
18069
18698
|
}
|
|
18070
18699
|
ReactRoot.prototype.render = function (children, callback) {
|
|
@@ -18187,8 +18816,8 @@ function legacyCreateRootFromDOMContainer(container, forceHydrate) {
|
|
|
18187
18816
|
}
|
|
18188
18817
|
}
|
|
18189
18818
|
// Legacy roots are not async by default.
|
|
18190
|
-
var
|
|
18191
|
-
return new ReactRoot(container,
|
|
18819
|
+
var isConcurrent = false;
|
|
18820
|
+
return new ReactRoot(container, isConcurrent, shouldHydrate);
|
|
18192
18821
|
}
|
|
18193
18822
|
|
|
18194
18823
|
function legacyRenderSubtreeIntoContainer(parentComponent, children, container, forceHydrate, callback) {
|
|
@@ -18264,7 +18893,9 @@ var ReactDOM = {
|
|
|
18264
18893
|
if (componentOrElement.nodeType === ELEMENT_NODE) {
|
|
18265
18894
|
return componentOrElement;
|
|
18266
18895
|
}
|
|
18267
|
-
|
|
18896
|
+
{
|
|
18897
|
+
return findHostInstanceWithWarning(componentOrElement, 'findDOMNode');
|
|
18898
|
+
}
|
|
18268
18899
|
return findHostInstance(componentOrElement);
|
|
18269
18900
|
},
|
|
18270
18901
|
hydrate: function (element, container, callback) {
|