react-test-renderer 16.6.0-alpha.8af6728 → 16.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/react-test-renderer-shallow.development.js +20 -14
- package/cjs/react-test-renderer-shallow.production.min.js +14 -14
- package/cjs/react-test-renderer.development.js +1073 -585
- package/cjs/react-test-renderer.production.min.js +132 -127
- package/package.json +4 -4
- package/umd/react-test-renderer-shallow.development.js +20 -14
- package/umd/react-test-renderer-shallow.production.min.js +12 -12
- package/umd/react-test-renderer.development.js +1073 -585
- package/umd/react-test-renderer.production.min.js +114 -110
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license React v16.6.0
|
|
1
|
+
/** @license React v16.6.0
|
|
2
2
|
* react-test-renderer.development.js
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
@@ -197,7 +197,8 @@ var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace;
|
|
|
197
197
|
var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
|
|
198
198
|
var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
|
|
199
199
|
var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
|
|
200
|
-
var
|
|
200
|
+
var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
|
|
201
|
+
var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
|
|
201
202
|
|
|
202
203
|
var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
|
|
203
204
|
var FAUX_ITERATOR_SYMBOL = '@@iterator';
|
|
@@ -217,12 +218,13 @@ var Pending = 0;
|
|
|
217
218
|
var Resolved = 1;
|
|
218
219
|
var Rejected = 2;
|
|
219
220
|
|
|
220
|
-
function
|
|
221
|
-
return
|
|
221
|
+
function refineResolvedLazyComponent(lazyComponent) {
|
|
222
|
+
return lazyComponent._status === Resolved ? lazyComponent._result : null;
|
|
222
223
|
}
|
|
223
224
|
|
|
224
|
-
function
|
|
225
|
-
|
|
225
|
+
function getWrappedName(outerType, innerType, wrapperName) {
|
|
226
|
+
var functionName = innerType.displayName || innerType.name || '';
|
|
227
|
+
return outerType.displayName || (functionName !== '' ? wrapperName + '(' + functionName + ')' : wrapperName);
|
|
226
228
|
}
|
|
227
229
|
|
|
228
230
|
function getComponentName(type) {
|
|
@@ -262,40 +264,40 @@ function getComponentName(type) {
|
|
|
262
264
|
case REACT_PROVIDER_TYPE:
|
|
263
265
|
return 'Context.Provider';
|
|
264
266
|
case REACT_FORWARD_REF_TYPE:
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
return type.
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
267
|
+
return getWrappedName(type, type.render, 'ForwardRef');
|
|
268
|
+
case REACT_MEMO_TYPE:
|
|
269
|
+
return getComponentName(type.type);
|
|
270
|
+
case REACT_LAZY_TYPE:
|
|
271
|
+
{
|
|
272
|
+
var thenable = type;
|
|
273
|
+
var resolvedThenable = refineResolvedLazyComponent(thenable);
|
|
274
|
+
if (resolvedThenable) {
|
|
275
|
+
return getComponentName(resolvedThenable);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
275
278
|
}
|
|
276
279
|
}
|
|
277
280
|
return null;
|
|
278
281
|
}
|
|
279
282
|
|
|
280
283
|
var FunctionComponent = 0;
|
|
281
|
-
var
|
|
282
|
-
var
|
|
283
|
-
var
|
|
284
|
-
var
|
|
285
|
-
var
|
|
286
|
-
var
|
|
287
|
-
var
|
|
288
|
-
var
|
|
289
|
-
var
|
|
290
|
-
var
|
|
291
|
-
var
|
|
292
|
-
var
|
|
293
|
-
var
|
|
294
|
-
var
|
|
295
|
-
var
|
|
296
|
-
var
|
|
297
|
-
var
|
|
298
|
-
var PureComponentLazy = 18;
|
|
284
|
+
var ClassComponent = 1;
|
|
285
|
+
var IndeterminateComponent = 2; // Before we know whether it is function or class
|
|
286
|
+
var HostRoot = 3; // Root of a host tree. Could be nested inside another node.
|
|
287
|
+
var HostPortal = 4; // A subtree. Could be an entry point to a different renderer.
|
|
288
|
+
var HostComponent = 5;
|
|
289
|
+
var HostText = 6;
|
|
290
|
+
var Fragment = 7;
|
|
291
|
+
var Mode = 8;
|
|
292
|
+
var ContextConsumer = 9;
|
|
293
|
+
var ContextProvider = 10;
|
|
294
|
+
var ForwardRef = 11;
|
|
295
|
+
var Profiler = 12;
|
|
296
|
+
var SuspenseComponent = 13;
|
|
297
|
+
var MemoComponent = 14;
|
|
298
|
+
var SimpleMemoComponent = 15;
|
|
299
|
+
var LazyComponent = 16;
|
|
300
|
+
var IncompleteClassComponent = 17;
|
|
299
301
|
|
|
300
302
|
// Don't change these two values. They're used by React Dev Tools.
|
|
301
303
|
var NoEffect = /* */0;
|
|
@@ -363,7 +365,7 @@ function isFiberMounted(fiber) {
|
|
|
363
365
|
function isMounted(component) {
|
|
364
366
|
{
|
|
365
367
|
var owner = ReactCurrentOwner.current;
|
|
366
|
-
if (owner !== null &&
|
|
368
|
+
if (owner !== null && owner.tag === ClassComponent) {
|
|
367
369
|
var ownerFiber = owner;
|
|
368
370
|
var instance = ownerFiber.stateNode;
|
|
369
371
|
!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;
|
|
@@ -650,6 +652,9 @@ var createContainerChildSet = shim;
|
|
|
650
652
|
var appendChildToContainerChildSet = shim;
|
|
651
653
|
var finalizeContainerChildren = shim;
|
|
652
654
|
var replaceContainerChildren = shim;
|
|
655
|
+
var cloneHiddenInstance = shim;
|
|
656
|
+
var cloneUnhiddenInstance = shim;
|
|
657
|
+
var createHiddenTextInstance = shim;
|
|
653
658
|
|
|
654
659
|
// Renderers that don't support hydration
|
|
655
660
|
// can re-export everything from this module.
|
|
@@ -740,6 +745,7 @@ function createInstance(type, props, rootContainerInstance, hostContext, interna
|
|
|
740
745
|
return {
|
|
741
746
|
type: type,
|
|
742
747
|
props: props,
|
|
748
|
+
isHidden: false,
|
|
743
749
|
children: [],
|
|
744
750
|
rootContainerInstance: rootContainerInstance,
|
|
745
751
|
tag: 'INSTANCE'
|
|
@@ -773,6 +779,7 @@ function shouldDeprioritizeSubtree(type, props) {
|
|
|
773
779
|
function createTextInstance(text, rootContainerInstance, hostContext, internalInstanceHandle) {
|
|
774
780
|
return {
|
|
775
781
|
text: text,
|
|
782
|
+
isHidden: false,
|
|
776
783
|
tag: 'TEXT'
|
|
777
784
|
};
|
|
778
785
|
}
|
|
@@ -815,6 +822,22 @@ var appendChildToContainer = appendChild;
|
|
|
815
822
|
var insertInContainerBefore = insertBefore;
|
|
816
823
|
var removeChildFromContainer = removeChild;
|
|
817
824
|
|
|
825
|
+
function hideInstance(instance) {
|
|
826
|
+
instance.isHidden = true;
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
function hideTextInstance(textInstance) {
|
|
830
|
+
textInstance.isHidden = true;
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
function unhideInstance(instance, props) {
|
|
834
|
+
instance.isHidden = false;
|
|
835
|
+
}
|
|
836
|
+
|
|
837
|
+
function unhideTextInstance(textInstance, text) {
|
|
838
|
+
textInstance.isHidden = false;
|
|
839
|
+
}
|
|
840
|
+
|
|
818
841
|
var BEFORE_SLASH_RE = /^(.*)[\\\/]/;
|
|
819
842
|
|
|
820
843
|
var describeComponentFrame = function (name, source, ownerName) {
|
|
@@ -848,10 +871,9 @@ var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
|
848
871
|
function describeFiber(fiber) {
|
|
849
872
|
switch (fiber.tag) {
|
|
850
873
|
case IndeterminateComponent:
|
|
874
|
+
case LazyComponent:
|
|
851
875
|
case FunctionComponent:
|
|
852
|
-
case FunctionComponentLazy:
|
|
853
876
|
case ClassComponent:
|
|
854
|
-
case ClassComponentLazy:
|
|
855
877
|
case HostComponent:
|
|
856
878
|
case Mode:
|
|
857
879
|
var owner = fiber._debugOwner;
|
|
@@ -1194,7 +1216,7 @@ function stopFailedWorkTimer(fiber) {
|
|
|
1194
1216
|
return;
|
|
1195
1217
|
}
|
|
1196
1218
|
fiber._debugIsCurrentlyTiming = false;
|
|
1197
|
-
var warning = 'An error was thrown inside this error boundary';
|
|
1219
|
+
var warning = fiber.tag === SuspenseComponent ? 'Rendering was suspended' : 'An error was thrown inside this error boundary';
|
|
1198
1220
|
endFiberMark(fiber, null, warning);
|
|
1199
1221
|
}
|
|
1200
1222
|
}
|
|
@@ -1616,7 +1638,7 @@ function invalidateContextProvider(workInProgress, type, didChange) {
|
|
|
1616
1638
|
function findCurrentUnmaskedContext(fiber) {
|
|
1617
1639
|
// Currently this is only used with renderSubtreeIntoContainer; not sure if it
|
|
1618
1640
|
// makes sense elsewhere
|
|
1619
|
-
!(isFiberMounted(fiber) &&
|
|
1641
|
+
!(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;
|
|
1620
1642
|
|
|
1621
1643
|
var node = fiber;
|
|
1622
1644
|
do {
|
|
@@ -1631,14 +1653,6 @@ function findCurrentUnmaskedContext(fiber) {
|
|
|
1631
1653
|
}
|
|
1632
1654
|
break;
|
|
1633
1655
|
}
|
|
1634
|
-
case ClassComponentLazy:
|
|
1635
|
-
{
|
|
1636
|
-
var _Component = getResultFromResolvedThenable(node.type);
|
|
1637
|
-
if (isContextProvider(_Component)) {
|
|
1638
|
-
return node.stateNode.__reactInternalMemoizedMergedChildContext;
|
|
1639
|
-
}
|
|
1640
|
-
break;
|
|
1641
|
-
}
|
|
1642
1656
|
}
|
|
1643
1657
|
node = node.return;
|
|
1644
1658
|
} while (node !== null);
|
|
@@ -1807,6 +1821,7 @@ function FiberNode(tag, pendingProps, key, mode) {
|
|
|
1807
1821
|
// Instance
|
|
1808
1822
|
this.tag = tag;
|
|
1809
1823
|
this.key = key;
|
|
1824
|
+
this.elementType = null;
|
|
1810
1825
|
this.type = null;
|
|
1811
1826
|
this.stateNode = null;
|
|
1812
1827
|
|
|
@@ -1879,16 +1894,20 @@ function shouldConstruct(Component) {
|
|
|
1879
1894
|
return !!(prototype && prototype.isReactComponent);
|
|
1880
1895
|
}
|
|
1881
1896
|
|
|
1882
|
-
function
|
|
1897
|
+
function isSimpleFunctionComponent(type) {
|
|
1898
|
+
return typeof type === 'function' && !shouldConstruct(type) && type.defaultProps === undefined;
|
|
1899
|
+
}
|
|
1900
|
+
|
|
1901
|
+
function resolveLazyComponentTag(Component) {
|
|
1883
1902
|
if (typeof Component === 'function') {
|
|
1884
|
-
return shouldConstruct(Component) ?
|
|
1903
|
+
return shouldConstruct(Component) ? ClassComponent : FunctionComponent;
|
|
1885
1904
|
} else if (Component !== undefined && Component !== null) {
|
|
1886
1905
|
var $$typeof = Component.$$typeof;
|
|
1887
1906
|
if ($$typeof === REACT_FORWARD_REF_TYPE) {
|
|
1888
|
-
return
|
|
1907
|
+
return ForwardRef;
|
|
1889
1908
|
}
|
|
1890
|
-
if ($$typeof ===
|
|
1891
|
-
return
|
|
1909
|
+
if ($$typeof === REACT_MEMO_TYPE) {
|
|
1910
|
+
return MemoComponent;
|
|
1892
1911
|
}
|
|
1893
1912
|
}
|
|
1894
1913
|
return IndeterminateComponent;
|
|
@@ -1904,6 +1923,7 @@ function createWorkInProgress(current, pendingProps, expirationTime) {
|
|
|
1904
1923
|
// extra objects for things that are never updated. It also allow us to
|
|
1905
1924
|
// reclaim the extra memory if needed.
|
|
1906
1925
|
workInProgress = createFiber(current.tag, pendingProps, current.key, current.mode);
|
|
1926
|
+
workInProgress.elementType = current.elementType;
|
|
1907
1927
|
workInProgress.type = current.type;
|
|
1908
1928
|
workInProgress.stateNode = current.stateNode;
|
|
1909
1929
|
|
|
@@ -1973,20 +1993,17 @@ function createHostRootFiber(isConcurrent) {
|
|
|
1973
1993
|
return createFiber(HostRoot, null, null, mode);
|
|
1974
1994
|
}
|
|
1975
1995
|
|
|
1976
|
-
function
|
|
1977
|
-
|
|
1978
|
-
{
|
|
1979
|
-
owner = element._owner;
|
|
1980
|
-
}
|
|
1981
|
-
|
|
1996
|
+
function createFiberFromTypeAndProps(type, // React$ElementType
|
|
1997
|
+
key, pendingProps, owner, mode, expirationTime) {
|
|
1982
1998
|
var fiber = void 0;
|
|
1983
|
-
var type = element.type;
|
|
1984
|
-
var key = element.key;
|
|
1985
|
-
var pendingProps = element.props;
|
|
1986
1999
|
|
|
1987
|
-
var fiberTag =
|
|
2000
|
+
var fiberTag = IndeterminateComponent;
|
|
2001
|
+
// The resolved type is set if we know what the final type will be. I.e. it's not lazy.
|
|
2002
|
+
var resolvedType = type;
|
|
1988
2003
|
if (typeof type === 'function') {
|
|
1989
|
-
|
|
2004
|
+
if (shouldConstruct(type)) {
|
|
2005
|
+
fiberTag = ClassComponent;
|
|
2006
|
+
}
|
|
1990
2007
|
} else if (typeof type === 'string') {
|
|
1991
2008
|
fiberTag = HostComponent;
|
|
1992
2009
|
} else {
|
|
@@ -1994,18 +2011,13 @@ function createFiberFromElement(element, mode, expirationTime) {
|
|
|
1994
2011
|
case REACT_FRAGMENT_TYPE:
|
|
1995
2012
|
return createFiberFromFragment(pendingProps.children, mode, expirationTime, key);
|
|
1996
2013
|
case REACT_CONCURRENT_MODE_TYPE:
|
|
1997
|
-
|
|
1998
|
-
mode |= ConcurrentMode | StrictMode;
|
|
1999
|
-
break;
|
|
2014
|
+
return createFiberFromMode(pendingProps, mode | ConcurrentMode | StrictMode, expirationTime, key);
|
|
2000
2015
|
case REACT_STRICT_MODE_TYPE:
|
|
2001
|
-
|
|
2002
|
-
mode |= StrictMode;
|
|
2003
|
-
break;
|
|
2016
|
+
return createFiberFromMode(pendingProps, mode | StrictMode, expirationTime, key);
|
|
2004
2017
|
case REACT_PROFILER_TYPE:
|
|
2005
2018
|
return createFiberFromProfiler(pendingProps, mode, expirationTime, key);
|
|
2006
2019
|
case REACT_SUSPENSE_TYPE:
|
|
2007
|
-
|
|
2008
|
-
break;
|
|
2020
|
+
return createFiberFromSuspense(pendingProps, mode, expirationTime, key);
|
|
2009
2021
|
default:
|
|
2010
2022
|
{
|
|
2011
2023
|
if (typeof type === 'object' && type !== null) {
|
|
@@ -2020,16 +2032,13 @@ function createFiberFromElement(element, mode, expirationTime) {
|
|
|
2020
2032
|
case REACT_FORWARD_REF_TYPE:
|
|
2021
2033
|
fiberTag = ForwardRef;
|
|
2022
2034
|
break getTag;
|
|
2023
|
-
case
|
|
2024
|
-
fiberTag =
|
|
2035
|
+
case REACT_MEMO_TYPE:
|
|
2036
|
+
fiberTag = MemoComponent;
|
|
2037
|
+
break getTag;
|
|
2038
|
+
case REACT_LAZY_TYPE:
|
|
2039
|
+
fiberTag = LazyComponent;
|
|
2040
|
+
resolvedType = null;
|
|
2025
2041
|
break getTag;
|
|
2026
|
-
default:
|
|
2027
|
-
{
|
|
2028
|
-
if (typeof type.then === 'function') {
|
|
2029
|
-
fiberTag = IndeterminateComponent;
|
|
2030
|
-
break getTag;
|
|
2031
|
-
}
|
|
2032
|
-
}
|
|
2033
2042
|
}
|
|
2034
2043
|
}
|
|
2035
2044
|
var info = '';
|
|
@@ -2048,14 +2057,26 @@ function createFiberFromElement(element, mode, expirationTime) {
|
|
|
2048
2057
|
}
|
|
2049
2058
|
|
|
2050
2059
|
fiber = createFiber(fiberTag, pendingProps, key, mode);
|
|
2051
|
-
fiber.
|
|
2060
|
+
fiber.elementType = type;
|
|
2061
|
+
fiber.type = resolvedType;
|
|
2052
2062
|
fiber.expirationTime = expirationTime;
|
|
2053
2063
|
|
|
2064
|
+
return fiber;
|
|
2065
|
+
}
|
|
2066
|
+
|
|
2067
|
+
function createFiberFromElement(element, mode, expirationTime) {
|
|
2068
|
+
var owner = null;
|
|
2069
|
+
{
|
|
2070
|
+
owner = element._owner;
|
|
2071
|
+
}
|
|
2072
|
+
var type = element.type;
|
|
2073
|
+
var key = element.key;
|
|
2074
|
+
var pendingProps = element.props;
|
|
2075
|
+
var fiber = createFiberFromTypeAndProps(type, key, pendingProps, owner, mode, expirationTime);
|
|
2054
2076
|
{
|
|
2055
2077
|
fiber._debugSource = element._source;
|
|
2056
2078
|
fiber._debugOwner = element._owner;
|
|
2057
2079
|
}
|
|
2058
|
-
|
|
2059
2080
|
return fiber;
|
|
2060
2081
|
}
|
|
2061
2082
|
|
|
@@ -2073,12 +2094,38 @@ function createFiberFromProfiler(pendingProps, mode, expirationTime, key) {
|
|
|
2073
2094
|
}
|
|
2074
2095
|
|
|
2075
2096
|
var fiber = createFiber(Profiler, pendingProps, key, mode | ProfileMode);
|
|
2097
|
+
// TODO: The Profiler fiber shouldn't have a type. It has a tag.
|
|
2098
|
+
fiber.elementType = REACT_PROFILER_TYPE;
|
|
2076
2099
|
fiber.type = REACT_PROFILER_TYPE;
|
|
2077
2100
|
fiber.expirationTime = expirationTime;
|
|
2078
2101
|
|
|
2079
2102
|
return fiber;
|
|
2080
2103
|
}
|
|
2081
2104
|
|
|
2105
|
+
function createFiberFromMode(pendingProps, mode, expirationTime, key) {
|
|
2106
|
+
var fiber = createFiber(Mode, pendingProps, key, mode);
|
|
2107
|
+
|
|
2108
|
+
// TODO: The Mode fiber shouldn't have a type. It has a tag.
|
|
2109
|
+
var type = (mode & ConcurrentMode) === NoContext ? REACT_STRICT_MODE_TYPE : REACT_CONCURRENT_MODE_TYPE;
|
|
2110
|
+
fiber.elementType = type;
|
|
2111
|
+
fiber.type = type;
|
|
2112
|
+
|
|
2113
|
+
fiber.expirationTime = expirationTime;
|
|
2114
|
+
return fiber;
|
|
2115
|
+
}
|
|
2116
|
+
|
|
2117
|
+
function createFiberFromSuspense(pendingProps, mode, expirationTime, key) {
|
|
2118
|
+
var fiber = createFiber(SuspenseComponent, pendingProps, key, mode);
|
|
2119
|
+
|
|
2120
|
+
// TODO: The SuspenseComponent fiber shouldn't have a type. It has a tag.
|
|
2121
|
+
var type = REACT_SUSPENSE_TYPE;
|
|
2122
|
+
fiber.elementType = type;
|
|
2123
|
+
fiber.type = type;
|
|
2124
|
+
|
|
2125
|
+
fiber.expirationTime = expirationTime;
|
|
2126
|
+
return fiber;
|
|
2127
|
+
}
|
|
2128
|
+
|
|
2082
2129
|
function createFiberFromText(content, mode, expirationTime) {
|
|
2083
2130
|
var fiber = createFiber(HostText, content, null, mode);
|
|
2084
2131
|
fiber.expirationTime = expirationTime;
|
|
@@ -2087,6 +2134,8 @@ function createFiberFromText(content, mode, expirationTime) {
|
|
|
2087
2134
|
|
|
2088
2135
|
function createFiberFromHostInstanceForDeletion() {
|
|
2089
2136
|
var fiber = createFiber(HostComponent, null, null, NoContext);
|
|
2137
|
+
// TODO: These should not need a type.
|
|
2138
|
+
fiber.elementType = 'DELETED';
|
|
2090
2139
|
fiber.type = 'DELETED';
|
|
2091
2140
|
return fiber;
|
|
2092
2141
|
}
|
|
@@ -2119,6 +2168,7 @@ function assignFiberPropertiesInDEV(target, source) {
|
|
|
2119
2168
|
|
|
2120
2169
|
target.tag = source.tag;
|
|
2121
2170
|
target.key = source.key;
|
|
2171
|
+
target.elementType = source.elementType;
|
|
2122
2172
|
target.type = source.type;
|
|
2123
2173
|
target.stateNode = source.stateNode;
|
|
2124
2174
|
target.return = source.return;
|
|
@@ -3196,7 +3246,7 @@ function enqueueUpdate(fiber, update) {
|
|
|
3196
3246
|
}
|
|
3197
3247
|
|
|
3198
3248
|
{
|
|
3199
|
-
if (
|
|
3249
|
+
if (fiber.tag === ClassComponent && (currentlyProcessingQueue === queue1 || queue2 !== null && currentlyProcessingQueue === queue2) && !didWarnUpdateInsideUpdate) {
|
|
3200
3250
|
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.');
|
|
3201
3251
|
didWarnUpdateInsideUpdate = true;
|
|
3202
3252
|
}
|
|
@@ -3569,7 +3619,7 @@ function propagateContextChange(workInProgress, context, changedBits, renderExpi
|
|
|
3569
3619
|
if (dependency.context === context && (dependency.observedBits & changedBits) !== 0) {
|
|
3570
3620
|
// Match! Schedule an update on this fiber.
|
|
3571
3621
|
|
|
3572
|
-
if (fiber.tag === ClassComponent
|
|
3622
|
+
if (fiber.tag === ClassComponent) {
|
|
3573
3623
|
// Schedule a force update on the work-in-progress.
|
|
3574
3624
|
var update = createUpdate(renderExpirationTime);
|
|
3575
3625
|
update.tag = ForceUpdate;
|
|
@@ -3676,7 +3726,7 @@ function readContext(context, observedBits) {
|
|
|
3676
3726
|
};
|
|
3677
3727
|
|
|
3678
3728
|
if (lastContextDependency === null) {
|
|
3679
|
-
!(currentlyRenderingFiber !== null) ? invariant(false, 'Context
|
|
3729
|
+
!(currentlyRenderingFiber !== null) ? invariant(false, 'Context can only be read while React is rendering, e.g. inside the render method or getDerivedStateFromProps.') : void 0;
|
|
3680
3730
|
// This is the first dependency in the list
|
|
3681
3731
|
currentlyRenderingFiber.firstContextDependency = lastContextDependency = contextItem;
|
|
3682
3732
|
} else {
|
|
@@ -3861,6 +3911,13 @@ function shallowEqual(objA, objB) {
|
|
|
3861
3911
|
return true;
|
|
3862
3912
|
}
|
|
3863
3913
|
|
|
3914
|
+
var ReactCurrentOwner$3 = ReactSharedInternals.ReactCurrentOwner;
|
|
3915
|
+
|
|
3916
|
+
function readContext$1(contextType) {
|
|
3917
|
+
var dispatcher = ReactCurrentOwner$3.currentDispatcher;
|
|
3918
|
+
return dispatcher.readContext(contextType);
|
|
3919
|
+
}
|
|
3920
|
+
|
|
3864
3921
|
var fakeInternalInstance = {};
|
|
3865
3922
|
var isArray$1 = Array.isArray;
|
|
3866
3923
|
|
|
@@ -4118,13 +4175,13 @@ function constructClassInstance(workInProgress, ctor, props, renderExpirationTim
|
|
|
4118
4175
|
var contextType = ctor.contextType;
|
|
4119
4176
|
if (typeof contextType === 'object' && contextType !== null) {
|
|
4120
4177
|
{
|
|
4121
|
-
if (typeof
|
|
4178
|
+
if (contextType.$$typeof !== REACT_CONTEXT_TYPE && !didWarnAboutInvalidateContextType.has(ctor)) {
|
|
4122
4179
|
didWarnAboutInvalidateContextType.add(ctor);
|
|
4123
4180
|
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');
|
|
4124
4181
|
}
|
|
4125
4182
|
}
|
|
4126
4183
|
|
|
4127
|
-
context = contextType
|
|
4184
|
+
context = readContext$1(contextType);
|
|
4128
4185
|
} else {
|
|
4129
4186
|
unmaskedContext = getUnmaskedContext(workInProgress, ctor, true);
|
|
4130
4187
|
var contextTypes = ctor.contextTypes;
|
|
@@ -4251,7 +4308,7 @@ function mountClassInstance(workInProgress, ctor, newProps, renderExpirationTime
|
|
|
4251
4308
|
|
|
4252
4309
|
var contextType = ctor.contextType;
|
|
4253
4310
|
if (typeof contextType === 'object' && contextType !== null) {
|
|
4254
|
-
instance.context = contextType
|
|
4311
|
+
instance.context = readContext$1(contextType);
|
|
4255
4312
|
} else {
|
|
4256
4313
|
var unmaskedContext = getUnmaskedContext(workInProgress, ctor, true);
|
|
4257
4314
|
instance.context = getMaskedContext(workInProgress, unmaskedContext);
|
|
@@ -4317,7 +4374,7 @@ function resumeMountClassInstance(workInProgress, ctor, newProps, renderExpirati
|
|
|
4317
4374
|
var contextType = ctor.contextType;
|
|
4318
4375
|
var nextContext = void 0;
|
|
4319
4376
|
if (typeof contextType === 'object' && contextType !== null) {
|
|
4320
|
-
nextContext = contextType
|
|
4377
|
+
nextContext = readContext$1(contextType);
|
|
4321
4378
|
} else {
|
|
4322
4379
|
var nextLegacyUnmaskedContext = getUnmaskedContext(workInProgress, ctor, true);
|
|
4323
4380
|
nextContext = getMaskedContext(workInProgress, nextLegacyUnmaskedContext);
|
|
@@ -4412,7 +4469,7 @@ function updateClassInstance(current, workInProgress, ctor, newProps, renderExpi
|
|
|
4412
4469
|
var contextType = ctor.contextType;
|
|
4413
4470
|
var nextContext = void 0;
|
|
4414
4471
|
if (typeof contextType === 'object' && contextType !== null) {
|
|
4415
|
-
nextContext = contextType
|
|
4472
|
+
nextContext = readContext$1(contextType);
|
|
4416
4473
|
} else {
|
|
4417
4474
|
var nextUnmaskedContext = getUnmaskedContext(workInProgress, ctor, true);
|
|
4418
4475
|
nextContext = getMaskedContext(workInProgress, nextUnmaskedContext);
|
|
@@ -4574,7 +4631,7 @@ function coerceRef(returnFiber, current$$1, element) {
|
|
|
4574
4631
|
var inst = void 0;
|
|
4575
4632
|
if (owner) {
|
|
4576
4633
|
var ownerFiber = owner;
|
|
4577
|
-
!(ownerFiber.tag === ClassComponent
|
|
4634
|
+
!(ownerFiber.tag === ClassComponent) ? invariant(false, 'Function components cannot have refs.') : void 0;
|
|
4578
4635
|
inst = ownerFiber.stateNode;
|
|
4579
4636
|
}
|
|
4580
4637
|
!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;
|
|
@@ -4742,7 +4799,7 @@ function ChildReconciler(shouldTrackSideEffects) {
|
|
|
4742
4799
|
}
|
|
4743
4800
|
|
|
4744
4801
|
function updateElement(returnFiber, current$$1, element, expirationTime) {
|
|
4745
|
-
if (current$$1 !== null && current$$1.
|
|
4802
|
+
if (current$$1 !== null && current$$1.elementType === element.type) {
|
|
4746
4803
|
// Move based on index
|
|
4747
4804
|
var existing = useFiber(current$$1, element.props, expirationTime);
|
|
4748
4805
|
existing.ref = coerceRef(returnFiber, current$$1, element);
|
|
@@ -5284,7 +5341,7 @@ function ChildReconciler(shouldTrackSideEffects) {
|
|
|
5284
5341
|
// TODO: If key === null and child.key === null, then this only applies to
|
|
5285
5342
|
// the first item in the list.
|
|
5286
5343
|
if (child.key === key) {
|
|
5287
|
-
if (child.tag === Fragment ? element.type === REACT_FRAGMENT_TYPE : child.
|
|
5344
|
+
if (child.tag === Fragment ? element.type === REACT_FRAGMENT_TYPE : child.elementType === element.type) {
|
|
5288
5345
|
deleteRemainingChildren(returnFiber, child.sibling);
|
|
5289
5346
|
var existing = useFiber(child, element.type === REACT_FRAGMENT_TYPE ? element.props.children : element.props, expirationTime);
|
|
5290
5347
|
existing.ref = coerceRef(returnFiber, child, element);
|
|
@@ -5399,7 +5456,6 @@ function ChildReconciler(shouldTrackSideEffects) {
|
|
|
5399
5456
|
// we already threw above.
|
|
5400
5457
|
switch (returnFiber.tag) {
|
|
5401
5458
|
case ClassComponent:
|
|
5402
|
-
case ClassComponentLazy:
|
|
5403
5459
|
{
|
|
5404
5460
|
{
|
|
5405
5461
|
var instance = returnFiber.stateNode;
|
|
@@ -5714,40 +5770,49 @@ function resetHydrationState() {
|
|
|
5714
5770
|
isHydrating = false;
|
|
5715
5771
|
}
|
|
5716
5772
|
|
|
5717
|
-
function readLazyComponentType(
|
|
5718
|
-
var status =
|
|
5773
|
+
function readLazyComponentType(lazyComponent) {
|
|
5774
|
+
var status = lazyComponent._status;
|
|
5775
|
+
var result = lazyComponent._result;
|
|
5719
5776
|
switch (status) {
|
|
5720
5777
|
case Resolved:
|
|
5721
|
-
|
|
5722
|
-
|
|
5778
|
+
{
|
|
5779
|
+
var Component = result;
|
|
5780
|
+
return Component;
|
|
5781
|
+
}
|
|
5723
5782
|
case Rejected:
|
|
5724
|
-
|
|
5783
|
+
{
|
|
5784
|
+
var error = result;
|
|
5785
|
+
throw error;
|
|
5786
|
+
}
|
|
5725
5787
|
case Pending:
|
|
5726
|
-
|
|
5788
|
+
{
|
|
5789
|
+
var thenable = result;
|
|
5790
|
+
throw thenable;
|
|
5791
|
+
}
|
|
5727
5792
|
default:
|
|
5728
5793
|
{
|
|
5729
|
-
|
|
5730
|
-
|
|
5731
|
-
|
|
5732
|
-
|
|
5733
|
-
|
|
5734
|
-
|
|
5735
|
-
|
|
5736
|
-
|
|
5737
|
-
|
|
5738
|
-
|
|
5739
|
-
} else {
|
|
5740
|
-
resolvedValue = resolvedValue;
|
|
5794
|
+
lazyComponent._status = Pending;
|
|
5795
|
+
var ctor = lazyComponent._ctor;
|
|
5796
|
+
var _thenable = ctor();
|
|
5797
|
+
_thenable.then(function (moduleObject) {
|
|
5798
|
+
if (lazyComponent._status === Pending) {
|
|
5799
|
+
var defaultExport = moduleObject.default;
|
|
5800
|
+
{
|
|
5801
|
+
if (defaultExport === undefined) {
|
|
5802
|
+
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);
|
|
5803
|
+
}
|
|
5741
5804
|
}
|
|
5742
|
-
|
|
5805
|
+
lazyComponent._status = Resolved;
|
|
5806
|
+
lazyComponent._result = defaultExport;
|
|
5743
5807
|
}
|
|
5744
5808
|
}, function (error) {
|
|
5745
|
-
if (
|
|
5746
|
-
|
|
5747
|
-
|
|
5809
|
+
if (lazyComponent._status === Pending) {
|
|
5810
|
+
lazyComponent._status = Rejected;
|
|
5811
|
+
lazyComponent._result = error;
|
|
5748
5812
|
}
|
|
5749
5813
|
});
|
|
5750
|
-
|
|
5814
|
+
lazyComponent._result = _thenable;
|
|
5815
|
+
throw _thenable;
|
|
5751
5816
|
}
|
|
5752
5817
|
}
|
|
5753
5818
|
}
|
|
@@ -5823,51 +5888,64 @@ function updateForwardRef(current$$1, workInProgress, type, nextProps, renderExp
|
|
|
5823
5888
|
}
|
|
5824
5889
|
|
|
5825
5890
|
reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
|
|
5826
|
-
memoizeProps(workInProgress, nextProps);
|
|
5827
5891
|
return workInProgress.child;
|
|
5828
5892
|
}
|
|
5829
5893
|
|
|
5830
|
-
function
|
|
5831
|
-
|
|
5832
|
-
|
|
5833
|
-
|
|
5834
|
-
|
|
5894
|
+
function updateMemoComponent(current$$1, workInProgress, Component, nextProps, updateExpirationTime, renderExpirationTime) {
|
|
5895
|
+
if (current$$1 === null) {
|
|
5896
|
+
var type = Component.type;
|
|
5897
|
+
if (isSimpleFunctionComponent(type) && Component.compare === null) {
|
|
5898
|
+
// If this is a plain function component without default props,
|
|
5899
|
+
// and with only the default shallow comparison, we upgrade it
|
|
5900
|
+
// to a SimpleMemoComponent to allow fast path updates.
|
|
5901
|
+
workInProgress.tag = SimpleMemoComponent;
|
|
5902
|
+
workInProgress.type = type;
|
|
5903
|
+
return updateSimpleMemoComponent(current$$1, workInProgress, type, nextProps, updateExpirationTime, renderExpirationTime);
|
|
5904
|
+
}
|
|
5905
|
+
var child = createFiberFromTypeAndProps(Component.type, null, nextProps, null, workInProgress.mode, renderExpirationTime);
|
|
5906
|
+
child.ref = workInProgress.ref;
|
|
5907
|
+
child.return = workInProgress;
|
|
5908
|
+
workInProgress.child = child;
|
|
5909
|
+
return child;
|
|
5910
|
+
}
|
|
5911
|
+
var currentChild = current$$1.child; // This is always exactly one child
|
|
5912
|
+
if (updateExpirationTime === NoWork || updateExpirationTime > renderExpirationTime) {
|
|
5913
|
+
// This will be the props with resolved defaultProps,
|
|
5914
|
+
// unlike current.memoizedProps which will be the unresolved ones.
|
|
5915
|
+
var prevProps = currentChild.memoizedProps;
|
|
5835
5916
|
// Default to shallow comparison
|
|
5836
5917
|
var compare = Component.compare;
|
|
5837
5918
|
compare = compare !== null ? compare : shallowEqual;
|
|
5838
|
-
if (compare(prevProps, nextProps)) {
|
|
5919
|
+
if (compare(prevProps, nextProps) && current$$1.ref === workInProgress.ref) {
|
|
5839
5920
|
return bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
|
|
5840
5921
|
}
|
|
5841
5922
|
}
|
|
5923
|
+
var newChild = createWorkInProgress(currentChild, nextProps, renderExpirationTime);
|
|
5924
|
+
newChild.ref = workInProgress.ref;
|
|
5925
|
+
newChild.return = workInProgress;
|
|
5926
|
+
workInProgress.child = newChild;
|
|
5927
|
+
return newChild;
|
|
5928
|
+
}
|
|
5842
5929
|
|
|
5843
|
-
|
|
5844
|
-
|
|
5845
|
-
|
|
5846
|
-
|
|
5847
|
-
|
|
5848
|
-
|
|
5849
|
-
nextChildren = render(nextProps);
|
|
5850
|
-
setCurrentPhase(null);
|
|
5930
|
+
function updateSimpleMemoComponent(current$$1, workInProgress, Component, nextProps, updateExpirationTime, renderExpirationTime) {
|
|
5931
|
+
if (current$$1 !== null && (updateExpirationTime === NoWork || updateExpirationTime > renderExpirationTime)) {
|
|
5932
|
+
var prevProps = current$$1.memoizedProps;
|
|
5933
|
+
if (shallowEqual(prevProps, nextProps) && current$$1.ref === workInProgress.ref) {
|
|
5934
|
+
return bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
|
|
5935
|
+
}
|
|
5851
5936
|
}
|
|
5852
|
-
|
|
5853
|
-
// React DevTools reads this flag.
|
|
5854
|
-
workInProgress.effectTag |= PerformedWork;
|
|
5855
|
-
reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
|
|
5856
|
-
memoizeProps(workInProgress, nextProps);
|
|
5857
|
-
return workInProgress.child;
|
|
5937
|
+
return updateFunctionComponent(current$$1, workInProgress, Component, nextProps, renderExpirationTime);
|
|
5858
5938
|
}
|
|
5859
5939
|
|
|
5860
5940
|
function updateFragment(current$$1, workInProgress, renderExpirationTime) {
|
|
5861
5941
|
var nextChildren = workInProgress.pendingProps;
|
|
5862
5942
|
reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
|
|
5863
|
-
memoizeProps(workInProgress, nextChildren);
|
|
5864
5943
|
return workInProgress.child;
|
|
5865
5944
|
}
|
|
5866
5945
|
|
|
5867
5946
|
function updateMode(current$$1, workInProgress, renderExpirationTime) {
|
|
5868
5947
|
var nextChildren = workInProgress.pendingProps.children;
|
|
5869
5948
|
reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
|
|
5870
|
-
memoizeProps(workInProgress, nextChildren);
|
|
5871
5949
|
return workInProgress.child;
|
|
5872
5950
|
}
|
|
5873
5951
|
|
|
@@ -5878,7 +5956,6 @@ function updateProfiler(current$$1, workInProgress, renderExpirationTime) {
|
|
|
5878
5956
|
var nextProps = workInProgress.pendingProps;
|
|
5879
5957
|
var nextChildren = nextProps.children;
|
|
5880
5958
|
reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
|
|
5881
|
-
memoizeProps(workInProgress, nextProps);
|
|
5882
5959
|
return workInProgress.child;
|
|
5883
5960
|
}
|
|
5884
5961
|
|
|
@@ -5906,7 +5983,6 @@ function updateFunctionComponent(current$$1, workInProgress, Component, nextProp
|
|
|
5906
5983
|
// React DevTools reads this flag.
|
|
5907
5984
|
workInProgress.effectTag |= PerformedWork;
|
|
5908
5985
|
reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
|
|
5909
|
-
memoizeProps(workInProgress, nextProps);
|
|
5910
5986
|
return workInProgress.child;
|
|
5911
5987
|
}
|
|
5912
5988
|
|
|
@@ -5923,17 +5999,26 @@ function updateClassComponent(current$$1, workInProgress, Component, nextProps,
|
|
|
5923
5999
|
}
|
|
5924
6000
|
prepareToReadContext(workInProgress, renderExpirationTime);
|
|
5925
6001
|
|
|
6002
|
+
var instance = workInProgress.stateNode;
|
|
5926
6003
|
var shouldUpdate = void 0;
|
|
5927
|
-
if (
|
|
5928
|
-
if (
|
|
5929
|
-
//
|
|
5930
|
-
|
|
5931
|
-
|
|
5932
|
-
|
|
5933
|
-
|
|
5934
|
-
|
|
5935
|
-
|
|
5936
|
-
|
|
6004
|
+
if (instance === null) {
|
|
6005
|
+
if (current$$1 !== null) {
|
|
6006
|
+
// An class component without an instance only mounts if it suspended
|
|
6007
|
+
// inside a non- concurrent tree, in an inconsistent state. We want to
|
|
6008
|
+
// tree it like a new mount, even though an empty version of it already
|
|
6009
|
+
// committed. Disconnect the alternate pointers.
|
|
6010
|
+
current$$1.alternate = null;
|
|
6011
|
+
workInProgress.alternate = null;
|
|
6012
|
+
// Since this is conceptually a new fiber, schedule a Placement effect
|
|
6013
|
+
workInProgress.effectTag |= Placement;
|
|
6014
|
+
}
|
|
6015
|
+
// In the initial pass we might need to construct the instance.
|
|
6016
|
+
constructClassInstance(workInProgress, Component, nextProps, renderExpirationTime);
|
|
6017
|
+
mountClassInstance(workInProgress, Component, nextProps, renderExpirationTime);
|
|
6018
|
+
shouldUpdate = true;
|
|
6019
|
+
} else if (current$$1 === null) {
|
|
6020
|
+
// In a resume, we'll already have an instance we can reuse.
|
|
6021
|
+
shouldUpdate = resumeMountClassInstance(workInProgress, Component, nextProps, renderExpirationTime);
|
|
5937
6022
|
} else {
|
|
5938
6023
|
shouldUpdate = updateClassInstance(current$$1, workInProgress, Component, nextProps, renderExpirationTime);
|
|
5939
6024
|
}
|
|
@@ -5994,10 +6079,9 @@ function finishClassComponent(current$$1, workInProgress, Component, shouldUpdat
|
|
|
5994
6079
|
reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
|
|
5995
6080
|
}
|
|
5996
6081
|
|
|
5997
|
-
// Memoize
|
|
6082
|
+
// Memoize state using the values we just used to render.
|
|
5998
6083
|
// TODO: Restructure so we never read values from the instance.
|
|
5999
|
-
|
|
6000
|
-
memoizeProps(workInProgress, instance.props);
|
|
6084
|
+
workInProgress.memoizedState = instance.state;
|
|
6001
6085
|
|
|
6002
6086
|
// The context might have changed so we need to recalculate it.
|
|
6003
6087
|
if (hasContext) {
|
|
@@ -6094,12 +6178,10 @@ function updateHostComponent(current$$1, workInProgress, renderExpirationTime) {
|
|
|
6094
6178
|
if (renderExpirationTime !== Never && workInProgress.mode & ConcurrentMode && shouldDeprioritizeSubtree(type, nextProps)) {
|
|
6095
6179
|
// Schedule this fiber to re-render at offscreen priority. Then bailout.
|
|
6096
6180
|
workInProgress.expirationTime = Never;
|
|
6097
|
-
workInProgress.memoizedProps = nextProps;
|
|
6098
6181
|
return null;
|
|
6099
6182
|
}
|
|
6100
6183
|
|
|
6101
6184
|
reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
|
|
6102
|
-
memoizeProps(workInProgress, nextProps);
|
|
6103
6185
|
return workInProgress.child;
|
|
6104
6186
|
}
|
|
6105
6187
|
|
|
@@ -6107,8 +6189,6 @@ function updateHostText(current$$1, workInProgress) {
|
|
|
6107
6189
|
if (current$$1 === null) {
|
|
6108
6190
|
tryToClaimNextHydratableInstance(workInProgress);
|
|
6109
6191
|
}
|
|
6110
|
-
var nextProps = workInProgress.pendingProps;
|
|
6111
|
-
memoizeProps(workInProgress, nextProps);
|
|
6112
6192
|
// Nothing to do here. This is terminal. We'll do the completion step
|
|
6113
6193
|
// immediately after.
|
|
6114
6194
|
return null;
|
|
@@ -6129,48 +6209,110 @@ function resolveDefaultProps(Component, baseProps) {
|
|
|
6129
6209
|
return baseProps;
|
|
6130
6210
|
}
|
|
6131
6211
|
|
|
6132
|
-
function
|
|
6133
|
-
|
|
6212
|
+
function mountLazyComponent(_current, workInProgress, elementType, updateExpirationTime, renderExpirationTime) {
|
|
6213
|
+
if (_current !== null) {
|
|
6214
|
+
// An lazy component only mounts if it suspended inside a non-
|
|
6215
|
+
// concurrent tree, in an inconsistent state. We want to tree it like
|
|
6216
|
+
// a new mount, even though an empty version of it already committed.
|
|
6217
|
+
// Disconnect the alternate pointers.
|
|
6218
|
+
_current.alternate = null;
|
|
6219
|
+
workInProgress.alternate = null;
|
|
6220
|
+
// Since this is conceptually a new fiber, schedule a Placement effect
|
|
6221
|
+
workInProgress.effectTag |= Placement;
|
|
6222
|
+
}
|
|
6134
6223
|
|
|
6135
6224
|
var props = workInProgress.pendingProps;
|
|
6136
|
-
|
|
6137
|
-
|
|
6138
|
-
|
|
6139
|
-
|
|
6140
|
-
|
|
6141
|
-
|
|
6142
|
-
|
|
6143
|
-
|
|
6144
|
-
|
|
6145
|
-
|
|
6146
|
-
|
|
6147
|
-
|
|
6148
|
-
|
|
6149
|
-
|
|
6150
|
-
|
|
6151
|
-
|
|
6152
|
-
|
|
6153
|
-
|
|
6154
|
-
|
|
6155
|
-
|
|
6156
|
-
|
|
6157
|
-
|
|
6158
|
-
|
|
6159
|
-
|
|
6160
|
-
|
|
6161
|
-
|
|
6162
|
-
|
|
6163
|
-
|
|
6164
|
-
|
|
6165
|
-
|
|
6166
|
-
|
|
6167
|
-
|
|
6168
|
-
|
|
6169
|
-
|
|
6170
|
-
|
|
6171
|
-
|
|
6225
|
+
// We can't start a User Timing measurement with correct label yet.
|
|
6226
|
+
// Cancel and resume right after we know the tag.
|
|
6227
|
+
cancelWorkTimer(workInProgress);
|
|
6228
|
+
var Component = readLazyComponentType(elementType);
|
|
6229
|
+
// Store the unwrapped component in the type.
|
|
6230
|
+
workInProgress.type = Component;
|
|
6231
|
+
var resolvedTag = workInProgress.tag = resolveLazyComponentTag(Component);
|
|
6232
|
+
startWorkTimer(workInProgress);
|
|
6233
|
+
var resolvedProps = resolveDefaultProps(Component, props);
|
|
6234
|
+
var child = void 0;
|
|
6235
|
+
switch (resolvedTag) {
|
|
6236
|
+
case FunctionComponent:
|
|
6237
|
+
{
|
|
6238
|
+
child = updateFunctionComponent(null, workInProgress, Component, resolvedProps, renderExpirationTime);
|
|
6239
|
+
break;
|
|
6240
|
+
}
|
|
6241
|
+
case ClassComponent:
|
|
6242
|
+
{
|
|
6243
|
+
child = updateClassComponent(null, workInProgress, Component, resolvedProps, renderExpirationTime);
|
|
6244
|
+
break;
|
|
6245
|
+
}
|
|
6246
|
+
case ForwardRef:
|
|
6247
|
+
{
|
|
6248
|
+
child = updateForwardRef(null, workInProgress, Component, resolvedProps, renderExpirationTime);
|
|
6249
|
+
break;
|
|
6250
|
+
}
|
|
6251
|
+
case MemoComponent:
|
|
6252
|
+
{
|
|
6253
|
+
child = updateMemoComponent(null, workInProgress, Component, resolveDefaultProps(Component.type, resolvedProps), // The inner type can have defaults too
|
|
6254
|
+
updateExpirationTime, renderExpirationTime);
|
|
6255
|
+
break;
|
|
6256
|
+
}
|
|
6257
|
+
default:
|
|
6258
|
+
{
|
|
6259
|
+
// This message intentionally doesn't metion ForwardRef or MemoComponent
|
|
6260
|
+
// because the fact that it's a separate type of work is an
|
|
6261
|
+
// implementation detail.
|
|
6262
|
+
invariant(false, 'Element type is invalid. Received a promise that resolves to: %s. Promise elements must resolve to a class or function.', Component);
|
|
6263
|
+
}
|
|
6264
|
+
}
|
|
6265
|
+
return child;
|
|
6266
|
+
}
|
|
6267
|
+
|
|
6268
|
+
function mountIncompleteClassComponent(_current, workInProgress, Component, nextProps, renderExpirationTime) {
|
|
6269
|
+
if (_current !== null) {
|
|
6270
|
+
// An incomplete component only mounts if it suspended inside a non-
|
|
6271
|
+
// concurrent tree, in an inconsistent state. We want to tree it like
|
|
6272
|
+
// a new mount, even though an empty version of it already committed.
|
|
6273
|
+
// Disconnect the alternate pointers.
|
|
6274
|
+
_current.alternate = null;
|
|
6275
|
+
workInProgress.alternate = null;
|
|
6276
|
+
// Since this is conceptually a new fiber, schedule a Placement effect
|
|
6277
|
+
workInProgress.effectTag |= Placement;
|
|
6278
|
+
}
|
|
6279
|
+
|
|
6280
|
+
// Promote the fiber to a class and try rendering again.
|
|
6281
|
+
workInProgress.tag = ClassComponent;
|
|
6282
|
+
|
|
6283
|
+
// The rest of this function is a fork of `updateClassComponent`
|
|
6284
|
+
|
|
6285
|
+
// Push context providers early to prevent context stack mismatches.
|
|
6286
|
+
// During mounting we don't know the child context yet as the instance doesn't exist.
|
|
6287
|
+
// We will invalidate the child context in finishClassComponent() right after rendering.
|
|
6288
|
+
var hasContext = void 0;
|
|
6289
|
+
if (isContextProvider(Component)) {
|
|
6290
|
+
hasContext = true;
|
|
6291
|
+
pushContextProvider(workInProgress);
|
|
6292
|
+
} else {
|
|
6293
|
+
hasContext = false;
|
|
6172
6294
|
}
|
|
6295
|
+
prepareToReadContext(workInProgress, renderExpirationTime);
|
|
6296
|
+
|
|
6297
|
+
constructClassInstance(workInProgress, Component, nextProps, renderExpirationTime);
|
|
6298
|
+
mountClassInstance(workInProgress, Component, nextProps, renderExpirationTime);
|
|
6299
|
+
|
|
6300
|
+
return finishClassComponent(null, workInProgress, Component, true, hasContext, renderExpirationTime);
|
|
6301
|
+
}
|
|
6173
6302
|
|
|
6303
|
+
function mountIndeterminateComponent(_current, workInProgress, Component, renderExpirationTime) {
|
|
6304
|
+
if (_current !== null) {
|
|
6305
|
+
// An indeterminate component only mounts if it suspended inside a non-
|
|
6306
|
+
// concurrent tree, in an inconsistent state. We want to tree it like
|
|
6307
|
+
// a new mount, even though an empty version of it already committed.
|
|
6308
|
+
// Disconnect the alternate pointers.
|
|
6309
|
+
_current.alternate = null;
|
|
6310
|
+
workInProgress.alternate = null;
|
|
6311
|
+
// Since this is conceptually a new fiber, schedule a Placement effect
|
|
6312
|
+
workInProgress.effectTag |= Placement;
|
|
6313
|
+
}
|
|
6314
|
+
|
|
6315
|
+
var props = workInProgress.pendingProps;
|
|
6174
6316
|
var unmaskedContext = getUnmaskedContext(workInProgress, Component, false);
|
|
6175
6317
|
var context = getMaskedContext(workInProgress, unmaskedContext);
|
|
6176
6318
|
|
|
@@ -6222,7 +6364,7 @@ function mountIndeterminateComponent(current$$1, workInProgress, Component, upda
|
|
|
6222
6364
|
|
|
6223
6365
|
adoptClassInstance(workInProgress, value);
|
|
6224
6366
|
mountClassInstance(workInProgress, Component, props, renderExpirationTime);
|
|
6225
|
-
return finishClassComponent(
|
|
6367
|
+
return finishClassComponent(null, workInProgress, Component, true, hasContext, renderExpirationTime);
|
|
6226
6368
|
} else {
|
|
6227
6369
|
// Proceed under the assumption that this is a function component
|
|
6228
6370
|
workInProgress.tag = FunctionComponent;
|
|
@@ -6266,64 +6408,166 @@ function mountIndeterminateComponent(current$$1, workInProgress, Component, upda
|
|
|
6266
6408
|
}
|
|
6267
6409
|
}
|
|
6268
6410
|
}
|
|
6269
|
-
reconcileChildren(
|
|
6270
|
-
memoizeProps(workInProgress, props);
|
|
6411
|
+
reconcileChildren(null, workInProgress, value, renderExpirationTime);
|
|
6271
6412
|
return workInProgress.child;
|
|
6272
6413
|
}
|
|
6273
6414
|
}
|
|
6274
6415
|
|
|
6275
6416
|
function updateSuspenseComponent(current$$1, workInProgress, renderExpirationTime) {
|
|
6417
|
+
var mode = workInProgress.mode;
|
|
6276
6418
|
var nextProps = workInProgress.pendingProps;
|
|
6277
6419
|
|
|
6278
|
-
//
|
|
6279
|
-
//
|
|
6280
|
-
var
|
|
6281
|
-
|
|
6282
|
-
|
|
6283
|
-
if (current$$1 !== null && workInProgress.updateQueue !== null) {
|
|
6284
|
-
// We're outside strict mode. Something inside this Placeholder boundary
|
|
6285
|
-
// suspended during the last commit. Switch to the placholder.
|
|
6286
|
-
workInProgress.updateQueue = null;
|
|
6287
|
-
nextDidTimeout = true;
|
|
6420
|
+
// We should attempt to render the primary children unless this boundary
|
|
6421
|
+
// already suspended during this render (`alreadyCaptured` is true).
|
|
6422
|
+
var nextState = workInProgress.memoizedState;
|
|
6423
|
+
if (nextState === null) {
|
|
6424
|
+
// An empty suspense state means this boundary has not yet timed out.
|
|
6288
6425
|
} else {
|
|
6289
|
-
|
|
6426
|
+
if (!nextState.alreadyCaptured) {
|
|
6427
|
+
// Since we haven't already suspended during this commit, clear the
|
|
6428
|
+
// existing suspense state. We'll try rendering again.
|
|
6429
|
+
nextState = null;
|
|
6430
|
+
} else {
|
|
6431
|
+
// Something in this boundary's subtree already suspended. Switch to
|
|
6432
|
+
// rendering the fallback children. Set `alreadyCaptured` to true.
|
|
6433
|
+
if (current$$1 !== null && nextState === current$$1.memoizedState) {
|
|
6434
|
+
// Create a new suspense state to avoid mutating the current tree's.
|
|
6435
|
+
nextState = {
|
|
6436
|
+
alreadyCaptured: true,
|
|
6437
|
+
didTimeout: true,
|
|
6438
|
+
timedOutAt: nextState.timedOutAt
|
|
6439
|
+
};
|
|
6440
|
+
} else {
|
|
6441
|
+
// Already have a clone, so it's safe to mutate.
|
|
6442
|
+
nextState.alreadyCaptured = true;
|
|
6443
|
+
nextState.didTimeout = true;
|
|
6444
|
+
}
|
|
6445
|
+
}
|
|
6290
6446
|
}
|
|
6447
|
+
var nextDidTimeout = nextState !== null && nextState.didTimeout;
|
|
6291
6448
|
|
|
6292
|
-
|
|
6449
|
+
// This next part is a bit confusing. If the children timeout, we switch to
|
|
6450
|
+
// showing the fallback children in place of the "primary" children.
|
|
6451
|
+
// However, we don't want to delete the primary children because then their
|
|
6452
|
+
// state will be lost (both the React state and the host state, e.g.
|
|
6453
|
+
// uncontrolled form inputs). Instead we keep them mounted and hide them.
|
|
6454
|
+
// Both the fallback children AND the primary children are rendered at the
|
|
6455
|
+
// same time. Once the primary children are un-suspended, we can delete
|
|
6456
|
+
// the fallback children — don't need to preserve their state.
|
|
6457
|
+
//
|
|
6458
|
+
// The two sets of children are siblings in the host environment, but
|
|
6459
|
+
// semantically, for purposes of reconciliation, they are two separate sets.
|
|
6460
|
+
// So we store them using two fragment fibers.
|
|
6461
|
+
//
|
|
6462
|
+
// However, we want to avoid allocating extra fibers for every placeholder.
|
|
6463
|
+
// They're only necessary when the children time out, because that's the
|
|
6464
|
+
// only time when both sets are mounted.
|
|
6465
|
+
//
|
|
6466
|
+
// So, the extra fragment fibers are only used if the children time out.
|
|
6467
|
+
// Otherwise, we render the primary children directly. This requires some
|
|
6468
|
+
// custom reconciliation logic to preserve the state of the primary
|
|
6469
|
+
// children. It's essentially a very basic form of re-parenting.
|
|
6470
|
+
|
|
6471
|
+
// `child` points to the child fiber. In the normal case, this is the first
|
|
6472
|
+
// fiber of the primary children set. In the timed-out case, it's a
|
|
6473
|
+
// a fragment fiber containing the primary children.
|
|
6474
|
+
var child = void 0;
|
|
6475
|
+
// `next` points to the next fiber React should render. In the normal case,
|
|
6476
|
+
// it's the same as `child`: the first fiber of the primary children set.
|
|
6477
|
+
// In the timed-out case, it's a fragment fiber containing the *fallback*
|
|
6478
|
+
// children -- we skip over the primary children entirely.
|
|
6479
|
+
var next = void 0;
|
|
6480
|
+
if (current$$1 === null) {
|
|
6481
|
+
// This is the initial mount. This branch is pretty simple because there's
|
|
6482
|
+
// no previous state that needs to be preserved.
|
|
6293
6483
|
if (nextDidTimeout) {
|
|
6294
|
-
//
|
|
6295
|
-
|
|
6296
|
-
|
|
6484
|
+
// Mount separate fragments for primary and fallback children.
|
|
6485
|
+
var nextFallbackChildren = nextProps.fallback;
|
|
6486
|
+
var primaryChildFragment = createFiberFromFragment(null, mode, NoWork, null);
|
|
6487
|
+
var fallbackChildFragment = createFiberFromFragment(nextFallbackChildren, mode, renderExpirationTime, null);
|
|
6488
|
+
primaryChildFragment.sibling = fallbackChildFragment;
|
|
6489
|
+
child = primaryChildFragment;
|
|
6490
|
+
// Skip the primary children, and continue working on the
|
|
6491
|
+
// fallback children.
|
|
6492
|
+
next = fallbackChildFragment;
|
|
6493
|
+
child.return = next.return = workInProgress;
|
|
6297
6494
|
} else {
|
|
6298
|
-
//
|
|
6299
|
-
|
|
6300
|
-
|
|
6495
|
+
// Mount the primary children without an intermediate fragment fiber.
|
|
6496
|
+
var nextPrimaryChildren = nextProps.children;
|
|
6497
|
+
child = next = mountChildFibers(workInProgress, null, nextPrimaryChildren, renderExpirationTime);
|
|
6301
6498
|
}
|
|
6302
|
-
}
|
|
6303
|
-
|
|
6304
|
-
// If the `children` prop is a function, treat it like a render prop.
|
|
6305
|
-
// TODO: This is temporary until we finalize a lower level API.
|
|
6306
|
-
var children = nextProps.children;
|
|
6307
|
-
var nextChildren = void 0;
|
|
6308
|
-
if (typeof children === 'function') {
|
|
6309
|
-
nextChildren = children(nextDidTimeout);
|
|
6310
6499
|
} else {
|
|
6311
|
-
|
|
6500
|
+
// This is an update. This branch is more complicated because we need to
|
|
6501
|
+
// ensure the state of the primary children is preserved.
|
|
6502
|
+
var prevState = current$$1.memoizedState;
|
|
6503
|
+
var prevDidTimeout = prevState !== null && prevState.didTimeout;
|
|
6504
|
+
if (prevDidTimeout) {
|
|
6505
|
+
// The current tree already timed out. That means each child set is
|
|
6506
|
+
var currentPrimaryChildFragment = current$$1.child;
|
|
6507
|
+
var currentFallbackChildFragment = currentPrimaryChildFragment.sibling;
|
|
6508
|
+
if (nextDidTimeout) {
|
|
6509
|
+
// Still timed out. Reuse the current primary children by cloning
|
|
6510
|
+
// its fragment. We're going to skip over these entirely.
|
|
6511
|
+
var _nextFallbackChildren = nextProps.fallback;
|
|
6512
|
+
var _primaryChildFragment = createWorkInProgress(currentPrimaryChildFragment, currentPrimaryChildFragment.pendingProps, NoWork);
|
|
6513
|
+
_primaryChildFragment.effectTag |= Placement;
|
|
6514
|
+
// Clone the fallback child fragment, too. These we'll continue
|
|
6515
|
+
// working on.
|
|
6516
|
+
var _fallbackChildFragment = _primaryChildFragment.sibling = createWorkInProgress(currentFallbackChildFragment, _nextFallbackChildren, currentFallbackChildFragment.expirationTime);
|
|
6517
|
+
_fallbackChildFragment.effectTag |= Placement;
|
|
6518
|
+
child = _primaryChildFragment;
|
|
6519
|
+
_primaryChildFragment.childExpirationTime = NoWork;
|
|
6520
|
+
// Skip the primary children, and continue working on the
|
|
6521
|
+
// fallback children.
|
|
6522
|
+
next = _fallbackChildFragment;
|
|
6523
|
+
child.return = next.return = workInProgress;
|
|
6524
|
+
} else {
|
|
6525
|
+
// No longer suspended. Switch back to showing the primary children,
|
|
6526
|
+
// and remove the intermediate fragment fiber.
|
|
6527
|
+
var _nextPrimaryChildren = nextProps.children;
|
|
6528
|
+
var currentPrimaryChild = currentPrimaryChildFragment.child;
|
|
6529
|
+
var currentFallbackChild = currentFallbackChildFragment.child;
|
|
6530
|
+
var primaryChild = reconcileChildFibers(workInProgress, currentPrimaryChild, _nextPrimaryChildren, renderExpirationTime);
|
|
6531
|
+
// Delete the fallback children.
|
|
6532
|
+
reconcileChildFibers(workInProgress, currentFallbackChild, null, renderExpirationTime);
|
|
6533
|
+
// Continue rendering the children, like we normally do.
|
|
6534
|
+
child = next = primaryChild;
|
|
6535
|
+
}
|
|
6536
|
+
} else {
|
|
6537
|
+
// The current tree has not already timed out. That means the primary
|
|
6538
|
+
var _currentPrimaryChild = current$$1.child;
|
|
6539
|
+
if (nextDidTimeout) {
|
|
6540
|
+
// Timed out. Wrap the children in a fragment fiber to keep them
|
|
6541
|
+
// separate from the fallback children.
|
|
6542
|
+
var _nextFallbackChildren2 = nextProps.fallback;
|
|
6543
|
+
var _primaryChildFragment2 = createFiberFromFragment(
|
|
6544
|
+
// It shouldn't matter what the pending props are because we aren't
|
|
6545
|
+
// going to render this fragment.
|
|
6546
|
+
null, mode, NoWork, null);
|
|
6547
|
+
_primaryChildFragment2.effectTag |= Placement;
|
|
6548
|
+
_primaryChildFragment2.child = _currentPrimaryChild;
|
|
6549
|
+
_currentPrimaryChild.return = _primaryChildFragment2;
|
|
6550
|
+
// Create a fragment from the fallback children, too.
|
|
6551
|
+
var _fallbackChildFragment2 = _primaryChildFragment2.sibling = createFiberFromFragment(_nextFallbackChildren2, mode, renderExpirationTime, null);
|
|
6552
|
+
_fallbackChildFragment2.effectTag |= Placement;
|
|
6553
|
+
child = _primaryChildFragment2;
|
|
6554
|
+
_primaryChildFragment2.childExpirationTime = NoWork;
|
|
6555
|
+
// Skip the primary children, and continue working on the
|
|
6556
|
+
// fallback children.
|
|
6557
|
+
next = _fallbackChildFragment2;
|
|
6558
|
+
child.return = next.return = workInProgress;
|
|
6559
|
+
} else {
|
|
6560
|
+
// Still haven't timed out. Continue rendering the children, like we
|
|
6561
|
+
// normally do.
|
|
6562
|
+
var _nextPrimaryChildren2 = nextProps.children;
|
|
6563
|
+
next = child = reconcileChildFibers(workInProgress, _currentPrimaryChild, _nextPrimaryChildren2, renderExpirationTime);
|
|
6564
|
+
}
|
|
6565
|
+
}
|
|
6312
6566
|
}
|
|
6313
6567
|
|
|
6314
|
-
|
|
6315
|
-
|
|
6316
|
-
|
|
6317
|
-
// happen to be stored in the same set. Call this special function to
|
|
6318
|
-
// force the new set not to match with the current set.
|
|
6319
|
-
// TODO: The proper way to model this is by storing each set separately.
|
|
6320
|
-
forceUnmountCurrentAndReconcile(current$$1, workInProgress, nextChildren, renderExpirationTime);
|
|
6321
|
-
} else {
|
|
6322
|
-
reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
|
|
6323
|
-
}
|
|
6324
|
-
workInProgress.memoizedProps = nextProps;
|
|
6325
|
-
workInProgress.memoizedState = nextDidTimeout;
|
|
6326
|
-
return workInProgress.child;
|
|
6568
|
+
workInProgress.memoizedState = nextState;
|
|
6569
|
+
workInProgress.child = child;
|
|
6570
|
+
return next;
|
|
6327
6571
|
}
|
|
6328
6572
|
|
|
6329
6573
|
function updatePortalComponent(current$$1, workInProgress, renderExpirationTime) {
|
|
@@ -6336,10 +6580,8 @@ function updatePortalComponent(current$$1, workInProgress, renderExpirationTime)
|
|
|
6336
6580
|
// the root always starts with a "current" with a null child.
|
|
6337
6581
|
// TODO: Consider unifying this with how the root works.
|
|
6338
6582
|
workInProgress.child = reconcileChildFibers(workInProgress, null, nextChildren, renderExpirationTime);
|
|
6339
|
-
memoizeProps(workInProgress, nextChildren);
|
|
6340
6583
|
} else {
|
|
6341
6584
|
reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
|
|
6342
|
-
memoizeProps(workInProgress, nextChildren);
|
|
6343
6585
|
}
|
|
6344
6586
|
return workInProgress.child;
|
|
6345
6587
|
}
|
|
@@ -6352,7 +6594,6 @@ function updateContextProvider(current$$1, workInProgress, renderExpirationTime)
|
|
|
6352
6594
|
var oldProps = workInProgress.memoizedProps;
|
|
6353
6595
|
|
|
6354
6596
|
var newValue = newProps.value;
|
|
6355
|
-
workInProgress.memoizedProps = newProps;
|
|
6356
6597
|
|
|
6357
6598
|
{
|
|
6358
6599
|
var providerPropTypes = workInProgress.type.propTypes;
|
|
@@ -6384,8 +6625,32 @@ function updateContextProvider(current$$1, workInProgress, renderExpirationTime)
|
|
|
6384
6625
|
return workInProgress.child;
|
|
6385
6626
|
}
|
|
6386
6627
|
|
|
6628
|
+
var hasWarnedAboutUsingContextAsConsumer = false;
|
|
6629
|
+
|
|
6387
6630
|
function updateContextConsumer(current$$1, workInProgress, renderExpirationTime) {
|
|
6388
6631
|
var context = workInProgress.type;
|
|
6632
|
+
// The logic below for Context differs depending on PROD or DEV mode. In
|
|
6633
|
+
// DEV mode, we create a separate object for Context.Consumer that acts
|
|
6634
|
+
// like a proxy to Context. This proxy object adds unnecessary code in PROD
|
|
6635
|
+
// so we use the old behaviour (Context.Consumer references Context) to
|
|
6636
|
+
// reduce size and overhead. The separate object references context via
|
|
6637
|
+
// a property called "_context", which also gives us the ability to check
|
|
6638
|
+
// in DEV mode if this property exists or not and warn if it does not.
|
|
6639
|
+
{
|
|
6640
|
+
if (context._context === undefined) {
|
|
6641
|
+
// This may be because it's a Context (rather than a Consumer).
|
|
6642
|
+
// Or it may be because it's older React where they're the same thing.
|
|
6643
|
+
// We only want to warn if we're sure it's a new React.
|
|
6644
|
+
if (context !== context.Consumer) {
|
|
6645
|
+
if (!hasWarnedAboutUsingContextAsConsumer) {
|
|
6646
|
+
hasWarnedAboutUsingContextAsConsumer = true;
|
|
6647
|
+
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?');
|
|
6648
|
+
}
|
|
6649
|
+
}
|
|
6650
|
+
} else {
|
|
6651
|
+
context = context._context;
|
|
6652
|
+
}
|
|
6653
|
+
}
|
|
6389
6654
|
var newProps = workInProgress.pendingProps;
|
|
6390
6655
|
var render = newProps.children;
|
|
6391
6656
|
|
|
@@ -6406,7 +6671,6 @@ function updateContextConsumer(current$$1, workInProgress, renderExpirationTime)
|
|
|
6406
6671
|
// React DevTools reads this flag.
|
|
6407
6672
|
workInProgress.effectTag |= PerformedWork;
|
|
6408
6673
|
reconcileChildren(current$$1, workInProgress, newChildren, renderExpirationTime);
|
|
6409
|
-
workInProgress.memoizedProps = newProps;
|
|
6410
6674
|
return workInProgress.child;
|
|
6411
6675
|
}
|
|
6412
6676
|
|
|
@@ -6457,17 +6721,6 @@ function bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirati
|
|
|
6457
6721
|
}
|
|
6458
6722
|
}
|
|
6459
6723
|
|
|
6460
|
-
// TODO: Delete memoizeProps/State and move to reconcile/bailout instead
|
|
6461
|
-
function memoizeProps(workInProgress, nextProps) {
|
|
6462
|
-
workInProgress.memoizedProps = nextProps;
|
|
6463
|
-
}
|
|
6464
|
-
|
|
6465
|
-
function memoizeState(workInProgress, nextState) {
|
|
6466
|
-
workInProgress.memoizedState = nextState;
|
|
6467
|
-
// Don't reset the updateQueue, in case there are pending updates. Resetting
|
|
6468
|
-
// is handled by processUpdateQueue.
|
|
6469
|
-
}
|
|
6470
|
-
|
|
6471
6724
|
function beginWork(current$$1, workInProgress, renderExpirationTime) {
|
|
6472
6725
|
var updateExpirationTime = workInProgress.expirationTime;
|
|
6473
6726
|
|
|
@@ -6494,15 +6747,6 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
|
|
|
6494
6747
|
}
|
|
6495
6748
|
break;
|
|
6496
6749
|
}
|
|
6497
|
-
case ClassComponentLazy:
|
|
6498
|
-
{
|
|
6499
|
-
var thenable = workInProgress.type;
|
|
6500
|
-
var _Component = getResultFromResolvedThenable(thenable);
|
|
6501
|
-
if (isContextProvider(_Component)) {
|
|
6502
|
-
pushContextProvider(workInProgress);
|
|
6503
|
-
}
|
|
6504
|
-
break;
|
|
6505
|
-
}
|
|
6506
6750
|
case HostPortal:
|
|
6507
6751
|
pushHostContainer(workInProgress, workInProgress.stateNode.containerInfo);
|
|
6508
6752
|
break;
|
|
@@ -6517,6 +6761,35 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
|
|
|
6517
6761
|
workInProgress.effectTag |= Update;
|
|
6518
6762
|
}
|
|
6519
6763
|
break;
|
|
6764
|
+
case SuspenseComponent:
|
|
6765
|
+
{
|
|
6766
|
+
var state = workInProgress.memoizedState;
|
|
6767
|
+
var didTimeout = state !== null && state.didTimeout;
|
|
6768
|
+
if (didTimeout) {
|
|
6769
|
+
// If this boundary is currently timed out, we need to decide
|
|
6770
|
+
// whether to retry the primary children, or to skip over it and
|
|
6771
|
+
// go straight to the fallback. Check the priority of the primary
|
|
6772
|
+
var primaryChildFragment = workInProgress.child;
|
|
6773
|
+
var primaryChildExpirationTime = primaryChildFragment.childExpirationTime;
|
|
6774
|
+
if (primaryChildExpirationTime !== NoWork && primaryChildExpirationTime <= renderExpirationTime) {
|
|
6775
|
+
// The primary children have pending work. Use the normal path
|
|
6776
|
+
// to attempt to render the primary children again.
|
|
6777
|
+
return updateSuspenseComponent(current$$1, workInProgress, renderExpirationTime);
|
|
6778
|
+
} else {
|
|
6779
|
+
// The primary children do not have pending work with sufficient
|
|
6780
|
+
// priority. Bailout.
|
|
6781
|
+
var child = bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
|
|
6782
|
+
if (child !== null) {
|
|
6783
|
+
// The fallback children have pending work. Skip over the
|
|
6784
|
+
// primary children and work on the fallback.
|
|
6785
|
+
return child.sibling;
|
|
6786
|
+
} else {
|
|
6787
|
+
return null;
|
|
6788
|
+
}
|
|
6789
|
+
}
|
|
6790
|
+
}
|
|
6791
|
+
break;
|
|
6792
|
+
}
|
|
6520
6793
|
}
|
|
6521
6794
|
return bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
|
|
6522
6795
|
}
|
|
@@ -6528,38 +6801,27 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
|
|
|
6528
6801
|
switch (workInProgress.tag) {
|
|
6529
6802
|
case IndeterminateComponent:
|
|
6530
6803
|
{
|
|
6531
|
-
var
|
|
6532
|
-
return mountIndeterminateComponent(current$$1, workInProgress,
|
|
6804
|
+
var elementType = workInProgress.elementType;
|
|
6805
|
+
return mountIndeterminateComponent(current$$1, workInProgress, elementType, renderExpirationTime);
|
|
6533
6806
|
}
|
|
6534
|
-
case
|
|
6807
|
+
case LazyComponent:
|
|
6535
6808
|
{
|
|
6536
|
-
var
|
|
6537
|
-
|
|
6538
|
-
return updateFunctionComponent(current$$1, workInProgress, _Component3, unresolvedProps, renderExpirationTime);
|
|
6809
|
+
var _elementType = workInProgress.elementType;
|
|
6810
|
+
return mountLazyComponent(current$$1, workInProgress, _elementType, updateExpirationTime, renderExpirationTime);
|
|
6539
6811
|
}
|
|
6540
|
-
case
|
|
6812
|
+
case FunctionComponent:
|
|
6541
6813
|
{
|
|
6542
|
-
var
|
|
6543
|
-
var
|
|
6544
|
-
var
|
|
6545
|
-
|
|
6546
|
-
workInProgress.memoizedProps = _unresolvedProps;
|
|
6547
|
-
return child;
|
|
6814
|
+
var _Component = workInProgress.type;
|
|
6815
|
+
var unresolvedProps = workInProgress.pendingProps;
|
|
6816
|
+
var resolvedProps = workInProgress.elementType === _Component ? unresolvedProps : resolveDefaultProps(_Component, unresolvedProps);
|
|
6817
|
+
return updateFunctionComponent(current$$1, workInProgress, _Component, resolvedProps, renderExpirationTime);
|
|
6548
6818
|
}
|
|
6549
6819
|
case ClassComponent:
|
|
6550
6820
|
{
|
|
6551
|
-
var
|
|
6552
|
-
var
|
|
6553
|
-
|
|
6554
|
-
|
|
6555
|
-
case ClassComponentLazy:
|
|
6556
|
-
{
|
|
6557
|
-
var _thenable2 = workInProgress.type;
|
|
6558
|
-
var _Component6 = getResultFromResolvedThenable(_thenable2);
|
|
6559
|
-
var _unresolvedProps3 = workInProgress.pendingProps;
|
|
6560
|
-
var _child = updateClassComponent(current$$1, workInProgress, _Component6, resolveDefaultProps(_Component6, _unresolvedProps3), renderExpirationTime);
|
|
6561
|
-
workInProgress.memoizedProps = _unresolvedProps3;
|
|
6562
|
-
return _child;
|
|
6821
|
+
var _Component2 = workInProgress.type;
|
|
6822
|
+
var _unresolvedProps = workInProgress.pendingProps;
|
|
6823
|
+
var _resolvedProps = workInProgress.elementType === _Component2 ? _unresolvedProps : resolveDefaultProps(_Component2, _unresolvedProps);
|
|
6824
|
+
return updateClassComponent(current$$1, workInProgress, _Component2, _resolvedProps, renderExpirationTime);
|
|
6563
6825
|
}
|
|
6564
6826
|
case HostRoot:
|
|
6565
6827
|
return updateHostRoot(current$$1, workInProgress, renderExpirationTime);
|
|
@@ -6574,16 +6836,9 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
|
|
|
6574
6836
|
case ForwardRef:
|
|
6575
6837
|
{
|
|
6576
6838
|
var type = workInProgress.type;
|
|
6577
|
-
|
|
6578
|
-
|
|
6579
|
-
|
|
6580
|
-
{
|
|
6581
|
-
var _thenable3 = workInProgress.type;
|
|
6582
|
-
var _Component7 = getResultFromResolvedThenable(_thenable3);
|
|
6583
|
-
var _unresolvedProps4 = workInProgress.pendingProps;
|
|
6584
|
-
var _child2 = updateForwardRef(current$$1, workInProgress, _Component7, resolveDefaultProps(_Component7, _unresolvedProps4), renderExpirationTime);
|
|
6585
|
-
workInProgress.memoizedProps = _unresolvedProps4;
|
|
6586
|
-
return _child2;
|
|
6839
|
+
var _unresolvedProps2 = workInProgress.pendingProps;
|
|
6840
|
+
var _resolvedProps2 = workInProgress.elementType === type ? _unresolvedProps2 : resolveDefaultProps(type, _unresolvedProps2);
|
|
6841
|
+
return updateForwardRef(current$$1, workInProgress, type, _resolvedProps2, renderExpirationTime);
|
|
6587
6842
|
}
|
|
6588
6843
|
case Fragment:
|
|
6589
6844
|
return updateFragment(current$$1, workInProgress, renderExpirationTime);
|
|
@@ -6595,19 +6850,23 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
|
|
|
6595
6850
|
return updateContextProvider(current$$1, workInProgress, renderExpirationTime);
|
|
6596
6851
|
case ContextConsumer:
|
|
6597
6852
|
return updateContextConsumer(current$$1, workInProgress, renderExpirationTime);
|
|
6598
|
-
case
|
|
6853
|
+
case MemoComponent:
|
|
6599
6854
|
{
|
|
6600
6855
|
var _type = workInProgress.type;
|
|
6601
|
-
|
|
6856
|
+
var _unresolvedProps3 = workInProgress.pendingProps;
|
|
6857
|
+
var _resolvedProps3 = resolveDefaultProps(_type.type, _unresolvedProps3);
|
|
6858
|
+
return updateMemoComponent(current$$1, workInProgress, _type, _resolvedProps3, updateExpirationTime, renderExpirationTime);
|
|
6602
6859
|
}
|
|
6603
|
-
case
|
|
6860
|
+
case SimpleMemoComponent:
|
|
6604
6861
|
{
|
|
6605
|
-
|
|
6606
|
-
|
|
6607
|
-
|
|
6608
|
-
|
|
6609
|
-
|
|
6610
|
-
|
|
6862
|
+
return updateSimpleMemoComponent(current$$1, workInProgress, workInProgress.type, workInProgress.pendingProps, updateExpirationTime, renderExpirationTime);
|
|
6863
|
+
}
|
|
6864
|
+
case IncompleteClassComponent:
|
|
6865
|
+
{
|
|
6866
|
+
var _Component3 = workInProgress.type;
|
|
6867
|
+
var _unresolvedProps4 = workInProgress.pendingProps;
|
|
6868
|
+
var _resolvedProps4 = workInProgress.elementType === _Component3 ? _unresolvedProps4 : resolveDefaultProps(_Component3, _unresolvedProps4);
|
|
6869
|
+
return mountIncompleteClassComponent(current$$1, workInProgress, _Component3, _resolvedProps4, renderExpirationTime);
|
|
6611
6870
|
}
|
|
6612
6871
|
default:
|
|
6613
6872
|
invariant(false, 'Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue.');
|
|
@@ -6624,42 +6883,43 @@ function markRef$1(workInProgress) {
|
|
|
6624
6883
|
workInProgress.effectTag |= Ref;
|
|
6625
6884
|
}
|
|
6626
6885
|
|
|
6627
|
-
|
|
6628
|
-
// We only have the top Fiber that was created but we need recurse down its
|
|
6629
|
-
// children to find all the terminal nodes.
|
|
6630
|
-
var node = workInProgress.child;
|
|
6631
|
-
while (node !== null) {
|
|
6632
|
-
if (node.tag === HostComponent || node.tag === HostText) {
|
|
6633
|
-
appendInitialChild(parent, node.stateNode);
|
|
6634
|
-
} else if (node.tag === HostPortal) {
|
|
6635
|
-
// If we have a portal child, then we don't want to traverse
|
|
6636
|
-
// down its children. Instead, we'll get insertions from each child in
|
|
6637
|
-
// the portal directly.
|
|
6638
|
-
} else if (node.child !== null) {
|
|
6639
|
-
node.child.return = node;
|
|
6640
|
-
node = node.child;
|
|
6641
|
-
continue;
|
|
6642
|
-
}
|
|
6643
|
-
if (node === workInProgress) {
|
|
6644
|
-
return;
|
|
6645
|
-
}
|
|
6646
|
-
while (node.sibling === null) {
|
|
6647
|
-
if (node.return === null || node.return === workInProgress) {
|
|
6648
|
-
return;
|
|
6649
|
-
}
|
|
6650
|
-
node = node.return;
|
|
6651
|
-
}
|
|
6652
|
-
node.sibling.return = node.return;
|
|
6653
|
-
node = node.sibling;
|
|
6654
|
-
}
|
|
6655
|
-
}
|
|
6656
|
-
|
|
6886
|
+
var appendAllChildren = void 0;
|
|
6657
6887
|
var updateHostContainer = void 0;
|
|
6658
6888
|
var updateHostComponent$1 = void 0;
|
|
6659
6889
|
var updateHostText$1 = void 0;
|
|
6660
6890
|
if (supportsMutation) {
|
|
6661
6891
|
// Mutation mode
|
|
6662
6892
|
|
|
6893
|
+
appendAllChildren = function (parent, workInProgress, needsVisibilityToggle, isHidden) {
|
|
6894
|
+
// We only have the top Fiber that was created but we need recurse down its
|
|
6895
|
+
// children to find all the terminal nodes.
|
|
6896
|
+
var node = workInProgress.child;
|
|
6897
|
+
while (node !== null) {
|
|
6898
|
+
if (node.tag === HostComponent || node.tag === HostText) {
|
|
6899
|
+
appendInitialChild(parent, node.stateNode);
|
|
6900
|
+
} else if (node.tag === HostPortal) {
|
|
6901
|
+
// If we have a portal child, then we don't want to traverse
|
|
6902
|
+
// down its children. Instead, we'll get insertions from each child in
|
|
6903
|
+
// the portal directly.
|
|
6904
|
+
} else if (node.child !== null) {
|
|
6905
|
+
node.child.return = node;
|
|
6906
|
+
node = node.child;
|
|
6907
|
+
continue;
|
|
6908
|
+
}
|
|
6909
|
+
if (node === workInProgress) {
|
|
6910
|
+
return;
|
|
6911
|
+
}
|
|
6912
|
+
while (node.sibling === null) {
|
|
6913
|
+
if (node.return === null || node.return === workInProgress) {
|
|
6914
|
+
return;
|
|
6915
|
+
}
|
|
6916
|
+
node = node.return;
|
|
6917
|
+
}
|
|
6918
|
+
node.sibling.return = node.return;
|
|
6919
|
+
node = node.sibling;
|
|
6920
|
+
}
|
|
6921
|
+
};
|
|
6922
|
+
|
|
6663
6923
|
updateHostContainer = function (workInProgress) {
|
|
6664
6924
|
// Noop
|
|
6665
6925
|
};
|
|
@@ -6700,23 +6960,167 @@ if (supportsMutation) {
|
|
|
6700
6960
|
} else if (supportsPersistence) {
|
|
6701
6961
|
// Persistent host tree mode
|
|
6702
6962
|
|
|
6963
|
+
appendAllChildren = function (parent, workInProgress, needsVisibilityToggle, isHidden) {
|
|
6964
|
+
// We only have the top Fiber that was created but we need recurse down its
|
|
6965
|
+
// children to find all the terminal nodes.
|
|
6966
|
+
var node = workInProgress.child;
|
|
6967
|
+
while (node !== null) {
|
|
6968
|
+
// eslint-disable-next-line no-labels
|
|
6969
|
+
branches: if (node.tag === HostComponent) {
|
|
6970
|
+
var instance = node.stateNode;
|
|
6971
|
+
if (needsVisibilityToggle) {
|
|
6972
|
+
var props = node.memoizedProps;
|
|
6973
|
+
var type = node.type;
|
|
6974
|
+
if (isHidden) {
|
|
6975
|
+
// This child is inside a timed out tree. Hide it.
|
|
6976
|
+
instance = cloneHiddenInstance(instance, type, props, node);
|
|
6977
|
+
} else {
|
|
6978
|
+
// This child was previously inside a timed out tree. If it was not
|
|
6979
|
+
// updated during this render, it may need to be unhidden. Clone
|
|
6980
|
+
// again to be sure.
|
|
6981
|
+
instance = cloneUnhiddenInstance(instance, type, props, node);
|
|
6982
|
+
}
|
|
6983
|
+
node.stateNode = instance;
|
|
6984
|
+
}
|
|
6985
|
+
appendInitialChild(parent, instance);
|
|
6986
|
+
} else if (node.tag === HostText) {
|
|
6987
|
+
var _instance = node.stateNode;
|
|
6988
|
+
if (needsVisibilityToggle) {
|
|
6989
|
+
var text = node.memoizedProps;
|
|
6990
|
+
var rootContainerInstance = getRootHostContainer();
|
|
6991
|
+
var currentHostContext = getHostContext();
|
|
6992
|
+
if (isHidden) {
|
|
6993
|
+
_instance = createHiddenTextInstance(text, rootContainerInstance, currentHostContext, workInProgress);
|
|
6994
|
+
} else {
|
|
6995
|
+
_instance = createTextInstance(text, rootContainerInstance, currentHostContext, workInProgress);
|
|
6996
|
+
}
|
|
6997
|
+
node.stateNode = _instance;
|
|
6998
|
+
}
|
|
6999
|
+
appendInitialChild(parent, _instance);
|
|
7000
|
+
} else if (node.tag === HostPortal) {
|
|
7001
|
+
// If we have a portal child, then we don't want to traverse
|
|
7002
|
+
// down its children. Instead, we'll get insertions from each child in
|
|
7003
|
+
// the portal directly.
|
|
7004
|
+
} else if (node.tag === SuspenseComponent) {
|
|
7005
|
+
var current = node.alternate;
|
|
7006
|
+
if (current !== null) {
|
|
7007
|
+
var oldState = current.memoizedState;
|
|
7008
|
+
var newState = node.memoizedState;
|
|
7009
|
+
var oldIsHidden = oldState !== null && oldState.didTimeout;
|
|
7010
|
+
var newIsHidden = newState !== null && newState.didTimeout;
|
|
7011
|
+
if (oldIsHidden !== newIsHidden) {
|
|
7012
|
+
// The placeholder either just timed out or switched back to the normal
|
|
7013
|
+
// children after having previously timed out. Toggle the visibility of
|
|
7014
|
+
// the direct host children.
|
|
7015
|
+
var primaryChildParent = newIsHidden ? node.child : node;
|
|
7016
|
+
if (primaryChildParent !== null) {
|
|
7017
|
+
appendAllChildren(parent, primaryChildParent, true, newIsHidden);
|
|
7018
|
+
}
|
|
7019
|
+
// eslint-disable-next-line no-labels
|
|
7020
|
+
break branches;
|
|
7021
|
+
}
|
|
7022
|
+
}
|
|
7023
|
+
if (node.child !== null) {
|
|
7024
|
+
// Continue traversing like normal
|
|
7025
|
+
node.child.return = node;
|
|
7026
|
+
node = node.child;
|
|
7027
|
+
continue;
|
|
7028
|
+
}
|
|
7029
|
+
} else if (node.child !== null) {
|
|
7030
|
+
node.child.return = node;
|
|
7031
|
+
node = node.child;
|
|
7032
|
+
continue;
|
|
7033
|
+
}
|
|
7034
|
+
// $FlowFixMe This is correct but Flow is confused by the labeled break.
|
|
7035
|
+
node = node;
|
|
7036
|
+
if (node === workInProgress) {
|
|
7037
|
+
return;
|
|
7038
|
+
}
|
|
7039
|
+
while (node.sibling === null) {
|
|
7040
|
+
if (node.return === null || node.return === workInProgress) {
|
|
7041
|
+
return;
|
|
7042
|
+
}
|
|
7043
|
+
node = node.return;
|
|
7044
|
+
}
|
|
7045
|
+
node.sibling.return = node.return;
|
|
7046
|
+
node = node.sibling;
|
|
7047
|
+
}
|
|
7048
|
+
};
|
|
7049
|
+
|
|
6703
7050
|
// An unfortunate fork of appendAllChildren because we have two different parent types.
|
|
6704
|
-
var appendAllChildrenToContainer = function (containerChildSet, workInProgress) {
|
|
7051
|
+
var appendAllChildrenToContainer = function (containerChildSet, workInProgress, needsVisibilityToggle, isHidden) {
|
|
6705
7052
|
// We only have the top Fiber that was created but we need recurse down its
|
|
6706
7053
|
// children to find all the terminal nodes.
|
|
6707
7054
|
var node = workInProgress.child;
|
|
6708
7055
|
while (node !== null) {
|
|
6709
|
-
|
|
6710
|
-
|
|
7056
|
+
// eslint-disable-next-line no-labels
|
|
7057
|
+
branches: if (node.tag === HostComponent) {
|
|
7058
|
+
var instance = node.stateNode;
|
|
7059
|
+
if (needsVisibilityToggle) {
|
|
7060
|
+
var props = node.memoizedProps;
|
|
7061
|
+
var type = node.type;
|
|
7062
|
+
if (isHidden) {
|
|
7063
|
+
// This child is inside a timed out tree. Hide it.
|
|
7064
|
+
instance = cloneHiddenInstance(instance, type, props, node);
|
|
7065
|
+
} else {
|
|
7066
|
+
// This child was previously inside a timed out tree. If it was not
|
|
7067
|
+
// updated during this render, it may need to be unhidden. Clone
|
|
7068
|
+
// again to be sure.
|
|
7069
|
+
instance = cloneUnhiddenInstance(instance, type, props, node);
|
|
7070
|
+
}
|
|
7071
|
+
node.stateNode = instance;
|
|
7072
|
+
}
|
|
7073
|
+
appendChildToContainerChildSet(containerChildSet, instance);
|
|
7074
|
+
} else if (node.tag === HostText) {
|
|
7075
|
+
var _instance2 = node.stateNode;
|
|
7076
|
+
if (needsVisibilityToggle) {
|
|
7077
|
+
var text = node.memoizedProps;
|
|
7078
|
+
var rootContainerInstance = getRootHostContainer();
|
|
7079
|
+
var currentHostContext = getHostContext();
|
|
7080
|
+
if (isHidden) {
|
|
7081
|
+
_instance2 = createHiddenTextInstance(text, rootContainerInstance, currentHostContext, workInProgress);
|
|
7082
|
+
} else {
|
|
7083
|
+
_instance2 = createTextInstance(text, rootContainerInstance, currentHostContext, workInProgress);
|
|
7084
|
+
}
|
|
7085
|
+
node.stateNode = _instance2;
|
|
7086
|
+
}
|
|
7087
|
+
appendChildToContainerChildSet(containerChildSet, _instance2);
|
|
6711
7088
|
} else if (node.tag === HostPortal) {
|
|
6712
7089
|
// If we have a portal child, then we don't want to traverse
|
|
6713
7090
|
// down its children. Instead, we'll get insertions from each child in
|
|
6714
7091
|
// the portal directly.
|
|
7092
|
+
} else if (node.tag === SuspenseComponent) {
|
|
7093
|
+
var current = node.alternate;
|
|
7094
|
+
if (current !== null) {
|
|
7095
|
+
var oldState = current.memoizedState;
|
|
7096
|
+
var newState = node.memoizedState;
|
|
7097
|
+
var oldIsHidden = oldState !== null && oldState.didTimeout;
|
|
7098
|
+
var newIsHidden = newState !== null && newState.didTimeout;
|
|
7099
|
+
if (oldIsHidden !== newIsHidden) {
|
|
7100
|
+
// The placeholder either just timed out or switched back to the normal
|
|
7101
|
+
// children after having previously timed out. Toggle the visibility of
|
|
7102
|
+
// the direct host children.
|
|
7103
|
+
var primaryChildParent = newIsHidden ? node.child : node;
|
|
7104
|
+
if (primaryChildParent !== null) {
|
|
7105
|
+
appendAllChildrenToContainer(containerChildSet, primaryChildParent, true, newIsHidden);
|
|
7106
|
+
}
|
|
7107
|
+
// eslint-disable-next-line no-labels
|
|
7108
|
+
break branches;
|
|
7109
|
+
}
|
|
7110
|
+
}
|
|
7111
|
+
if (node.child !== null) {
|
|
7112
|
+
// Continue traversing like normal
|
|
7113
|
+
node.child.return = node;
|
|
7114
|
+
node = node.child;
|
|
7115
|
+
continue;
|
|
7116
|
+
}
|
|
6715
7117
|
} else if (node.child !== null) {
|
|
6716
7118
|
node.child.return = node;
|
|
6717
7119
|
node = node.child;
|
|
6718
7120
|
continue;
|
|
6719
7121
|
}
|
|
7122
|
+
// $FlowFixMe This is correct but Flow is confused by the labeled break.
|
|
7123
|
+
node = node;
|
|
6720
7124
|
if (node === workInProgress) {
|
|
6721
7125
|
return;
|
|
6722
7126
|
}
|
|
@@ -6739,7 +7143,7 @@ if (supportsMutation) {
|
|
|
6739
7143
|
var container = portalOrRoot.containerInfo;
|
|
6740
7144
|
var newChildSet = createContainerChildSet(container);
|
|
6741
7145
|
// If children might have changed, we have to add them all to the set.
|
|
6742
|
-
appendAllChildrenToContainer(newChildSet, workInProgress);
|
|
7146
|
+
appendAllChildrenToContainer(newChildSet, workInProgress, false, false);
|
|
6743
7147
|
portalOrRoot.pendingChildren = newChildSet;
|
|
6744
7148
|
// Schedule an update on the container to swap out the container.
|
|
6745
7149
|
markUpdate(workInProgress);
|
|
@@ -6782,7 +7186,7 @@ if (supportsMutation) {
|
|
|
6782
7186
|
markUpdate(workInProgress);
|
|
6783
7187
|
} else {
|
|
6784
7188
|
// If children might have changed, we have to add them all to the set.
|
|
6785
|
-
appendAllChildren(newInstance, workInProgress);
|
|
7189
|
+
appendAllChildren(newInstance, workInProgress, false, false);
|
|
6786
7190
|
}
|
|
6787
7191
|
};
|
|
6788
7192
|
updateHostText$1 = function (current, workInProgress, oldText, newText) {
|
|
@@ -6813,8 +7217,12 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
6813
7217
|
var newProps = workInProgress.pendingProps;
|
|
6814
7218
|
|
|
6815
7219
|
switch (workInProgress.tag) {
|
|
7220
|
+
case IndeterminateComponent:
|
|
7221
|
+
break;
|
|
7222
|
+
case LazyComponent:
|
|
7223
|
+
break;
|
|
7224
|
+
case SimpleMemoComponent:
|
|
6816
7225
|
case FunctionComponent:
|
|
6817
|
-
case FunctionComponentLazy:
|
|
6818
7226
|
break;
|
|
6819
7227
|
case ClassComponent:
|
|
6820
7228
|
{
|
|
@@ -6824,14 +7232,6 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
6824
7232
|
}
|
|
6825
7233
|
break;
|
|
6826
7234
|
}
|
|
6827
|
-
case ClassComponentLazy:
|
|
6828
|
-
{
|
|
6829
|
-
var _Component = getResultFromResolvedThenable(workInProgress.type);
|
|
6830
|
-
if (isContextProvider(_Component)) {
|
|
6831
|
-
popContext(workInProgress);
|
|
6832
|
-
}
|
|
6833
|
-
break;
|
|
6834
|
-
}
|
|
6835
7235
|
case HostRoot:
|
|
6836
7236
|
{
|
|
6837
7237
|
popHostContainer(workInProgress);
|
|
@@ -6887,7 +7287,7 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
6887
7287
|
} else {
|
|
6888
7288
|
var instance = createInstance(type, newProps, rootContainerInstance, currentHostContext, workInProgress);
|
|
6889
7289
|
|
|
6890
|
-
appendAllChildren(instance, workInProgress);
|
|
7290
|
+
appendAllChildren(instance, workInProgress, false, false);
|
|
6891
7291
|
|
|
6892
7292
|
// Certain renderers require commit-time effects for initial mount.
|
|
6893
7293
|
// (eg DOM renderer supports auto-focus for certain elements).
|
|
@@ -6932,10 +7332,20 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
6932
7332
|
break;
|
|
6933
7333
|
}
|
|
6934
7334
|
case ForwardRef:
|
|
6935
|
-
case ForwardRefLazy:
|
|
6936
7335
|
break;
|
|
6937
7336
|
case SuspenseComponent:
|
|
6938
|
-
|
|
7337
|
+
{
|
|
7338
|
+
var nextState = workInProgress.memoizedState;
|
|
7339
|
+
var prevState = current !== null ? current.memoizedState : null;
|
|
7340
|
+
var nextDidTimeout = nextState !== null && nextState.didTimeout;
|
|
7341
|
+
var prevDidTimeout = prevState !== null && prevState.didTimeout;
|
|
7342
|
+
if (nextDidTimeout !== prevDidTimeout) {
|
|
7343
|
+
// If this render commits, and it switches between the normal state
|
|
7344
|
+
// and the timed-out state, schedule an effect.
|
|
7345
|
+
workInProgress.effectTag |= Update;
|
|
7346
|
+
}
|
|
7347
|
+
break;
|
|
7348
|
+
}
|
|
6939
7349
|
case Fragment:
|
|
6940
7350
|
break;
|
|
6941
7351
|
case Mode:
|
|
@@ -6952,13 +7362,18 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
6952
7362
|
break;
|
|
6953
7363
|
case ContextConsumer:
|
|
6954
7364
|
break;
|
|
6955
|
-
case
|
|
6956
|
-
case PureComponentLazy:
|
|
7365
|
+
case MemoComponent:
|
|
6957
7366
|
break;
|
|
6958
|
-
|
|
6959
|
-
|
|
6960
|
-
|
|
6961
|
-
|
|
7367
|
+
case IncompleteClassComponent:
|
|
7368
|
+
{
|
|
7369
|
+
// Same as class component case. I put it down here so that the tags are
|
|
7370
|
+
// sequential to ensure this switch is compiled to a jump table.
|
|
7371
|
+
var _Component = workInProgress.type;
|
|
7372
|
+
if (isContextProvider(_Component)) {
|
|
7373
|
+
popContext(workInProgress);
|
|
7374
|
+
}
|
|
7375
|
+
break;
|
|
7376
|
+
}
|
|
6962
7377
|
default:
|
|
6963
7378
|
invariant(false, 'Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue.');
|
|
6964
7379
|
}
|
|
@@ -6966,6 +7381,17 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
6966
7381
|
return null;
|
|
6967
7382
|
}
|
|
6968
7383
|
|
|
7384
|
+
function shouldCaptureSuspense(current, workInProgress) {
|
|
7385
|
+
// In order to capture, the Suspense component must have a fallback prop.
|
|
7386
|
+
if (workInProgress.memoizedProps.fallback === undefined) {
|
|
7387
|
+
return false;
|
|
7388
|
+
}
|
|
7389
|
+
// If it was the primary children that just suspended, capture and render the
|
|
7390
|
+
// fallback. Otherwise, don't capture and bubble to the next boundary.
|
|
7391
|
+
var nextState = workInProgress.memoizedState;
|
|
7392
|
+
return nextState === null || !nextState.didTimeout;
|
|
7393
|
+
}
|
|
7394
|
+
|
|
6969
7395
|
// This module is forked in different environments.
|
|
6970
7396
|
// By default, return `true` to log errors to the console.
|
|
6971
7397
|
// Forks can return `false` if this isn't desirable.
|
|
@@ -7033,8 +7459,6 @@ function logCapturedError(capturedError) {
|
|
|
7033
7459
|
}
|
|
7034
7460
|
}
|
|
7035
7461
|
|
|
7036
|
-
var emptyObject = {};
|
|
7037
|
-
|
|
7038
7462
|
var didWarnAboutUndefinedSnapshotBeforeUpdate = null;
|
|
7039
7463
|
{
|
|
7040
7464
|
didWarnAboutUndefinedSnapshotBeforeUpdate = new Set();
|
|
@@ -7116,7 +7540,6 @@ function safelyDetachRef(current$$1) {
|
|
|
7116
7540
|
function commitBeforeMutationLifeCycles(current$$1, finishedWork) {
|
|
7117
7541
|
switch (finishedWork.tag) {
|
|
7118
7542
|
case ClassComponent:
|
|
7119
|
-
case ClassComponentLazy:
|
|
7120
7543
|
{
|
|
7121
7544
|
if (finishedWork.effectTag & Snapshot) {
|
|
7122
7545
|
if (current$$1 !== null) {
|
|
@@ -7144,6 +7567,7 @@ function commitBeforeMutationLifeCycles(current$$1, finishedWork) {
|
|
|
7144
7567
|
case HostComponent:
|
|
7145
7568
|
case HostText:
|
|
7146
7569
|
case HostPortal:
|
|
7570
|
+
case IncompleteClassComponent:
|
|
7147
7571
|
// Nothing to do for these component types
|
|
7148
7572
|
return;
|
|
7149
7573
|
default:
|
|
@@ -7156,7 +7580,6 @@ function commitBeforeMutationLifeCycles(current$$1, finishedWork) {
|
|
|
7156
7580
|
function commitLifeCycles(finishedRoot, current$$1, finishedWork, committedExpirationTime) {
|
|
7157
7581
|
switch (finishedWork.tag) {
|
|
7158
7582
|
case ClassComponent:
|
|
7159
|
-
case ClassComponentLazy:
|
|
7160
7583
|
{
|
|
7161
7584
|
var instance = finishedWork.stateNode;
|
|
7162
7585
|
if (finishedWork.effectTag & Update) {
|
|
@@ -7195,7 +7618,6 @@ function commitLifeCycles(finishedRoot, current$$1, finishedWork, committedExpir
|
|
|
7195
7618
|
_instance = getPublicInstance(finishedWork.child.stateNode);
|
|
7196
7619
|
break;
|
|
7197
7620
|
case ClassComponent:
|
|
7198
|
-
case ClassComponentLazy:
|
|
7199
7621
|
_instance = finishedWork.child.stateNode;
|
|
7200
7622
|
break;
|
|
7201
7623
|
}
|
|
@@ -7245,22 +7667,48 @@ function commitLifeCycles(finishedRoot, current$$1, finishedWork, committedExpir
|
|
|
7245
7667
|
}
|
|
7246
7668
|
case SuspenseComponent:
|
|
7247
7669
|
{
|
|
7248
|
-
if (
|
|
7249
|
-
// In
|
|
7250
|
-
//
|
|
7251
|
-
//
|
|
7252
|
-
|
|
7253
|
-
|
|
7254
|
-
|
|
7670
|
+
if (finishedWork.effectTag & Callback) {
|
|
7671
|
+
// In non-strict mode, a suspense boundary times out by commiting
|
|
7672
|
+
// twice: first, by committing the children in an inconsistent state,
|
|
7673
|
+
// then hiding them and showing the fallback children in a subsequent
|
|
7674
|
+
var _newState = {
|
|
7675
|
+
alreadyCaptured: true,
|
|
7676
|
+
didTimeout: false,
|
|
7677
|
+
timedOutAt: NoWork
|
|
7678
|
+
};
|
|
7679
|
+
finishedWork.memoizedState = _newState;
|
|
7255
7680
|
scheduleWork(finishedWork, Sync);
|
|
7681
|
+
return;
|
|
7682
|
+
}
|
|
7683
|
+
var oldState = current$$1 !== null ? current$$1.memoizedState : null;
|
|
7684
|
+
var newState = finishedWork.memoizedState;
|
|
7685
|
+
var oldDidTimeout = oldState !== null ? oldState.didTimeout : false;
|
|
7686
|
+
|
|
7687
|
+
var newDidTimeout = void 0;
|
|
7688
|
+
var primaryChildParent = finishedWork;
|
|
7689
|
+
if (newState === null) {
|
|
7690
|
+
newDidTimeout = false;
|
|
7256
7691
|
} else {
|
|
7257
|
-
|
|
7258
|
-
|
|
7259
|
-
|
|
7260
|
-
|
|
7692
|
+
newDidTimeout = newState.didTimeout;
|
|
7693
|
+
if (newDidTimeout) {
|
|
7694
|
+
primaryChildParent = finishedWork.child;
|
|
7695
|
+
newState.alreadyCaptured = false;
|
|
7696
|
+
if (newState.timedOutAt === NoWork) {
|
|
7697
|
+
// If the children had not already timed out, record the time.
|
|
7698
|
+
// This is used to compute the elapsed time during subsequent
|
|
7699
|
+
// attempts to render the children.
|
|
7700
|
+
newState.timedOutAt = requestCurrentTime();
|
|
7701
|
+
}
|
|
7702
|
+
}
|
|
7703
|
+
}
|
|
7704
|
+
|
|
7705
|
+
if (newDidTimeout !== oldDidTimeout && primaryChildParent !== null) {
|
|
7706
|
+
hideOrUnhideAllChildren(primaryChildParent, newDidTimeout);
|
|
7261
7707
|
}
|
|
7262
7708
|
return;
|
|
7263
7709
|
}
|
|
7710
|
+
case IncompleteClassComponent:
|
|
7711
|
+
break;
|
|
7264
7712
|
default:
|
|
7265
7713
|
{
|
|
7266
7714
|
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.');
|
|
@@ -7268,6 +7716,45 @@ function commitLifeCycles(finishedRoot, current$$1, finishedWork, committedExpir
|
|
|
7268
7716
|
}
|
|
7269
7717
|
}
|
|
7270
7718
|
|
|
7719
|
+
function hideOrUnhideAllChildren(finishedWork, isHidden) {
|
|
7720
|
+
if (supportsMutation) {
|
|
7721
|
+
// We only have the top Fiber that was inserted but we need recurse down its
|
|
7722
|
+
var node = finishedWork;
|
|
7723
|
+
while (true) {
|
|
7724
|
+
if (node.tag === HostComponent) {
|
|
7725
|
+
var instance = node.stateNode;
|
|
7726
|
+
if (isHidden) {
|
|
7727
|
+
hideInstance(instance);
|
|
7728
|
+
} else {
|
|
7729
|
+
unhideInstance(node.stateNode, node.memoizedProps);
|
|
7730
|
+
}
|
|
7731
|
+
} else if (node.tag === HostText) {
|
|
7732
|
+
var _instance3 = node.stateNode;
|
|
7733
|
+
if (isHidden) {
|
|
7734
|
+
hideTextInstance(_instance3);
|
|
7735
|
+
} else {
|
|
7736
|
+
unhideTextInstance(_instance3, node.memoizedProps);
|
|
7737
|
+
}
|
|
7738
|
+
} else if (node.child !== null) {
|
|
7739
|
+
node.child.return = node;
|
|
7740
|
+
node = node.child;
|
|
7741
|
+
continue;
|
|
7742
|
+
}
|
|
7743
|
+
if (node === finishedWork) {
|
|
7744
|
+
return;
|
|
7745
|
+
}
|
|
7746
|
+
while (node.sibling === null) {
|
|
7747
|
+
if (node.return === null || node.return === finishedWork) {
|
|
7748
|
+
return;
|
|
7749
|
+
}
|
|
7750
|
+
node = node.return;
|
|
7751
|
+
}
|
|
7752
|
+
node.sibling.return = node.return;
|
|
7753
|
+
node = node.sibling;
|
|
7754
|
+
}
|
|
7755
|
+
}
|
|
7756
|
+
}
|
|
7757
|
+
|
|
7271
7758
|
function commitAttachRef(finishedWork) {
|
|
7272
7759
|
var ref = finishedWork.ref;
|
|
7273
7760
|
if (ref !== null) {
|
|
@@ -7313,7 +7800,6 @@ function commitUnmount(current$$1) {
|
|
|
7313
7800
|
|
|
7314
7801
|
switch (current$$1.tag) {
|
|
7315
7802
|
case ClassComponent:
|
|
7316
|
-
case ClassComponentLazy:
|
|
7317
7803
|
{
|
|
7318
7804
|
safelyDetachRef(current$$1);
|
|
7319
7805
|
var instance = current$$1.stateNode;
|
|
@@ -7407,7 +7893,6 @@ function commitContainer(finishedWork) {
|
|
|
7407
7893
|
|
|
7408
7894
|
switch (finishedWork.tag) {
|
|
7409
7895
|
case ClassComponent:
|
|
7410
|
-
case ClassComponentLazy:
|
|
7411
7896
|
{
|
|
7412
7897
|
return;
|
|
7413
7898
|
}
|
|
@@ -7672,7 +8157,6 @@ function commitWork(current$$1, finishedWork) {
|
|
|
7672
8157
|
|
|
7673
8158
|
switch (finishedWork.tag) {
|
|
7674
8159
|
case ClassComponent:
|
|
7675
|
-
case ClassComponentLazy:
|
|
7676
8160
|
{
|
|
7677
8161
|
return;
|
|
7678
8162
|
}
|
|
@@ -7720,6 +8204,10 @@ function commitWork(current$$1, finishedWork) {
|
|
|
7720
8204
|
{
|
|
7721
8205
|
return;
|
|
7722
8206
|
}
|
|
8207
|
+
case IncompleteClassComponent:
|
|
8208
|
+
{
|
|
8209
|
+
return;
|
|
8210
|
+
}
|
|
7723
8211
|
default:
|
|
7724
8212
|
{
|
|
7725
8213
|
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.');
|
|
@@ -7734,10 +8222,6 @@ function commitResetTextContent(current$$1) {
|
|
|
7734
8222
|
resetTextContent(current$$1.stateNode);
|
|
7735
8223
|
}
|
|
7736
8224
|
|
|
7737
|
-
function NoopComponent() {
|
|
7738
|
-
return null;
|
|
7739
|
-
}
|
|
7740
|
-
|
|
7741
8225
|
function createRootErrorUpdate(fiber, errorInfo, expirationTime) {
|
|
7742
8226
|
var update = createUpdate(expirationTime);
|
|
7743
8227
|
// Unmount the root by rendering null.
|
|
@@ -7815,17 +8299,16 @@ function throwException(root, returnFiber, sourceFiber, value, renderExpirationT
|
|
|
7815
8299
|
do {
|
|
7816
8300
|
if (_workInProgress.tag === SuspenseComponent) {
|
|
7817
8301
|
var current = _workInProgress.alternate;
|
|
7818
|
-
if (current !== null
|
|
7819
|
-
|
|
7820
|
-
|
|
7821
|
-
|
|
7822
|
-
|
|
7823
|
-
|
|
7824
|
-
|
|
7825
|
-
|
|
7826
|
-
|
|
7827
|
-
|
|
7828
|
-
break;
|
|
8302
|
+
if (current !== null) {
|
|
8303
|
+
var currentState = current.memoizedState;
|
|
8304
|
+
if (currentState !== null && currentState.didTimeout) {
|
|
8305
|
+
// Reached a boundary that already timed out. Do not search
|
|
8306
|
+
// any further.
|
|
8307
|
+
var timedOutAt = currentState.timedOutAt;
|
|
8308
|
+
startTimeMs = expirationTimeToMs(timedOutAt);
|
|
8309
|
+
// Do not search any further.
|
|
8310
|
+
break;
|
|
8311
|
+
}
|
|
7829
8312
|
}
|
|
7830
8313
|
var timeoutPropMs = _workInProgress.pendingProps.maxDuration;
|
|
7831
8314
|
if (typeof timeoutPropMs === 'number') {
|
|
@@ -7842,103 +8325,93 @@ function throwException(root, returnFiber, sourceFiber, value, renderExpirationT
|
|
|
7842
8325
|
// Schedule the nearest Suspense to re-render the timed out view.
|
|
7843
8326
|
_workInProgress = returnFiber;
|
|
7844
8327
|
do {
|
|
7845
|
-
if (_workInProgress.tag === SuspenseComponent) {
|
|
7846
|
-
|
|
7847
|
-
|
|
7848
|
-
|
|
7849
|
-
|
|
7850
|
-
|
|
7851
|
-
|
|
7852
|
-
|
|
7853
|
-
|
|
7854
|
-
|
|
7855
|
-
|
|
7856
|
-
|
|
7857
|
-
|
|
7858
|
-
|
|
7859
|
-
|
|
7860
|
-
|
|
7861
|
-
|
|
7862
|
-
|
|
7863
|
-
|
|
7864
|
-
|
|
7865
|
-
|
|
7866
|
-
|
|
7867
|
-
|
|
7868
|
-
|
|
7869
|
-
|
|
7870
|
-
|
|
7871
|
-
|
|
7872
|
-
|
|
7873
|
-
|
|
7874
|
-
|
|
7875
|
-
|
|
7876
|
-
|
|
7877
|
-
|
|
7878
|
-
|
|
7879
|
-
|
|
7880
|
-
|
|
7881
|
-
|
|
7882
|
-
|
|
7883
|
-
//
|
|
7884
|
-
//
|
|
7885
|
-
|
|
7886
|
-
sourceFiber.effectTag &= ~LifecycleEffectMask;
|
|
7887
|
-
if (sourceFiber.alternate === null) {
|
|
7888
|
-
// We're about to mount a class component that doesn't have an
|
|
7889
|
-
// instance. Turn this into a dummy function component instead,
|
|
7890
|
-
// to prevent type errors. This is a bit weird but it's an edge
|
|
7891
|
-
// case and we're about to synchronously delete this
|
|
7892
|
-
// component, anyway.
|
|
7893
|
-
sourceFiber.tag = FunctionComponent;
|
|
7894
|
-
sourceFiber.type = NoopComponent;
|
|
7895
|
-
}
|
|
8328
|
+
if (_workInProgress.tag === SuspenseComponent && shouldCaptureSuspense(_workInProgress.alternate, _workInProgress)) {
|
|
8329
|
+
// Found the nearest boundary.
|
|
8330
|
+
|
|
8331
|
+
// If the boundary is not in concurrent mode, we should not suspend, and
|
|
8332
|
+
// likewise, when the promise resolves, we should ping synchronously.
|
|
8333
|
+
var pingTime = (_workInProgress.mode & ConcurrentMode) === NoEffect ? Sync : renderExpirationTime;
|
|
8334
|
+
|
|
8335
|
+
// Attach a listener to the promise to "ping" the root and retry.
|
|
8336
|
+
var onResolveOrReject = retrySuspendedRoot.bind(null, root, _workInProgress, sourceFiber, pingTime);
|
|
8337
|
+
if (enableSchedulerTracing) {
|
|
8338
|
+
onResolveOrReject = tracing.unstable_wrap(onResolveOrReject);
|
|
8339
|
+
}
|
|
8340
|
+
thenable.then(onResolveOrReject, onResolveOrReject);
|
|
8341
|
+
|
|
8342
|
+
// If the boundary is outside of concurrent mode, we should *not*
|
|
8343
|
+
// suspend the commit. Pretend as if the suspended component rendered
|
|
8344
|
+
// null and keep rendering. In the commit phase, we'll schedule a
|
|
8345
|
+
// subsequent synchronous update to re-render the Suspense.
|
|
8346
|
+
//
|
|
8347
|
+
// Note: It doesn't matter whether the component that suspended was
|
|
8348
|
+
// inside a concurrent mode tree. If the Suspense is outside of it, we
|
|
8349
|
+
// should *not* suspend the commit.
|
|
8350
|
+
if ((_workInProgress.mode & ConcurrentMode) === NoEffect) {
|
|
8351
|
+
_workInProgress.effectTag |= Callback;
|
|
8352
|
+
|
|
8353
|
+
// Unmount the source fiber's children
|
|
8354
|
+
var nextChildren = null;
|
|
8355
|
+
reconcileChildren(sourceFiber.alternate, sourceFiber, nextChildren, renderExpirationTime);
|
|
8356
|
+
sourceFiber.effectTag &= ~Incomplete;
|
|
8357
|
+
|
|
8358
|
+
if (sourceFiber.tag === ClassComponent) {
|
|
8359
|
+
// We're going to commit this fiber even though it didn't complete.
|
|
8360
|
+
// But we shouldn't call any lifecycle methods or callbacks. Remove
|
|
8361
|
+
// all lifecycle effect tags.
|
|
8362
|
+
sourceFiber.effectTag &= ~LifecycleEffectMask;
|
|
8363
|
+
var _current = sourceFiber.alternate;
|
|
8364
|
+
if (_current === null) {
|
|
8365
|
+
// This is a new mount. Change the tag so it's not mistaken for a
|
|
8366
|
+
// completed component. For example, we should not call
|
|
8367
|
+
// componentWillUnmount if it is deleted.
|
|
8368
|
+
sourceFiber.tag = IncompleteClassComponent;
|
|
7896
8369
|
}
|
|
7897
|
-
|
|
7898
|
-
// Exit without suspending.
|
|
7899
|
-
return;
|
|
7900
8370
|
}
|
|
7901
8371
|
|
|
7902
|
-
//
|
|
7903
|
-
|
|
8372
|
+
// Exit without suspending.
|
|
8373
|
+
return;
|
|
8374
|
+
}
|
|
7904
8375
|
|
|
7905
|
-
|
|
7906
|
-
|
|
7907
|
-
|
|
7908
|
-
|
|
7909
|
-
|
|
7910
|
-
|
|
7911
|
-
|
|
7912
|
-
|
|
7913
|
-
|
|
7914
|
-
|
|
7915
|
-
|
|
7916
|
-
|
|
7917
|
-
|
|
7918
|
-
|
|
7919
|
-
|
|
7920
|
-
|
|
7921
|
-
|
|
7922
|
-
|
|
7923
|
-
|
|
7924
|
-
|
|
7925
|
-
|
|
7926
|
-
|
|
8376
|
+
// Confirmed that the boundary is in a concurrent mode tree. Continue
|
|
8377
|
+
// with the normal suspend path.
|
|
8378
|
+
|
|
8379
|
+
var absoluteTimeoutMs = void 0;
|
|
8380
|
+
if (earliestTimeoutMs === -1) {
|
|
8381
|
+
// If no explicit threshold is given, default to an abitrarily large
|
|
8382
|
+
// value. The actual size doesn't matter because the threshold for the
|
|
8383
|
+
// whole tree will be clamped to the expiration time.
|
|
8384
|
+
absoluteTimeoutMs = maxSigned31BitInt;
|
|
8385
|
+
} else {
|
|
8386
|
+
if (startTimeMs === -1) {
|
|
8387
|
+
// This suspend happened outside of any already timed-out
|
|
8388
|
+
// placeholders. We don't know exactly when the update was
|
|
8389
|
+
// scheduled, but we can infer an approximate start time from the
|
|
8390
|
+
// expiration time. First, find the earliest uncommitted expiration
|
|
8391
|
+
// time in the tree, including work that is suspended. Then subtract
|
|
8392
|
+
// the offset used to compute an async update's expiration time.
|
|
8393
|
+
// This will cause high priority (interactive) work to expire
|
|
8394
|
+
// earlier than necessary, but we can account for this by adjusting
|
|
8395
|
+
// for the Just Noticeable Difference.
|
|
8396
|
+
var earliestExpirationTime = findEarliestOutstandingPriorityLevel(root, renderExpirationTime);
|
|
8397
|
+
var earliestExpirationTimeMs = expirationTimeToMs(earliestExpirationTime);
|
|
8398
|
+
startTimeMs = earliestExpirationTimeMs - LOW_PRIORITY_EXPIRATION;
|
|
7927
8399
|
}
|
|
8400
|
+
absoluteTimeoutMs = startTimeMs + earliestTimeoutMs;
|
|
8401
|
+
}
|
|
7928
8402
|
|
|
7929
|
-
|
|
7930
|
-
|
|
7931
|
-
|
|
7932
|
-
|
|
7933
|
-
|
|
8403
|
+
// Mark the earliest timeout in the suspended fiber's ancestor path.
|
|
8404
|
+
// After completing the root, we'll take the largest of all the
|
|
8405
|
+
// suspended fiber's timeouts and use it to compute a timeout for the
|
|
8406
|
+
// whole tree.
|
|
8407
|
+
renderDidSuspend(root, absoluteTimeoutMs, renderExpirationTime);
|
|
7934
8408
|
|
|
7935
|
-
|
|
7936
|
-
|
|
7937
|
-
|
|
7938
|
-
}
|
|
7939
|
-
// This boundary already captured during this render. Continue to the
|
|
7940
|
-
// next boundary.
|
|
8409
|
+
_workInProgress.effectTag |= ShouldCapture;
|
|
8410
|
+
_workInProgress.expirationTime = renderExpirationTime;
|
|
8411
|
+
return;
|
|
7941
8412
|
}
|
|
8413
|
+
// This boundary already captured during this render. Continue to the next
|
|
8414
|
+
// boundary.
|
|
7942
8415
|
_workInProgress = _workInProgress.return;
|
|
7943
8416
|
} while (_workInProgress !== null);
|
|
7944
8417
|
// No boundary was found. Fallthrough to error mode.
|
|
@@ -7963,7 +8436,6 @@ function throwException(root, returnFiber, sourceFiber, value, renderExpirationT
|
|
|
7963
8436
|
return;
|
|
7964
8437
|
}
|
|
7965
8438
|
case ClassComponent:
|
|
7966
|
-
case ClassComponentLazy:
|
|
7967
8439
|
// Capture and retry
|
|
7968
8440
|
var errorInfo = value;
|
|
7969
8441
|
var ctor = workInProgress.type;
|
|
@@ -7999,26 +8471,13 @@ function unwindWork(workInProgress, renderExpirationTime) {
|
|
|
7999
8471
|
}
|
|
8000
8472
|
return null;
|
|
8001
8473
|
}
|
|
8002
|
-
case ClassComponentLazy:
|
|
8003
|
-
{
|
|
8004
|
-
var _Component = workInProgress.type._reactResult;
|
|
8005
|
-
if (isContextProvider(_Component)) {
|
|
8006
|
-
popContext(workInProgress);
|
|
8007
|
-
}
|
|
8008
|
-
var _effectTag = workInProgress.effectTag;
|
|
8009
|
-
if (_effectTag & ShouldCapture) {
|
|
8010
|
-
workInProgress.effectTag = _effectTag & ~ShouldCapture | DidCapture;
|
|
8011
|
-
return workInProgress;
|
|
8012
|
-
}
|
|
8013
|
-
return null;
|
|
8014
|
-
}
|
|
8015
8474
|
case HostRoot:
|
|
8016
8475
|
{
|
|
8017
8476
|
popHostContainer(workInProgress);
|
|
8018
8477
|
popTopLevelContextObject(workInProgress);
|
|
8019
|
-
var
|
|
8020
|
-
!((
|
|
8021
|
-
workInProgress.effectTag =
|
|
8478
|
+
var _effectTag = workInProgress.effectTag;
|
|
8479
|
+
!((_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;
|
|
8480
|
+
workInProgress.effectTag = _effectTag & ~ShouldCapture | DidCapture;
|
|
8022
8481
|
return workInProgress;
|
|
8023
8482
|
}
|
|
8024
8483
|
case HostComponent:
|
|
@@ -8028,9 +8487,35 @@ function unwindWork(workInProgress, renderExpirationTime) {
|
|
|
8028
8487
|
}
|
|
8029
8488
|
case SuspenseComponent:
|
|
8030
8489
|
{
|
|
8031
|
-
var
|
|
8032
|
-
if (
|
|
8033
|
-
workInProgress.effectTag =
|
|
8490
|
+
var _effectTag2 = workInProgress.effectTag;
|
|
8491
|
+
if (_effectTag2 & ShouldCapture) {
|
|
8492
|
+
workInProgress.effectTag = _effectTag2 & ~ShouldCapture | DidCapture;
|
|
8493
|
+
// Captured a suspense effect. Set the boundary's `alreadyCaptured`
|
|
8494
|
+
// state to true so we know to render the fallback.
|
|
8495
|
+
var current = workInProgress.alternate;
|
|
8496
|
+
var currentState = current !== null ? current.memoizedState : null;
|
|
8497
|
+
var nextState = workInProgress.memoizedState;
|
|
8498
|
+
if (nextState === null) {
|
|
8499
|
+
// No existing state. Create a new object.
|
|
8500
|
+
nextState = {
|
|
8501
|
+
alreadyCaptured: true,
|
|
8502
|
+
didTimeout: false,
|
|
8503
|
+
timedOutAt: NoWork
|
|
8504
|
+
};
|
|
8505
|
+
} else if (currentState === nextState) {
|
|
8506
|
+
// There is an existing state but it's the same as the current tree's.
|
|
8507
|
+
// Clone the object.
|
|
8508
|
+
nextState = {
|
|
8509
|
+
alreadyCaptured: true,
|
|
8510
|
+
didTimeout: nextState.didTimeout,
|
|
8511
|
+
timedOutAt: nextState.timedOutAt
|
|
8512
|
+
};
|
|
8513
|
+
} else {
|
|
8514
|
+
// Already have a clone, so it's safe to mutate.
|
|
8515
|
+
nextState.alreadyCaptured = true;
|
|
8516
|
+
}
|
|
8517
|
+
workInProgress.memoizedState = nextState;
|
|
8518
|
+
// Re-render the boundary.
|
|
8034
8519
|
return workInProgress;
|
|
8035
8520
|
}
|
|
8036
8521
|
return null;
|
|
@@ -8056,14 +8541,6 @@ function unwindInterruptedWork(interruptedWork) {
|
|
|
8056
8541
|
}
|
|
8057
8542
|
break;
|
|
8058
8543
|
}
|
|
8059
|
-
case ClassComponentLazy:
|
|
8060
|
-
{
|
|
8061
|
-
var _childContextTypes = interruptedWork.type._reactResult.childContextTypes;
|
|
8062
|
-
if (_childContextTypes !== null && _childContextTypes !== undefined) {
|
|
8063
|
-
popContext(interruptedWork);
|
|
8064
|
-
}
|
|
8065
|
-
break;
|
|
8066
|
-
}
|
|
8067
8544
|
case HostRoot:
|
|
8068
8545
|
{
|
|
8069
8546
|
popHostContainer(interruptedWork);
|
|
@@ -8206,14 +8683,6 @@ if (true && replayFailedUnitOfWorkWithInvokeGuardedCallback) {
|
|
|
8206
8683
|
}
|
|
8207
8684
|
break;
|
|
8208
8685
|
}
|
|
8209
|
-
case ClassComponentLazy:
|
|
8210
|
-
{
|
|
8211
|
-
var _Component = getResultFromResolvedThenable(failedUnitOfWork.type);
|
|
8212
|
-
if (isContextProvider(_Component)) {
|
|
8213
|
-
popContext(failedUnitOfWork);
|
|
8214
|
-
}
|
|
8215
|
-
break;
|
|
8216
|
-
}
|
|
8217
8686
|
case HostPortal:
|
|
8218
8687
|
popHostContainer(failedUnitOfWork);
|
|
8219
8688
|
break;
|
|
@@ -8873,6 +9342,7 @@ function performUnitOfWork(workInProgress) {
|
|
|
8873
9342
|
}
|
|
8874
9343
|
|
|
8875
9344
|
next = beginWork(current$$1, workInProgress, nextRenderExpirationTime);
|
|
9345
|
+
workInProgress.memoizedProps = workInProgress.pendingProps;
|
|
8876
9346
|
|
|
8877
9347
|
if (workInProgress.mode & ProfileMode) {
|
|
8878
9348
|
// Record the render duration assuming we didn't bailout (or error).
|
|
@@ -8880,6 +9350,7 @@ function performUnitOfWork(workInProgress) {
|
|
|
8880
9350
|
}
|
|
8881
9351
|
} else {
|
|
8882
9352
|
next = beginWork(current$$1, workInProgress, nextRenderExpirationTime);
|
|
9353
|
+
workInProgress.memoizedProps = workInProgress.pendingProps;
|
|
8883
9354
|
}
|
|
8884
9355
|
|
|
8885
9356
|
{
|
|
@@ -9153,7 +9624,6 @@ function dispatch(sourceFiber, value, expirationTime) {
|
|
|
9153
9624
|
while (fiber !== null) {
|
|
9154
9625
|
switch (fiber.tag) {
|
|
9155
9626
|
case ClassComponent:
|
|
9156
|
-
case ClassComponentLazy:
|
|
9157
9627
|
var ctor = fiber.type;
|
|
9158
9628
|
var instance = fiber.stateNode;
|
|
9159
9629
|
if (typeof ctor.getDerivedStateFromError === 'function' || typeof instance.componentDidCatch === 'function' && !isAlreadyFailedLegacyErrorBoundary(instance)) {
|
|
@@ -9246,7 +9716,7 @@ function renderDidError() {
|
|
|
9246
9716
|
nextRenderDidError = true;
|
|
9247
9717
|
}
|
|
9248
9718
|
|
|
9249
|
-
function retrySuspendedRoot(root,
|
|
9719
|
+
function retrySuspendedRoot(root, boundaryFiber, sourceFiber, suspendedTime) {
|
|
9250
9720
|
var retryTime = void 0;
|
|
9251
9721
|
|
|
9252
9722
|
if (isPriorityLevelSuspended(root, suspendedTime)) {
|
|
@@ -9257,18 +9727,18 @@ function retrySuspendedRoot(root, fiber, suspendedTime) {
|
|
|
9257
9727
|
} else {
|
|
9258
9728
|
// Suspense already timed out. Compute a new expiration time
|
|
9259
9729
|
var currentTime = requestCurrentTime();
|
|
9260
|
-
retryTime = computeExpirationForFiber(currentTime,
|
|
9730
|
+
retryTime = computeExpirationForFiber(currentTime, boundaryFiber);
|
|
9261
9731
|
markPendingPriorityLevel(root, retryTime);
|
|
9262
9732
|
}
|
|
9263
9733
|
|
|
9264
|
-
// TODO: If the
|
|
9734
|
+
// TODO: If the suspense fiber has already rendered the primary children
|
|
9265
9735
|
// without suspending (that is, all of the promises have already resolved),
|
|
9266
9736
|
// we should not trigger another update here. One case this happens is when
|
|
9267
9737
|
// we are in sync mode and a single promise is thrown both on initial render
|
|
9268
9738
|
// and on update; we attach two .then(retrySuspendedRoot) callbacks and each
|
|
9269
9739
|
// one performs Sync work, rerendering the Suspense.
|
|
9270
9740
|
|
|
9271
|
-
if ((
|
|
9741
|
+
if ((boundaryFiber.mode & ConcurrentMode) !== NoContext) {
|
|
9272
9742
|
if (root === nextRoot && nextRenderExpirationTime === suspendedTime) {
|
|
9273
9743
|
// Received a ping at the same priority level at which we're currently
|
|
9274
9744
|
// rendering. Restart from the root.
|
|
@@ -9276,7 +9746,23 @@ function retrySuspendedRoot(root, fiber, suspendedTime) {
|
|
|
9276
9746
|
}
|
|
9277
9747
|
}
|
|
9278
9748
|
|
|
9279
|
-
scheduleWorkToRoot(
|
|
9749
|
+
scheduleWorkToRoot(boundaryFiber, retryTime);
|
|
9750
|
+
if ((boundaryFiber.mode & ConcurrentMode) === NoContext) {
|
|
9751
|
+
// Outside of concurrent mode, we must schedule an update on the source
|
|
9752
|
+
// fiber, too, since it already committed in an inconsistent state and
|
|
9753
|
+
// therefore does not have any pending work.
|
|
9754
|
+
scheduleWorkToRoot(sourceFiber, retryTime);
|
|
9755
|
+
var sourceTag = sourceFiber.tag;
|
|
9756
|
+
if (sourceTag === ClassComponent && sourceFiber.stateNode !== null) {
|
|
9757
|
+
// When we try rendering again, we should not reuse the current fiber,
|
|
9758
|
+
// since it's known to be in an inconsistent state. Use a force updte to
|
|
9759
|
+
// prevent a bail out.
|
|
9760
|
+
var update = createUpdate(retryTime);
|
|
9761
|
+
update.tag = ForceUpdate;
|
|
9762
|
+
enqueueUpdate(sourceFiber, update);
|
|
9763
|
+
}
|
|
9764
|
+
}
|
|
9765
|
+
|
|
9280
9766
|
var rootExpirationTime = root.expirationTime;
|
|
9281
9767
|
if (rootExpirationTime !== NoWork) {
|
|
9282
9768
|
requestWork(root, rootExpirationTime);
|
|
@@ -9287,7 +9773,7 @@ function scheduleWorkToRoot(fiber, expirationTime) {
|
|
|
9287
9773
|
recordScheduleUpdate();
|
|
9288
9774
|
|
|
9289
9775
|
{
|
|
9290
|
-
if (fiber.tag === ClassComponent
|
|
9776
|
+
if (fiber.tag === ClassComponent) {
|
|
9291
9777
|
var instance = fiber.stateNode;
|
|
9292
9778
|
warnAboutInvalidUpdates(instance);
|
|
9293
9779
|
}
|
|
@@ -9326,7 +9812,7 @@ function scheduleWorkToRoot(fiber, expirationTime) {
|
|
|
9326
9812
|
}
|
|
9327
9813
|
|
|
9328
9814
|
if (root === null) {
|
|
9329
|
-
if (true &&
|
|
9815
|
+
if (true && fiber.tag === ClassComponent) {
|
|
9330
9816
|
warnAboutUpdateOnUnmounted(fiber);
|
|
9331
9817
|
}
|
|
9332
9818
|
return null;
|
|
@@ -9935,9 +10421,9 @@ function flushSync(fn, a) {
|
|
|
9935
10421
|
|
|
9936
10422
|
|
|
9937
10423
|
var didWarnAboutNestedUpdates = void 0;
|
|
9938
|
-
|
|
9939
10424
|
{
|
|
9940
10425
|
didWarnAboutNestedUpdates = false;
|
|
10426
|
+
|
|
9941
10427
|
}
|
|
9942
10428
|
|
|
9943
10429
|
function getContextForSubtree(parentComponent) {
|
|
@@ -9953,11 +10439,6 @@ function getContextForSubtree(parentComponent) {
|
|
|
9953
10439
|
if (isContextProvider(Component)) {
|
|
9954
10440
|
return processChildContext(fiber, Component, parentContext);
|
|
9955
10441
|
}
|
|
9956
|
-
} else if (fiber.tag === ClassComponentLazy) {
|
|
9957
|
-
var _Component = getResultFromResolvedThenable(fiber.type);
|
|
9958
|
-
if (isContextProvider(_Component)) {
|
|
9959
|
-
return processChildContext(fiber, _Component, parentContext);
|
|
9960
|
-
}
|
|
9961
10442
|
}
|
|
9962
10443
|
|
|
9963
10444
|
return parentContext;
|
|
@@ -10184,7 +10665,7 @@ function batchedUpdates$1(fn, bookkeeping) {
|
|
|
10184
10665
|
|
|
10185
10666
|
// TODO: this is special because it gets imported during build.
|
|
10186
10667
|
|
|
10187
|
-
var ReactVersion = '16.6.0
|
|
10668
|
+
var ReactVersion = '16.6.0';
|
|
10188
10669
|
|
|
10189
10670
|
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
10190
10671
|
|
|
@@ -10199,32 +10680,49 @@ var defaultTestOptions = {
|
|
|
10199
10680
|
};
|
|
10200
10681
|
|
|
10201
10682
|
function toJSON(inst) {
|
|
10683
|
+
if (inst.isHidden) {
|
|
10684
|
+
// Omit timed out children from output entirely. This seems like the least
|
|
10685
|
+
// surprising behavior. We could perhaps add a separate API that includes
|
|
10686
|
+
// them, if it turns out people need it.
|
|
10687
|
+
return null;
|
|
10688
|
+
}
|
|
10202
10689
|
switch (inst.tag) {
|
|
10203
10690
|
case 'TEXT':
|
|
10204
10691
|
return inst.text;
|
|
10205
10692
|
case 'INSTANCE':
|
|
10206
|
-
|
|
10207
|
-
|
|
10208
|
-
|
|
10209
|
-
|
|
10210
|
-
|
|
10211
|
-
|
|
10212
|
-
|
|
10213
|
-
|
|
10214
|
-
|
|
10215
|
-
|
|
10216
|
-
|
|
10217
|
-
|
|
10693
|
+
{
|
|
10694
|
+
/* eslint-disable no-unused-vars */
|
|
10695
|
+
// We don't include the `children` prop in JSON.
|
|
10696
|
+
// Instead, we will include the actual rendered children.
|
|
10697
|
+
var _inst$props = inst.props,
|
|
10698
|
+
_children = _inst$props.children,
|
|
10699
|
+
_props = _objectWithoutProperties(_inst$props, ['children']);
|
|
10700
|
+
/* eslint-enable */
|
|
10701
|
+
|
|
10702
|
+
|
|
10703
|
+
var renderedChildren = null;
|
|
10704
|
+
if (inst.children && inst.children.length) {
|
|
10705
|
+
for (var i = 0; i < inst.children.length; i++) {
|
|
10706
|
+
var renderedChild = toJSON(inst.children[i]);
|
|
10707
|
+
if (renderedChild !== null) {
|
|
10708
|
+
if (renderedChildren === null) {
|
|
10709
|
+
renderedChildren = [renderedChild];
|
|
10710
|
+
} else {
|
|
10711
|
+
renderedChildren.push(renderedChild);
|
|
10712
|
+
}
|
|
10713
|
+
}
|
|
10714
|
+
}
|
|
10715
|
+
}
|
|
10716
|
+
var json = {
|
|
10717
|
+
type: inst.type,
|
|
10718
|
+
props: _props,
|
|
10719
|
+
children: renderedChildren
|
|
10720
|
+
};
|
|
10721
|
+
Object.defineProperty(json, '$$typeof', {
|
|
10722
|
+
value: Symbol.for('react.test.json')
|
|
10723
|
+
});
|
|
10724
|
+
return json;
|
|
10218
10725
|
}
|
|
10219
|
-
var json = {
|
|
10220
|
-
type: inst.type,
|
|
10221
|
-
props: _props,
|
|
10222
|
-
children: renderedChildren
|
|
10223
|
-
};
|
|
10224
|
-
Object.defineProperty(json, '$$typeof', {
|
|
10225
|
-
value: Symbol.for('react.test.json')
|
|
10226
|
-
});
|
|
10227
|
-
return json;
|
|
10228
10726
|
default:
|
|
10229
10727
|
throw new Error('Unexpected node type in toJSON: ' + inst.tag);
|
|
10230
10728
|
}
|
|
@@ -10289,19 +10787,8 @@ function toTree(node) {
|
|
|
10289
10787
|
instance: node.stateNode,
|
|
10290
10788
|
rendered: childrenToTree(node.child)
|
|
10291
10789
|
};
|
|
10292
|
-
case ClassComponentLazy:
|
|
10293
|
-
{
|
|
10294
|
-
var thenable = node.type;
|
|
10295
|
-
var _type = thenable._reactResult;
|
|
10296
|
-
return {
|
|
10297
|
-
nodeType: 'component',
|
|
10298
|
-
type: _type,
|
|
10299
|
-
props: _assign({}, node.memoizedProps),
|
|
10300
|
-
instance: node.stateNode,
|
|
10301
|
-
rendered: childrenToTree(node.child)
|
|
10302
|
-
};
|
|
10303
|
-
}
|
|
10304
10790
|
case FunctionComponent:
|
|
10791
|
+
case SimpleMemoComponent:
|
|
10305
10792
|
return {
|
|
10306
10793
|
nodeType: 'component',
|
|
10307
10794
|
type: node.type,
|
|
@@ -10309,18 +10796,6 @@ function toTree(node) {
|
|
|
10309
10796
|
instance: null,
|
|
10310
10797
|
rendered: childrenToTree(node.child)
|
|
10311
10798
|
};
|
|
10312
|
-
case FunctionComponentLazy:
|
|
10313
|
-
{
|
|
10314
|
-
var _thenable = node.type;
|
|
10315
|
-
var _type2 = _thenable._reactResult;
|
|
10316
|
-
return {
|
|
10317
|
-
nodeType: 'component',
|
|
10318
|
-
type: _type2,
|
|
10319
|
-
props: _assign({}, node.memoizedProps),
|
|
10320
|
-
instance: node.stateNode,
|
|
10321
|
-
rendered: childrenToTree(node.child)
|
|
10322
|
-
};
|
|
10323
|
-
}
|
|
10324
10799
|
case HostComponent:
|
|
10325
10800
|
{
|
|
10326
10801
|
return {
|
|
@@ -10339,16 +10814,15 @@ function toTree(node) {
|
|
|
10339
10814
|
case Mode:
|
|
10340
10815
|
case Profiler:
|
|
10341
10816
|
case ForwardRef:
|
|
10342
|
-
case
|
|
10343
|
-
case
|
|
10344
|
-
case PureComponentLazy:
|
|
10817
|
+
case MemoComponent:
|
|
10818
|
+
case IncompleteClassComponent:
|
|
10345
10819
|
return childrenToTree(node.child);
|
|
10346
10820
|
default:
|
|
10347
10821
|
invariant(false, 'toTree() does not yet know how to handle nodes with tag=%s', node.tag);
|
|
10348
10822
|
}
|
|
10349
10823
|
}
|
|
10350
10824
|
|
|
10351
|
-
var validWrapperTypes = new Set([FunctionComponent,
|
|
10825
|
+
var validWrapperTypes = new Set([FunctionComponent, ClassComponent, HostComponent, ForwardRef, MemoComponent,
|
|
10352
10826
|
// Normally skipped, but used when there's more than one root child.
|
|
10353
10827
|
HostRoot]);
|
|
10354
10828
|
|
|
@@ -10559,7 +11033,21 @@ var ReactTestRendererFiber = {
|
|
|
10559
11033
|
if (container.children.length === 1) {
|
|
10560
11034
|
return toJSON(container.children[0]);
|
|
10561
11035
|
}
|
|
10562
|
-
|
|
11036
|
+
|
|
11037
|
+
var renderedChildren = null;
|
|
11038
|
+
if (container.children && container.children.length) {
|
|
11039
|
+
for (var i = 0; i < container.children.length; i++) {
|
|
11040
|
+
var renderedChild = toJSON(container.children[i]);
|
|
11041
|
+
if (renderedChild !== null) {
|
|
11042
|
+
if (renderedChildren === null) {
|
|
11043
|
+
renderedChildren = [renderedChild];
|
|
11044
|
+
} else {
|
|
11045
|
+
renderedChildren.push(renderedChild);
|
|
11046
|
+
}
|
|
11047
|
+
}
|
|
11048
|
+
}
|
|
11049
|
+
}
|
|
11050
|
+
return renderedChildren;
|
|
10563
11051
|
},
|
|
10564
11052
|
toTree: function () {
|
|
10565
11053
|
if (root == null || root.current == null) {
|