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.
|
|
@@ -196,7 +196,8 @@ var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace;
|
|
|
196
196
|
var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
|
|
197
197
|
var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
|
|
198
198
|
var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
|
|
199
|
-
var
|
|
199
|
+
var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
|
|
200
|
+
var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
|
|
200
201
|
|
|
201
202
|
var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
|
|
202
203
|
var FAUX_ITERATOR_SYMBOL = '@@iterator';
|
|
@@ -216,12 +217,13 @@ var Pending = 0;
|
|
|
216
217
|
var Resolved = 1;
|
|
217
218
|
var Rejected = 2;
|
|
218
219
|
|
|
219
|
-
function
|
|
220
|
-
return
|
|
220
|
+
function refineResolvedLazyComponent(lazyComponent) {
|
|
221
|
+
return lazyComponent._status === Resolved ? lazyComponent._result : null;
|
|
221
222
|
}
|
|
222
223
|
|
|
223
|
-
function
|
|
224
|
-
|
|
224
|
+
function getWrappedName(outerType, innerType, wrapperName) {
|
|
225
|
+
var functionName = innerType.displayName || innerType.name || '';
|
|
226
|
+
return outerType.displayName || (functionName !== '' ? wrapperName + '(' + functionName + ')' : wrapperName);
|
|
225
227
|
}
|
|
226
228
|
|
|
227
229
|
function getComponentName(type) {
|
|
@@ -261,40 +263,40 @@ function getComponentName(type) {
|
|
|
261
263
|
case REACT_PROVIDER_TYPE:
|
|
262
264
|
return 'Context.Provider';
|
|
263
265
|
case REACT_FORWARD_REF_TYPE:
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
return type.
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
266
|
+
return getWrappedName(type, type.render, 'ForwardRef');
|
|
267
|
+
case REACT_MEMO_TYPE:
|
|
268
|
+
return getComponentName(type.type);
|
|
269
|
+
case REACT_LAZY_TYPE:
|
|
270
|
+
{
|
|
271
|
+
var thenable = type;
|
|
272
|
+
var resolvedThenable = refineResolvedLazyComponent(thenable);
|
|
273
|
+
if (resolvedThenable) {
|
|
274
|
+
return getComponentName(resolvedThenable);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
274
277
|
}
|
|
275
278
|
}
|
|
276
279
|
return null;
|
|
277
280
|
}
|
|
278
281
|
|
|
279
282
|
var FunctionComponent = 0;
|
|
280
|
-
var
|
|
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 PureComponentLazy = 18;
|
|
283
|
+
var ClassComponent = 1;
|
|
284
|
+
var IndeterminateComponent = 2; // Before we know whether it is function or class
|
|
285
|
+
var HostRoot = 3; // Root of a host tree. Could be nested inside another node.
|
|
286
|
+
var HostPortal = 4; // A subtree. Could be an entry point to a different renderer.
|
|
287
|
+
var HostComponent = 5;
|
|
288
|
+
var HostText = 6;
|
|
289
|
+
var Fragment = 7;
|
|
290
|
+
var Mode = 8;
|
|
291
|
+
var ContextConsumer = 9;
|
|
292
|
+
var ContextProvider = 10;
|
|
293
|
+
var ForwardRef = 11;
|
|
294
|
+
var Profiler = 12;
|
|
295
|
+
var SuspenseComponent = 13;
|
|
296
|
+
var MemoComponent = 14;
|
|
297
|
+
var SimpleMemoComponent = 15;
|
|
298
|
+
var LazyComponent = 16;
|
|
299
|
+
var IncompleteClassComponent = 17;
|
|
298
300
|
|
|
299
301
|
// Don't change these two values. They're used by React Dev Tools.
|
|
300
302
|
var NoEffect = /* */0;
|
|
@@ -362,7 +364,7 @@ function isFiberMounted(fiber) {
|
|
|
362
364
|
function isMounted(component) {
|
|
363
365
|
{
|
|
364
366
|
var owner = ReactCurrentOwner.current;
|
|
365
|
-
if (owner !== null &&
|
|
367
|
+
if (owner !== null && owner.tag === ClassComponent) {
|
|
366
368
|
var ownerFiber = owner;
|
|
367
369
|
var instance = ownerFiber.stateNode;
|
|
368
370
|
!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;
|
|
@@ -649,6 +651,9 @@ var createContainerChildSet = shim;
|
|
|
649
651
|
var appendChildToContainerChildSet = shim;
|
|
650
652
|
var finalizeContainerChildren = shim;
|
|
651
653
|
var replaceContainerChildren = shim;
|
|
654
|
+
var cloneHiddenInstance = shim;
|
|
655
|
+
var cloneUnhiddenInstance = shim;
|
|
656
|
+
var createHiddenTextInstance = shim;
|
|
652
657
|
|
|
653
658
|
// Renderers that don't support hydration
|
|
654
659
|
// can re-export everything from this module.
|
|
@@ -739,6 +744,7 @@ function createInstance(type, props, rootContainerInstance, hostContext, interna
|
|
|
739
744
|
return {
|
|
740
745
|
type: type,
|
|
741
746
|
props: props,
|
|
747
|
+
isHidden: false,
|
|
742
748
|
children: [],
|
|
743
749
|
rootContainerInstance: rootContainerInstance,
|
|
744
750
|
tag: 'INSTANCE'
|
|
@@ -772,6 +778,7 @@ function shouldDeprioritizeSubtree(type, props) {
|
|
|
772
778
|
function createTextInstance(text, rootContainerInstance, hostContext, internalInstanceHandle) {
|
|
773
779
|
return {
|
|
774
780
|
text: text,
|
|
781
|
+
isHidden: false,
|
|
775
782
|
tag: 'TEXT'
|
|
776
783
|
};
|
|
777
784
|
}
|
|
@@ -814,6 +821,22 @@ var appendChildToContainer = appendChild;
|
|
|
814
821
|
var insertInContainerBefore = insertBefore;
|
|
815
822
|
var removeChildFromContainer = removeChild;
|
|
816
823
|
|
|
824
|
+
function hideInstance(instance) {
|
|
825
|
+
instance.isHidden = true;
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
function hideTextInstance(textInstance) {
|
|
829
|
+
textInstance.isHidden = true;
|
|
830
|
+
}
|
|
831
|
+
|
|
832
|
+
function unhideInstance(instance, props) {
|
|
833
|
+
instance.isHidden = false;
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
function unhideTextInstance(textInstance, text) {
|
|
837
|
+
textInstance.isHidden = false;
|
|
838
|
+
}
|
|
839
|
+
|
|
817
840
|
/**
|
|
818
841
|
* Copyright (c) 2013-present, Facebook, Inc.
|
|
819
842
|
*
|
|
@@ -952,10 +975,9 @@ var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
|
952
975
|
function describeFiber(fiber) {
|
|
953
976
|
switch (fiber.tag) {
|
|
954
977
|
case IndeterminateComponent:
|
|
978
|
+
case LazyComponent:
|
|
955
979
|
case FunctionComponent:
|
|
956
|
-
case FunctionComponentLazy:
|
|
957
980
|
case ClassComponent:
|
|
958
|
-
case ClassComponentLazy:
|
|
959
981
|
case HostComponent:
|
|
960
982
|
case Mode:
|
|
961
983
|
var owner = fiber._debugOwner;
|
|
@@ -1298,7 +1320,7 @@ function stopFailedWorkTimer(fiber) {
|
|
|
1298
1320
|
return;
|
|
1299
1321
|
}
|
|
1300
1322
|
fiber._debugIsCurrentlyTiming = false;
|
|
1301
|
-
var warning = 'An error was thrown inside this error boundary';
|
|
1323
|
+
var warning = fiber.tag === SuspenseComponent ? 'Rendering was suspended' : 'An error was thrown inside this error boundary';
|
|
1302
1324
|
endFiberMark(fiber, null, warning);
|
|
1303
1325
|
}
|
|
1304
1326
|
}
|
|
@@ -1720,7 +1742,7 @@ function invalidateContextProvider(workInProgress, type, didChange) {
|
|
|
1720
1742
|
function findCurrentUnmaskedContext(fiber) {
|
|
1721
1743
|
// Currently this is only used with renderSubtreeIntoContainer; not sure if it
|
|
1722
1744
|
// makes sense elsewhere
|
|
1723
|
-
!(isFiberMounted(fiber) &&
|
|
1745
|
+
!(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;
|
|
1724
1746
|
|
|
1725
1747
|
var node = fiber;
|
|
1726
1748
|
do {
|
|
@@ -1735,14 +1757,6 @@ function findCurrentUnmaskedContext(fiber) {
|
|
|
1735
1757
|
}
|
|
1736
1758
|
break;
|
|
1737
1759
|
}
|
|
1738
|
-
case ClassComponentLazy:
|
|
1739
|
-
{
|
|
1740
|
-
var _Component = getResultFromResolvedThenable(node.type);
|
|
1741
|
-
if (isContextProvider(_Component)) {
|
|
1742
|
-
return node.stateNode.__reactInternalMemoizedMergedChildContext;
|
|
1743
|
-
}
|
|
1744
|
-
break;
|
|
1745
|
-
}
|
|
1746
1760
|
}
|
|
1747
1761
|
node = node.return;
|
|
1748
1762
|
} while (node !== null);
|
|
@@ -1911,6 +1925,7 @@ function FiberNode(tag, pendingProps, key, mode) {
|
|
|
1911
1925
|
// Instance
|
|
1912
1926
|
this.tag = tag;
|
|
1913
1927
|
this.key = key;
|
|
1928
|
+
this.elementType = null;
|
|
1914
1929
|
this.type = null;
|
|
1915
1930
|
this.stateNode = null;
|
|
1916
1931
|
|
|
@@ -1983,16 +1998,20 @@ function shouldConstruct(Component) {
|
|
|
1983
1998
|
return !!(prototype && prototype.isReactComponent);
|
|
1984
1999
|
}
|
|
1985
2000
|
|
|
1986
|
-
function
|
|
2001
|
+
function isSimpleFunctionComponent(type) {
|
|
2002
|
+
return typeof type === 'function' && !shouldConstruct(type) && type.defaultProps === undefined;
|
|
2003
|
+
}
|
|
2004
|
+
|
|
2005
|
+
function resolveLazyComponentTag(Component) {
|
|
1987
2006
|
if (typeof Component === 'function') {
|
|
1988
|
-
return shouldConstruct(Component) ?
|
|
2007
|
+
return shouldConstruct(Component) ? ClassComponent : FunctionComponent;
|
|
1989
2008
|
} else if (Component !== undefined && Component !== null) {
|
|
1990
2009
|
var $$typeof = Component.$$typeof;
|
|
1991
2010
|
if ($$typeof === REACT_FORWARD_REF_TYPE) {
|
|
1992
|
-
return
|
|
2011
|
+
return ForwardRef;
|
|
1993
2012
|
}
|
|
1994
|
-
if ($$typeof ===
|
|
1995
|
-
return
|
|
2013
|
+
if ($$typeof === REACT_MEMO_TYPE) {
|
|
2014
|
+
return MemoComponent;
|
|
1996
2015
|
}
|
|
1997
2016
|
}
|
|
1998
2017
|
return IndeterminateComponent;
|
|
@@ -2008,6 +2027,7 @@ function createWorkInProgress(current, pendingProps, expirationTime) {
|
|
|
2008
2027
|
// extra objects for things that are never updated. It also allow us to
|
|
2009
2028
|
// reclaim the extra memory if needed.
|
|
2010
2029
|
workInProgress = createFiber(current.tag, pendingProps, current.key, current.mode);
|
|
2030
|
+
workInProgress.elementType = current.elementType;
|
|
2011
2031
|
workInProgress.type = current.type;
|
|
2012
2032
|
workInProgress.stateNode = current.stateNode;
|
|
2013
2033
|
|
|
@@ -2077,20 +2097,17 @@ function createHostRootFiber(isConcurrent) {
|
|
|
2077
2097
|
return createFiber(HostRoot, null, null, mode);
|
|
2078
2098
|
}
|
|
2079
2099
|
|
|
2080
|
-
function
|
|
2081
|
-
|
|
2082
|
-
{
|
|
2083
|
-
owner = element._owner;
|
|
2084
|
-
}
|
|
2085
|
-
|
|
2100
|
+
function createFiberFromTypeAndProps(type, // React$ElementType
|
|
2101
|
+
key, pendingProps, owner, mode, expirationTime) {
|
|
2086
2102
|
var fiber = void 0;
|
|
2087
|
-
var type = element.type;
|
|
2088
|
-
var key = element.key;
|
|
2089
|
-
var pendingProps = element.props;
|
|
2090
2103
|
|
|
2091
|
-
var fiberTag =
|
|
2104
|
+
var fiberTag = IndeterminateComponent;
|
|
2105
|
+
// The resolved type is set if we know what the final type will be. I.e. it's not lazy.
|
|
2106
|
+
var resolvedType = type;
|
|
2092
2107
|
if (typeof type === 'function') {
|
|
2093
|
-
|
|
2108
|
+
if (shouldConstruct(type)) {
|
|
2109
|
+
fiberTag = ClassComponent;
|
|
2110
|
+
}
|
|
2094
2111
|
} else if (typeof type === 'string') {
|
|
2095
2112
|
fiberTag = HostComponent;
|
|
2096
2113
|
} else {
|
|
@@ -2098,18 +2115,13 @@ function createFiberFromElement(element, mode, expirationTime) {
|
|
|
2098
2115
|
case REACT_FRAGMENT_TYPE:
|
|
2099
2116
|
return createFiberFromFragment(pendingProps.children, mode, expirationTime, key);
|
|
2100
2117
|
case REACT_CONCURRENT_MODE_TYPE:
|
|
2101
|
-
|
|
2102
|
-
mode |= ConcurrentMode | StrictMode;
|
|
2103
|
-
break;
|
|
2118
|
+
return createFiberFromMode(pendingProps, mode | ConcurrentMode | StrictMode, expirationTime, key);
|
|
2104
2119
|
case REACT_STRICT_MODE_TYPE:
|
|
2105
|
-
|
|
2106
|
-
mode |= StrictMode;
|
|
2107
|
-
break;
|
|
2120
|
+
return createFiberFromMode(pendingProps, mode | StrictMode, expirationTime, key);
|
|
2108
2121
|
case REACT_PROFILER_TYPE:
|
|
2109
2122
|
return createFiberFromProfiler(pendingProps, mode, expirationTime, key);
|
|
2110
2123
|
case REACT_SUSPENSE_TYPE:
|
|
2111
|
-
|
|
2112
|
-
break;
|
|
2124
|
+
return createFiberFromSuspense(pendingProps, mode, expirationTime, key);
|
|
2113
2125
|
default:
|
|
2114
2126
|
{
|
|
2115
2127
|
if (typeof type === 'object' && type !== null) {
|
|
@@ -2124,16 +2136,13 @@ function createFiberFromElement(element, mode, expirationTime) {
|
|
|
2124
2136
|
case REACT_FORWARD_REF_TYPE:
|
|
2125
2137
|
fiberTag = ForwardRef;
|
|
2126
2138
|
break getTag;
|
|
2127
|
-
case
|
|
2128
|
-
fiberTag =
|
|
2139
|
+
case REACT_MEMO_TYPE:
|
|
2140
|
+
fiberTag = MemoComponent;
|
|
2141
|
+
break getTag;
|
|
2142
|
+
case REACT_LAZY_TYPE:
|
|
2143
|
+
fiberTag = LazyComponent;
|
|
2144
|
+
resolvedType = null;
|
|
2129
2145
|
break getTag;
|
|
2130
|
-
default:
|
|
2131
|
-
{
|
|
2132
|
-
if (typeof type.then === 'function') {
|
|
2133
|
-
fiberTag = IndeterminateComponent;
|
|
2134
|
-
break getTag;
|
|
2135
|
-
}
|
|
2136
|
-
}
|
|
2137
2146
|
}
|
|
2138
2147
|
}
|
|
2139
2148
|
var info = '';
|
|
@@ -2152,14 +2161,26 @@ function createFiberFromElement(element, mode, expirationTime) {
|
|
|
2152
2161
|
}
|
|
2153
2162
|
|
|
2154
2163
|
fiber = createFiber(fiberTag, pendingProps, key, mode);
|
|
2155
|
-
fiber.
|
|
2164
|
+
fiber.elementType = type;
|
|
2165
|
+
fiber.type = resolvedType;
|
|
2156
2166
|
fiber.expirationTime = expirationTime;
|
|
2157
2167
|
|
|
2168
|
+
return fiber;
|
|
2169
|
+
}
|
|
2170
|
+
|
|
2171
|
+
function createFiberFromElement(element, mode, expirationTime) {
|
|
2172
|
+
var owner = null;
|
|
2173
|
+
{
|
|
2174
|
+
owner = element._owner;
|
|
2175
|
+
}
|
|
2176
|
+
var type = element.type;
|
|
2177
|
+
var key = element.key;
|
|
2178
|
+
var pendingProps = element.props;
|
|
2179
|
+
var fiber = createFiberFromTypeAndProps(type, key, pendingProps, owner, mode, expirationTime);
|
|
2158
2180
|
{
|
|
2159
2181
|
fiber._debugSource = element._source;
|
|
2160
2182
|
fiber._debugOwner = element._owner;
|
|
2161
2183
|
}
|
|
2162
|
-
|
|
2163
2184
|
return fiber;
|
|
2164
2185
|
}
|
|
2165
2186
|
|
|
@@ -2177,12 +2198,38 @@ function createFiberFromProfiler(pendingProps, mode, expirationTime, key) {
|
|
|
2177
2198
|
}
|
|
2178
2199
|
|
|
2179
2200
|
var fiber = createFiber(Profiler, pendingProps, key, mode | ProfileMode);
|
|
2201
|
+
// TODO: The Profiler fiber shouldn't have a type. It has a tag.
|
|
2202
|
+
fiber.elementType = REACT_PROFILER_TYPE;
|
|
2180
2203
|
fiber.type = REACT_PROFILER_TYPE;
|
|
2181
2204
|
fiber.expirationTime = expirationTime;
|
|
2182
2205
|
|
|
2183
2206
|
return fiber;
|
|
2184
2207
|
}
|
|
2185
2208
|
|
|
2209
|
+
function createFiberFromMode(pendingProps, mode, expirationTime, key) {
|
|
2210
|
+
var fiber = createFiber(Mode, pendingProps, key, mode);
|
|
2211
|
+
|
|
2212
|
+
// TODO: The Mode fiber shouldn't have a type. It has a tag.
|
|
2213
|
+
var type = (mode & ConcurrentMode) === NoContext ? REACT_STRICT_MODE_TYPE : REACT_CONCURRENT_MODE_TYPE;
|
|
2214
|
+
fiber.elementType = type;
|
|
2215
|
+
fiber.type = type;
|
|
2216
|
+
|
|
2217
|
+
fiber.expirationTime = expirationTime;
|
|
2218
|
+
return fiber;
|
|
2219
|
+
}
|
|
2220
|
+
|
|
2221
|
+
function createFiberFromSuspense(pendingProps, mode, expirationTime, key) {
|
|
2222
|
+
var fiber = createFiber(SuspenseComponent, pendingProps, key, mode);
|
|
2223
|
+
|
|
2224
|
+
// TODO: The SuspenseComponent fiber shouldn't have a type. It has a tag.
|
|
2225
|
+
var type = REACT_SUSPENSE_TYPE;
|
|
2226
|
+
fiber.elementType = type;
|
|
2227
|
+
fiber.type = type;
|
|
2228
|
+
|
|
2229
|
+
fiber.expirationTime = expirationTime;
|
|
2230
|
+
return fiber;
|
|
2231
|
+
}
|
|
2232
|
+
|
|
2186
2233
|
function createFiberFromText(content, mode, expirationTime) {
|
|
2187
2234
|
var fiber = createFiber(HostText, content, null, mode);
|
|
2188
2235
|
fiber.expirationTime = expirationTime;
|
|
@@ -2191,6 +2238,8 @@ function createFiberFromText(content, mode, expirationTime) {
|
|
|
2191
2238
|
|
|
2192
2239
|
function createFiberFromHostInstanceForDeletion() {
|
|
2193
2240
|
var fiber = createFiber(HostComponent, null, null, NoContext);
|
|
2241
|
+
// TODO: These should not need a type.
|
|
2242
|
+
fiber.elementType = 'DELETED';
|
|
2194
2243
|
fiber.type = 'DELETED';
|
|
2195
2244
|
return fiber;
|
|
2196
2245
|
}
|
|
@@ -2223,6 +2272,7 @@ function assignFiberPropertiesInDEV(target, source) {
|
|
|
2223
2272
|
|
|
2224
2273
|
target.tag = source.tag;
|
|
2225
2274
|
target.key = source.key;
|
|
2275
|
+
target.elementType = source.elementType;
|
|
2226
2276
|
target.type = source.type;
|
|
2227
2277
|
target.stateNode = source.stateNode;
|
|
2228
2278
|
target.return = source.return;
|
|
@@ -3313,7 +3363,7 @@ function enqueueUpdate(fiber, update) {
|
|
|
3313
3363
|
}
|
|
3314
3364
|
|
|
3315
3365
|
{
|
|
3316
|
-
if (
|
|
3366
|
+
if (fiber.tag === ClassComponent && (currentlyProcessingQueue === queue1 || queue2 !== null && currentlyProcessingQueue === queue2) && !didWarnUpdateInsideUpdate) {
|
|
3317
3367
|
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.');
|
|
3318
3368
|
didWarnUpdateInsideUpdate = true;
|
|
3319
3369
|
}
|
|
@@ -3686,7 +3736,7 @@ function propagateContextChange(workInProgress, context, changedBits, renderExpi
|
|
|
3686
3736
|
if (dependency.context === context && (dependency.observedBits & changedBits) !== 0) {
|
|
3687
3737
|
// Match! Schedule an update on this fiber.
|
|
3688
3738
|
|
|
3689
|
-
if (fiber.tag === ClassComponent
|
|
3739
|
+
if (fiber.tag === ClassComponent) {
|
|
3690
3740
|
// Schedule a force update on the work-in-progress.
|
|
3691
3741
|
var update = createUpdate(renderExpirationTime);
|
|
3692
3742
|
update.tag = ForceUpdate;
|
|
@@ -3793,7 +3843,7 @@ function readContext(context, observedBits) {
|
|
|
3793
3843
|
};
|
|
3794
3844
|
|
|
3795
3845
|
if (lastContextDependency === null) {
|
|
3796
|
-
!(currentlyRenderingFiber !== null) ? invariant(false, 'Context
|
|
3846
|
+
!(currentlyRenderingFiber !== null) ? invariant(false, 'Context can only be read while React is rendering, e.g. inside the render method or getDerivedStateFromProps.') : void 0;
|
|
3797
3847
|
// This is the first dependency in the list
|
|
3798
3848
|
currentlyRenderingFiber.firstContextDependency = lastContextDependency = contextItem;
|
|
3799
3849
|
} else {
|
|
@@ -3978,6 +4028,13 @@ function shallowEqual(objA, objB) {
|
|
|
3978
4028
|
return true;
|
|
3979
4029
|
}
|
|
3980
4030
|
|
|
4031
|
+
var ReactCurrentOwner$3 = ReactSharedInternals.ReactCurrentOwner;
|
|
4032
|
+
|
|
4033
|
+
function readContext$1(contextType) {
|
|
4034
|
+
var dispatcher = ReactCurrentOwner$3.currentDispatcher;
|
|
4035
|
+
return dispatcher.readContext(contextType);
|
|
4036
|
+
}
|
|
4037
|
+
|
|
3981
4038
|
var fakeInternalInstance = {};
|
|
3982
4039
|
var isArray$1 = Array.isArray;
|
|
3983
4040
|
|
|
@@ -4235,13 +4292,13 @@ function constructClassInstance(workInProgress, ctor, props, renderExpirationTim
|
|
|
4235
4292
|
var contextType = ctor.contextType;
|
|
4236
4293
|
if (typeof contextType === 'object' && contextType !== null) {
|
|
4237
4294
|
{
|
|
4238
|
-
if (typeof
|
|
4295
|
+
if (contextType.$$typeof !== REACT_CONTEXT_TYPE && !didWarnAboutInvalidateContextType.has(ctor)) {
|
|
4239
4296
|
didWarnAboutInvalidateContextType.add(ctor);
|
|
4240
4297
|
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');
|
|
4241
4298
|
}
|
|
4242
4299
|
}
|
|
4243
4300
|
|
|
4244
|
-
context = contextType
|
|
4301
|
+
context = readContext$1(contextType);
|
|
4245
4302
|
} else {
|
|
4246
4303
|
unmaskedContext = getUnmaskedContext(workInProgress, ctor, true);
|
|
4247
4304
|
var contextTypes = ctor.contextTypes;
|
|
@@ -4368,7 +4425,7 @@ function mountClassInstance(workInProgress, ctor, newProps, renderExpirationTime
|
|
|
4368
4425
|
|
|
4369
4426
|
var contextType = ctor.contextType;
|
|
4370
4427
|
if (typeof contextType === 'object' && contextType !== null) {
|
|
4371
|
-
instance.context = contextType
|
|
4428
|
+
instance.context = readContext$1(contextType);
|
|
4372
4429
|
} else {
|
|
4373
4430
|
var unmaskedContext = getUnmaskedContext(workInProgress, ctor, true);
|
|
4374
4431
|
instance.context = getMaskedContext(workInProgress, unmaskedContext);
|
|
@@ -4434,7 +4491,7 @@ function resumeMountClassInstance(workInProgress, ctor, newProps, renderExpirati
|
|
|
4434
4491
|
var contextType = ctor.contextType;
|
|
4435
4492
|
var nextContext = void 0;
|
|
4436
4493
|
if (typeof contextType === 'object' && contextType !== null) {
|
|
4437
|
-
nextContext = contextType
|
|
4494
|
+
nextContext = readContext$1(contextType);
|
|
4438
4495
|
} else {
|
|
4439
4496
|
var nextLegacyUnmaskedContext = getUnmaskedContext(workInProgress, ctor, true);
|
|
4440
4497
|
nextContext = getMaskedContext(workInProgress, nextLegacyUnmaskedContext);
|
|
@@ -4529,7 +4586,7 @@ function updateClassInstance(current, workInProgress, ctor, newProps, renderExpi
|
|
|
4529
4586
|
var contextType = ctor.contextType;
|
|
4530
4587
|
var nextContext = void 0;
|
|
4531
4588
|
if (typeof contextType === 'object' && contextType !== null) {
|
|
4532
|
-
nextContext = contextType
|
|
4589
|
+
nextContext = readContext$1(contextType);
|
|
4533
4590
|
} else {
|
|
4534
4591
|
var nextUnmaskedContext = getUnmaskedContext(workInProgress, ctor, true);
|
|
4535
4592
|
nextContext = getMaskedContext(workInProgress, nextUnmaskedContext);
|
|
@@ -4691,7 +4748,7 @@ function coerceRef(returnFiber, current$$1, element) {
|
|
|
4691
4748
|
var inst = void 0;
|
|
4692
4749
|
if (owner) {
|
|
4693
4750
|
var ownerFiber = owner;
|
|
4694
|
-
!(ownerFiber.tag === ClassComponent
|
|
4751
|
+
!(ownerFiber.tag === ClassComponent) ? invariant(false, 'Function components cannot have refs.') : void 0;
|
|
4695
4752
|
inst = ownerFiber.stateNode;
|
|
4696
4753
|
}
|
|
4697
4754
|
!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;
|
|
@@ -4859,7 +4916,7 @@ function ChildReconciler(shouldTrackSideEffects) {
|
|
|
4859
4916
|
}
|
|
4860
4917
|
|
|
4861
4918
|
function updateElement(returnFiber, current$$1, element, expirationTime) {
|
|
4862
|
-
if (current$$1 !== null && current$$1.
|
|
4919
|
+
if (current$$1 !== null && current$$1.elementType === element.type) {
|
|
4863
4920
|
// Move based on index
|
|
4864
4921
|
var existing = useFiber(current$$1, element.props, expirationTime);
|
|
4865
4922
|
existing.ref = coerceRef(returnFiber, current$$1, element);
|
|
@@ -5401,7 +5458,7 @@ function ChildReconciler(shouldTrackSideEffects) {
|
|
|
5401
5458
|
// TODO: If key === null and child.key === null, then this only applies to
|
|
5402
5459
|
// the first item in the list.
|
|
5403
5460
|
if (child.key === key) {
|
|
5404
|
-
if (child.tag === Fragment ? element.type === REACT_FRAGMENT_TYPE : child.
|
|
5461
|
+
if (child.tag === Fragment ? element.type === REACT_FRAGMENT_TYPE : child.elementType === element.type) {
|
|
5405
5462
|
deleteRemainingChildren(returnFiber, child.sibling);
|
|
5406
5463
|
var existing = useFiber(child, element.type === REACT_FRAGMENT_TYPE ? element.props.children : element.props, expirationTime);
|
|
5407
5464
|
existing.ref = coerceRef(returnFiber, child, element);
|
|
@@ -5516,7 +5573,6 @@ function ChildReconciler(shouldTrackSideEffects) {
|
|
|
5516
5573
|
// we already threw above.
|
|
5517
5574
|
switch (returnFiber.tag) {
|
|
5518
5575
|
case ClassComponent:
|
|
5519
|
-
case ClassComponentLazy:
|
|
5520
5576
|
{
|
|
5521
5577
|
{
|
|
5522
5578
|
var instance = returnFiber.stateNode;
|
|
@@ -5831,40 +5887,49 @@ function resetHydrationState() {
|
|
|
5831
5887
|
isHydrating = false;
|
|
5832
5888
|
}
|
|
5833
5889
|
|
|
5834
|
-
function readLazyComponentType(
|
|
5835
|
-
var status =
|
|
5890
|
+
function readLazyComponentType(lazyComponent) {
|
|
5891
|
+
var status = lazyComponent._status;
|
|
5892
|
+
var result = lazyComponent._result;
|
|
5836
5893
|
switch (status) {
|
|
5837
5894
|
case Resolved:
|
|
5838
|
-
|
|
5839
|
-
|
|
5895
|
+
{
|
|
5896
|
+
var Component = result;
|
|
5897
|
+
return Component;
|
|
5898
|
+
}
|
|
5840
5899
|
case Rejected:
|
|
5841
|
-
|
|
5900
|
+
{
|
|
5901
|
+
var error = result;
|
|
5902
|
+
throw error;
|
|
5903
|
+
}
|
|
5842
5904
|
case Pending:
|
|
5843
|
-
|
|
5905
|
+
{
|
|
5906
|
+
var thenable = result;
|
|
5907
|
+
throw thenable;
|
|
5908
|
+
}
|
|
5844
5909
|
default:
|
|
5845
5910
|
{
|
|
5846
|
-
|
|
5847
|
-
|
|
5848
|
-
|
|
5849
|
-
|
|
5850
|
-
|
|
5851
|
-
|
|
5852
|
-
|
|
5853
|
-
|
|
5854
|
-
|
|
5855
|
-
|
|
5856
|
-
} else {
|
|
5857
|
-
resolvedValue = resolvedValue;
|
|
5911
|
+
lazyComponent._status = Pending;
|
|
5912
|
+
var ctor = lazyComponent._ctor;
|
|
5913
|
+
var _thenable = ctor();
|
|
5914
|
+
_thenable.then(function (moduleObject) {
|
|
5915
|
+
if (lazyComponent._status === Pending) {
|
|
5916
|
+
var defaultExport = moduleObject.default;
|
|
5917
|
+
{
|
|
5918
|
+
if (defaultExport === undefined) {
|
|
5919
|
+
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);
|
|
5920
|
+
}
|
|
5858
5921
|
}
|
|
5859
|
-
|
|
5922
|
+
lazyComponent._status = Resolved;
|
|
5923
|
+
lazyComponent._result = defaultExport;
|
|
5860
5924
|
}
|
|
5861
5925
|
}, function (error) {
|
|
5862
|
-
if (
|
|
5863
|
-
|
|
5864
|
-
|
|
5926
|
+
if (lazyComponent._status === Pending) {
|
|
5927
|
+
lazyComponent._status = Rejected;
|
|
5928
|
+
lazyComponent._result = error;
|
|
5865
5929
|
}
|
|
5866
5930
|
});
|
|
5867
|
-
|
|
5931
|
+
lazyComponent._result = _thenable;
|
|
5932
|
+
throw _thenable;
|
|
5868
5933
|
}
|
|
5869
5934
|
}
|
|
5870
5935
|
}
|
|
@@ -5940,51 +6005,64 @@ function updateForwardRef(current$$1, workInProgress, type, nextProps, renderExp
|
|
|
5940
6005
|
}
|
|
5941
6006
|
|
|
5942
6007
|
reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
|
|
5943
|
-
memoizeProps(workInProgress, nextProps);
|
|
5944
6008
|
return workInProgress.child;
|
|
5945
6009
|
}
|
|
5946
6010
|
|
|
5947
|
-
function
|
|
5948
|
-
|
|
5949
|
-
|
|
5950
|
-
|
|
5951
|
-
|
|
6011
|
+
function updateMemoComponent(current$$1, workInProgress, Component, nextProps, updateExpirationTime, renderExpirationTime) {
|
|
6012
|
+
if (current$$1 === null) {
|
|
6013
|
+
var type = Component.type;
|
|
6014
|
+
if (isSimpleFunctionComponent(type) && Component.compare === null) {
|
|
6015
|
+
// If this is a plain function component without default props,
|
|
6016
|
+
// and with only the default shallow comparison, we upgrade it
|
|
6017
|
+
// to a SimpleMemoComponent to allow fast path updates.
|
|
6018
|
+
workInProgress.tag = SimpleMemoComponent;
|
|
6019
|
+
workInProgress.type = type;
|
|
6020
|
+
return updateSimpleMemoComponent(current$$1, workInProgress, type, nextProps, updateExpirationTime, renderExpirationTime);
|
|
6021
|
+
}
|
|
6022
|
+
var child = createFiberFromTypeAndProps(Component.type, null, nextProps, null, workInProgress.mode, renderExpirationTime);
|
|
6023
|
+
child.ref = workInProgress.ref;
|
|
6024
|
+
child.return = workInProgress;
|
|
6025
|
+
workInProgress.child = child;
|
|
6026
|
+
return child;
|
|
6027
|
+
}
|
|
6028
|
+
var currentChild = current$$1.child; // This is always exactly one child
|
|
6029
|
+
if (updateExpirationTime === NoWork || updateExpirationTime > renderExpirationTime) {
|
|
6030
|
+
// This will be the props with resolved defaultProps,
|
|
6031
|
+
// unlike current.memoizedProps which will be the unresolved ones.
|
|
6032
|
+
var prevProps = currentChild.memoizedProps;
|
|
5952
6033
|
// Default to shallow comparison
|
|
5953
6034
|
var compare = Component.compare;
|
|
5954
6035
|
compare = compare !== null ? compare : shallowEqual;
|
|
5955
|
-
if (compare(prevProps, nextProps)) {
|
|
6036
|
+
if (compare(prevProps, nextProps) && current$$1.ref === workInProgress.ref) {
|
|
5956
6037
|
return bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
|
|
5957
6038
|
}
|
|
5958
6039
|
}
|
|
6040
|
+
var newChild = createWorkInProgress(currentChild, nextProps, renderExpirationTime);
|
|
6041
|
+
newChild.ref = workInProgress.ref;
|
|
6042
|
+
newChild.return = workInProgress;
|
|
6043
|
+
workInProgress.child = newChild;
|
|
6044
|
+
return newChild;
|
|
6045
|
+
}
|
|
5959
6046
|
|
|
5960
|
-
|
|
5961
|
-
|
|
5962
|
-
|
|
5963
|
-
|
|
5964
|
-
|
|
5965
|
-
|
|
5966
|
-
nextChildren = render(nextProps);
|
|
5967
|
-
setCurrentPhase(null);
|
|
6047
|
+
function updateSimpleMemoComponent(current$$1, workInProgress, Component, nextProps, updateExpirationTime, renderExpirationTime) {
|
|
6048
|
+
if (current$$1 !== null && (updateExpirationTime === NoWork || updateExpirationTime > renderExpirationTime)) {
|
|
6049
|
+
var prevProps = current$$1.memoizedProps;
|
|
6050
|
+
if (shallowEqual(prevProps, nextProps) && current$$1.ref === workInProgress.ref) {
|
|
6051
|
+
return bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
|
|
6052
|
+
}
|
|
5968
6053
|
}
|
|
5969
|
-
|
|
5970
|
-
// React DevTools reads this flag.
|
|
5971
|
-
workInProgress.effectTag |= PerformedWork;
|
|
5972
|
-
reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
|
|
5973
|
-
memoizeProps(workInProgress, nextProps);
|
|
5974
|
-
return workInProgress.child;
|
|
6054
|
+
return updateFunctionComponent(current$$1, workInProgress, Component, nextProps, renderExpirationTime);
|
|
5975
6055
|
}
|
|
5976
6056
|
|
|
5977
6057
|
function updateFragment(current$$1, workInProgress, renderExpirationTime) {
|
|
5978
6058
|
var nextChildren = workInProgress.pendingProps;
|
|
5979
6059
|
reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
|
|
5980
|
-
memoizeProps(workInProgress, nextChildren);
|
|
5981
6060
|
return workInProgress.child;
|
|
5982
6061
|
}
|
|
5983
6062
|
|
|
5984
6063
|
function updateMode(current$$1, workInProgress, renderExpirationTime) {
|
|
5985
6064
|
var nextChildren = workInProgress.pendingProps.children;
|
|
5986
6065
|
reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
|
|
5987
|
-
memoizeProps(workInProgress, nextChildren);
|
|
5988
6066
|
return workInProgress.child;
|
|
5989
6067
|
}
|
|
5990
6068
|
|
|
@@ -5995,7 +6073,6 @@ function updateProfiler(current$$1, workInProgress, renderExpirationTime) {
|
|
|
5995
6073
|
var nextProps = workInProgress.pendingProps;
|
|
5996
6074
|
var nextChildren = nextProps.children;
|
|
5997
6075
|
reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
|
|
5998
|
-
memoizeProps(workInProgress, nextProps);
|
|
5999
6076
|
return workInProgress.child;
|
|
6000
6077
|
}
|
|
6001
6078
|
|
|
@@ -6023,7 +6100,6 @@ function updateFunctionComponent(current$$1, workInProgress, Component, nextProp
|
|
|
6023
6100
|
// React DevTools reads this flag.
|
|
6024
6101
|
workInProgress.effectTag |= PerformedWork;
|
|
6025
6102
|
reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
|
|
6026
|
-
memoizeProps(workInProgress, nextProps);
|
|
6027
6103
|
return workInProgress.child;
|
|
6028
6104
|
}
|
|
6029
6105
|
|
|
@@ -6040,17 +6116,26 @@ function updateClassComponent(current$$1, workInProgress, Component, nextProps,
|
|
|
6040
6116
|
}
|
|
6041
6117
|
prepareToReadContext(workInProgress, renderExpirationTime);
|
|
6042
6118
|
|
|
6119
|
+
var instance = workInProgress.stateNode;
|
|
6043
6120
|
var shouldUpdate = void 0;
|
|
6044
|
-
if (
|
|
6045
|
-
if (
|
|
6046
|
-
//
|
|
6047
|
-
|
|
6048
|
-
|
|
6049
|
-
|
|
6050
|
-
|
|
6051
|
-
|
|
6052
|
-
|
|
6053
|
-
|
|
6121
|
+
if (instance === null) {
|
|
6122
|
+
if (current$$1 !== null) {
|
|
6123
|
+
// An class component without an instance only mounts if it suspended
|
|
6124
|
+
// inside a non- concurrent tree, in an inconsistent state. We want to
|
|
6125
|
+
// tree it like a new mount, even though an empty version of it already
|
|
6126
|
+
// committed. Disconnect the alternate pointers.
|
|
6127
|
+
current$$1.alternate = null;
|
|
6128
|
+
workInProgress.alternate = null;
|
|
6129
|
+
// Since this is conceptually a new fiber, schedule a Placement effect
|
|
6130
|
+
workInProgress.effectTag |= Placement;
|
|
6131
|
+
}
|
|
6132
|
+
// In the initial pass we might need to construct the instance.
|
|
6133
|
+
constructClassInstance(workInProgress, Component, nextProps, renderExpirationTime);
|
|
6134
|
+
mountClassInstance(workInProgress, Component, nextProps, renderExpirationTime);
|
|
6135
|
+
shouldUpdate = true;
|
|
6136
|
+
} else if (current$$1 === null) {
|
|
6137
|
+
// In a resume, we'll already have an instance we can reuse.
|
|
6138
|
+
shouldUpdate = resumeMountClassInstance(workInProgress, Component, nextProps, renderExpirationTime);
|
|
6054
6139
|
} else {
|
|
6055
6140
|
shouldUpdate = updateClassInstance(current$$1, workInProgress, Component, nextProps, renderExpirationTime);
|
|
6056
6141
|
}
|
|
@@ -6111,10 +6196,9 @@ function finishClassComponent(current$$1, workInProgress, Component, shouldUpdat
|
|
|
6111
6196
|
reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
|
|
6112
6197
|
}
|
|
6113
6198
|
|
|
6114
|
-
// Memoize
|
|
6199
|
+
// Memoize state using the values we just used to render.
|
|
6115
6200
|
// TODO: Restructure so we never read values from the instance.
|
|
6116
|
-
|
|
6117
|
-
memoizeProps(workInProgress, instance.props);
|
|
6201
|
+
workInProgress.memoizedState = instance.state;
|
|
6118
6202
|
|
|
6119
6203
|
// The context might have changed so we need to recalculate it.
|
|
6120
6204
|
if (hasContext) {
|
|
@@ -6211,12 +6295,10 @@ function updateHostComponent(current$$1, workInProgress, renderExpirationTime) {
|
|
|
6211
6295
|
if (renderExpirationTime !== Never && workInProgress.mode & ConcurrentMode && shouldDeprioritizeSubtree(type, nextProps)) {
|
|
6212
6296
|
// Schedule this fiber to re-render at offscreen priority. Then bailout.
|
|
6213
6297
|
workInProgress.expirationTime = Never;
|
|
6214
|
-
workInProgress.memoizedProps = nextProps;
|
|
6215
6298
|
return null;
|
|
6216
6299
|
}
|
|
6217
6300
|
|
|
6218
6301
|
reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
|
|
6219
|
-
memoizeProps(workInProgress, nextProps);
|
|
6220
6302
|
return workInProgress.child;
|
|
6221
6303
|
}
|
|
6222
6304
|
|
|
@@ -6224,8 +6306,6 @@ function updateHostText(current$$1, workInProgress) {
|
|
|
6224
6306
|
if (current$$1 === null) {
|
|
6225
6307
|
tryToClaimNextHydratableInstance(workInProgress);
|
|
6226
6308
|
}
|
|
6227
|
-
var nextProps = workInProgress.pendingProps;
|
|
6228
|
-
memoizeProps(workInProgress, nextProps);
|
|
6229
6309
|
// Nothing to do here. This is terminal. We'll do the completion step
|
|
6230
6310
|
// immediately after.
|
|
6231
6311
|
return null;
|
|
@@ -6246,48 +6326,110 @@ function resolveDefaultProps(Component, baseProps) {
|
|
|
6246
6326
|
return baseProps;
|
|
6247
6327
|
}
|
|
6248
6328
|
|
|
6249
|
-
function
|
|
6250
|
-
|
|
6329
|
+
function mountLazyComponent(_current, workInProgress, elementType, updateExpirationTime, renderExpirationTime) {
|
|
6330
|
+
if (_current !== null) {
|
|
6331
|
+
// An lazy component only mounts if it suspended inside a non-
|
|
6332
|
+
// concurrent tree, in an inconsistent state. We want to tree it like
|
|
6333
|
+
// a new mount, even though an empty version of it already committed.
|
|
6334
|
+
// Disconnect the alternate pointers.
|
|
6335
|
+
_current.alternate = null;
|
|
6336
|
+
workInProgress.alternate = null;
|
|
6337
|
+
// Since this is conceptually a new fiber, schedule a Placement effect
|
|
6338
|
+
workInProgress.effectTag |= Placement;
|
|
6339
|
+
}
|
|
6251
6340
|
|
|
6252
6341
|
var props = workInProgress.pendingProps;
|
|
6253
|
-
|
|
6254
|
-
|
|
6255
|
-
|
|
6256
|
-
|
|
6257
|
-
|
|
6258
|
-
|
|
6259
|
-
|
|
6260
|
-
|
|
6261
|
-
|
|
6262
|
-
|
|
6263
|
-
|
|
6264
|
-
|
|
6265
|
-
|
|
6266
|
-
|
|
6267
|
-
|
|
6268
|
-
|
|
6269
|
-
|
|
6270
|
-
|
|
6271
|
-
|
|
6272
|
-
|
|
6273
|
-
|
|
6274
|
-
|
|
6275
|
-
|
|
6276
|
-
|
|
6277
|
-
|
|
6278
|
-
|
|
6279
|
-
|
|
6280
|
-
|
|
6281
|
-
|
|
6282
|
-
|
|
6283
|
-
|
|
6284
|
-
|
|
6285
|
-
|
|
6286
|
-
|
|
6287
|
-
|
|
6288
|
-
|
|
6342
|
+
// We can't start a User Timing measurement with correct label yet.
|
|
6343
|
+
// Cancel and resume right after we know the tag.
|
|
6344
|
+
cancelWorkTimer(workInProgress);
|
|
6345
|
+
var Component = readLazyComponentType(elementType);
|
|
6346
|
+
// Store the unwrapped component in the type.
|
|
6347
|
+
workInProgress.type = Component;
|
|
6348
|
+
var resolvedTag = workInProgress.tag = resolveLazyComponentTag(Component);
|
|
6349
|
+
startWorkTimer(workInProgress);
|
|
6350
|
+
var resolvedProps = resolveDefaultProps(Component, props);
|
|
6351
|
+
var child = void 0;
|
|
6352
|
+
switch (resolvedTag) {
|
|
6353
|
+
case FunctionComponent:
|
|
6354
|
+
{
|
|
6355
|
+
child = updateFunctionComponent(null, workInProgress, Component, resolvedProps, renderExpirationTime);
|
|
6356
|
+
break;
|
|
6357
|
+
}
|
|
6358
|
+
case ClassComponent:
|
|
6359
|
+
{
|
|
6360
|
+
child = updateClassComponent(null, workInProgress, Component, resolvedProps, renderExpirationTime);
|
|
6361
|
+
break;
|
|
6362
|
+
}
|
|
6363
|
+
case ForwardRef:
|
|
6364
|
+
{
|
|
6365
|
+
child = updateForwardRef(null, workInProgress, Component, resolvedProps, renderExpirationTime);
|
|
6366
|
+
break;
|
|
6367
|
+
}
|
|
6368
|
+
case MemoComponent:
|
|
6369
|
+
{
|
|
6370
|
+
child = updateMemoComponent(null, workInProgress, Component, resolveDefaultProps(Component.type, resolvedProps), // The inner type can have defaults too
|
|
6371
|
+
updateExpirationTime, renderExpirationTime);
|
|
6372
|
+
break;
|
|
6373
|
+
}
|
|
6374
|
+
default:
|
|
6375
|
+
{
|
|
6376
|
+
// This message intentionally doesn't metion ForwardRef or MemoComponent
|
|
6377
|
+
// because the fact that it's a separate type of work is an
|
|
6378
|
+
// implementation detail.
|
|
6379
|
+
invariant(false, 'Element type is invalid. Received a promise that resolves to: %s. Promise elements must resolve to a class or function.', Component);
|
|
6380
|
+
}
|
|
6381
|
+
}
|
|
6382
|
+
return child;
|
|
6383
|
+
}
|
|
6384
|
+
|
|
6385
|
+
function mountIncompleteClassComponent(_current, workInProgress, Component, nextProps, renderExpirationTime) {
|
|
6386
|
+
if (_current !== null) {
|
|
6387
|
+
// An incomplete component only mounts if it suspended inside a non-
|
|
6388
|
+
// concurrent tree, in an inconsistent state. We want to tree it like
|
|
6389
|
+
// a new mount, even though an empty version of it already committed.
|
|
6390
|
+
// Disconnect the alternate pointers.
|
|
6391
|
+
_current.alternate = null;
|
|
6392
|
+
workInProgress.alternate = null;
|
|
6393
|
+
// Since this is conceptually a new fiber, schedule a Placement effect
|
|
6394
|
+
workInProgress.effectTag |= Placement;
|
|
6395
|
+
}
|
|
6396
|
+
|
|
6397
|
+
// Promote the fiber to a class and try rendering again.
|
|
6398
|
+
workInProgress.tag = ClassComponent;
|
|
6399
|
+
|
|
6400
|
+
// The rest of this function is a fork of `updateClassComponent`
|
|
6401
|
+
|
|
6402
|
+
// Push context providers early to prevent context stack mismatches.
|
|
6403
|
+
// During mounting we don't know the child context yet as the instance doesn't exist.
|
|
6404
|
+
// We will invalidate the child context in finishClassComponent() right after rendering.
|
|
6405
|
+
var hasContext = void 0;
|
|
6406
|
+
if (isContextProvider(Component)) {
|
|
6407
|
+
hasContext = true;
|
|
6408
|
+
pushContextProvider(workInProgress);
|
|
6409
|
+
} else {
|
|
6410
|
+
hasContext = false;
|
|
6289
6411
|
}
|
|
6412
|
+
prepareToReadContext(workInProgress, renderExpirationTime);
|
|
6413
|
+
|
|
6414
|
+
constructClassInstance(workInProgress, Component, nextProps, renderExpirationTime);
|
|
6415
|
+
mountClassInstance(workInProgress, Component, nextProps, renderExpirationTime);
|
|
6416
|
+
|
|
6417
|
+
return finishClassComponent(null, workInProgress, Component, true, hasContext, renderExpirationTime);
|
|
6418
|
+
}
|
|
6290
6419
|
|
|
6420
|
+
function mountIndeterminateComponent(_current, workInProgress, Component, renderExpirationTime) {
|
|
6421
|
+
if (_current !== null) {
|
|
6422
|
+
// An indeterminate component only mounts if it suspended inside a non-
|
|
6423
|
+
// concurrent tree, in an inconsistent state. We want to tree it like
|
|
6424
|
+
// a new mount, even though an empty version of it already committed.
|
|
6425
|
+
// Disconnect the alternate pointers.
|
|
6426
|
+
_current.alternate = null;
|
|
6427
|
+
workInProgress.alternate = null;
|
|
6428
|
+
// Since this is conceptually a new fiber, schedule a Placement effect
|
|
6429
|
+
workInProgress.effectTag |= Placement;
|
|
6430
|
+
}
|
|
6431
|
+
|
|
6432
|
+
var props = workInProgress.pendingProps;
|
|
6291
6433
|
var unmaskedContext = getUnmaskedContext(workInProgress, Component, false);
|
|
6292
6434
|
var context = getMaskedContext(workInProgress, unmaskedContext);
|
|
6293
6435
|
|
|
@@ -6339,7 +6481,7 @@ function mountIndeterminateComponent(current$$1, workInProgress, Component, upda
|
|
|
6339
6481
|
|
|
6340
6482
|
adoptClassInstance(workInProgress, value);
|
|
6341
6483
|
mountClassInstance(workInProgress, Component, props, renderExpirationTime);
|
|
6342
|
-
return finishClassComponent(
|
|
6484
|
+
return finishClassComponent(null, workInProgress, Component, true, hasContext, renderExpirationTime);
|
|
6343
6485
|
} else {
|
|
6344
6486
|
// Proceed under the assumption that this is a function component
|
|
6345
6487
|
workInProgress.tag = FunctionComponent;
|
|
@@ -6383,64 +6525,166 @@ function mountIndeterminateComponent(current$$1, workInProgress, Component, upda
|
|
|
6383
6525
|
}
|
|
6384
6526
|
}
|
|
6385
6527
|
}
|
|
6386
|
-
reconcileChildren(
|
|
6387
|
-
memoizeProps(workInProgress, props);
|
|
6528
|
+
reconcileChildren(null, workInProgress, value, renderExpirationTime);
|
|
6388
6529
|
return workInProgress.child;
|
|
6389
6530
|
}
|
|
6390
6531
|
}
|
|
6391
6532
|
|
|
6392
6533
|
function updateSuspenseComponent(current$$1, workInProgress, renderExpirationTime) {
|
|
6534
|
+
var mode = workInProgress.mode;
|
|
6393
6535
|
var nextProps = workInProgress.pendingProps;
|
|
6394
6536
|
|
|
6395
|
-
//
|
|
6396
|
-
//
|
|
6397
|
-
var
|
|
6398
|
-
|
|
6399
|
-
|
|
6400
|
-
if (current$$1 !== null && workInProgress.updateQueue !== null) {
|
|
6401
|
-
// We're outside strict mode. Something inside this Placeholder boundary
|
|
6402
|
-
// suspended during the last commit. Switch to the placholder.
|
|
6403
|
-
workInProgress.updateQueue = null;
|
|
6404
|
-
nextDidTimeout = true;
|
|
6537
|
+
// We should attempt to render the primary children unless this boundary
|
|
6538
|
+
// already suspended during this render (`alreadyCaptured` is true).
|
|
6539
|
+
var nextState = workInProgress.memoizedState;
|
|
6540
|
+
if (nextState === null) {
|
|
6541
|
+
// An empty suspense state means this boundary has not yet timed out.
|
|
6405
6542
|
} else {
|
|
6406
|
-
|
|
6543
|
+
if (!nextState.alreadyCaptured) {
|
|
6544
|
+
// Since we haven't already suspended during this commit, clear the
|
|
6545
|
+
// existing suspense state. We'll try rendering again.
|
|
6546
|
+
nextState = null;
|
|
6547
|
+
} else {
|
|
6548
|
+
// Something in this boundary's subtree already suspended. Switch to
|
|
6549
|
+
// rendering the fallback children. Set `alreadyCaptured` to true.
|
|
6550
|
+
if (current$$1 !== null && nextState === current$$1.memoizedState) {
|
|
6551
|
+
// Create a new suspense state to avoid mutating the current tree's.
|
|
6552
|
+
nextState = {
|
|
6553
|
+
alreadyCaptured: true,
|
|
6554
|
+
didTimeout: true,
|
|
6555
|
+
timedOutAt: nextState.timedOutAt
|
|
6556
|
+
};
|
|
6557
|
+
} else {
|
|
6558
|
+
// Already have a clone, so it's safe to mutate.
|
|
6559
|
+
nextState.alreadyCaptured = true;
|
|
6560
|
+
nextState.didTimeout = true;
|
|
6561
|
+
}
|
|
6562
|
+
}
|
|
6407
6563
|
}
|
|
6564
|
+
var nextDidTimeout = nextState !== null && nextState.didTimeout;
|
|
6408
6565
|
|
|
6409
|
-
|
|
6566
|
+
// This next part is a bit confusing. If the children timeout, we switch to
|
|
6567
|
+
// showing the fallback children in place of the "primary" children.
|
|
6568
|
+
// However, we don't want to delete the primary children because then their
|
|
6569
|
+
// state will be lost (both the React state and the host state, e.g.
|
|
6570
|
+
// uncontrolled form inputs). Instead we keep them mounted and hide them.
|
|
6571
|
+
// Both the fallback children AND the primary children are rendered at the
|
|
6572
|
+
// same time. Once the primary children are un-suspended, we can delete
|
|
6573
|
+
// the fallback children — don't need to preserve their state.
|
|
6574
|
+
//
|
|
6575
|
+
// The two sets of children are siblings in the host environment, but
|
|
6576
|
+
// semantically, for purposes of reconciliation, they are two separate sets.
|
|
6577
|
+
// So we store them using two fragment fibers.
|
|
6578
|
+
//
|
|
6579
|
+
// However, we want to avoid allocating extra fibers for every placeholder.
|
|
6580
|
+
// They're only necessary when the children time out, because that's the
|
|
6581
|
+
// only time when both sets are mounted.
|
|
6582
|
+
//
|
|
6583
|
+
// So, the extra fragment fibers are only used if the children time out.
|
|
6584
|
+
// Otherwise, we render the primary children directly. This requires some
|
|
6585
|
+
// custom reconciliation logic to preserve the state of the primary
|
|
6586
|
+
// children. It's essentially a very basic form of re-parenting.
|
|
6587
|
+
|
|
6588
|
+
// `child` points to the child fiber. In the normal case, this is the first
|
|
6589
|
+
// fiber of the primary children set. In the timed-out case, it's a
|
|
6590
|
+
// a fragment fiber containing the primary children.
|
|
6591
|
+
var child = void 0;
|
|
6592
|
+
// `next` points to the next fiber React should render. In the normal case,
|
|
6593
|
+
// it's the same as `child`: the first fiber of the primary children set.
|
|
6594
|
+
// In the timed-out case, it's a fragment fiber containing the *fallback*
|
|
6595
|
+
// children -- we skip over the primary children entirely.
|
|
6596
|
+
var next = void 0;
|
|
6597
|
+
if (current$$1 === null) {
|
|
6598
|
+
// This is the initial mount. This branch is pretty simple because there's
|
|
6599
|
+
// no previous state that needs to be preserved.
|
|
6410
6600
|
if (nextDidTimeout) {
|
|
6411
|
-
//
|
|
6412
|
-
|
|
6413
|
-
|
|
6601
|
+
// Mount separate fragments for primary and fallback children.
|
|
6602
|
+
var nextFallbackChildren = nextProps.fallback;
|
|
6603
|
+
var primaryChildFragment = createFiberFromFragment(null, mode, NoWork, null);
|
|
6604
|
+
var fallbackChildFragment = createFiberFromFragment(nextFallbackChildren, mode, renderExpirationTime, null);
|
|
6605
|
+
primaryChildFragment.sibling = fallbackChildFragment;
|
|
6606
|
+
child = primaryChildFragment;
|
|
6607
|
+
// Skip the primary children, and continue working on the
|
|
6608
|
+
// fallback children.
|
|
6609
|
+
next = fallbackChildFragment;
|
|
6610
|
+
child.return = next.return = workInProgress;
|
|
6414
6611
|
} else {
|
|
6415
|
-
//
|
|
6416
|
-
|
|
6417
|
-
|
|
6612
|
+
// Mount the primary children without an intermediate fragment fiber.
|
|
6613
|
+
var nextPrimaryChildren = nextProps.children;
|
|
6614
|
+
child = next = mountChildFibers(workInProgress, null, nextPrimaryChildren, renderExpirationTime);
|
|
6418
6615
|
}
|
|
6419
|
-
}
|
|
6420
|
-
|
|
6421
|
-
// If the `children` prop is a function, treat it like a render prop.
|
|
6422
|
-
// TODO: This is temporary until we finalize a lower level API.
|
|
6423
|
-
var children = nextProps.children;
|
|
6424
|
-
var nextChildren = void 0;
|
|
6425
|
-
if (typeof children === 'function') {
|
|
6426
|
-
nextChildren = children(nextDidTimeout);
|
|
6427
6616
|
} else {
|
|
6428
|
-
|
|
6617
|
+
// This is an update. This branch is more complicated because we need to
|
|
6618
|
+
// ensure the state of the primary children is preserved.
|
|
6619
|
+
var prevState = current$$1.memoizedState;
|
|
6620
|
+
var prevDidTimeout = prevState !== null && prevState.didTimeout;
|
|
6621
|
+
if (prevDidTimeout) {
|
|
6622
|
+
// The current tree already timed out. That means each child set is
|
|
6623
|
+
var currentPrimaryChildFragment = current$$1.child;
|
|
6624
|
+
var currentFallbackChildFragment = currentPrimaryChildFragment.sibling;
|
|
6625
|
+
if (nextDidTimeout) {
|
|
6626
|
+
// Still timed out. Reuse the current primary children by cloning
|
|
6627
|
+
// its fragment. We're going to skip over these entirely.
|
|
6628
|
+
var _nextFallbackChildren = nextProps.fallback;
|
|
6629
|
+
var _primaryChildFragment = createWorkInProgress(currentPrimaryChildFragment, currentPrimaryChildFragment.pendingProps, NoWork);
|
|
6630
|
+
_primaryChildFragment.effectTag |= Placement;
|
|
6631
|
+
// Clone the fallback child fragment, too. These we'll continue
|
|
6632
|
+
// working on.
|
|
6633
|
+
var _fallbackChildFragment = _primaryChildFragment.sibling = createWorkInProgress(currentFallbackChildFragment, _nextFallbackChildren, currentFallbackChildFragment.expirationTime);
|
|
6634
|
+
_fallbackChildFragment.effectTag |= Placement;
|
|
6635
|
+
child = _primaryChildFragment;
|
|
6636
|
+
_primaryChildFragment.childExpirationTime = NoWork;
|
|
6637
|
+
// Skip the primary children, and continue working on the
|
|
6638
|
+
// fallback children.
|
|
6639
|
+
next = _fallbackChildFragment;
|
|
6640
|
+
child.return = next.return = workInProgress;
|
|
6641
|
+
} else {
|
|
6642
|
+
// No longer suspended. Switch back to showing the primary children,
|
|
6643
|
+
// and remove the intermediate fragment fiber.
|
|
6644
|
+
var _nextPrimaryChildren = nextProps.children;
|
|
6645
|
+
var currentPrimaryChild = currentPrimaryChildFragment.child;
|
|
6646
|
+
var currentFallbackChild = currentFallbackChildFragment.child;
|
|
6647
|
+
var primaryChild = reconcileChildFibers(workInProgress, currentPrimaryChild, _nextPrimaryChildren, renderExpirationTime);
|
|
6648
|
+
// Delete the fallback children.
|
|
6649
|
+
reconcileChildFibers(workInProgress, currentFallbackChild, null, renderExpirationTime);
|
|
6650
|
+
// Continue rendering the children, like we normally do.
|
|
6651
|
+
child = next = primaryChild;
|
|
6652
|
+
}
|
|
6653
|
+
} else {
|
|
6654
|
+
// The current tree has not already timed out. That means the primary
|
|
6655
|
+
var _currentPrimaryChild = current$$1.child;
|
|
6656
|
+
if (nextDidTimeout) {
|
|
6657
|
+
// Timed out. Wrap the children in a fragment fiber to keep them
|
|
6658
|
+
// separate from the fallback children.
|
|
6659
|
+
var _nextFallbackChildren2 = nextProps.fallback;
|
|
6660
|
+
var _primaryChildFragment2 = createFiberFromFragment(
|
|
6661
|
+
// It shouldn't matter what the pending props are because we aren't
|
|
6662
|
+
// going to render this fragment.
|
|
6663
|
+
null, mode, NoWork, null);
|
|
6664
|
+
_primaryChildFragment2.effectTag |= Placement;
|
|
6665
|
+
_primaryChildFragment2.child = _currentPrimaryChild;
|
|
6666
|
+
_currentPrimaryChild.return = _primaryChildFragment2;
|
|
6667
|
+
// Create a fragment from the fallback children, too.
|
|
6668
|
+
var _fallbackChildFragment2 = _primaryChildFragment2.sibling = createFiberFromFragment(_nextFallbackChildren2, mode, renderExpirationTime, null);
|
|
6669
|
+
_fallbackChildFragment2.effectTag |= Placement;
|
|
6670
|
+
child = _primaryChildFragment2;
|
|
6671
|
+
_primaryChildFragment2.childExpirationTime = NoWork;
|
|
6672
|
+
// Skip the primary children, and continue working on the
|
|
6673
|
+
// fallback children.
|
|
6674
|
+
next = _fallbackChildFragment2;
|
|
6675
|
+
child.return = next.return = workInProgress;
|
|
6676
|
+
} else {
|
|
6677
|
+
// Still haven't timed out. Continue rendering the children, like we
|
|
6678
|
+
// normally do.
|
|
6679
|
+
var _nextPrimaryChildren2 = nextProps.children;
|
|
6680
|
+
next = child = reconcileChildFibers(workInProgress, _currentPrimaryChild, _nextPrimaryChildren2, renderExpirationTime);
|
|
6681
|
+
}
|
|
6682
|
+
}
|
|
6429
6683
|
}
|
|
6430
6684
|
|
|
6431
|
-
|
|
6432
|
-
|
|
6433
|
-
|
|
6434
|
-
// happen to be stored in the same set. Call this special function to
|
|
6435
|
-
// force the new set not to match with the current set.
|
|
6436
|
-
// TODO: The proper way to model this is by storing each set separately.
|
|
6437
|
-
forceUnmountCurrentAndReconcile(current$$1, workInProgress, nextChildren, renderExpirationTime);
|
|
6438
|
-
} else {
|
|
6439
|
-
reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
|
|
6440
|
-
}
|
|
6441
|
-
workInProgress.memoizedProps = nextProps;
|
|
6442
|
-
workInProgress.memoizedState = nextDidTimeout;
|
|
6443
|
-
return workInProgress.child;
|
|
6685
|
+
workInProgress.memoizedState = nextState;
|
|
6686
|
+
workInProgress.child = child;
|
|
6687
|
+
return next;
|
|
6444
6688
|
}
|
|
6445
6689
|
|
|
6446
6690
|
function updatePortalComponent(current$$1, workInProgress, renderExpirationTime) {
|
|
@@ -6453,10 +6697,8 @@ function updatePortalComponent(current$$1, workInProgress, renderExpirationTime)
|
|
|
6453
6697
|
// the root always starts with a "current" with a null child.
|
|
6454
6698
|
// TODO: Consider unifying this with how the root works.
|
|
6455
6699
|
workInProgress.child = reconcileChildFibers(workInProgress, null, nextChildren, renderExpirationTime);
|
|
6456
|
-
memoizeProps(workInProgress, nextChildren);
|
|
6457
6700
|
} else {
|
|
6458
6701
|
reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
|
|
6459
|
-
memoizeProps(workInProgress, nextChildren);
|
|
6460
6702
|
}
|
|
6461
6703
|
return workInProgress.child;
|
|
6462
6704
|
}
|
|
@@ -6469,7 +6711,6 @@ function updateContextProvider(current$$1, workInProgress, renderExpirationTime)
|
|
|
6469
6711
|
var oldProps = workInProgress.memoizedProps;
|
|
6470
6712
|
|
|
6471
6713
|
var newValue = newProps.value;
|
|
6472
|
-
workInProgress.memoizedProps = newProps;
|
|
6473
6714
|
|
|
6474
6715
|
{
|
|
6475
6716
|
var providerPropTypes = workInProgress.type.propTypes;
|
|
@@ -6501,8 +6742,32 @@ function updateContextProvider(current$$1, workInProgress, renderExpirationTime)
|
|
|
6501
6742
|
return workInProgress.child;
|
|
6502
6743
|
}
|
|
6503
6744
|
|
|
6745
|
+
var hasWarnedAboutUsingContextAsConsumer = false;
|
|
6746
|
+
|
|
6504
6747
|
function updateContextConsumer(current$$1, workInProgress, renderExpirationTime) {
|
|
6505
6748
|
var context = workInProgress.type;
|
|
6749
|
+
// The logic below for Context differs depending on PROD or DEV mode. In
|
|
6750
|
+
// DEV mode, we create a separate object for Context.Consumer that acts
|
|
6751
|
+
// like a proxy to Context. This proxy object adds unnecessary code in PROD
|
|
6752
|
+
// so we use the old behaviour (Context.Consumer references Context) to
|
|
6753
|
+
// reduce size and overhead. The separate object references context via
|
|
6754
|
+
// a property called "_context", which also gives us the ability to check
|
|
6755
|
+
// in DEV mode if this property exists or not and warn if it does not.
|
|
6756
|
+
{
|
|
6757
|
+
if (context._context === undefined) {
|
|
6758
|
+
// This may be because it's a Context (rather than a Consumer).
|
|
6759
|
+
// Or it may be because it's older React where they're the same thing.
|
|
6760
|
+
// We only want to warn if we're sure it's a new React.
|
|
6761
|
+
if (context !== context.Consumer) {
|
|
6762
|
+
if (!hasWarnedAboutUsingContextAsConsumer) {
|
|
6763
|
+
hasWarnedAboutUsingContextAsConsumer = true;
|
|
6764
|
+
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?');
|
|
6765
|
+
}
|
|
6766
|
+
}
|
|
6767
|
+
} else {
|
|
6768
|
+
context = context._context;
|
|
6769
|
+
}
|
|
6770
|
+
}
|
|
6506
6771
|
var newProps = workInProgress.pendingProps;
|
|
6507
6772
|
var render = newProps.children;
|
|
6508
6773
|
|
|
@@ -6523,7 +6788,6 @@ function updateContextConsumer(current$$1, workInProgress, renderExpirationTime)
|
|
|
6523
6788
|
// React DevTools reads this flag.
|
|
6524
6789
|
workInProgress.effectTag |= PerformedWork;
|
|
6525
6790
|
reconcileChildren(current$$1, workInProgress, newChildren, renderExpirationTime);
|
|
6526
|
-
workInProgress.memoizedProps = newProps;
|
|
6527
6791
|
return workInProgress.child;
|
|
6528
6792
|
}
|
|
6529
6793
|
|
|
@@ -6574,17 +6838,6 @@ function bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirati
|
|
|
6574
6838
|
}
|
|
6575
6839
|
}
|
|
6576
6840
|
|
|
6577
|
-
// TODO: Delete memoizeProps/State and move to reconcile/bailout instead
|
|
6578
|
-
function memoizeProps(workInProgress, nextProps) {
|
|
6579
|
-
workInProgress.memoizedProps = nextProps;
|
|
6580
|
-
}
|
|
6581
|
-
|
|
6582
|
-
function memoizeState(workInProgress, nextState) {
|
|
6583
|
-
workInProgress.memoizedState = nextState;
|
|
6584
|
-
// Don't reset the updateQueue, in case there are pending updates. Resetting
|
|
6585
|
-
// is handled by processUpdateQueue.
|
|
6586
|
-
}
|
|
6587
|
-
|
|
6588
6841
|
function beginWork(current$$1, workInProgress, renderExpirationTime) {
|
|
6589
6842
|
var updateExpirationTime = workInProgress.expirationTime;
|
|
6590
6843
|
|
|
@@ -6611,15 +6864,6 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
|
|
|
6611
6864
|
}
|
|
6612
6865
|
break;
|
|
6613
6866
|
}
|
|
6614
|
-
case ClassComponentLazy:
|
|
6615
|
-
{
|
|
6616
|
-
var thenable = workInProgress.type;
|
|
6617
|
-
var _Component = getResultFromResolvedThenable(thenable);
|
|
6618
|
-
if (isContextProvider(_Component)) {
|
|
6619
|
-
pushContextProvider(workInProgress);
|
|
6620
|
-
}
|
|
6621
|
-
break;
|
|
6622
|
-
}
|
|
6623
6867
|
case HostPortal:
|
|
6624
6868
|
pushHostContainer(workInProgress, workInProgress.stateNode.containerInfo);
|
|
6625
6869
|
break;
|
|
@@ -6634,6 +6878,35 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
|
|
|
6634
6878
|
workInProgress.effectTag |= Update;
|
|
6635
6879
|
}
|
|
6636
6880
|
break;
|
|
6881
|
+
case SuspenseComponent:
|
|
6882
|
+
{
|
|
6883
|
+
var state = workInProgress.memoizedState;
|
|
6884
|
+
var didTimeout = state !== null && state.didTimeout;
|
|
6885
|
+
if (didTimeout) {
|
|
6886
|
+
// If this boundary is currently timed out, we need to decide
|
|
6887
|
+
// whether to retry the primary children, or to skip over it and
|
|
6888
|
+
// go straight to the fallback. Check the priority of the primary
|
|
6889
|
+
var primaryChildFragment = workInProgress.child;
|
|
6890
|
+
var primaryChildExpirationTime = primaryChildFragment.childExpirationTime;
|
|
6891
|
+
if (primaryChildExpirationTime !== NoWork && primaryChildExpirationTime <= renderExpirationTime) {
|
|
6892
|
+
// The primary children have pending work. Use the normal path
|
|
6893
|
+
// to attempt to render the primary children again.
|
|
6894
|
+
return updateSuspenseComponent(current$$1, workInProgress, renderExpirationTime);
|
|
6895
|
+
} else {
|
|
6896
|
+
// The primary children do not have pending work with sufficient
|
|
6897
|
+
// priority. Bailout.
|
|
6898
|
+
var child = bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
|
|
6899
|
+
if (child !== null) {
|
|
6900
|
+
// The fallback children have pending work. Skip over the
|
|
6901
|
+
// primary children and work on the fallback.
|
|
6902
|
+
return child.sibling;
|
|
6903
|
+
} else {
|
|
6904
|
+
return null;
|
|
6905
|
+
}
|
|
6906
|
+
}
|
|
6907
|
+
}
|
|
6908
|
+
break;
|
|
6909
|
+
}
|
|
6637
6910
|
}
|
|
6638
6911
|
return bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
|
|
6639
6912
|
}
|
|
@@ -6645,38 +6918,27 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
|
|
|
6645
6918
|
switch (workInProgress.tag) {
|
|
6646
6919
|
case IndeterminateComponent:
|
|
6647
6920
|
{
|
|
6648
|
-
var
|
|
6649
|
-
return mountIndeterminateComponent(current$$1, workInProgress,
|
|
6921
|
+
var elementType = workInProgress.elementType;
|
|
6922
|
+
return mountIndeterminateComponent(current$$1, workInProgress, elementType, renderExpirationTime);
|
|
6650
6923
|
}
|
|
6651
|
-
case
|
|
6924
|
+
case LazyComponent:
|
|
6652
6925
|
{
|
|
6653
|
-
var
|
|
6654
|
-
|
|
6655
|
-
return updateFunctionComponent(current$$1, workInProgress, _Component3, unresolvedProps, renderExpirationTime);
|
|
6926
|
+
var _elementType = workInProgress.elementType;
|
|
6927
|
+
return mountLazyComponent(current$$1, workInProgress, _elementType, updateExpirationTime, renderExpirationTime);
|
|
6656
6928
|
}
|
|
6657
|
-
case
|
|
6929
|
+
case FunctionComponent:
|
|
6658
6930
|
{
|
|
6659
|
-
var
|
|
6660
|
-
var
|
|
6661
|
-
var
|
|
6662
|
-
|
|
6663
|
-
workInProgress.memoizedProps = _unresolvedProps;
|
|
6664
|
-
return child;
|
|
6931
|
+
var _Component = workInProgress.type;
|
|
6932
|
+
var unresolvedProps = workInProgress.pendingProps;
|
|
6933
|
+
var resolvedProps = workInProgress.elementType === _Component ? unresolvedProps : resolveDefaultProps(_Component, unresolvedProps);
|
|
6934
|
+
return updateFunctionComponent(current$$1, workInProgress, _Component, resolvedProps, renderExpirationTime);
|
|
6665
6935
|
}
|
|
6666
6936
|
case ClassComponent:
|
|
6667
6937
|
{
|
|
6668
|
-
var
|
|
6669
|
-
var
|
|
6670
|
-
|
|
6671
|
-
|
|
6672
|
-
case ClassComponentLazy:
|
|
6673
|
-
{
|
|
6674
|
-
var _thenable2 = workInProgress.type;
|
|
6675
|
-
var _Component6 = getResultFromResolvedThenable(_thenable2);
|
|
6676
|
-
var _unresolvedProps3 = workInProgress.pendingProps;
|
|
6677
|
-
var _child = updateClassComponent(current$$1, workInProgress, _Component6, resolveDefaultProps(_Component6, _unresolvedProps3), renderExpirationTime);
|
|
6678
|
-
workInProgress.memoizedProps = _unresolvedProps3;
|
|
6679
|
-
return _child;
|
|
6938
|
+
var _Component2 = workInProgress.type;
|
|
6939
|
+
var _unresolvedProps = workInProgress.pendingProps;
|
|
6940
|
+
var _resolvedProps = workInProgress.elementType === _Component2 ? _unresolvedProps : resolveDefaultProps(_Component2, _unresolvedProps);
|
|
6941
|
+
return updateClassComponent(current$$1, workInProgress, _Component2, _resolvedProps, renderExpirationTime);
|
|
6680
6942
|
}
|
|
6681
6943
|
case HostRoot:
|
|
6682
6944
|
return updateHostRoot(current$$1, workInProgress, renderExpirationTime);
|
|
@@ -6691,16 +6953,9 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
|
|
|
6691
6953
|
case ForwardRef:
|
|
6692
6954
|
{
|
|
6693
6955
|
var type = workInProgress.type;
|
|
6694
|
-
|
|
6695
|
-
|
|
6696
|
-
|
|
6697
|
-
{
|
|
6698
|
-
var _thenable3 = workInProgress.type;
|
|
6699
|
-
var _Component7 = getResultFromResolvedThenable(_thenable3);
|
|
6700
|
-
var _unresolvedProps4 = workInProgress.pendingProps;
|
|
6701
|
-
var _child2 = updateForwardRef(current$$1, workInProgress, _Component7, resolveDefaultProps(_Component7, _unresolvedProps4), renderExpirationTime);
|
|
6702
|
-
workInProgress.memoizedProps = _unresolvedProps4;
|
|
6703
|
-
return _child2;
|
|
6956
|
+
var _unresolvedProps2 = workInProgress.pendingProps;
|
|
6957
|
+
var _resolvedProps2 = workInProgress.elementType === type ? _unresolvedProps2 : resolveDefaultProps(type, _unresolvedProps2);
|
|
6958
|
+
return updateForwardRef(current$$1, workInProgress, type, _resolvedProps2, renderExpirationTime);
|
|
6704
6959
|
}
|
|
6705
6960
|
case Fragment:
|
|
6706
6961
|
return updateFragment(current$$1, workInProgress, renderExpirationTime);
|
|
@@ -6712,19 +6967,23 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
|
|
|
6712
6967
|
return updateContextProvider(current$$1, workInProgress, renderExpirationTime);
|
|
6713
6968
|
case ContextConsumer:
|
|
6714
6969
|
return updateContextConsumer(current$$1, workInProgress, renderExpirationTime);
|
|
6715
|
-
case
|
|
6970
|
+
case MemoComponent:
|
|
6716
6971
|
{
|
|
6717
6972
|
var _type = workInProgress.type;
|
|
6718
|
-
|
|
6973
|
+
var _unresolvedProps3 = workInProgress.pendingProps;
|
|
6974
|
+
var _resolvedProps3 = resolveDefaultProps(_type.type, _unresolvedProps3);
|
|
6975
|
+
return updateMemoComponent(current$$1, workInProgress, _type, _resolvedProps3, updateExpirationTime, renderExpirationTime);
|
|
6719
6976
|
}
|
|
6720
|
-
case
|
|
6977
|
+
case SimpleMemoComponent:
|
|
6721
6978
|
{
|
|
6722
|
-
|
|
6723
|
-
|
|
6724
|
-
|
|
6725
|
-
|
|
6726
|
-
|
|
6727
|
-
|
|
6979
|
+
return updateSimpleMemoComponent(current$$1, workInProgress, workInProgress.type, workInProgress.pendingProps, updateExpirationTime, renderExpirationTime);
|
|
6980
|
+
}
|
|
6981
|
+
case IncompleteClassComponent:
|
|
6982
|
+
{
|
|
6983
|
+
var _Component3 = workInProgress.type;
|
|
6984
|
+
var _unresolvedProps4 = workInProgress.pendingProps;
|
|
6985
|
+
var _resolvedProps4 = workInProgress.elementType === _Component3 ? _unresolvedProps4 : resolveDefaultProps(_Component3, _unresolvedProps4);
|
|
6986
|
+
return mountIncompleteClassComponent(current$$1, workInProgress, _Component3, _resolvedProps4, renderExpirationTime);
|
|
6728
6987
|
}
|
|
6729
6988
|
default:
|
|
6730
6989
|
invariant(false, 'Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue.');
|
|
@@ -6741,42 +7000,43 @@ function markRef$1(workInProgress) {
|
|
|
6741
7000
|
workInProgress.effectTag |= Ref;
|
|
6742
7001
|
}
|
|
6743
7002
|
|
|
6744
|
-
|
|
6745
|
-
// We only have the top Fiber that was created but we need recurse down its
|
|
6746
|
-
// children to find all the terminal nodes.
|
|
6747
|
-
var node = workInProgress.child;
|
|
6748
|
-
while (node !== null) {
|
|
6749
|
-
if (node.tag === HostComponent || node.tag === HostText) {
|
|
6750
|
-
appendInitialChild(parent, node.stateNode);
|
|
6751
|
-
} else if (node.tag === HostPortal) {
|
|
6752
|
-
// If we have a portal child, then we don't want to traverse
|
|
6753
|
-
// down its children. Instead, we'll get insertions from each child in
|
|
6754
|
-
// the portal directly.
|
|
6755
|
-
} else if (node.child !== null) {
|
|
6756
|
-
node.child.return = node;
|
|
6757
|
-
node = node.child;
|
|
6758
|
-
continue;
|
|
6759
|
-
}
|
|
6760
|
-
if (node === workInProgress) {
|
|
6761
|
-
return;
|
|
6762
|
-
}
|
|
6763
|
-
while (node.sibling === null) {
|
|
6764
|
-
if (node.return === null || node.return === workInProgress) {
|
|
6765
|
-
return;
|
|
6766
|
-
}
|
|
6767
|
-
node = node.return;
|
|
6768
|
-
}
|
|
6769
|
-
node.sibling.return = node.return;
|
|
6770
|
-
node = node.sibling;
|
|
6771
|
-
}
|
|
6772
|
-
}
|
|
6773
|
-
|
|
7003
|
+
var appendAllChildren = void 0;
|
|
6774
7004
|
var updateHostContainer = void 0;
|
|
6775
7005
|
var updateHostComponent$1 = void 0;
|
|
6776
7006
|
var updateHostText$1 = void 0;
|
|
6777
7007
|
if (supportsMutation) {
|
|
6778
7008
|
// Mutation mode
|
|
6779
7009
|
|
|
7010
|
+
appendAllChildren = function (parent, workInProgress, needsVisibilityToggle, isHidden) {
|
|
7011
|
+
// We only have the top Fiber that was created but we need recurse down its
|
|
7012
|
+
// children to find all the terminal nodes.
|
|
7013
|
+
var node = workInProgress.child;
|
|
7014
|
+
while (node !== null) {
|
|
7015
|
+
if (node.tag === HostComponent || node.tag === HostText) {
|
|
7016
|
+
appendInitialChild(parent, node.stateNode);
|
|
7017
|
+
} else if (node.tag === HostPortal) {
|
|
7018
|
+
// If we have a portal child, then we don't want to traverse
|
|
7019
|
+
// down its children. Instead, we'll get insertions from each child in
|
|
7020
|
+
// the portal directly.
|
|
7021
|
+
} else if (node.child !== null) {
|
|
7022
|
+
node.child.return = node;
|
|
7023
|
+
node = node.child;
|
|
7024
|
+
continue;
|
|
7025
|
+
}
|
|
7026
|
+
if (node === workInProgress) {
|
|
7027
|
+
return;
|
|
7028
|
+
}
|
|
7029
|
+
while (node.sibling === null) {
|
|
7030
|
+
if (node.return === null || node.return === workInProgress) {
|
|
7031
|
+
return;
|
|
7032
|
+
}
|
|
7033
|
+
node = node.return;
|
|
7034
|
+
}
|
|
7035
|
+
node.sibling.return = node.return;
|
|
7036
|
+
node = node.sibling;
|
|
7037
|
+
}
|
|
7038
|
+
};
|
|
7039
|
+
|
|
6780
7040
|
updateHostContainer = function (workInProgress) {
|
|
6781
7041
|
// Noop
|
|
6782
7042
|
};
|
|
@@ -6817,23 +7077,167 @@ if (supportsMutation) {
|
|
|
6817
7077
|
} else if (supportsPersistence) {
|
|
6818
7078
|
// Persistent host tree mode
|
|
6819
7079
|
|
|
7080
|
+
appendAllChildren = function (parent, workInProgress, needsVisibilityToggle, isHidden) {
|
|
7081
|
+
// We only have the top Fiber that was created but we need recurse down its
|
|
7082
|
+
// children to find all the terminal nodes.
|
|
7083
|
+
var node = workInProgress.child;
|
|
7084
|
+
while (node !== null) {
|
|
7085
|
+
// eslint-disable-next-line no-labels
|
|
7086
|
+
branches: if (node.tag === HostComponent) {
|
|
7087
|
+
var instance = node.stateNode;
|
|
7088
|
+
if (needsVisibilityToggle) {
|
|
7089
|
+
var props = node.memoizedProps;
|
|
7090
|
+
var type = node.type;
|
|
7091
|
+
if (isHidden) {
|
|
7092
|
+
// This child is inside a timed out tree. Hide it.
|
|
7093
|
+
instance = cloneHiddenInstance(instance, type, props, node);
|
|
7094
|
+
} else {
|
|
7095
|
+
// This child was previously inside a timed out tree. If it was not
|
|
7096
|
+
// updated during this render, it may need to be unhidden. Clone
|
|
7097
|
+
// again to be sure.
|
|
7098
|
+
instance = cloneUnhiddenInstance(instance, type, props, node);
|
|
7099
|
+
}
|
|
7100
|
+
node.stateNode = instance;
|
|
7101
|
+
}
|
|
7102
|
+
appendInitialChild(parent, instance);
|
|
7103
|
+
} else if (node.tag === HostText) {
|
|
7104
|
+
var _instance = node.stateNode;
|
|
7105
|
+
if (needsVisibilityToggle) {
|
|
7106
|
+
var text = node.memoizedProps;
|
|
7107
|
+
var rootContainerInstance = getRootHostContainer();
|
|
7108
|
+
var currentHostContext = getHostContext();
|
|
7109
|
+
if (isHidden) {
|
|
7110
|
+
_instance = createHiddenTextInstance(text, rootContainerInstance, currentHostContext, workInProgress);
|
|
7111
|
+
} else {
|
|
7112
|
+
_instance = createTextInstance(text, rootContainerInstance, currentHostContext, workInProgress);
|
|
7113
|
+
}
|
|
7114
|
+
node.stateNode = _instance;
|
|
7115
|
+
}
|
|
7116
|
+
appendInitialChild(parent, _instance);
|
|
7117
|
+
} else if (node.tag === HostPortal) {
|
|
7118
|
+
// If we have a portal child, then we don't want to traverse
|
|
7119
|
+
// down its children. Instead, we'll get insertions from each child in
|
|
7120
|
+
// the portal directly.
|
|
7121
|
+
} else if (node.tag === SuspenseComponent) {
|
|
7122
|
+
var current = node.alternate;
|
|
7123
|
+
if (current !== null) {
|
|
7124
|
+
var oldState = current.memoizedState;
|
|
7125
|
+
var newState = node.memoizedState;
|
|
7126
|
+
var oldIsHidden = oldState !== null && oldState.didTimeout;
|
|
7127
|
+
var newIsHidden = newState !== null && newState.didTimeout;
|
|
7128
|
+
if (oldIsHidden !== newIsHidden) {
|
|
7129
|
+
// The placeholder either just timed out or switched back to the normal
|
|
7130
|
+
// children after having previously timed out. Toggle the visibility of
|
|
7131
|
+
// the direct host children.
|
|
7132
|
+
var primaryChildParent = newIsHidden ? node.child : node;
|
|
7133
|
+
if (primaryChildParent !== null) {
|
|
7134
|
+
appendAllChildren(parent, primaryChildParent, true, newIsHidden);
|
|
7135
|
+
}
|
|
7136
|
+
// eslint-disable-next-line no-labels
|
|
7137
|
+
break branches;
|
|
7138
|
+
}
|
|
7139
|
+
}
|
|
7140
|
+
if (node.child !== null) {
|
|
7141
|
+
// Continue traversing like normal
|
|
7142
|
+
node.child.return = node;
|
|
7143
|
+
node = node.child;
|
|
7144
|
+
continue;
|
|
7145
|
+
}
|
|
7146
|
+
} else if (node.child !== null) {
|
|
7147
|
+
node.child.return = node;
|
|
7148
|
+
node = node.child;
|
|
7149
|
+
continue;
|
|
7150
|
+
}
|
|
7151
|
+
// $FlowFixMe This is correct but Flow is confused by the labeled break.
|
|
7152
|
+
node = node;
|
|
7153
|
+
if (node === workInProgress) {
|
|
7154
|
+
return;
|
|
7155
|
+
}
|
|
7156
|
+
while (node.sibling === null) {
|
|
7157
|
+
if (node.return === null || node.return === workInProgress) {
|
|
7158
|
+
return;
|
|
7159
|
+
}
|
|
7160
|
+
node = node.return;
|
|
7161
|
+
}
|
|
7162
|
+
node.sibling.return = node.return;
|
|
7163
|
+
node = node.sibling;
|
|
7164
|
+
}
|
|
7165
|
+
};
|
|
7166
|
+
|
|
6820
7167
|
// An unfortunate fork of appendAllChildren because we have two different parent types.
|
|
6821
|
-
var appendAllChildrenToContainer = function (containerChildSet, workInProgress) {
|
|
7168
|
+
var appendAllChildrenToContainer = function (containerChildSet, workInProgress, needsVisibilityToggle, isHidden) {
|
|
6822
7169
|
// We only have the top Fiber that was created but we need recurse down its
|
|
6823
7170
|
// children to find all the terminal nodes.
|
|
6824
7171
|
var node = workInProgress.child;
|
|
6825
7172
|
while (node !== null) {
|
|
6826
|
-
|
|
6827
|
-
|
|
7173
|
+
// eslint-disable-next-line no-labels
|
|
7174
|
+
branches: if (node.tag === HostComponent) {
|
|
7175
|
+
var instance = node.stateNode;
|
|
7176
|
+
if (needsVisibilityToggle) {
|
|
7177
|
+
var props = node.memoizedProps;
|
|
7178
|
+
var type = node.type;
|
|
7179
|
+
if (isHidden) {
|
|
7180
|
+
// This child is inside a timed out tree. Hide it.
|
|
7181
|
+
instance = cloneHiddenInstance(instance, type, props, node);
|
|
7182
|
+
} else {
|
|
7183
|
+
// This child was previously inside a timed out tree. If it was not
|
|
7184
|
+
// updated during this render, it may need to be unhidden. Clone
|
|
7185
|
+
// again to be sure.
|
|
7186
|
+
instance = cloneUnhiddenInstance(instance, type, props, node);
|
|
7187
|
+
}
|
|
7188
|
+
node.stateNode = instance;
|
|
7189
|
+
}
|
|
7190
|
+
appendChildToContainerChildSet(containerChildSet, instance);
|
|
7191
|
+
} else if (node.tag === HostText) {
|
|
7192
|
+
var _instance2 = node.stateNode;
|
|
7193
|
+
if (needsVisibilityToggle) {
|
|
7194
|
+
var text = node.memoizedProps;
|
|
7195
|
+
var rootContainerInstance = getRootHostContainer();
|
|
7196
|
+
var currentHostContext = getHostContext();
|
|
7197
|
+
if (isHidden) {
|
|
7198
|
+
_instance2 = createHiddenTextInstance(text, rootContainerInstance, currentHostContext, workInProgress);
|
|
7199
|
+
} else {
|
|
7200
|
+
_instance2 = createTextInstance(text, rootContainerInstance, currentHostContext, workInProgress);
|
|
7201
|
+
}
|
|
7202
|
+
node.stateNode = _instance2;
|
|
7203
|
+
}
|
|
7204
|
+
appendChildToContainerChildSet(containerChildSet, _instance2);
|
|
6828
7205
|
} else if (node.tag === HostPortal) {
|
|
6829
7206
|
// If we have a portal child, then we don't want to traverse
|
|
6830
7207
|
// down its children. Instead, we'll get insertions from each child in
|
|
6831
7208
|
// the portal directly.
|
|
7209
|
+
} else if (node.tag === SuspenseComponent) {
|
|
7210
|
+
var current = node.alternate;
|
|
7211
|
+
if (current !== null) {
|
|
7212
|
+
var oldState = current.memoizedState;
|
|
7213
|
+
var newState = node.memoizedState;
|
|
7214
|
+
var oldIsHidden = oldState !== null && oldState.didTimeout;
|
|
7215
|
+
var newIsHidden = newState !== null && newState.didTimeout;
|
|
7216
|
+
if (oldIsHidden !== newIsHidden) {
|
|
7217
|
+
// The placeholder either just timed out or switched back to the normal
|
|
7218
|
+
// children after having previously timed out. Toggle the visibility of
|
|
7219
|
+
// the direct host children.
|
|
7220
|
+
var primaryChildParent = newIsHidden ? node.child : node;
|
|
7221
|
+
if (primaryChildParent !== null) {
|
|
7222
|
+
appendAllChildrenToContainer(containerChildSet, primaryChildParent, true, newIsHidden);
|
|
7223
|
+
}
|
|
7224
|
+
// eslint-disable-next-line no-labels
|
|
7225
|
+
break branches;
|
|
7226
|
+
}
|
|
7227
|
+
}
|
|
7228
|
+
if (node.child !== null) {
|
|
7229
|
+
// Continue traversing like normal
|
|
7230
|
+
node.child.return = node;
|
|
7231
|
+
node = node.child;
|
|
7232
|
+
continue;
|
|
7233
|
+
}
|
|
6832
7234
|
} else if (node.child !== null) {
|
|
6833
7235
|
node.child.return = node;
|
|
6834
7236
|
node = node.child;
|
|
6835
7237
|
continue;
|
|
6836
7238
|
}
|
|
7239
|
+
// $FlowFixMe This is correct but Flow is confused by the labeled break.
|
|
7240
|
+
node = node;
|
|
6837
7241
|
if (node === workInProgress) {
|
|
6838
7242
|
return;
|
|
6839
7243
|
}
|
|
@@ -6856,7 +7260,7 @@ if (supportsMutation) {
|
|
|
6856
7260
|
var container = portalOrRoot.containerInfo;
|
|
6857
7261
|
var newChildSet = createContainerChildSet(container);
|
|
6858
7262
|
// If children might have changed, we have to add them all to the set.
|
|
6859
|
-
appendAllChildrenToContainer(newChildSet, workInProgress);
|
|
7263
|
+
appendAllChildrenToContainer(newChildSet, workInProgress, false, false);
|
|
6860
7264
|
portalOrRoot.pendingChildren = newChildSet;
|
|
6861
7265
|
// Schedule an update on the container to swap out the container.
|
|
6862
7266
|
markUpdate(workInProgress);
|
|
@@ -6899,7 +7303,7 @@ if (supportsMutation) {
|
|
|
6899
7303
|
markUpdate(workInProgress);
|
|
6900
7304
|
} else {
|
|
6901
7305
|
// If children might have changed, we have to add them all to the set.
|
|
6902
|
-
appendAllChildren(newInstance, workInProgress);
|
|
7306
|
+
appendAllChildren(newInstance, workInProgress, false, false);
|
|
6903
7307
|
}
|
|
6904
7308
|
};
|
|
6905
7309
|
updateHostText$1 = function (current, workInProgress, oldText, newText) {
|
|
@@ -6930,8 +7334,12 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
6930
7334
|
var newProps = workInProgress.pendingProps;
|
|
6931
7335
|
|
|
6932
7336
|
switch (workInProgress.tag) {
|
|
7337
|
+
case IndeterminateComponent:
|
|
7338
|
+
break;
|
|
7339
|
+
case LazyComponent:
|
|
7340
|
+
break;
|
|
7341
|
+
case SimpleMemoComponent:
|
|
6933
7342
|
case FunctionComponent:
|
|
6934
|
-
case FunctionComponentLazy:
|
|
6935
7343
|
break;
|
|
6936
7344
|
case ClassComponent:
|
|
6937
7345
|
{
|
|
@@ -6941,14 +7349,6 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
6941
7349
|
}
|
|
6942
7350
|
break;
|
|
6943
7351
|
}
|
|
6944
|
-
case ClassComponentLazy:
|
|
6945
|
-
{
|
|
6946
|
-
var _Component = getResultFromResolvedThenable(workInProgress.type);
|
|
6947
|
-
if (isContextProvider(_Component)) {
|
|
6948
|
-
popContext(workInProgress);
|
|
6949
|
-
}
|
|
6950
|
-
break;
|
|
6951
|
-
}
|
|
6952
7352
|
case HostRoot:
|
|
6953
7353
|
{
|
|
6954
7354
|
popHostContainer(workInProgress);
|
|
@@ -7004,7 +7404,7 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
7004
7404
|
} else {
|
|
7005
7405
|
var instance = createInstance(type, newProps, rootContainerInstance, currentHostContext, workInProgress);
|
|
7006
7406
|
|
|
7007
|
-
appendAllChildren(instance, workInProgress);
|
|
7407
|
+
appendAllChildren(instance, workInProgress, false, false);
|
|
7008
7408
|
|
|
7009
7409
|
// Certain renderers require commit-time effects for initial mount.
|
|
7010
7410
|
// (eg DOM renderer supports auto-focus for certain elements).
|
|
@@ -7049,10 +7449,20 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
7049
7449
|
break;
|
|
7050
7450
|
}
|
|
7051
7451
|
case ForwardRef:
|
|
7052
|
-
case ForwardRefLazy:
|
|
7053
7452
|
break;
|
|
7054
7453
|
case SuspenseComponent:
|
|
7055
|
-
|
|
7454
|
+
{
|
|
7455
|
+
var nextState = workInProgress.memoizedState;
|
|
7456
|
+
var prevState = current !== null ? current.memoizedState : null;
|
|
7457
|
+
var nextDidTimeout = nextState !== null && nextState.didTimeout;
|
|
7458
|
+
var prevDidTimeout = prevState !== null && prevState.didTimeout;
|
|
7459
|
+
if (nextDidTimeout !== prevDidTimeout) {
|
|
7460
|
+
// If this render commits, and it switches between the normal state
|
|
7461
|
+
// and the timed-out state, schedule an effect.
|
|
7462
|
+
workInProgress.effectTag |= Update;
|
|
7463
|
+
}
|
|
7464
|
+
break;
|
|
7465
|
+
}
|
|
7056
7466
|
case Fragment:
|
|
7057
7467
|
break;
|
|
7058
7468
|
case Mode:
|
|
@@ -7069,13 +7479,18 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
7069
7479
|
break;
|
|
7070
7480
|
case ContextConsumer:
|
|
7071
7481
|
break;
|
|
7072
|
-
case
|
|
7073
|
-
case PureComponentLazy:
|
|
7482
|
+
case MemoComponent:
|
|
7074
7483
|
break;
|
|
7075
|
-
|
|
7076
|
-
|
|
7077
|
-
|
|
7078
|
-
|
|
7484
|
+
case IncompleteClassComponent:
|
|
7485
|
+
{
|
|
7486
|
+
// Same as class component case. I put it down here so that the tags are
|
|
7487
|
+
// sequential to ensure this switch is compiled to a jump table.
|
|
7488
|
+
var _Component = workInProgress.type;
|
|
7489
|
+
if (isContextProvider(_Component)) {
|
|
7490
|
+
popContext(workInProgress);
|
|
7491
|
+
}
|
|
7492
|
+
break;
|
|
7493
|
+
}
|
|
7079
7494
|
default:
|
|
7080
7495
|
invariant(false, 'Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue.');
|
|
7081
7496
|
}
|
|
@@ -7083,6 +7498,17 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
7083
7498
|
return null;
|
|
7084
7499
|
}
|
|
7085
7500
|
|
|
7501
|
+
function shouldCaptureSuspense(current, workInProgress) {
|
|
7502
|
+
// In order to capture, the Suspense component must have a fallback prop.
|
|
7503
|
+
if (workInProgress.memoizedProps.fallback === undefined) {
|
|
7504
|
+
return false;
|
|
7505
|
+
}
|
|
7506
|
+
// If it was the primary children that just suspended, capture and render the
|
|
7507
|
+
// fallback. Otherwise, don't capture and bubble to the next boundary.
|
|
7508
|
+
var nextState = workInProgress.memoizedState;
|
|
7509
|
+
return nextState === null || !nextState.didTimeout;
|
|
7510
|
+
}
|
|
7511
|
+
|
|
7086
7512
|
// This module is forked in different environments.
|
|
7087
7513
|
// By default, return `true` to log errors to the console.
|
|
7088
7514
|
// Forks can return `false` if this isn't desirable.
|
|
@@ -7150,8 +7576,6 @@ function logCapturedError(capturedError) {
|
|
|
7150
7576
|
}
|
|
7151
7577
|
}
|
|
7152
7578
|
|
|
7153
|
-
var emptyObject = {};
|
|
7154
|
-
|
|
7155
7579
|
var didWarnAboutUndefinedSnapshotBeforeUpdate = null;
|
|
7156
7580
|
{
|
|
7157
7581
|
didWarnAboutUndefinedSnapshotBeforeUpdate = new Set();
|
|
@@ -7233,7 +7657,6 @@ function safelyDetachRef(current$$1) {
|
|
|
7233
7657
|
function commitBeforeMutationLifeCycles(current$$1, finishedWork) {
|
|
7234
7658
|
switch (finishedWork.tag) {
|
|
7235
7659
|
case ClassComponent:
|
|
7236
|
-
case ClassComponentLazy:
|
|
7237
7660
|
{
|
|
7238
7661
|
if (finishedWork.effectTag & Snapshot) {
|
|
7239
7662
|
if (current$$1 !== null) {
|
|
@@ -7261,6 +7684,7 @@ function commitBeforeMutationLifeCycles(current$$1, finishedWork) {
|
|
|
7261
7684
|
case HostComponent:
|
|
7262
7685
|
case HostText:
|
|
7263
7686
|
case HostPortal:
|
|
7687
|
+
case IncompleteClassComponent:
|
|
7264
7688
|
// Nothing to do for these component types
|
|
7265
7689
|
return;
|
|
7266
7690
|
default:
|
|
@@ -7273,7 +7697,6 @@ function commitBeforeMutationLifeCycles(current$$1, finishedWork) {
|
|
|
7273
7697
|
function commitLifeCycles(finishedRoot, current$$1, finishedWork, committedExpirationTime) {
|
|
7274
7698
|
switch (finishedWork.tag) {
|
|
7275
7699
|
case ClassComponent:
|
|
7276
|
-
case ClassComponentLazy:
|
|
7277
7700
|
{
|
|
7278
7701
|
var instance = finishedWork.stateNode;
|
|
7279
7702
|
if (finishedWork.effectTag & Update) {
|
|
@@ -7312,7 +7735,6 @@ function commitLifeCycles(finishedRoot, current$$1, finishedWork, committedExpir
|
|
|
7312
7735
|
_instance = getPublicInstance(finishedWork.child.stateNode);
|
|
7313
7736
|
break;
|
|
7314
7737
|
case ClassComponent:
|
|
7315
|
-
case ClassComponentLazy:
|
|
7316
7738
|
_instance = finishedWork.child.stateNode;
|
|
7317
7739
|
break;
|
|
7318
7740
|
}
|
|
@@ -7362,22 +7784,48 @@ function commitLifeCycles(finishedRoot, current$$1, finishedWork, committedExpir
|
|
|
7362
7784
|
}
|
|
7363
7785
|
case SuspenseComponent:
|
|
7364
7786
|
{
|
|
7365
|
-
if (
|
|
7366
|
-
// In
|
|
7367
|
-
//
|
|
7368
|
-
//
|
|
7369
|
-
|
|
7370
|
-
|
|
7371
|
-
|
|
7787
|
+
if (finishedWork.effectTag & Callback) {
|
|
7788
|
+
// In non-strict mode, a suspense boundary times out by commiting
|
|
7789
|
+
// twice: first, by committing the children in an inconsistent state,
|
|
7790
|
+
// then hiding them and showing the fallback children in a subsequent
|
|
7791
|
+
var _newState = {
|
|
7792
|
+
alreadyCaptured: true,
|
|
7793
|
+
didTimeout: false,
|
|
7794
|
+
timedOutAt: NoWork
|
|
7795
|
+
};
|
|
7796
|
+
finishedWork.memoizedState = _newState;
|
|
7372
7797
|
scheduleWork(finishedWork, Sync);
|
|
7798
|
+
return;
|
|
7799
|
+
}
|
|
7800
|
+
var oldState = current$$1 !== null ? current$$1.memoizedState : null;
|
|
7801
|
+
var newState = finishedWork.memoizedState;
|
|
7802
|
+
var oldDidTimeout = oldState !== null ? oldState.didTimeout : false;
|
|
7803
|
+
|
|
7804
|
+
var newDidTimeout = void 0;
|
|
7805
|
+
var primaryChildParent = finishedWork;
|
|
7806
|
+
if (newState === null) {
|
|
7807
|
+
newDidTimeout = false;
|
|
7373
7808
|
} else {
|
|
7374
|
-
|
|
7375
|
-
|
|
7376
|
-
|
|
7377
|
-
|
|
7809
|
+
newDidTimeout = newState.didTimeout;
|
|
7810
|
+
if (newDidTimeout) {
|
|
7811
|
+
primaryChildParent = finishedWork.child;
|
|
7812
|
+
newState.alreadyCaptured = false;
|
|
7813
|
+
if (newState.timedOutAt === NoWork) {
|
|
7814
|
+
// If the children had not already timed out, record the time.
|
|
7815
|
+
// This is used to compute the elapsed time during subsequent
|
|
7816
|
+
// attempts to render the children.
|
|
7817
|
+
newState.timedOutAt = requestCurrentTime();
|
|
7818
|
+
}
|
|
7819
|
+
}
|
|
7820
|
+
}
|
|
7821
|
+
|
|
7822
|
+
if (newDidTimeout !== oldDidTimeout && primaryChildParent !== null) {
|
|
7823
|
+
hideOrUnhideAllChildren(primaryChildParent, newDidTimeout);
|
|
7378
7824
|
}
|
|
7379
7825
|
return;
|
|
7380
7826
|
}
|
|
7827
|
+
case IncompleteClassComponent:
|
|
7828
|
+
break;
|
|
7381
7829
|
default:
|
|
7382
7830
|
{
|
|
7383
7831
|
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.');
|
|
@@ -7385,6 +7833,45 @@ function commitLifeCycles(finishedRoot, current$$1, finishedWork, committedExpir
|
|
|
7385
7833
|
}
|
|
7386
7834
|
}
|
|
7387
7835
|
|
|
7836
|
+
function hideOrUnhideAllChildren(finishedWork, isHidden) {
|
|
7837
|
+
if (supportsMutation) {
|
|
7838
|
+
// We only have the top Fiber that was inserted but we need recurse down its
|
|
7839
|
+
var node = finishedWork;
|
|
7840
|
+
while (true) {
|
|
7841
|
+
if (node.tag === HostComponent) {
|
|
7842
|
+
var instance = node.stateNode;
|
|
7843
|
+
if (isHidden) {
|
|
7844
|
+
hideInstance(instance);
|
|
7845
|
+
} else {
|
|
7846
|
+
unhideInstance(node.stateNode, node.memoizedProps);
|
|
7847
|
+
}
|
|
7848
|
+
} else if (node.tag === HostText) {
|
|
7849
|
+
var _instance3 = node.stateNode;
|
|
7850
|
+
if (isHidden) {
|
|
7851
|
+
hideTextInstance(_instance3);
|
|
7852
|
+
} else {
|
|
7853
|
+
unhideTextInstance(_instance3, node.memoizedProps);
|
|
7854
|
+
}
|
|
7855
|
+
} else if (node.child !== null) {
|
|
7856
|
+
node.child.return = node;
|
|
7857
|
+
node = node.child;
|
|
7858
|
+
continue;
|
|
7859
|
+
}
|
|
7860
|
+
if (node === finishedWork) {
|
|
7861
|
+
return;
|
|
7862
|
+
}
|
|
7863
|
+
while (node.sibling === null) {
|
|
7864
|
+
if (node.return === null || node.return === finishedWork) {
|
|
7865
|
+
return;
|
|
7866
|
+
}
|
|
7867
|
+
node = node.return;
|
|
7868
|
+
}
|
|
7869
|
+
node.sibling.return = node.return;
|
|
7870
|
+
node = node.sibling;
|
|
7871
|
+
}
|
|
7872
|
+
}
|
|
7873
|
+
}
|
|
7874
|
+
|
|
7388
7875
|
function commitAttachRef(finishedWork) {
|
|
7389
7876
|
var ref = finishedWork.ref;
|
|
7390
7877
|
if (ref !== null) {
|
|
@@ -7430,7 +7917,6 @@ function commitUnmount(current$$1) {
|
|
|
7430
7917
|
|
|
7431
7918
|
switch (current$$1.tag) {
|
|
7432
7919
|
case ClassComponent:
|
|
7433
|
-
case ClassComponentLazy:
|
|
7434
7920
|
{
|
|
7435
7921
|
safelyDetachRef(current$$1);
|
|
7436
7922
|
var instance = current$$1.stateNode;
|
|
@@ -7524,7 +8010,6 @@ function commitContainer(finishedWork) {
|
|
|
7524
8010
|
|
|
7525
8011
|
switch (finishedWork.tag) {
|
|
7526
8012
|
case ClassComponent:
|
|
7527
|
-
case ClassComponentLazy:
|
|
7528
8013
|
{
|
|
7529
8014
|
return;
|
|
7530
8015
|
}
|
|
@@ -7789,7 +8274,6 @@ function commitWork(current$$1, finishedWork) {
|
|
|
7789
8274
|
|
|
7790
8275
|
switch (finishedWork.tag) {
|
|
7791
8276
|
case ClassComponent:
|
|
7792
|
-
case ClassComponentLazy:
|
|
7793
8277
|
{
|
|
7794
8278
|
return;
|
|
7795
8279
|
}
|
|
@@ -7837,6 +8321,10 @@ function commitWork(current$$1, finishedWork) {
|
|
|
7837
8321
|
{
|
|
7838
8322
|
return;
|
|
7839
8323
|
}
|
|
8324
|
+
case IncompleteClassComponent:
|
|
8325
|
+
{
|
|
8326
|
+
return;
|
|
8327
|
+
}
|
|
7840
8328
|
default:
|
|
7841
8329
|
{
|
|
7842
8330
|
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.');
|
|
@@ -7851,10 +8339,6 @@ function commitResetTextContent(current$$1) {
|
|
|
7851
8339
|
resetTextContent(current$$1.stateNode);
|
|
7852
8340
|
}
|
|
7853
8341
|
|
|
7854
|
-
function NoopComponent() {
|
|
7855
|
-
return null;
|
|
7856
|
-
}
|
|
7857
|
-
|
|
7858
8342
|
function createRootErrorUpdate(fiber, errorInfo, expirationTime) {
|
|
7859
8343
|
var update = createUpdate(expirationTime);
|
|
7860
8344
|
// Unmount the root by rendering null.
|
|
@@ -7932,17 +8416,16 @@ function throwException(root, returnFiber, sourceFiber, value, renderExpirationT
|
|
|
7932
8416
|
do {
|
|
7933
8417
|
if (_workInProgress.tag === SuspenseComponent) {
|
|
7934
8418
|
var current = _workInProgress.alternate;
|
|
7935
|
-
if (current !== null
|
|
7936
|
-
|
|
7937
|
-
|
|
7938
|
-
|
|
7939
|
-
|
|
7940
|
-
|
|
7941
|
-
|
|
7942
|
-
|
|
7943
|
-
|
|
7944
|
-
|
|
7945
|
-
break;
|
|
8419
|
+
if (current !== null) {
|
|
8420
|
+
var currentState = current.memoizedState;
|
|
8421
|
+
if (currentState !== null && currentState.didTimeout) {
|
|
8422
|
+
// Reached a boundary that already timed out. Do not search
|
|
8423
|
+
// any further.
|
|
8424
|
+
var timedOutAt = currentState.timedOutAt;
|
|
8425
|
+
startTimeMs = expirationTimeToMs(timedOutAt);
|
|
8426
|
+
// Do not search any further.
|
|
8427
|
+
break;
|
|
8428
|
+
}
|
|
7946
8429
|
}
|
|
7947
8430
|
var timeoutPropMs = _workInProgress.pendingProps.maxDuration;
|
|
7948
8431
|
if (typeof timeoutPropMs === 'number') {
|
|
@@ -7959,103 +8442,93 @@ function throwException(root, returnFiber, sourceFiber, value, renderExpirationT
|
|
|
7959
8442
|
// Schedule the nearest Suspense to re-render the timed out view.
|
|
7960
8443
|
_workInProgress = returnFiber;
|
|
7961
8444
|
do {
|
|
7962
|
-
if (_workInProgress.tag === SuspenseComponent) {
|
|
7963
|
-
|
|
7964
|
-
|
|
7965
|
-
|
|
7966
|
-
|
|
7967
|
-
|
|
7968
|
-
|
|
7969
|
-
|
|
7970
|
-
|
|
7971
|
-
|
|
7972
|
-
|
|
7973
|
-
|
|
7974
|
-
|
|
7975
|
-
|
|
7976
|
-
|
|
7977
|
-
|
|
7978
|
-
|
|
7979
|
-
|
|
7980
|
-
|
|
7981
|
-
|
|
7982
|
-
|
|
7983
|
-
|
|
7984
|
-
|
|
7985
|
-
|
|
7986
|
-
|
|
7987
|
-
|
|
7988
|
-
|
|
7989
|
-
|
|
7990
|
-
|
|
7991
|
-
|
|
7992
|
-
|
|
7993
|
-
|
|
7994
|
-
|
|
7995
|
-
|
|
7996
|
-
|
|
7997
|
-
|
|
7998
|
-
|
|
7999
|
-
|
|
8000
|
-
//
|
|
8001
|
-
//
|
|
8002
|
-
|
|
8003
|
-
sourceFiber.effectTag &= ~LifecycleEffectMask;
|
|
8004
|
-
if (sourceFiber.alternate === null) {
|
|
8005
|
-
// We're about to mount a class component that doesn't have an
|
|
8006
|
-
// instance. Turn this into a dummy function component instead,
|
|
8007
|
-
// to prevent type errors. This is a bit weird but it's an edge
|
|
8008
|
-
// case and we're about to synchronously delete this
|
|
8009
|
-
// component, anyway.
|
|
8010
|
-
sourceFiber.tag = FunctionComponent;
|
|
8011
|
-
sourceFiber.type = NoopComponent;
|
|
8012
|
-
}
|
|
8445
|
+
if (_workInProgress.tag === SuspenseComponent && shouldCaptureSuspense(_workInProgress.alternate, _workInProgress)) {
|
|
8446
|
+
// Found the nearest boundary.
|
|
8447
|
+
|
|
8448
|
+
// If the boundary is not in concurrent mode, we should not suspend, and
|
|
8449
|
+
// likewise, when the promise resolves, we should ping synchronously.
|
|
8450
|
+
var pingTime = (_workInProgress.mode & ConcurrentMode) === NoEffect ? Sync : renderExpirationTime;
|
|
8451
|
+
|
|
8452
|
+
// Attach a listener to the promise to "ping" the root and retry.
|
|
8453
|
+
var onResolveOrReject = retrySuspendedRoot.bind(null, root, _workInProgress, sourceFiber, pingTime);
|
|
8454
|
+
if (enableSchedulerTracing) {
|
|
8455
|
+
onResolveOrReject = unstable_wrap(onResolveOrReject);
|
|
8456
|
+
}
|
|
8457
|
+
thenable.then(onResolveOrReject, onResolveOrReject);
|
|
8458
|
+
|
|
8459
|
+
// If the boundary is outside of concurrent mode, we should *not*
|
|
8460
|
+
// suspend the commit. Pretend as if the suspended component rendered
|
|
8461
|
+
// null and keep rendering. In the commit phase, we'll schedule a
|
|
8462
|
+
// subsequent synchronous update to re-render the Suspense.
|
|
8463
|
+
//
|
|
8464
|
+
// Note: It doesn't matter whether the component that suspended was
|
|
8465
|
+
// inside a concurrent mode tree. If the Suspense is outside of it, we
|
|
8466
|
+
// should *not* suspend the commit.
|
|
8467
|
+
if ((_workInProgress.mode & ConcurrentMode) === NoEffect) {
|
|
8468
|
+
_workInProgress.effectTag |= Callback;
|
|
8469
|
+
|
|
8470
|
+
// Unmount the source fiber's children
|
|
8471
|
+
var nextChildren = null;
|
|
8472
|
+
reconcileChildren(sourceFiber.alternate, sourceFiber, nextChildren, renderExpirationTime);
|
|
8473
|
+
sourceFiber.effectTag &= ~Incomplete;
|
|
8474
|
+
|
|
8475
|
+
if (sourceFiber.tag === ClassComponent) {
|
|
8476
|
+
// We're going to commit this fiber even though it didn't complete.
|
|
8477
|
+
// But we shouldn't call any lifecycle methods or callbacks. Remove
|
|
8478
|
+
// all lifecycle effect tags.
|
|
8479
|
+
sourceFiber.effectTag &= ~LifecycleEffectMask;
|
|
8480
|
+
var _current = sourceFiber.alternate;
|
|
8481
|
+
if (_current === null) {
|
|
8482
|
+
// This is a new mount. Change the tag so it's not mistaken for a
|
|
8483
|
+
// completed component. For example, we should not call
|
|
8484
|
+
// componentWillUnmount if it is deleted.
|
|
8485
|
+
sourceFiber.tag = IncompleteClassComponent;
|
|
8013
8486
|
}
|
|
8014
|
-
|
|
8015
|
-
// Exit without suspending.
|
|
8016
|
-
return;
|
|
8017
8487
|
}
|
|
8018
8488
|
|
|
8019
|
-
//
|
|
8020
|
-
|
|
8489
|
+
// Exit without suspending.
|
|
8490
|
+
return;
|
|
8491
|
+
}
|
|
8021
8492
|
|
|
8022
|
-
|
|
8023
|
-
|
|
8024
|
-
|
|
8025
|
-
|
|
8026
|
-
|
|
8027
|
-
|
|
8028
|
-
|
|
8029
|
-
|
|
8030
|
-
|
|
8031
|
-
|
|
8032
|
-
|
|
8033
|
-
|
|
8034
|
-
|
|
8035
|
-
|
|
8036
|
-
|
|
8037
|
-
|
|
8038
|
-
|
|
8039
|
-
|
|
8040
|
-
|
|
8041
|
-
|
|
8042
|
-
|
|
8043
|
-
|
|
8493
|
+
// Confirmed that the boundary is in a concurrent mode tree. Continue
|
|
8494
|
+
// with the normal suspend path.
|
|
8495
|
+
|
|
8496
|
+
var absoluteTimeoutMs = void 0;
|
|
8497
|
+
if (earliestTimeoutMs === -1) {
|
|
8498
|
+
// If no explicit threshold is given, default to an abitrarily large
|
|
8499
|
+
// value. The actual size doesn't matter because the threshold for the
|
|
8500
|
+
// whole tree will be clamped to the expiration time.
|
|
8501
|
+
absoluteTimeoutMs = maxSigned31BitInt;
|
|
8502
|
+
} else {
|
|
8503
|
+
if (startTimeMs === -1) {
|
|
8504
|
+
// This suspend happened outside of any already timed-out
|
|
8505
|
+
// placeholders. We don't know exactly when the update was
|
|
8506
|
+
// scheduled, but we can infer an approximate start time from the
|
|
8507
|
+
// expiration time. First, find the earliest uncommitted expiration
|
|
8508
|
+
// time in the tree, including work that is suspended. Then subtract
|
|
8509
|
+
// the offset used to compute an async update's expiration time.
|
|
8510
|
+
// This will cause high priority (interactive) work to expire
|
|
8511
|
+
// earlier than necessary, but we can account for this by adjusting
|
|
8512
|
+
// for the Just Noticeable Difference.
|
|
8513
|
+
var earliestExpirationTime = findEarliestOutstandingPriorityLevel(root, renderExpirationTime);
|
|
8514
|
+
var earliestExpirationTimeMs = expirationTimeToMs(earliestExpirationTime);
|
|
8515
|
+
startTimeMs = earliestExpirationTimeMs - LOW_PRIORITY_EXPIRATION;
|
|
8044
8516
|
}
|
|
8517
|
+
absoluteTimeoutMs = startTimeMs + earliestTimeoutMs;
|
|
8518
|
+
}
|
|
8045
8519
|
|
|
8046
|
-
|
|
8047
|
-
|
|
8048
|
-
|
|
8049
|
-
|
|
8050
|
-
|
|
8520
|
+
// Mark the earliest timeout in the suspended fiber's ancestor path.
|
|
8521
|
+
// After completing the root, we'll take the largest of all the
|
|
8522
|
+
// suspended fiber's timeouts and use it to compute a timeout for the
|
|
8523
|
+
// whole tree.
|
|
8524
|
+
renderDidSuspend(root, absoluteTimeoutMs, renderExpirationTime);
|
|
8051
8525
|
|
|
8052
|
-
|
|
8053
|
-
|
|
8054
|
-
|
|
8055
|
-
}
|
|
8056
|
-
// This boundary already captured during this render. Continue to the
|
|
8057
|
-
// next boundary.
|
|
8526
|
+
_workInProgress.effectTag |= ShouldCapture;
|
|
8527
|
+
_workInProgress.expirationTime = renderExpirationTime;
|
|
8528
|
+
return;
|
|
8058
8529
|
}
|
|
8530
|
+
// This boundary already captured during this render. Continue to the next
|
|
8531
|
+
// boundary.
|
|
8059
8532
|
_workInProgress = _workInProgress.return;
|
|
8060
8533
|
} while (_workInProgress !== null);
|
|
8061
8534
|
// No boundary was found. Fallthrough to error mode.
|
|
@@ -8080,7 +8553,6 @@ function throwException(root, returnFiber, sourceFiber, value, renderExpirationT
|
|
|
8080
8553
|
return;
|
|
8081
8554
|
}
|
|
8082
8555
|
case ClassComponent:
|
|
8083
|
-
case ClassComponentLazy:
|
|
8084
8556
|
// Capture and retry
|
|
8085
8557
|
var errorInfo = value;
|
|
8086
8558
|
var ctor = workInProgress.type;
|
|
@@ -8116,26 +8588,13 @@ function unwindWork(workInProgress, renderExpirationTime) {
|
|
|
8116
8588
|
}
|
|
8117
8589
|
return null;
|
|
8118
8590
|
}
|
|
8119
|
-
case ClassComponentLazy:
|
|
8120
|
-
{
|
|
8121
|
-
var _Component = workInProgress.type._reactResult;
|
|
8122
|
-
if (isContextProvider(_Component)) {
|
|
8123
|
-
popContext(workInProgress);
|
|
8124
|
-
}
|
|
8125
|
-
var _effectTag = workInProgress.effectTag;
|
|
8126
|
-
if (_effectTag & ShouldCapture) {
|
|
8127
|
-
workInProgress.effectTag = _effectTag & ~ShouldCapture | DidCapture;
|
|
8128
|
-
return workInProgress;
|
|
8129
|
-
}
|
|
8130
|
-
return null;
|
|
8131
|
-
}
|
|
8132
8591
|
case HostRoot:
|
|
8133
8592
|
{
|
|
8134
8593
|
popHostContainer(workInProgress);
|
|
8135
8594
|
popTopLevelContextObject(workInProgress);
|
|
8136
|
-
var
|
|
8137
|
-
!((
|
|
8138
|
-
workInProgress.effectTag =
|
|
8595
|
+
var _effectTag = workInProgress.effectTag;
|
|
8596
|
+
!((_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;
|
|
8597
|
+
workInProgress.effectTag = _effectTag & ~ShouldCapture | DidCapture;
|
|
8139
8598
|
return workInProgress;
|
|
8140
8599
|
}
|
|
8141
8600
|
case HostComponent:
|
|
@@ -8145,9 +8604,35 @@ function unwindWork(workInProgress, renderExpirationTime) {
|
|
|
8145
8604
|
}
|
|
8146
8605
|
case SuspenseComponent:
|
|
8147
8606
|
{
|
|
8148
|
-
var
|
|
8149
|
-
if (
|
|
8150
|
-
workInProgress.effectTag =
|
|
8607
|
+
var _effectTag2 = workInProgress.effectTag;
|
|
8608
|
+
if (_effectTag2 & ShouldCapture) {
|
|
8609
|
+
workInProgress.effectTag = _effectTag2 & ~ShouldCapture | DidCapture;
|
|
8610
|
+
// Captured a suspense effect. Set the boundary's `alreadyCaptured`
|
|
8611
|
+
// state to true so we know to render the fallback.
|
|
8612
|
+
var current = workInProgress.alternate;
|
|
8613
|
+
var currentState = current !== null ? current.memoizedState : null;
|
|
8614
|
+
var nextState = workInProgress.memoizedState;
|
|
8615
|
+
if (nextState === null) {
|
|
8616
|
+
// No existing state. Create a new object.
|
|
8617
|
+
nextState = {
|
|
8618
|
+
alreadyCaptured: true,
|
|
8619
|
+
didTimeout: false,
|
|
8620
|
+
timedOutAt: NoWork
|
|
8621
|
+
};
|
|
8622
|
+
} else if (currentState === nextState) {
|
|
8623
|
+
// There is an existing state but it's the same as the current tree's.
|
|
8624
|
+
// Clone the object.
|
|
8625
|
+
nextState = {
|
|
8626
|
+
alreadyCaptured: true,
|
|
8627
|
+
didTimeout: nextState.didTimeout,
|
|
8628
|
+
timedOutAt: nextState.timedOutAt
|
|
8629
|
+
};
|
|
8630
|
+
} else {
|
|
8631
|
+
// Already have a clone, so it's safe to mutate.
|
|
8632
|
+
nextState.alreadyCaptured = true;
|
|
8633
|
+
}
|
|
8634
|
+
workInProgress.memoizedState = nextState;
|
|
8635
|
+
// Re-render the boundary.
|
|
8151
8636
|
return workInProgress;
|
|
8152
8637
|
}
|
|
8153
8638
|
return null;
|
|
@@ -8173,14 +8658,6 @@ function unwindInterruptedWork(interruptedWork) {
|
|
|
8173
8658
|
}
|
|
8174
8659
|
break;
|
|
8175
8660
|
}
|
|
8176
|
-
case ClassComponentLazy:
|
|
8177
|
-
{
|
|
8178
|
-
var _childContextTypes = interruptedWork.type._reactResult.childContextTypes;
|
|
8179
|
-
if (_childContextTypes !== null && _childContextTypes !== undefined) {
|
|
8180
|
-
popContext(interruptedWork);
|
|
8181
|
-
}
|
|
8182
|
-
break;
|
|
8183
|
-
}
|
|
8184
8661
|
case HostRoot:
|
|
8185
8662
|
{
|
|
8186
8663
|
popHostContainer(interruptedWork);
|
|
@@ -8323,14 +8800,6 @@ if (true && replayFailedUnitOfWorkWithInvokeGuardedCallback) {
|
|
|
8323
8800
|
}
|
|
8324
8801
|
break;
|
|
8325
8802
|
}
|
|
8326
|
-
case ClassComponentLazy:
|
|
8327
|
-
{
|
|
8328
|
-
var _Component = getResultFromResolvedThenable(failedUnitOfWork.type);
|
|
8329
|
-
if (isContextProvider(_Component)) {
|
|
8330
|
-
popContext(failedUnitOfWork);
|
|
8331
|
-
}
|
|
8332
|
-
break;
|
|
8333
|
-
}
|
|
8334
8803
|
case HostPortal:
|
|
8335
8804
|
popHostContainer(failedUnitOfWork);
|
|
8336
8805
|
break;
|
|
@@ -8990,6 +9459,7 @@ function performUnitOfWork(workInProgress) {
|
|
|
8990
9459
|
}
|
|
8991
9460
|
|
|
8992
9461
|
next = beginWork(current$$1, workInProgress, nextRenderExpirationTime);
|
|
9462
|
+
workInProgress.memoizedProps = workInProgress.pendingProps;
|
|
8993
9463
|
|
|
8994
9464
|
if (workInProgress.mode & ProfileMode) {
|
|
8995
9465
|
// Record the render duration assuming we didn't bailout (or error).
|
|
@@ -8997,6 +9467,7 @@ function performUnitOfWork(workInProgress) {
|
|
|
8997
9467
|
}
|
|
8998
9468
|
} else {
|
|
8999
9469
|
next = beginWork(current$$1, workInProgress, nextRenderExpirationTime);
|
|
9470
|
+
workInProgress.memoizedProps = workInProgress.pendingProps;
|
|
9000
9471
|
}
|
|
9001
9472
|
|
|
9002
9473
|
{
|
|
@@ -9270,7 +9741,6 @@ function dispatch(sourceFiber, value, expirationTime) {
|
|
|
9270
9741
|
while (fiber !== null) {
|
|
9271
9742
|
switch (fiber.tag) {
|
|
9272
9743
|
case ClassComponent:
|
|
9273
|
-
case ClassComponentLazy:
|
|
9274
9744
|
var ctor = fiber.type;
|
|
9275
9745
|
var instance = fiber.stateNode;
|
|
9276
9746
|
if (typeof ctor.getDerivedStateFromError === 'function' || typeof instance.componentDidCatch === 'function' && !isAlreadyFailedLegacyErrorBoundary(instance)) {
|
|
@@ -9363,7 +9833,7 @@ function renderDidError() {
|
|
|
9363
9833
|
nextRenderDidError = true;
|
|
9364
9834
|
}
|
|
9365
9835
|
|
|
9366
|
-
function retrySuspendedRoot(root,
|
|
9836
|
+
function retrySuspendedRoot(root, boundaryFiber, sourceFiber, suspendedTime) {
|
|
9367
9837
|
var retryTime = void 0;
|
|
9368
9838
|
|
|
9369
9839
|
if (isPriorityLevelSuspended(root, suspendedTime)) {
|
|
@@ -9374,18 +9844,18 @@ function retrySuspendedRoot(root, fiber, suspendedTime) {
|
|
|
9374
9844
|
} else {
|
|
9375
9845
|
// Suspense already timed out. Compute a new expiration time
|
|
9376
9846
|
var currentTime = requestCurrentTime();
|
|
9377
|
-
retryTime = computeExpirationForFiber(currentTime,
|
|
9847
|
+
retryTime = computeExpirationForFiber(currentTime, boundaryFiber);
|
|
9378
9848
|
markPendingPriorityLevel(root, retryTime);
|
|
9379
9849
|
}
|
|
9380
9850
|
|
|
9381
|
-
// TODO: If the
|
|
9851
|
+
// TODO: If the suspense fiber has already rendered the primary children
|
|
9382
9852
|
// without suspending (that is, all of the promises have already resolved),
|
|
9383
9853
|
// we should not trigger another update here. One case this happens is when
|
|
9384
9854
|
// we are in sync mode and a single promise is thrown both on initial render
|
|
9385
9855
|
// and on update; we attach two .then(retrySuspendedRoot) callbacks and each
|
|
9386
9856
|
// one performs Sync work, rerendering the Suspense.
|
|
9387
9857
|
|
|
9388
|
-
if ((
|
|
9858
|
+
if ((boundaryFiber.mode & ConcurrentMode) !== NoContext) {
|
|
9389
9859
|
if (root === nextRoot && nextRenderExpirationTime === suspendedTime) {
|
|
9390
9860
|
// Received a ping at the same priority level at which we're currently
|
|
9391
9861
|
// rendering. Restart from the root.
|
|
@@ -9393,7 +9863,23 @@ function retrySuspendedRoot(root, fiber, suspendedTime) {
|
|
|
9393
9863
|
}
|
|
9394
9864
|
}
|
|
9395
9865
|
|
|
9396
|
-
scheduleWorkToRoot(
|
|
9866
|
+
scheduleWorkToRoot(boundaryFiber, retryTime);
|
|
9867
|
+
if ((boundaryFiber.mode & ConcurrentMode) === NoContext) {
|
|
9868
|
+
// Outside of concurrent mode, we must schedule an update on the source
|
|
9869
|
+
// fiber, too, since it already committed in an inconsistent state and
|
|
9870
|
+
// therefore does not have any pending work.
|
|
9871
|
+
scheduleWorkToRoot(sourceFiber, retryTime);
|
|
9872
|
+
var sourceTag = sourceFiber.tag;
|
|
9873
|
+
if (sourceTag === ClassComponent && sourceFiber.stateNode !== null) {
|
|
9874
|
+
// When we try rendering again, we should not reuse the current fiber,
|
|
9875
|
+
// since it's known to be in an inconsistent state. Use a force updte to
|
|
9876
|
+
// prevent a bail out.
|
|
9877
|
+
var update = createUpdate(retryTime);
|
|
9878
|
+
update.tag = ForceUpdate;
|
|
9879
|
+
enqueueUpdate(sourceFiber, update);
|
|
9880
|
+
}
|
|
9881
|
+
}
|
|
9882
|
+
|
|
9397
9883
|
var rootExpirationTime = root.expirationTime;
|
|
9398
9884
|
if (rootExpirationTime !== NoWork) {
|
|
9399
9885
|
requestWork(root, rootExpirationTime);
|
|
@@ -9404,7 +9890,7 @@ function scheduleWorkToRoot(fiber, expirationTime) {
|
|
|
9404
9890
|
recordScheduleUpdate();
|
|
9405
9891
|
|
|
9406
9892
|
{
|
|
9407
|
-
if (fiber.tag === ClassComponent
|
|
9893
|
+
if (fiber.tag === ClassComponent) {
|
|
9408
9894
|
var instance = fiber.stateNode;
|
|
9409
9895
|
warnAboutInvalidUpdates(instance);
|
|
9410
9896
|
}
|
|
@@ -9443,7 +9929,7 @@ function scheduleWorkToRoot(fiber, expirationTime) {
|
|
|
9443
9929
|
}
|
|
9444
9930
|
|
|
9445
9931
|
if (root === null) {
|
|
9446
|
-
if (true &&
|
|
9932
|
+
if (true && fiber.tag === ClassComponent) {
|
|
9447
9933
|
warnAboutUpdateOnUnmounted(fiber);
|
|
9448
9934
|
}
|
|
9449
9935
|
return null;
|
|
@@ -10052,9 +10538,9 @@ function flushSync(fn, a) {
|
|
|
10052
10538
|
|
|
10053
10539
|
|
|
10054
10540
|
var didWarnAboutNestedUpdates = void 0;
|
|
10055
|
-
|
|
10056
10541
|
{
|
|
10057
10542
|
didWarnAboutNestedUpdates = false;
|
|
10543
|
+
|
|
10058
10544
|
}
|
|
10059
10545
|
|
|
10060
10546
|
function getContextForSubtree(parentComponent) {
|
|
@@ -10070,11 +10556,6 @@ function getContextForSubtree(parentComponent) {
|
|
|
10070
10556
|
if (isContextProvider(Component)) {
|
|
10071
10557
|
return processChildContext(fiber, Component, parentContext);
|
|
10072
10558
|
}
|
|
10073
|
-
} else if (fiber.tag === ClassComponentLazy) {
|
|
10074
|
-
var _Component = getResultFromResolvedThenable(fiber.type);
|
|
10075
|
-
if (isContextProvider(_Component)) {
|
|
10076
|
-
return processChildContext(fiber, _Component, parentContext);
|
|
10077
|
-
}
|
|
10078
10559
|
}
|
|
10079
10560
|
|
|
10080
10561
|
return parentContext;
|
|
@@ -10301,7 +10782,7 @@ function batchedUpdates$1(fn, bookkeeping) {
|
|
|
10301
10782
|
|
|
10302
10783
|
// TODO: this is special because it gets imported during build.
|
|
10303
10784
|
|
|
10304
|
-
var ReactVersion = '16.6.0
|
|
10785
|
+
var ReactVersion = '16.6.0';
|
|
10305
10786
|
|
|
10306
10787
|
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; }; }();
|
|
10307
10788
|
|
|
@@ -10316,32 +10797,49 @@ var defaultTestOptions = {
|
|
|
10316
10797
|
};
|
|
10317
10798
|
|
|
10318
10799
|
function toJSON(inst) {
|
|
10800
|
+
if (inst.isHidden) {
|
|
10801
|
+
// Omit timed out children from output entirely. This seems like the least
|
|
10802
|
+
// surprising behavior. We could perhaps add a separate API that includes
|
|
10803
|
+
// them, if it turns out people need it.
|
|
10804
|
+
return null;
|
|
10805
|
+
}
|
|
10319
10806
|
switch (inst.tag) {
|
|
10320
10807
|
case 'TEXT':
|
|
10321
10808
|
return inst.text;
|
|
10322
10809
|
case 'INSTANCE':
|
|
10323
|
-
|
|
10324
|
-
|
|
10325
|
-
|
|
10326
|
-
|
|
10327
|
-
|
|
10328
|
-
|
|
10329
|
-
|
|
10330
|
-
|
|
10331
|
-
|
|
10332
|
-
|
|
10333
|
-
|
|
10334
|
-
|
|
10810
|
+
{
|
|
10811
|
+
/* eslint-disable no-unused-vars */
|
|
10812
|
+
// We don't include the `children` prop in JSON.
|
|
10813
|
+
// Instead, we will include the actual rendered children.
|
|
10814
|
+
var _inst$props = inst.props,
|
|
10815
|
+
_children = _inst$props.children,
|
|
10816
|
+
_props = _objectWithoutProperties(_inst$props, ['children']);
|
|
10817
|
+
/* eslint-enable */
|
|
10818
|
+
|
|
10819
|
+
|
|
10820
|
+
var renderedChildren = null;
|
|
10821
|
+
if (inst.children && inst.children.length) {
|
|
10822
|
+
for (var i = 0; i < inst.children.length; i++) {
|
|
10823
|
+
var renderedChild = toJSON(inst.children[i]);
|
|
10824
|
+
if (renderedChild !== null) {
|
|
10825
|
+
if (renderedChildren === null) {
|
|
10826
|
+
renderedChildren = [renderedChild];
|
|
10827
|
+
} else {
|
|
10828
|
+
renderedChildren.push(renderedChild);
|
|
10829
|
+
}
|
|
10830
|
+
}
|
|
10831
|
+
}
|
|
10832
|
+
}
|
|
10833
|
+
var json = {
|
|
10834
|
+
type: inst.type,
|
|
10835
|
+
props: _props,
|
|
10836
|
+
children: renderedChildren
|
|
10837
|
+
};
|
|
10838
|
+
Object.defineProperty(json, '$$typeof', {
|
|
10839
|
+
value: Symbol.for('react.test.json')
|
|
10840
|
+
});
|
|
10841
|
+
return json;
|
|
10335
10842
|
}
|
|
10336
|
-
var json = {
|
|
10337
|
-
type: inst.type,
|
|
10338
|
-
props: _props,
|
|
10339
|
-
children: renderedChildren
|
|
10340
|
-
};
|
|
10341
|
-
Object.defineProperty(json, '$$typeof', {
|
|
10342
|
-
value: Symbol.for('react.test.json')
|
|
10343
|
-
});
|
|
10344
|
-
return json;
|
|
10345
10843
|
default:
|
|
10346
10844
|
throw new Error('Unexpected node type in toJSON: ' + inst.tag);
|
|
10347
10845
|
}
|
|
@@ -10406,19 +10904,8 @@ function toTree(node) {
|
|
|
10406
10904
|
instance: node.stateNode,
|
|
10407
10905
|
rendered: childrenToTree(node.child)
|
|
10408
10906
|
};
|
|
10409
|
-
case ClassComponentLazy:
|
|
10410
|
-
{
|
|
10411
|
-
var thenable = node.type;
|
|
10412
|
-
var _type = thenable._reactResult;
|
|
10413
|
-
return {
|
|
10414
|
-
nodeType: 'component',
|
|
10415
|
-
type: _type,
|
|
10416
|
-
props: _assign({}, node.memoizedProps),
|
|
10417
|
-
instance: node.stateNode,
|
|
10418
|
-
rendered: childrenToTree(node.child)
|
|
10419
|
-
};
|
|
10420
|
-
}
|
|
10421
10907
|
case FunctionComponent:
|
|
10908
|
+
case SimpleMemoComponent:
|
|
10422
10909
|
return {
|
|
10423
10910
|
nodeType: 'component',
|
|
10424
10911
|
type: node.type,
|
|
@@ -10426,18 +10913,6 @@ function toTree(node) {
|
|
|
10426
10913
|
instance: null,
|
|
10427
10914
|
rendered: childrenToTree(node.child)
|
|
10428
10915
|
};
|
|
10429
|
-
case FunctionComponentLazy:
|
|
10430
|
-
{
|
|
10431
|
-
var _thenable = node.type;
|
|
10432
|
-
var _type2 = _thenable._reactResult;
|
|
10433
|
-
return {
|
|
10434
|
-
nodeType: 'component',
|
|
10435
|
-
type: _type2,
|
|
10436
|
-
props: _assign({}, node.memoizedProps),
|
|
10437
|
-
instance: node.stateNode,
|
|
10438
|
-
rendered: childrenToTree(node.child)
|
|
10439
|
-
};
|
|
10440
|
-
}
|
|
10441
10916
|
case HostComponent:
|
|
10442
10917
|
{
|
|
10443
10918
|
return {
|
|
@@ -10456,16 +10931,15 @@ function toTree(node) {
|
|
|
10456
10931
|
case Mode:
|
|
10457
10932
|
case Profiler:
|
|
10458
10933
|
case ForwardRef:
|
|
10459
|
-
case
|
|
10460
|
-
case
|
|
10461
|
-
case PureComponentLazy:
|
|
10934
|
+
case MemoComponent:
|
|
10935
|
+
case IncompleteClassComponent:
|
|
10462
10936
|
return childrenToTree(node.child);
|
|
10463
10937
|
default:
|
|
10464
10938
|
invariant(false, 'toTree() does not yet know how to handle nodes with tag=%s', node.tag);
|
|
10465
10939
|
}
|
|
10466
10940
|
}
|
|
10467
10941
|
|
|
10468
|
-
var validWrapperTypes = new Set([FunctionComponent,
|
|
10942
|
+
var validWrapperTypes = new Set([FunctionComponent, ClassComponent, HostComponent, ForwardRef, MemoComponent,
|
|
10469
10943
|
// Normally skipped, but used when there's more than one root child.
|
|
10470
10944
|
HostRoot]);
|
|
10471
10945
|
|
|
@@ -10676,7 +11150,21 @@ var ReactTestRendererFiber = {
|
|
|
10676
11150
|
if (container.children.length === 1) {
|
|
10677
11151
|
return toJSON(container.children[0]);
|
|
10678
11152
|
}
|
|
10679
|
-
|
|
11153
|
+
|
|
11154
|
+
var renderedChildren = null;
|
|
11155
|
+
if (container.children && container.children.length) {
|
|
11156
|
+
for (var i = 0; i < container.children.length; i++) {
|
|
11157
|
+
var renderedChild = toJSON(container.children[i]);
|
|
11158
|
+
if (renderedChild !== null) {
|
|
11159
|
+
if (renderedChildren === null) {
|
|
11160
|
+
renderedChildren = [renderedChild];
|
|
11161
|
+
} else {
|
|
11162
|
+
renderedChildren.push(renderedChild);
|
|
11163
|
+
}
|
|
11164
|
+
}
|
|
11165
|
+
}
|
|
11166
|
+
}
|
|
11167
|
+
return renderedChildren;
|
|
10680
11168
|
},
|
|
10681
11169
|
toTree: function () {
|
|
10682
11170
|
if (root == null || root.current == null) {
|