react-dom 16.7.0-alpha.2 → 16.7.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/build-info.json +8 -0
- package/cjs/react-dom-server.browser.development.js +14 -12
- package/cjs/react-dom-server.browser.production.min.js +37 -41
- package/cjs/react-dom-server.node.development.js +16 -13
- package/cjs/react-dom-server.node.production.min.js +39 -43
- package/cjs/react-dom-test-utils.development.js +1 -1
- package/cjs/react-dom-test-utils.production.min.js +1 -1
- package/cjs/react-dom-unstable-fire.development.js +20093 -0
- package/cjs/react-dom-unstable-fire.production.min.js +249 -0
- package/cjs/react-dom-unstable-fire.profiling.min.js +261 -0
- package/cjs/react-dom-unstable-fizz.browser.development.js +144 -0
- package/cjs/react-dom-unstable-fizz.browser.production.min.js +11 -0
- package/cjs/react-dom-unstable-fizz.node.development.js +150 -0
- package/cjs/react-dom-unstable-fizz.node.production.min.js +11 -0
- package/cjs/react-dom-unstable-native-dependencies.development.js +1 -1
- package/cjs/react-dom-unstable-native-dependencies.production.min.js +1 -1
- package/cjs/react-dom.development.js +349 -112
- package/cjs/react-dom.production.min.js +209 -219
- package/cjs/react-dom.profiling.min.js +194 -204
- package/package.json +58 -20
- package/umd/react-dom-server.browser.development.js +14 -12
- package/umd/react-dom-server.browser.production.min.js +33 -36
- package/umd/react-dom-test-utils.development.js +1 -1
- package/umd/react-dom-test-utils.production.min.js +1 -1
- package/umd/react-dom-unstable-fire.development.js +20220 -0
- package/umd/react-dom-unstable-fire.production.min.js +207 -0
- package/umd/react-dom-unstable-fire.profiling.min.js +212 -0
- package/umd/react-dom-unstable-fizz.browser.development.js +144 -0
- package/umd/react-dom-unstable-fizz.browser.production.min.js +10 -0
- package/umd/react-dom-unstable-native-dependencies.development.js +1 -1
- package/umd/react-dom-unstable-native-dependencies.production.min.js +1 -1
- package/umd/react-dom.development.js +352 -112
- package/umd/react-dom.production.min.js +195 -201
- package/umd/react-dom.profiling.min.js +202 -210
- package/unstable-fizz.browser.js +7 -0
- package/unstable-fizz.js +3 -0
- package/unstable-fizz.node.js +7 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license React v16.7.0
|
|
1
|
+
/** @license React v16.7.0
|
|
2
2
|
* react-dom.development.js
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
@@ -2514,13 +2514,14 @@ var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
|
2514
2514
|
|
|
2515
2515
|
function describeFiber(fiber) {
|
|
2516
2516
|
switch (fiber.tag) {
|
|
2517
|
-
case
|
|
2518
|
-
case
|
|
2519
|
-
case
|
|
2520
|
-
case
|
|
2521
|
-
case
|
|
2522
|
-
case
|
|
2523
|
-
|
|
2517
|
+
case HostRoot:
|
|
2518
|
+
case HostPortal:
|
|
2519
|
+
case HostText:
|
|
2520
|
+
case Fragment:
|
|
2521
|
+
case ContextProvider:
|
|
2522
|
+
case ContextConsumer:
|
|
2523
|
+
return '';
|
|
2524
|
+
default:
|
|
2524
2525
|
var owner = fiber._debugOwner;
|
|
2525
2526
|
var source = fiber._debugSource;
|
|
2526
2527
|
var name = getComponentName(fiber.type);
|
|
@@ -2529,8 +2530,6 @@ function describeFiber(fiber) {
|
|
|
2529
2530
|
ownerName = getComponentName(owner.type);
|
|
2530
2531
|
}
|
|
2531
2532
|
return describeComponentFrame(name, source, ownerName);
|
|
2532
|
-
default:
|
|
2533
|
-
return '';
|
|
2534
2533
|
}
|
|
2535
2534
|
}
|
|
2536
2535
|
|
|
@@ -3116,7 +3115,7 @@ var ReactControlledValuePropTypes = {
|
|
|
3116
3115
|
|
|
3117
3116
|
var enableUserTimingAPI = true;
|
|
3118
3117
|
|
|
3119
|
-
var enableHooks =
|
|
3118
|
+
var enableHooks = false;
|
|
3120
3119
|
// Helps identify side effects in begin-phase lifecycle hooks and setState reducers:
|
|
3121
3120
|
var debugRenderPhaseSideEffects = false;
|
|
3122
3121
|
|
|
@@ -3139,6 +3138,9 @@ var enableProfilerTimer = true;
|
|
|
3139
3138
|
// Trace which interactions trigger each commit.
|
|
3140
3139
|
var enableSchedulerTracing = true;
|
|
3141
3140
|
|
|
3141
|
+
// Only used in www builds.
|
|
3142
|
+
// TODO: true? Here it might just be false.
|
|
3143
|
+
|
|
3142
3144
|
// Only used in www builds.
|
|
3143
3145
|
|
|
3144
3146
|
|
|
@@ -3151,7 +3153,9 @@ var disableInputAttributeSyncing = false;
|
|
|
3151
3153
|
|
|
3152
3154
|
// These APIs will no longer be "unstable" in the upcoming 16.7 release,
|
|
3153
3155
|
// Control this behavior with a flag to support 16.6 minor releases in the meanwhile.
|
|
3154
|
-
var enableStableConcurrentModeAPIs =
|
|
3156
|
+
var enableStableConcurrentModeAPIs = false;
|
|
3157
|
+
|
|
3158
|
+
var warnAboutShorthandPropertyCollision = false;
|
|
3155
3159
|
|
|
3156
3160
|
// TODO: direct imports like some-package/src/* are bad. Fix me.
|
|
3157
3161
|
var didWarnValueDefaultValue = false;
|
|
@@ -6460,6 +6464,10 @@ function expandShorthandMap(styles) {
|
|
|
6460
6464
|
* becomes .style.fontVariant = ''
|
|
6461
6465
|
*/
|
|
6462
6466
|
function validateShorthandPropertyCollisionInDev(styleUpdates, nextStyles) {
|
|
6467
|
+
if (!warnAboutShorthandPropertyCollision) {
|
|
6468
|
+
return;
|
|
6469
|
+
}
|
|
6470
|
+
|
|
6463
6471
|
if (!nextStyles) {
|
|
6464
6472
|
return;
|
|
6465
6473
|
}
|
|
@@ -9872,6 +9880,26 @@ function FiberNode(tag, pendingProps, key, mode) {
|
|
|
9872
9880
|
this.alternate = null;
|
|
9873
9881
|
|
|
9874
9882
|
if (enableProfilerTimer) {
|
|
9883
|
+
// Note: The following is done to avoid a v8 performance cliff.
|
|
9884
|
+
//
|
|
9885
|
+
// Initializing the fields below to smis and later updating them with
|
|
9886
|
+
// double values will cause Fibers to end up having separate shapes.
|
|
9887
|
+
// This behavior/bug has something to do with Object.preventExtension().
|
|
9888
|
+
// Fortunately this only impacts DEV builds.
|
|
9889
|
+
// Unfortunately it makes React unusably slow for some applications.
|
|
9890
|
+
// To work around this, initialize the fields below with doubles.
|
|
9891
|
+
//
|
|
9892
|
+
// Learn more about this here:
|
|
9893
|
+
// https://github.com/facebook/react/issues/14365
|
|
9894
|
+
// https://bugs.chromium.org/p/v8/issues/detail?id=8538
|
|
9895
|
+
this.actualDuration = Number.NaN;
|
|
9896
|
+
this.actualStartTime = Number.NaN;
|
|
9897
|
+
this.selfBaseDuration = Number.NaN;
|
|
9898
|
+
this.treeBaseDuration = Number.NaN;
|
|
9899
|
+
|
|
9900
|
+
// It's okay to replace the initial doubles with smis after initialization.
|
|
9901
|
+
// This won't trigger the performance cliff mentioned above,
|
|
9902
|
+
// and it simplifies other profiler code (including DevTools).
|
|
9875
9903
|
this.actualDuration = 0;
|
|
9876
9904
|
this.actualStartTime = -1;
|
|
9877
9905
|
this.selfBaseDuration = 0;
|
|
@@ -10254,6 +10282,8 @@ function createFiberRoot(containerInfo, isConcurrent, hydrate) {
|
|
|
10254
10282
|
latestSuspendedTime: NoWork,
|
|
10255
10283
|
latestPingedTime: NoWork,
|
|
10256
10284
|
|
|
10285
|
+
pingCache: null,
|
|
10286
|
+
|
|
10257
10287
|
didError: false,
|
|
10258
10288
|
|
|
10259
10289
|
pendingCommitExpirationTime: NoWork,
|
|
@@ -10277,6 +10307,8 @@ function createFiberRoot(containerInfo, isConcurrent, hydrate) {
|
|
|
10277
10307
|
containerInfo: containerInfo,
|
|
10278
10308
|
pendingChildren: null,
|
|
10279
10309
|
|
|
10310
|
+
pingCache: null,
|
|
10311
|
+
|
|
10280
10312
|
earliestPendingTime: NoWork,
|
|
10281
10313
|
latestPendingTime: NoWork,
|
|
10282
10314
|
earliestSuspendedTime: NoWork,
|
|
@@ -10651,6 +10683,10 @@ function markCommittedPriorityLevels(root, earliestRemainingTime) {
|
|
|
10651
10683
|
return;
|
|
10652
10684
|
}
|
|
10653
10685
|
|
|
10686
|
+
if (earliestRemainingTime < root.latestPingedTime) {
|
|
10687
|
+
root.latestPingedTime = NoWork;
|
|
10688
|
+
}
|
|
10689
|
+
|
|
10654
10690
|
// Let's see if the previous latest known pending level was just flushed.
|
|
10655
10691
|
var latestPendingTime = root.latestPendingTime;
|
|
10656
10692
|
if (latestPendingTime !== NoWork) {
|
|
@@ -10776,10 +10812,8 @@ function markPingedPriorityLevel(root, pingedTime) {
|
|
|
10776
10812
|
}
|
|
10777
10813
|
|
|
10778
10814
|
function clearPing(root, completedTime) {
|
|
10779
|
-
// TODO: Track whether the root was pinged during the render phase. If so,
|
|
10780
|
-
// we need to make sure we don't lose track of it.
|
|
10781
10815
|
var latestPingedTime = root.latestPingedTime;
|
|
10782
|
-
if (latestPingedTime
|
|
10816
|
+
if (latestPingedTime >= completedTime) {
|
|
10783
10817
|
root.latestPingedTime = NoWork;
|
|
10784
10818
|
}
|
|
10785
10819
|
}
|
|
@@ -11730,7 +11764,7 @@ function cloneHook(hook) {
|
|
|
11730
11764
|
return {
|
|
11731
11765
|
memoizedState: hook.memoizedState,
|
|
11732
11766
|
|
|
11733
|
-
baseState: hook.
|
|
11767
|
+
baseState: hook.baseState,
|
|
11734
11768
|
queue: hook.queue,
|
|
11735
11769
|
baseUpdate: hook.baseUpdate,
|
|
11736
11770
|
|
|
@@ -11975,10 +12009,6 @@ function useRef(initialValue) {
|
|
|
11975
12009
|
return ref;
|
|
11976
12010
|
}
|
|
11977
12011
|
|
|
11978
|
-
function useMutationEffect(create, inputs) {
|
|
11979
|
-
useEffectImpl(Snapshot | Update, UnmountSnapshot | MountMutation, create, inputs);
|
|
11980
|
-
}
|
|
11981
|
-
|
|
11982
12012
|
function useLayoutEffect(create, inputs) {
|
|
11983
12013
|
useEffectImpl(Update, UnmountMutation | MountLayout, create, inputs);
|
|
11984
12014
|
}
|
|
@@ -12013,7 +12043,7 @@ function useImperativeMethods(ref, create, inputs) {
|
|
|
12013
12043
|
// TODO: I've implemented this on top of useEffect because it's almost the
|
|
12014
12044
|
// same thing, and it would require an equal amount of code. It doesn't seem
|
|
12015
12045
|
// like a common enough use case to justify the additional size.
|
|
12016
|
-
|
|
12046
|
+
useLayoutEffect(function () {
|
|
12017
12047
|
if (typeof ref === 'function') {
|
|
12018
12048
|
var refCallback = ref;
|
|
12019
12049
|
var _inst = create();
|
|
@@ -14175,12 +14205,14 @@ var didWarnAboutBadClass = void 0;
|
|
|
14175
14205
|
var didWarnAboutContextTypeOnFunctionComponent = void 0;
|
|
14176
14206
|
var didWarnAboutGetDerivedStateOnFunctionComponent = void 0;
|
|
14177
14207
|
var didWarnAboutFunctionRefs = void 0;
|
|
14208
|
+
var didWarnAboutReassigningProps = void 0;
|
|
14178
14209
|
|
|
14179
14210
|
{
|
|
14180
14211
|
didWarnAboutBadClass = {};
|
|
14181
14212
|
didWarnAboutContextTypeOnFunctionComponent = {};
|
|
14182
14213
|
didWarnAboutGetDerivedStateOnFunctionComponent = {};
|
|
14183
14214
|
didWarnAboutFunctionRefs = {};
|
|
14215
|
+
didWarnAboutReassigningProps = false;
|
|
14184
14216
|
}
|
|
14185
14217
|
|
|
14186
14218
|
function reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime) {
|
|
@@ -14219,6 +14251,18 @@ function forceUnmountCurrentAndReconcile(current$$1, workInProgress, nextChildre
|
|
|
14219
14251
|
}
|
|
14220
14252
|
|
|
14221
14253
|
function updateForwardRef(current$$1, workInProgress, Component, nextProps, renderExpirationTime) {
|
|
14254
|
+
{
|
|
14255
|
+
if (workInProgress.type !== workInProgress.elementType) {
|
|
14256
|
+
// Lazy component props can't be validated in createElement
|
|
14257
|
+
// because they're only guaranteed to be resolved here.
|
|
14258
|
+
var innerPropTypes = Component.propTypes;
|
|
14259
|
+
if (innerPropTypes) {
|
|
14260
|
+
checkPropTypes(innerPropTypes, nextProps, // Resolved props
|
|
14261
|
+
'prop', getComponentName(Component), getCurrentFiberStackInDev);
|
|
14262
|
+
}
|
|
14263
|
+
}
|
|
14264
|
+
}
|
|
14265
|
+
|
|
14222
14266
|
var render = Component.render;
|
|
14223
14267
|
var ref = workInProgress.ref;
|
|
14224
14268
|
|
|
@@ -14243,7 +14287,9 @@ function updateForwardRef(current$$1, workInProgress, Component, nextProps, rend
|
|
|
14243
14287
|
function updateMemoComponent(current$$1, workInProgress, Component, nextProps, updateExpirationTime, renderExpirationTime) {
|
|
14244
14288
|
if (current$$1 === null) {
|
|
14245
14289
|
var type = Component.type;
|
|
14246
|
-
if (isSimpleFunctionComponent(type) && Component.compare === null
|
|
14290
|
+
if (isSimpleFunctionComponent(type) && Component.compare === null &&
|
|
14291
|
+
// SimpleMemoComponent codepath doesn't resolve outer props either.
|
|
14292
|
+
Component.defaultProps === undefined) {
|
|
14247
14293
|
// If this is a plain function component without default props,
|
|
14248
14294
|
// and with only the default shallow comparison, we upgrade it
|
|
14249
14295
|
// to a SimpleMemoComponent to allow fast path updates.
|
|
@@ -14254,12 +14300,31 @@ function updateMemoComponent(current$$1, workInProgress, Component, nextProps, u
|
|
|
14254
14300
|
}
|
|
14255
14301
|
return updateSimpleMemoComponent(current$$1, workInProgress, type, nextProps, updateExpirationTime, renderExpirationTime);
|
|
14256
14302
|
}
|
|
14303
|
+
{
|
|
14304
|
+
var innerPropTypes = type.propTypes;
|
|
14305
|
+
if (innerPropTypes) {
|
|
14306
|
+
// Inner memo component props aren't currently validated in createElement.
|
|
14307
|
+
// We could move it there, but we'd still need this for lazy code path.
|
|
14308
|
+
checkPropTypes(innerPropTypes, nextProps, // Resolved props
|
|
14309
|
+
'prop', getComponentName(type), getCurrentFiberStackInDev);
|
|
14310
|
+
}
|
|
14311
|
+
}
|
|
14257
14312
|
var child = createFiberFromTypeAndProps(Component.type, null, nextProps, null, workInProgress.mode, renderExpirationTime);
|
|
14258
14313
|
child.ref = workInProgress.ref;
|
|
14259
14314
|
child.return = workInProgress;
|
|
14260
14315
|
workInProgress.child = child;
|
|
14261
14316
|
return child;
|
|
14262
14317
|
}
|
|
14318
|
+
{
|
|
14319
|
+
var _type = Component.type;
|
|
14320
|
+
var _innerPropTypes = _type.propTypes;
|
|
14321
|
+
if (_innerPropTypes) {
|
|
14322
|
+
// Inner memo component props aren't currently validated in createElement.
|
|
14323
|
+
// We could move it there, but we'd still need this for lazy code path.
|
|
14324
|
+
checkPropTypes(_innerPropTypes, nextProps, // Resolved props
|
|
14325
|
+
'prop', getComponentName(_type), getCurrentFiberStackInDev);
|
|
14326
|
+
}
|
|
14327
|
+
}
|
|
14263
14328
|
var currentChild = current$$1.child; // This is always exactly one child
|
|
14264
14329
|
if (updateExpirationTime < renderExpirationTime) {
|
|
14265
14330
|
// This will be the props with resolved defaultProps,
|
|
@@ -14282,6 +14347,25 @@ function updateMemoComponent(current$$1, workInProgress, Component, nextProps, u
|
|
|
14282
14347
|
}
|
|
14283
14348
|
|
|
14284
14349
|
function updateSimpleMemoComponent(current$$1, workInProgress, Component, nextProps, updateExpirationTime, renderExpirationTime) {
|
|
14350
|
+
{
|
|
14351
|
+
if (workInProgress.type !== workInProgress.elementType) {
|
|
14352
|
+
// Lazy component props can't be validated in createElement
|
|
14353
|
+
// because they're only guaranteed to be resolved here.
|
|
14354
|
+
var outerMemoType = workInProgress.elementType;
|
|
14355
|
+
if (outerMemoType.$$typeof === REACT_LAZY_TYPE) {
|
|
14356
|
+
// We warn when you define propTypes on lazy()
|
|
14357
|
+
// so let's just skip over it to find memo() outer wrapper.
|
|
14358
|
+
// Inner props for memo are validated later.
|
|
14359
|
+
outerMemoType = refineResolvedLazyComponent(outerMemoType);
|
|
14360
|
+
}
|
|
14361
|
+
var outerPropTypes = outerMemoType && outerMemoType.propTypes;
|
|
14362
|
+
if (outerPropTypes) {
|
|
14363
|
+
checkPropTypes(outerPropTypes, nextProps, // Resolved (SimpleMemoComponent has no defaultProps)
|
|
14364
|
+
'prop', getComponentName(outerMemoType), getCurrentFiberStackInDev);
|
|
14365
|
+
}
|
|
14366
|
+
// Inner propTypes will be validated in the function component path.
|
|
14367
|
+
}
|
|
14368
|
+
}
|
|
14285
14369
|
if (current$$1 !== null && updateExpirationTime < renderExpirationTime) {
|
|
14286
14370
|
var prevProps = current$$1.memoizedProps;
|
|
14287
14371
|
if (shallowEqual(prevProps, nextProps) && current$$1.ref === workInProgress.ref) {
|
|
@@ -14322,6 +14406,18 @@ function markRef(current$$1, workInProgress) {
|
|
|
14322
14406
|
}
|
|
14323
14407
|
|
|
14324
14408
|
function updateFunctionComponent(current$$1, workInProgress, Component, nextProps, renderExpirationTime) {
|
|
14409
|
+
{
|
|
14410
|
+
if (workInProgress.type !== workInProgress.elementType) {
|
|
14411
|
+
// Lazy component props can't be validated in createElement
|
|
14412
|
+
// because they're only guaranteed to be resolved here.
|
|
14413
|
+
var innerPropTypes = Component.propTypes;
|
|
14414
|
+
if (innerPropTypes) {
|
|
14415
|
+
checkPropTypes(innerPropTypes, nextProps, // Resolved props
|
|
14416
|
+
'prop', getComponentName(Component), getCurrentFiberStackInDev);
|
|
14417
|
+
}
|
|
14418
|
+
}
|
|
14419
|
+
}
|
|
14420
|
+
|
|
14325
14421
|
var unmaskedContext = getUnmaskedContext(workInProgress, Component, true);
|
|
14326
14422
|
var context = getMaskedContext(workInProgress, unmaskedContext);
|
|
14327
14423
|
|
|
@@ -14343,6 +14439,18 @@ function updateFunctionComponent(current$$1, workInProgress, Component, nextProp
|
|
|
14343
14439
|
}
|
|
14344
14440
|
|
|
14345
14441
|
function updateClassComponent(current$$1, workInProgress, Component, nextProps, renderExpirationTime) {
|
|
14442
|
+
{
|
|
14443
|
+
if (workInProgress.type !== workInProgress.elementType) {
|
|
14444
|
+
// Lazy component props can't be validated in createElement
|
|
14445
|
+
// because they're only guaranteed to be resolved here.
|
|
14446
|
+
var innerPropTypes = Component.propTypes;
|
|
14447
|
+
if (innerPropTypes) {
|
|
14448
|
+
checkPropTypes(innerPropTypes, nextProps, // Resolved props
|
|
14449
|
+
'prop', getComponentName(Component), getCurrentFiberStackInDev);
|
|
14450
|
+
}
|
|
14451
|
+
}
|
|
14452
|
+
}
|
|
14453
|
+
|
|
14346
14454
|
// Push context providers early to prevent context stack mismatches.
|
|
14347
14455
|
// During mounting we don't know the child context yet as the instance doesn't exist.
|
|
14348
14456
|
// We will invalidate the child context in finishClassComponent() right after rendering.
|
|
@@ -14378,7 +14486,15 @@ function updateClassComponent(current$$1, workInProgress, Component, nextProps,
|
|
|
14378
14486
|
} else {
|
|
14379
14487
|
shouldUpdate = updateClassInstance(current$$1, workInProgress, Component, nextProps, renderExpirationTime);
|
|
14380
14488
|
}
|
|
14381
|
-
|
|
14489
|
+
var nextUnitOfWork = finishClassComponent(current$$1, workInProgress, Component, shouldUpdate, hasContext, renderExpirationTime);
|
|
14490
|
+
{
|
|
14491
|
+
var inst = workInProgress.stateNode;
|
|
14492
|
+
if (inst.props !== nextProps) {
|
|
14493
|
+
!didWarnAboutReassigningProps ? warning$1(false, 'It looks like %s is reassigning its own `this.props` while rendering. ' + 'This is not supported and can lead to confusing bugs.', getComponentName(workInProgress.type) || 'a component') : void 0;
|
|
14494
|
+
didWarnAboutReassigningProps = true;
|
|
14495
|
+
}
|
|
14496
|
+
}
|
|
14497
|
+
return nextUnitOfWork;
|
|
14382
14498
|
}
|
|
14383
14499
|
|
|
14384
14500
|
function finishClassComponent(current$$1, workInProgress, Component, shouldUpdate, hasContext, renderExpirationTime) {
|
|
@@ -14591,16 +14707,31 @@ function mountLazyComponent(_current, workInProgress, elementType, updateExpirat
|
|
|
14591
14707
|
}
|
|
14592
14708
|
case MemoComponent:
|
|
14593
14709
|
{
|
|
14710
|
+
{
|
|
14711
|
+
if (workInProgress.type !== workInProgress.elementType) {
|
|
14712
|
+
var outerPropTypes = Component.propTypes;
|
|
14713
|
+
if (outerPropTypes) {
|
|
14714
|
+
checkPropTypes(outerPropTypes, resolvedProps, // Resolved for outer only
|
|
14715
|
+
'prop', getComponentName(Component), getCurrentFiberStackInDev);
|
|
14716
|
+
}
|
|
14717
|
+
}
|
|
14718
|
+
}
|
|
14594
14719
|
child = updateMemoComponent(null, workInProgress, Component, resolveDefaultProps(Component.type, resolvedProps), // The inner type can have defaults too
|
|
14595
14720
|
updateExpirationTime, renderExpirationTime);
|
|
14596
14721
|
break;
|
|
14597
14722
|
}
|
|
14598
14723
|
default:
|
|
14599
14724
|
{
|
|
14725
|
+
var hint = '';
|
|
14726
|
+
{
|
|
14727
|
+
if (Component !== null && typeof Component === 'object' && Component.$$typeof === REACT_LAZY_TYPE) {
|
|
14728
|
+
hint = ' Did you wrap a component in React.lazy() more than once?';
|
|
14729
|
+
}
|
|
14730
|
+
}
|
|
14600
14731
|
// This message intentionally doesn't mention ForwardRef or MemoComponent
|
|
14601
14732
|
// because the fact that it's a separate type of work is an
|
|
14602
14733
|
// implementation detail.
|
|
14603
|
-
invariant(false, 'Element type is invalid. Received a promise that resolves to: %s.
|
|
14734
|
+
invariant(false, 'Element type is invalid. Received a promise that resolves to: %s. Lazy element type must resolve to a class or function.%s', Component, hint);
|
|
14604
14735
|
}
|
|
14605
14736
|
}
|
|
14606
14737
|
return child;
|
|
@@ -14961,6 +15092,7 @@ function updateSuspenseComponent(current$$1, workInProgress, renderExpirationTim
|
|
|
14961
15092
|
next = child = reconcileChildFibers(workInProgress, _currentPrimaryChild, _nextPrimaryChildren2, renderExpirationTime);
|
|
14962
15093
|
}
|
|
14963
15094
|
}
|
|
15095
|
+
workInProgress.stateNode = current$$1.stateNode;
|
|
14964
15096
|
}
|
|
14965
15097
|
|
|
14966
15098
|
workInProgress.memoizedState = nextState;
|
|
@@ -15231,10 +15363,21 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
|
|
|
15231
15363
|
return updateContextConsumer(current$$1, workInProgress, renderExpirationTime);
|
|
15232
15364
|
case MemoComponent:
|
|
15233
15365
|
{
|
|
15234
|
-
var
|
|
15366
|
+
var _type2 = workInProgress.type;
|
|
15235
15367
|
var _unresolvedProps3 = workInProgress.pendingProps;
|
|
15236
|
-
|
|
15237
|
-
|
|
15368
|
+
// Resolve outer props first, then resolve inner props.
|
|
15369
|
+
var _resolvedProps3 = resolveDefaultProps(_type2, _unresolvedProps3);
|
|
15370
|
+
{
|
|
15371
|
+
if (workInProgress.type !== workInProgress.elementType) {
|
|
15372
|
+
var outerPropTypes = _type2.propTypes;
|
|
15373
|
+
if (outerPropTypes) {
|
|
15374
|
+
checkPropTypes(outerPropTypes, _resolvedProps3, // Resolved for outer only
|
|
15375
|
+
'prop', getComponentName(_type2), getCurrentFiberStackInDev);
|
|
15376
|
+
}
|
|
15377
|
+
}
|
|
15378
|
+
}
|
|
15379
|
+
_resolvedProps3 = resolveDefaultProps(_type2.type, _resolvedProps3);
|
|
15380
|
+
return updateMemoComponent(current$$1, workInProgress, _type2, _resolvedProps3, updateExpirationTime, renderExpirationTime);
|
|
15238
15381
|
}
|
|
15239
15382
|
case SimpleMemoComponent:
|
|
15240
15383
|
{
|
|
@@ -15793,7 +15936,7 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
15793
15936
|
return null;
|
|
15794
15937
|
}
|
|
15795
15938
|
|
|
15796
|
-
function shouldCaptureSuspense(
|
|
15939
|
+
function shouldCaptureSuspense(workInProgress) {
|
|
15797
15940
|
// In order to capture, the Suspense component must have a fallback prop.
|
|
15798
15941
|
if (workInProgress.memoizedProps.fallback === undefined) {
|
|
15799
15942
|
return false;
|
|
@@ -15876,6 +16019,8 @@ var didWarnAboutUndefinedSnapshotBeforeUpdate = null;
|
|
|
15876
16019
|
didWarnAboutUndefinedSnapshotBeforeUpdate = new Set();
|
|
15877
16020
|
}
|
|
15878
16021
|
|
|
16022
|
+
var PossiblyWeakSet = typeof WeakSet === 'function' ? WeakSet : Set;
|
|
16023
|
+
|
|
15879
16024
|
function logError(boundary, errorInfo) {
|
|
15880
16025
|
var source = errorInfo.source;
|
|
15881
16026
|
var stack = errorInfo.stack;
|
|
@@ -15980,9 +16125,9 @@ function commitBeforeMutationLifeCycles(current$$1, finishedWork) {
|
|
|
15980
16125
|
// but instead we rely on them being set during last render.
|
|
15981
16126
|
// TODO: revisit this when we implement resuming.
|
|
15982
16127
|
{
|
|
15983
|
-
if (finishedWork.type === finishedWork.elementType) {
|
|
15984
|
-
!(instance.props === finishedWork.memoizedProps) ? warning$1(false, 'Expected
|
|
15985
|
-
!(instance.state === finishedWork.memoizedState) ? warning$1(false, 'Expected
|
|
16128
|
+
if (finishedWork.type === finishedWork.elementType && !didWarnAboutReassigningProps) {
|
|
16129
|
+
!(instance.props === finishedWork.memoizedProps) ? warning$1(false, 'Expected %s props to match memoized props before ' + 'getSnapshotBeforeUpdate. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance') : void 0;
|
|
16130
|
+
!(instance.state === finishedWork.memoizedState) ? warning$1(false, 'Expected %s state to match memoized state before ' + 'getSnapshotBeforeUpdate. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance') : void 0;
|
|
15986
16131
|
}
|
|
15987
16132
|
}
|
|
15988
16133
|
var snapshot = instance.getSnapshotBeforeUpdate(finishedWork.elementType === finishedWork.type ? prevProps : resolveDefaultProps(finishedWork.type, prevProps), prevState);
|
|
@@ -16038,7 +16183,7 @@ function commitHookEffectList(unmountTag, mountTag, finishedWork) {
|
|
|
16038
16183
|
if (typeof _destroy !== 'function') {
|
|
16039
16184
|
{
|
|
16040
16185
|
if (_destroy !== null && _destroy !== undefined) {
|
|
16041
|
-
warningWithoutStack$1(false, 'useEffect function must return a cleanup function or ' + 'nothing.%s%s', typeof _destroy.then === 'function' ? '
|
|
16186
|
+
warningWithoutStack$1(false, 'useEffect function must return a cleanup function or ' + 'nothing.%s%s', typeof _destroy.then === 'function' ? '\n\nIt looks like you wrote useEffect(async () => ...) or returned a Promise. ' + 'Instead, you may write an async function separately ' + 'and then call it from inside the effect:\n\n' + 'async function fetchComment(commentId) {\n' + ' // You can await here\n' + '}\n\n' + 'useEffect(() => {\n' + ' fetchComment(commentId);\n' + '}, [commentId]);\n\n' + 'In the future, React will provide a more idiomatic solution for data fetching ' + "that doesn't involve writing effects manually." : '', getStackByFiberInDevAndProd(finishedWork));
|
|
16042
16187
|
}
|
|
16043
16188
|
}
|
|
16044
16189
|
_destroy = null;
|
|
@@ -16074,9 +16219,9 @@ function commitLifeCycles(finishedRoot, current$$1, finishedWork, committedExpir
|
|
|
16074
16219
|
// but instead we rely on them being set during last render.
|
|
16075
16220
|
// TODO: revisit this when we implement resuming.
|
|
16076
16221
|
{
|
|
16077
|
-
if (finishedWork.type === finishedWork.elementType) {
|
|
16078
|
-
!(instance.props === finishedWork.memoizedProps) ? warning$1(false, 'Expected
|
|
16079
|
-
!(instance.state === finishedWork.memoizedState) ? warning$1(false, 'Expected
|
|
16222
|
+
if (finishedWork.type === finishedWork.elementType && !didWarnAboutReassigningProps) {
|
|
16223
|
+
!(instance.props === finishedWork.memoizedProps) ? warning$1(false, 'Expected %s props to match memoized props before ' + 'componentDidMount. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance') : void 0;
|
|
16224
|
+
!(instance.state === finishedWork.memoizedState) ? warning$1(false, 'Expected %s state to match memoized state before ' + 'componentDidMount. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance') : void 0;
|
|
16080
16225
|
}
|
|
16081
16226
|
}
|
|
16082
16227
|
instance.componentDidMount();
|
|
@@ -16089,9 +16234,9 @@ function commitLifeCycles(finishedRoot, current$$1, finishedWork, committedExpir
|
|
|
16089
16234
|
// but instead we rely on them being set during last render.
|
|
16090
16235
|
// TODO: revisit this when we implement resuming.
|
|
16091
16236
|
{
|
|
16092
|
-
if (finishedWork.type === finishedWork.elementType) {
|
|
16093
|
-
!(instance.props === finishedWork.memoizedProps) ? warning$1(false, 'Expected
|
|
16094
|
-
!(instance.state === finishedWork.memoizedState) ? warning$1(false, 'Expected
|
|
16237
|
+
if (finishedWork.type === finishedWork.elementType && !didWarnAboutReassigningProps) {
|
|
16238
|
+
!(instance.props === finishedWork.memoizedProps) ? warning$1(false, 'Expected %s props to match memoized props before ' + 'componentDidUpdate. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance') : void 0;
|
|
16239
|
+
!(instance.state === finishedWork.memoizedState) ? warning$1(false, 'Expected %s state to match memoized state before ' + 'componentDidUpdate. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance') : void 0;
|
|
16095
16240
|
}
|
|
16096
16241
|
}
|
|
16097
16242
|
instance.componentDidUpdate(prevProps, prevState, instance.__reactInternalSnapshotBeforeUpdate);
|
|
@@ -16101,9 +16246,9 @@ function commitLifeCycles(finishedRoot, current$$1, finishedWork, committedExpir
|
|
|
16101
16246
|
var updateQueue = finishedWork.updateQueue;
|
|
16102
16247
|
if (updateQueue !== null) {
|
|
16103
16248
|
{
|
|
16104
|
-
if (finishedWork.type === finishedWork.elementType) {
|
|
16105
|
-
!(instance.props === finishedWork.memoizedProps) ? warning$1(false, 'Expected
|
|
16106
|
-
!(instance.state === finishedWork.memoizedState) ? warning$1(false, 'Expected
|
|
16249
|
+
if (finishedWork.type === finishedWork.elementType && !didWarnAboutReassigningProps) {
|
|
16250
|
+
!(instance.props === finishedWork.memoizedProps) ? warning$1(false, 'Expected %s props to match memoized props before ' + 'processing the update queue. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance') : void 0;
|
|
16251
|
+
!(instance.state === finishedWork.memoizedState) ? warning$1(false, 'Expected %s state to match memoized state before ' + 'processing the update queue. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance') : void 0;
|
|
16107
16252
|
}
|
|
16108
16253
|
}
|
|
16109
16254
|
// We could update instance props and state here,
|
|
@@ -16362,9 +16507,14 @@ function detachFiber(current$$1) {
|
|
|
16362
16507
|
// itself will be GC:ed when the parent updates the next time.
|
|
16363
16508
|
current$$1.return = null;
|
|
16364
16509
|
current$$1.child = null;
|
|
16365
|
-
|
|
16366
|
-
|
|
16367
|
-
|
|
16510
|
+
current$$1.memoizedState = null;
|
|
16511
|
+
current$$1.updateQueue = null;
|
|
16512
|
+
var alternate = current$$1.alternate;
|
|
16513
|
+
if (alternate !== null) {
|
|
16514
|
+
alternate.return = null;
|
|
16515
|
+
alternate.child = null;
|
|
16516
|
+
alternate.memoizedState = null;
|
|
16517
|
+
alternate.updateQueue = null;
|
|
16368
16518
|
}
|
|
16369
16519
|
}
|
|
16370
16520
|
|
|
@@ -16653,6 +16803,8 @@ function commitWork(current$$1, finishedWork) {
|
|
|
16653
16803
|
case MemoComponent:
|
|
16654
16804
|
case SimpleMemoComponent:
|
|
16655
16805
|
{
|
|
16806
|
+
// Note: We currently never use MountMutation, but useLayout uses
|
|
16807
|
+
// UnmountMutation.
|
|
16656
16808
|
commitHookEffectList(UnmountMutation, MountMutation, finishedWork);
|
|
16657
16809
|
return;
|
|
16658
16810
|
}
|
|
@@ -16668,6 +16820,8 @@ function commitWork(current$$1, finishedWork) {
|
|
|
16668
16820
|
case MemoComponent:
|
|
16669
16821
|
case SimpleMemoComponent:
|
|
16670
16822
|
{
|
|
16823
|
+
// Note: We currently never use MountMutation, but useLayout uses
|
|
16824
|
+
// UnmountMutation.
|
|
16671
16825
|
commitHookEffectList(UnmountMutation, MountMutation, finishedWork);
|
|
16672
16826
|
return;
|
|
16673
16827
|
}
|
|
@@ -16737,6 +16891,30 @@ function commitWork(current$$1, finishedWork) {
|
|
|
16737
16891
|
if (primaryChildParent !== null) {
|
|
16738
16892
|
hideOrUnhideAllChildren(primaryChildParent, newDidTimeout);
|
|
16739
16893
|
}
|
|
16894
|
+
|
|
16895
|
+
// If this boundary just timed out, then it will have a set of thenables.
|
|
16896
|
+
// For each thenable, attach a listener so that when it resolves, React
|
|
16897
|
+
// attempts to re-render the boundary in the primary (pre-timeout) state.
|
|
16898
|
+
var thenables = finishedWork.updateQueue;
|
|
16899
|
+
if (thenables !== null) {
|
|
16900
|
+
finishedWork.updateQueue = null;
|
|
16901
|
+
var retryCache = finishedWork.stateNode;
|
|
16902
|
+
if (retryCache === null) {
|
|
16903
|
+
retryCache = finishedWork.stateNode = new PossiblyWeakSet();
|
|
16904
|
+
}
|
|
16905
|
+
thenables.forEach(function (thenable) {
|
|
16906
|
+
// Memoize using the boundary fiber to prevent redundant listeners.
|
|
16907
|
+
var retry = retryTimedOutBoundary.bind(null, finishedWork, thenable);
|
|
16908
|
+
if (enableSchedulerTracing) {
|
|
16909
|
+
retry = tracing.unstable_wrap(retry);
|
|
16910
|
+
}
|
|
16911
|
+
if (!retryCache.has(thenable)) {
|
|
16912
|
+
retryCache.add(thenable);
|
|
16913
|
+
thenable.then(retry, retry);
|
|
16914
|
+
}
|
|
16915
|
+
});
|
|
16916
|
+
}
|
|
16917
|
+
|
|
16740
16918
|
return;
|
|
16741
16919
|
}
|
|
16742
16920
|
case IncompleteClassComponent:
|
|
@@ -16757,6 +16935,8 @@ function commitResetTextContent(current$$1) {
|
|
|
16757
16935
|
resetTextContent(current$$1.stateNode);
|
|
16758
16936
|
}
|
|
16759
16937
|
|
|
16938
|
+
var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;
|
|
16939
|
+
|
|
16760
16940
|
function createRootErrorUpdate(fiber, errorInfo, expirationTime) {
|
|
16761
16941
|
var update = createUpdate(expirationTime);
|
|
16762
16942
|
// Unmount the root by rendering null.
|
|
@@ -16860,19 +17040,16 @@ function throwException(root, returnFiber, sourceFiber, value, renderExpirationT
|
|
|
16860
17040
|
// Schedule the nearest Suspense to re-render the timed out view.
|
|
16861
17041
|
_workInProgress = returnFiber;
|
|
16862
17042
|
do {
|
|
16863
|
-
if (_workInProgress.tag === SuspenseComponent && shouldCaptureSuspense(_workInProgress
|
|
17043
|
+
if (_workInProgress.tag === SuspenseComponent && shouldCaptureSuspense(_workInProgress)) {
|
|
16864
17044
|
// Found the nearest boundary.
|
|
16865
17045
|
|
|
16866
|
-
//
|
|
16867
|
-
|
|
16868
|
-
|
|
16869
|
-
|
|
16870
|
-
|
|
16871
|
-
|
|
16872
|
-
if (enableSchedulerTracing) {
|
|
16873
|
-
onResolveOrReject = tracing.unstable_wrap(onResolveOrReject);
|
|
17046
|
+
// Stash the promise on the boundary fiber. If the boundary times out, we'll
|
|
17047
|
+
var thenables = _workInProgress.updateQueue;
|
|
17048
|
+
if (thenables === null) {
|
|
17049
|
+
_workInProgress.updateQueue = new Set([thenable]);
|
|
17050
|
+
} else {
|
|
17051
|
+
thenables.add(thenable);
|
|
16874
17052
|
}
|
|
16875
|
-
thenable.then(onResolveOrReject, onResolveOrReject);
|
|
16876
17053
|
|
|
16877
17054
|
// If the boundary is outside of concurrent mode, we should *not*
|
|
16878
17055
|
// suspend the commit. Pretend as if the suspended component rendered
|
|
@@ -16891,18 +17068,25 @@ function throwException(root, returnFiber, sourceFiber, value, renderExpirationT
|
|
|
16891
17068
|
sourceFiber.effectTag &= ~(LifecycleEffectMask | Incomplete);
|
|
16892
17069
|
|
|
16893
17070
|
if (sourceFiber.tag === ClassComponent) {
|
|
16894
|
-
var
|
|
16895
|
-
if (
|
|
17071
|
+
var currentSourceFiber = sourceFiber.alternate;
|
|
17072
|
+
if (currentSourceFiber === null) {
|
|
16896
17073
|
// This is a new mount. Change the tag so it's not mistaken for a
|
|
16897
17074
|
// completed class component. For example, we should not call
|
|
16898
17075
|
// componentWillUnmount if it is deleted.
|
|
16899
17076
|
sourceFiber.tag = IncompleteClassComponent;
|
|
17077
|
+
} else {
|
|
17078
|
+
// When we try rendering again, we should not reuse the current fiber,
|
|
17079
|
+
// since it's known to be in an inconsistent state. Use a force updte to
|
|
17080
|
+
// prevent a bail out.
|
|
17081
|
+
var update = createUpdate(Sync);
|
|
17082
|
+
update.tag = ForceUpdate;
|
|
17083
|
+
enqueueUpdate(sourceFiber, update);
|
|
16900
17084
|
}
|
|
16901
17085
|
}
|
|
16902
17086
|
|
|
16903
|
-
// The source fiber did not complete. Mark it with
|
|
16904
|
-
//
|
|
16905
|
-
sourceFiber.expirationTime =
|
|
17087
|
+
// The source fiber did not complete. Mark it with Sync priority to
|
|
17088
|
+
// indicate that it still has pending work.
|
|
17089
|
+
sourceFiber.expirationTime = Sync;
|
|
16906
17090
|
|
|
16907
17091
|
// Exit without suspending.
|
|
16908
17092
|
return;
|
|
@@ -16911,6 +17095,32 @@ function throwException(root, returnFiber, sourceFiber, value, renderExpirationT
|
|
|
16911
17095
|
// Confirmed that the boundary is in a concurrent mode tree. Continue
|
|
16912
17096
|
// with the normal suspend path.
|
|
16913
17097
|
|
|
17098
|
+
// Attach a listener to the promise to "ping" the root and retry. But
|
|
17099
|
+
// only if one does not already exist for the current render expiration
|
|
17100
|
+
// time (which acts like a "thread ID" here).
|
|
17101
|
+
var pingCache = root.pingCache;
|
|
17102
|
+
var threadIDs = void 0;
|
|
17103
|
+
if (pingCache === null) {
|
|
17104
|
+
pingCache = root.pingCache = new PossiblyWeakMap();
|
|
17105
|
+
threadIDs = new Set();
|
|
17106
|
+
pingCache.set(thenable, threadIDs);
|
|
17107
|
+
} else {
|
|
17108
|
+
threadIDs = pingCache.get(thenable);
|
|
17109
|
+
if (threadIDs === undefined) {
|
|
17110
|
+
threadIDs = new Set();
|
|
17111
|
+
pingCache.set(thenable, threadIDs);
|
|
17112
|
+
}
|
|
17113
|
+
}
|
|
17114
|
+
if (!threadIDs.has(renderExpirationTime)) {
|
|
17115
|
+
// Memoize using the thread ID to prevent redundant listeners.
|
|
17116
|
+
threadIDs.add(renderExpirationTime);
|
|
17117
|
+
var ping = pingSuspendedRoot.bind(null, root, thenable, renderExpirationTime);
|
|
17118
|
+
if (enableSchedulerTracing) {
|
|
17119
|
+
ping = tracing.unstable_wrap(ping);
|
|
17120
|
+
}
|
|
17121
|
+
thenable.then(ping, ping);
|
|
17122
|
+
}
|
|
17123
|
+
|
|
16914
17124
|
var absoluteTimeoutMs = void 0;
|
|
16915
17125
|
if (earliestTimeoutMs === -1) {
|
|
16916
17126
|
// If no explicit threshold is given, default to an abitrarily large
|
|
@@ -16967,8 +17177,8 @@ function throwException(root, returnFiber, sourceFiber, value, renderExpirationT
|
|
|
16967
17177
|
var _errorInfo = value;
|
|
16968
17178
|
workInProgress.effectTag |= ShouldCapture;
|
|
16969
17179
|
workInProgress.expirationTime = renderExpirationTime;
|
|
16970
|
-
var
|
|
16971
|
-
enqueueCapturedUpdate(workInProgress,
|
|
17180
|
+
var _update = createRootErrorUpdate(workInProgress, _errorInfo, renderExpirationTime);
|
|
17181
|
+
enqueueCapturedUpdate(workInProgress, _update);
|
|
16972
17182
|
return;
|
|
16973
17183
|
}
|
|
16974
17184
|
case ClassComponent:
|
|
@@ -16980,8 +17190,8 @@ function throwException(root, returnFiber, sourceFiber, value, renderExpirationT
|
|
|
16980
17190
|
workInProgress.effectTag |= ShouldCapture;
|
|
16981
17191
|
workInProgress.expirationTime = renderExpirationTime;
|
|
16982
17192
|
// Schedule the error boundary to re-render using updated state
|
|
16983
|
-
var
|
|
16984
|
-
enqueueCapturedUpdate(workInProgress,
|
|
17193
|
+
var _update2 = createClassErrorUpdate(workInProgress, errorInfo, renderExpirationTime);
|
|
17194
|
+
enqueueCapturedUpdate(workInProgress, _update2);
|
|
16985
17195
|
return;
|
|
16986
17196
|
}
|
|
16987
17197
|
break;
|
|
@@ -17082,7 +17292,6 @@ var Dispatcher = {
|
|
|
17082
17292
|
useImperativeMethods: useImperativeMethods,
|
|
17083
17293
|
useLayoutEffect: useLayoutEffect,
|
|
17084
17294
|
useMemo: useMemo,
|
|
17085
|
-
useMutationEffect: useMutationEffect,
|
|
17086
17295
|
useReducer: useReducer,
|
|
17087
17296
|
useRef: useRef,
|
|
17088
17297
|
useState: useState
|
|
@@ -18357,56 +18566,54 @@ function renderDidError() {
|
|
|
18357
18566
|
nextRenderDidError = true;
|
|
18358
18567
|
}
|
|
18359
18568
|
|
|
18360
|
-
function
|
|
18361
|
-
|
|
18362
|
-
|
|
18363
|
-
if (isPriorityLevelSuspended(root, suspendedTime)) {
|
|
18364
|
-
// Ping at the original level
|
|
18365
|
-
retryTime = suspendedTime;
|
|
18569
|
+
function pingSuspendedRoot(root, thenable, pingTime) {
|
|
18570
|
+
// A promise that previously suspended React from committing has resolved.
|
|
18571
|
+
// If React is still suspended, try again at the previous level (pingTime).
|
|
18366
18572
|
|
|
18367
|
-
|
|
18368
|
-
|
|
18369
|
-
//
|
|
18370
|
-
|
|
18371
|
-
|
|
18372
|
-
markPendingPriorityLevel(root, retryTime);
|
|
18573
|
+
var pingCache = root.pingCache;
|
|
18574
|
+
if (pingCache !== null) {
|
|
18575
|
+
// The thenable resolved, so we no longer need to memoize, because it will
|
|
18576
|
+
// never be thrown again.
|
|
18577
|
+
pingCache.delete(thenable);
|
|
18373
18578
|
}
|
|
18374
18579
|
|
|
18375
|
-
|
|
18376
|
-
|
|
18377
|
-
|
|
18378
|
-
|
|
18379
|
-
|
|
18380
|
-
|
|
18381
|
-
|
|
18382
|
-
|
|
18383
|
-
|
|
18384
|
-
|
|
18385
|
-
|
|
18386
|
-
|
|
18580
|
+
if (nextRoot !== null && nextRenderExpirationTime === pingTime) {
|
|
18581
|
+
// Received a ping at the same priority level at which we're currently
|
|
18582
|
+
// rendering. Restart from the root.
|
|
18583
|
+
nextRoot = null;
|
|
18584
|
+
} else {
|
|
18585
|
+
// Confirm that the root is still suspended at this level. Otherwise exit.
|
|
18586
|
+
if (isPriorityLevelSuspended(root, pingTime)) {
|
|
18587
|
+
// Ping at the original level
|
|
18588
|
+
markPingedPriorityLevel(root, pingTime);
|
|
18589
|
+
var rootExpirationTime = root.expirationTime;
|
|
18590
|
+
if (rootExpirationTime !== NoWork) {
|
|
18591
|
+
requestWork(root, rootExpirationTime);
|
|
18592
|
+
}
|
|
18387
18593
|
}
|
|
18388
18594
|
}
|
|
18595
|
+
}
|
|
18389
18596
|
|
|
18390
|
-
|
|
18391
|
-
|
|
18392
|
-
|
|
18393
|
-
|
|
18394
|
-
|
|
18395
|
-
|
|
18396
|
-
|
|
18397
|
-
|
|
18398
|
-
|
|
18399
|
-
// since it's known to be in an inconsistent state. Use a force updte to
|
|
18400
|
-
// prevent a bail out.
|
|
18401
|
-
var update = createUpdate(retryTime);
|
|
18402
|
-
update.tag = ForceUpdate;
|
|
18403
|
-
enqueueUpdate(sourceFiber, update);
|
|
18404
|
-
}
|
|
18597
|
+
function retryTimedOutBoundary(boundaryFiber, thenable) {
|
|
18598
|
+
// The boundary fiber (a Suspense component) previously timed out and was
|
|
18599
|
+
// rendered in its fallback state. One of the promises that suspended it has
|
|
18600
|
+
// resolved, which means at least part of the tree was likely unblocked. Try
|
|
18601
|
+
var retryCache = boundaryFiber.stateNode;
|
|
18602
|
+
if (retryCache !== null) {
|
|
18603
|
+
// The thenable resolved, so we no longer need to memoize, because it will
|
|
18604
|
+
// never be thrown again.
|
|
18605
|
+
retryCache.delete(thenable);
|
|
18405
18606
|
}
|
|
18406
18607
|
|
|
18407
|
-
var
|
|
18408
|
-
|
|
18409
|
-
|
|
18608
|
+
var currentTime = requestCurrentTime();
|
|
18609
|
+
var retryTime = computeExpirationForFiber(currentTime, boundaryFiber);
|
|
18610
|
+
var root = scheduleWorkToRoot(boundaryFiber, retryTime);
|
|
18611
|
+
if (root !== null) {
|
|
18612
|
+
markPendingPriorityLevel(root, retryTime);
|
|
18613
|
+
var rootExpirationTime = root.expirationTime;
|
|
18614
|
+
if (rootExpirationTime !== NoWork) {
|
|
18615
|
+
requestWork(root, rootExpirationTime);
|
|
18616
|
+
}
|
|
18410
18617
|
}
|
|
18411
18618
|
}
|
|
18412
18619
|
|
|
@@ -19296,10 +19503,40 @@ function findHostInstanceWithNoPortals(fiber) {
|
|
|
19296
19503
|
return hostFiber.stateNode;
|
|
19297
19504
|
}
|
|
19298
19505
|
|
|
19506
|
+
var overrideProps = null;
|
|
19507
|
+
|
|
19508
|
+
{
|
|
19509
|
+
var copyWithSetImpl = function (obj, path, idx, value) {
|
|
19510
|
+
if (idx >= path.length) {
|
|
19511
|
+
return value;
|
|
19512
|
+
}
|
|
19513
|
+
var key = path[idx];
|
|
19514
|
+
var updated = Array.isArray(obj) ? obj.slice() : _assign({}, obj);
|
|
19515
|
+
// $FlowFixMe number or string is fine here
|
|
19516
|
+
updated[key] = copyWithSetImpl(obj[key], path, idx + 1, value);
|
|
19517
|
+
return updated;
|
|
19518
|
+
};
|
|
19519
|
+
|
|
19520
|
+
var copyWithSet = function (obj, path, value) {
|
|
19521
|
+
return copyWithSetImpl(obj, path, 0, value);
|
|
19522
|
+
};
|
|
19523
|
+
|
|
19524
|
+
// Support DevTools props for function components, forwardRef, memo, host components, etc.
|
|
19525
|
+
overrideProps = function (fiber, path, value) {
|
|
19526
|
+
flushPassiveEffects();
|
|
19527
|
+
fiber.pendingProps = copyWithSet(fiber.memoizedProps, path, value);
|
|
19528
|
+
if (fiber.alternate) {
|
|
19529
|
+
fiber.alternate.pendingProps = fiber.pendingProps;
|
|
19530
|
+
}
|
|
19531
|
+
scheduleWork(fiber, Sync);
|
|
19532
|
+
};
|
|
19533
|
+
}
|
|
19534
|
+
|
|
19299
19535
|
function injectIntoDevTools(devToolsConfig) {
|
|
19300
19536
|
var findFiberByHostInstance = devToolsConfig.findFiberByHostInstance;
|
|
19301
19537
|
|
|
19302
19538
|
return injectInternals(_assign({}, devToolsConfig, {
|
|
19539
|
+
overrideProps: overrideProps,
|
|
19303
19540
|
findHostInstanceByFiber: function (fiber) {
|
|
19304
19541
|
var hostFiber = findCurrentHostFiber(fiber);
|
|
19305
19542
|
if (hostFiber === null) {
|
|
@@ -19337,7 +19574,7 @@ implementation) {
|
|
|
19337
19574
|
|
|
19338
19575
|
// TODO: this is special because it gets imported during build.
|
|
19339
19576
|
|
|
19340
|
-
var ReactVersion = '16.7.0
|
|
19577
|
+
var ReactVersion = '16.7.0';
|
|
19341
19578
|
|
|
19342
19579
|
// TODO: This type is shared between the reconciler and ReactDOM, but will
|
|
19343
19580
|
// eventually be lifted out to the renderer.
|
|
@@ -19695,7 +19932,7 @@ function legacyRenderSubtreeIntoContainer(parentComponent, children, container,
|
|
|
19695
19932
|
return getPublicRootInstance(root._internalRoot);
|
|
19696
19933
|
}
|
|
19697
19934
|
|
|
19698
|
-
function createPortal(children, container) {
|
|
19935
|
+
function createPortal$$1(children, container) {
|
|
19699
19936
|
var key = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
19700
19937
|
|
|
19701
19938
|
!isValidContainer(container) ? invariant(false, 'Target container is not a DOM element.') : void 0;
|
|
@@ -19704,7 +19941,7 @@ function createPortal(children, container) {
|
|
|
19704
19941
|
}
|
|
19705
19942
|
|
|
19706
19943
|
var ReactDOM = {
|
|
19707
|
-
createPortal: createPortal,
|
|
19944
|
+
createPortal: createPortal$$1,
|
|
19708
19945
|
|
|
19709
19946
|
findDOMNode: function (componentOrElement) {
|
|
19710
19947
|
{
|
|
@@ -19779,7 +20016,7 @@ var ReactDOM = {
|
|
|
19779
20016
|
didWarnAboutUnstableCreatePortal = true;
|
|
19780
20017
|
lowPriorityWarning$1(false, 'The ReactDOM.unstable_createPortal() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactDOM.createPortal() instead. It has the exact same API, ' + 'but without the "unstable_" prefix.');
|
|
19781
20018
|
}
|
|
19782
|
-
return createPortal.apply(undefined, arguments);
|
|
20019
|
+
return createPortal$$1.apply(undefined, arguments);
|
|
19783
20020
|
},
|
|
19784
20021
|
|
|
19785
20022
|
|
|
@@ -19789,6 +20026,7 @@ var ReactDOM = {
|
|
|
19789
20026
|
|
|
19790
20027
|
flushSync: flushSync,
|
|
19791
20028
|
|
|
20029
|
+
unstable_createRoot: createRoot,
|
|
19792
20030
|
unstable_flushControlled: flushControlled,
|
|
19793
20031
|
|
|
19794
20032
|
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: {
|
|
@@ -19807,8 +20045,7 @@ function createRoot(container, options) {
|
|
|
19807
20045
|
|
|
19808
20046
|
if (enableStableConcurrentModeAPIs) {
|
|
19809
20047
|
ReactDOM.createRoot = createRoot;
|
|
19810
|
-
|
|
19811
|
-
ReactDOM.unstable_createRoot = createRoot;
|
|
20048
|
+
ReactDOM.unstable_createRoot = undefined;
|
|
19812
20049
|
}
|
|
19813
20050
|
|
|
19814
20051
|
var foundDevTools = injectIntoDevTools({
|