react-dom 16.6.3 → 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.
Files changed (37) hide show
  1. package/build-info.json +8 -0
  2. package/cjs/react-dom-server.browser.development.js +13 -11
  3. package/cjs/react-dom-server.browser.production.min.js +3 -3
  4. package/cjs/react-dom-server.node.development.js +15 -12
  5. package/cjs/react-dom-server.node.production.min.js +4 -4
  6. package/cjs/react-dom-test-utils.development.js +1 -1
  7. package/cjs/react-dom-test-utils.production.min.js +1 -1
  8. package/cjs/react-dom-unstable-fire.development.js +20093 -0
  9. package/cjs/react-dom-unstable-fire.production.min.js +249 -0
  10. package/cjs/react-dom-unstable-fire.profiling.min.js +261 -0
  11. package/cjs/react-dom-unstable-fizz.browser.development.js +144 -0
  12. package/cjs/react-dom-unstable-fizz.browser.production.min.js +11 -0
  13. package/cjs/react-dom-unstable-fizz.node.development.js +150 -0
  14. package/cjs/react-dom-unstable-fizz.node.production.min.js +11 -0
  15. package/cjs/react-dom-unstable-native-dependencies.development.js +1 -1
  16. package/cjs/react-dom-unstable-native-dependencies.production.min.js +1 -1
  17. package/cjs/react-dom.development.js +503 -145
  18. package/cjs/react-dom.production.min.js +163 -163
  19. package/cjs/react-dom.profiling.min.js +140 -139
  20. package/package.json +58 -37
  21. package/umd/react-dom-server.browser.development.js +13 -11
  22. package/umd/react-dom-server.browser.production.min.js +11 -11
  23. package/umd/react-dom-test-utils.development.js +1 -1
  24. package/umd/react-dom-test-utils.production.min.js +1 -1
  25. package/umd/react-dom-unstable-fire.development.js +20220 -0
  26. package/umd/react-dom-unstable-fire.production.min.js +207 -0
  27. package/umd/react-dom-unstable-fire.profiling.min.js +212 -0
  28. package/umd/react-dom-unstable-fizz.browser.development.js +144 -0
  29. package/umd/react-dom-unstable-fizz.browser.production.min.js +10 -0
  30. package/umd/react-dom-unstable-native-dependencies.development.js +1 -1
  31. package/umd/react-dom-unstable-native-dependencies.production.min.js +1 -1
  32. package/umd/react-dom.development.js +506 -145
  33. package/umd/react-dom.production.min.js +195 -192
  34. package/umd/react-dom.profiling.min.js +178 -176
  35. package/unstable-fizz.browser.js +7 -0
  36. package/unstable-fizz.js +3 -0
  37. package/unstable-fizz.node.js +7 -0
@@ -1,4 +1,4 @@
1
- /** @license React v16.6.1
1
+ /** @license React v16.7.0
2
2
  * react-dom.development.js
3
3
  *
4
4
  * Copyright (c) Facebook, Inc. and its affiliates.
@@ -2512,13 +2512,14 @@ var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
2512
2512
 
2513
2513
  function describeFiber(fiber) {
2514
2514
  switch (fiber.tag) {
2515
- case IndeterminateComponent:
2516
- case LazyComponent:
2517
- case FunctionComponent:
2518
- case ClassComponent:
2519
- case HostComponent:
2520
- case Mode:
2521
- case SuspenseComponent:
2515
+ case HostRoot:
2516
+ case HostPortal:
2517
+ case HostText:
2518
+ case Fragment:
2519
+ case ContextProvider:
2520
+ case ContextConsumer:
2521
+ return '';
2522
+ default:
2522
2523
  var owner = fiber._debugOwner;
2523
2524
  var source = fiber._debugSource;
2524
2525
  var name = getComponentName(fiber.type);
@@ -2527,8 +2528,6 @@ function describeFiber(fiber) {
2527
2528
  ownerName = getComponentName(owner.type);
2528
2529
  }
2529
2530
  return describeComponentFrame(name, source, ownerName);
2530
- default:
2531
- return '';
2532
2531
  }
2533
2532
  }
2534
2533
 
@@ -3242,6 +3241,9 @@ var enableProfilerTimer = true;
3242
3241
  // Trace which interactions trigger each commit.
3243
3242
  var enableSchedulerTracing = true;
3244
3243
 
3244
+ // Only used in www builds.
3245
+ // TODO: true? Here it might just be false.
3246
+
3245
3247
  // Only used in www builds.
3246
3248
 
3247
3249
 
@@ -3256,6 +3258,8 @@ var disableInputAttributeSyncing = false;
3256
3258
  // Control this behavior with a flag to support 16.6 minor releases in the meanwhile.
3257
3259
  var enableStableConcurrentModeAPIs = false;
3258
3260
 
3261
+ var warnAboutShorthandPropertyCollision = false;
3262
+
3259
3263
  // TODO: direct imports like some-package/src/* are bad. Fix me.
3260
3264
  var didWarnValueDefaultValue = false;
3261
3265
  var didWarnCheckedDefaultChecked = false;
@@ -6193,6 +6197,58 @@ var setTextContent = function (node, text) {
6193
6197
  node.textContent = text;
6194
6198
  };
6195
6199
 
6200
+ // List derived from Gecko source code:
6201
+ // https://github.com/mozilla/gecko-dev/blob/4e638efc71/layout/style/test/property_database.js
6202
+ var shorthandToLonghand = {
6203
+ animation: ['animationDelay', 'animationDirection', 'animationDuration', 'animationFillMode', 'animationIterationCount', 'animationName', 'animationPlayState', 'animationTimingFunction'],
6204
+ background: ['backgroundAttachment', 'backgroundClip', 'backgroundColor', 'backgroundImage', 'backgroundOrigin', 'backgroundPositionX', 'backgroundPositionY', 'backgroundRepeat', 'backgroundSize'],
6205
+ backgroundPosition: ['backgroundPositionX', 'backgroundPositionY'],
6206
+ border: ['borderBottomColor', 'borderBottomStyle', 'borderBottomWidth', 'borderImageOutset', 'borderImageRepeat', 'borderImageSlice', 'borderImageSource', 'borderImageWidth', 'borderLeftColor', 'borderLeftStyle', 'borderLeftWidth', 'borderRightColor', 'borderRightStyle', 'borderRightWidth', 'borderTopColor', 'borderTopStyle', 'borderTopWidth'],
6207
+ borderBlockEnd: ['borderBlockEndColor', 'borderBlockEndStyle', 'borderBlockEndWidth'],
6208
+ borderBlockStart: ['borderBlockStartColor', 'borderBlockStartStyle', 'borderBlockStartWidth'],
6209
+ borderBottom: ['borderBottomColor', 'borderBottomStyle', 'borderBottomWidth'],
6210
+ borderColor: ['borderBottomColor', 'borderLeftColor', 'borderRightColor', 'borderTopColor'],
6211
+ borderImage: ['borderImageOutset', 'borderImageRepeat', 'borderImageSlice', 'borderImageSource', 'borderImageWidth'],
6212
+ borderInlineEnd: ['borderInlineEndColor', 'borderInlineEndStyle', 'borderInlineEndWidth'],
6213
+ borderInlineStart: ['borderInlineStartColor', 'borderInlineStartStyle', 'borderInlineStartWidth'],
6214
+ borderLeft: ['borderLeftColor', 'borderLeftStyle', 'borderLeftWidth'],
6215
+ borderRadius: ['borderBottomLeftRadius', 'borderBottomRightRadius', 'borderTopLeftRadius', 'borderTopRightRadius'],
6216
+ borderRight: ['borderRightColor', 'borderRightStyle', 'borderRightWidth'],
6217
+ borderStyle: ['borderBottomStyle', 'borderLeftStyle', 'borderRightStyle', 'borderTopStyle'],
6218
+ borderTop: ['borderTopColor', 'borderTopStyle', 'borderTopWidth'],
6219
+ borderWidth: ['borderBottomWidth', 'borderLeftWidth', 'borderRightWidth', 'borderTopWidth'],
6220
+ columnRule: ['columnRuleColor', 'columnRuleStyle', 'columnRuleWidth'],
6221
+ columns: ['columnCount', 'columnWidth'],
6222
+ flex: ['flexBasis', 'flexGrow', 'flexShrink'],
6223
+ flexFlow: ['flexDirection', 'flexWrap'],
6224
+ font: ['fontFamily', 'fontFeatureSettings', 'fontKerning', 'fontLanguageOverride', 'fontSize', 'fontSizeAdjust', 'fontStretch', 'fontStyle', 'fontVariant', 'fontVariantAlternates', 'fontVariantCaps', 'fontVariantEastAsian', 'fontVariantLigatures', 'fontVariantNumeric', 'fontVariantPosition', 'fontWeight', 'lineHeight'],
6225
+ fontVariant: ['fontVariantAlternates', 'fontVariantCaps', 'fontVariantEastAsian', 'fontVariantLigatures', 'fontVariantNumeric', 'fontVariantPosition'],
6226
+ gap: ['columnGap', 'rowGap'],
6227
+ grid: ['gridAutoColumns', 'gridAutoFlow', 'gridAutoRows', 'gridTemplateAreas', 'gridTemplateColumns', 'gridTemplateRows'],
6228
+ gridArea: ['gridColumnEnd', 'gridColumnStart', 'gridRowEnd', 'gridRowStart'],
6229
+ gridColumn: ['gridColumnEnd', 'gridColumnStart'],
6230
+ gridColumnGap: ['columnGap'],
6231
+ gridGap: ['columnGap', 'rowGap'],
6232
+ gridRow: ['gridRowEnd', 'gridRowStart'],
6233
+ gridRowGap: ['rowGap'],
6234
+ gridTemplate: ['gridTemplateAreas', 'gridTemplateColumns', 'gridTemplateRows'],
6235
+ listStyle: ['listStyleImage', 'listStylePosition', 'listStyleType'],
6236
+ margin: ['marginBottom', 'marginLeft', 'marginRight', 'marginTop'],
6237
+ marker: ['markerEnd', 'markerMid', 'markerStart'],
6238
+ mask: ['maskClip', 'maskComposite', 'maskImage', 'maskMode', 'maskOrigin', 'maskPositionX', 'maskPositionY', 'maskRepeat', 'maskSize'],
6239
+ maskPosition: ['maskPositionX', 'maskPositionY'],
6240
+ outline: ['outlineColor', 'outlineStyle', 'outlineWidth'],
6241
+ overflow: ['overflowX', 'overflowY'],
6242
+ padding: ['paddingBottom', 'paddingLeft', 'paddingRight', 'paddingTop'],
6243
+ placeContent: ['alignContent', 'justifyContent'],
6244
+ placeItems: ['alignItems', 'justifyItems'],
6245
+ placeSelf: ['alignSelf', 'justifySelf'],
6246
+ textDecoration: ['textDecorationColor', 'textDecorationLine', 'textDecorationStyle'],
6247
+ textEmphasis: ['textEmphasisColor', 'textEmphasisStyle'],
6248
+ transition: ['transitionDelay', 'transitionDuration', 'transitionProperty', 'transitionTimingFunction'],
6249
+ wordWrap: ['overflowWrap']
6250
+ };
6251
+
6196
6252
  /**
6197
6253
  * CSS properties which accept numbers but are not in units of "px".
6198
6254
  */
@@ -6473,6 +6529,69 @@ function setValueForStyles(node, styles) {
6473
6529
  }
6474
6530
  }
6475
6531
 
6532
+ function isValueEmpty(value) {
6533
+ return value == null || typeof value === 'boolean' || value === '';
6534
+ }
6535
+
6536
+ /**
6537
+ * Given {color: 'red', overflow: 'hidden'} returns {
6538
+ * color: 'color',
6539
+ * overflowX: 'overflow',
6540
+ * overflowY: 'overflow',
6541
+ * }. This can be read as "the overflowY property was set by the overflow
6542
+ * shorthand". That is, the values are the property that each was derived from.
6543
+ */
6544
+ function expandShorthandMap(styles) {
6545
+ var expanded = {};
6546
+ for (var key in styles) {
6547
+ var longhands = shorthandToLonghand[key] || [key];
6548
+ for (var i = 0; i < longhands.length; i++) {
6549
+ expanded[longhands[i]] = key;
6550
+ }
6551
+ }
6552
+ return expanded;
6553
+ }
6554
+
6555
+ /**
6556
+ * When mixing shorthand and longhand property names, we warn during updates if
6557
+ * we expect an incorrect result to occur. In particular, we warn for:
6558
+ *
6559
+ * Updating a shorthand property (longhand gets overwritten):
6560
+ * {font: 'foo', fontVariant: 'bar'} -> {font: 'baz', fontVariant: 'bar'}
6561
+ * becomes .style.font = 'baz'
6562
+ * Removing a shorthand property (longhand gets lost too):
6563
+ * {font: 'foo', fontVariant: 'bar'} -> {fontVariant: 'bar'}
6564
+ * becomes .style.font = ''
6565
+ * Removing a longhand property (should revert to shorthand; doesn't):
6566
+ * {font: 'foo', fontVariant: 'bar'} -> {font: 'foo'}
6567
+ * becomes .style.fontVariant = ''
6568
+ */
6569
+ function validateShorthandPropertyCollisionInDev(styleUpdates, nextStyles) {
6570
+ if (!warnAboutShorthandPropertyCollision) {
6571
+ return;
6572
+ }
6573
+
6574
+ if (!nextStyles) {
6575
+ return;
6576
+ }
6577
+
6578
+ var expandedUpdates = expandShorthandMap(styleUpdates);
6579
+ var expandedStyles = expandShorthandMap(nextStyles);
6580
+ var warnedAbout = {};
6581
+ for (var key in expandedUpdates) {
6582
+ var originalKey = expandedUpdates[key];
6583
+ var correctOriginalKey = expandedStyles[key];
6584
+ if (correctOriginalKey && originalKey !== correctOriginalKey) {
6585
+ var warningKey = originalKey + ',' + correctOriginalKey;
6586
+ if (warnedAbout[warningKey]) {
6587
+ continue;
6588
+ }
6589
+ warnedAbout[warningKey] = true;
6590
+ warning$1(false, '%s a style property during rerender (%s) when a ' + 'conflicting property is set (%s) can lead to styling bugs. To ' + "avoid this, don't mix shorthand and non-shorthand properties " + 'for the same value; instead, replace the shorthand with ' + 'separate values.', isValueEmpty(styleUpdates[originalKey]) ? 'Removing' : 'Updating', originalKey, correctOriginalKey);
6591
+ }
6592
+ }
6593
+ }
6594
+
6476
6595
  // For HTML, certain tags should omit their close tag. We keep a whitelist for
6477
6596
  // those special-case tags.
6478
6597
 
@@ -7912,6 +8031,9 @@ function diffProperties(domElement, tag, lastRawProps, nextRawProps, rootContain
7912
8031
  }
7913
8032
  }
7914
8033
  if (styleUpdates) {
8034
+ {
8035
+ validateShorthandPropertyCollisionInDev(styleUpdates, nextProps[STYLE$1]);
8036
+ }
7915
8037
  (updatePayload = updatePayload || []).push(STYLE$1, styleUpdates);
7916
8038
  }
7917
8039
  return updatePayload;
@@ -8589,6 +8711,9 @@ var unstable_cancelCallback = _ReactInternals$Sched.unstable_cancelCallback;
8589
8711
  var unstable_now = _ReactInternals$Sched.unstable_now;
8590
8712
  var unstable_scheduleCallback = _ReactInternals$Sched.unstable_scheduleCallback;
8591
8713
  var unstable_shouldYield = _ReactInternals$Sched.unstable_shouldYield;
8714
+ var unstable_getFirstCallbackNode = _ReactInternals$Sched.unstable_getFirstCallbackNode;
8715
+ var unstable_continueExecution = _ReactInternals$Sched.unstable_continueExecution;
8716
+ var unstable_pauseExecution = _ReactInternals$Sched.unstable_pauseExecution;
8592
8717
 
8593
8718
  // Renderers that don't support persistence
8594
8719
  // can re-export everything from this module.
@@ -9869,6 +9994,26 @@ function FiberNode(tag, pendingProps, key, mode) {
9869
9994
  this.alternate = null;
9870
9995
 
9871
9996
  if (enableProfilerTimer) {
9997
+ // Note: The following is done to avoid a v8 performance cliff.
9998
+ //
9999
+ // Initializing the fields below to smis and later updating them with
10000
+ // double values will cause Fibers to end up having separate shapes.
10001
+ // This behavior/bug has something to do with Object.preventExtension().
10002
+ // Fortunately this only impacts DEV builds.
10003
+ // Unfortunately it makes React unusably slow for some applications.
10004
+ // To work around this, initialize the fields below with doubles.
10005
+ //
10006
+ // Learn more about this here:
10007
+ // https://github.com/facebook/react/issues/14365
10008
+ // https://bugs.chromium.org/p/v8/issues/detail?id=8538
10009
+ this.actualDuration = Number.NaN;
10010
+ this.actualStartTime = Number.NaN;
10011
+ this.selfBaseDuration = Number.NaN;
10012
+ this.treeBaseDuration = Number.NaN;
10013
+
10014
+ // It's okay to replace the initial doubles with smis after initialization.
10015
+ // This won't trigger the performance cliff mentioned above,
10016
+ // and it simplifies other profiler code (including DevTools).
9872
10017
  this.actualDuration = 0;
9873
10018
  this.actualStartTime = -1;
9874
10019
  this.selfBaseDuration = 0;
@@ -10264,6 +10409,8 @@ function createFiberRoot(containerInfo, isConcurrent, hydrate) {
10264
10409
  latestSuspendedTime: NoWork,
10265
10410
  latestPingedTime: NoWork,
10266
10411
 
10412
+ pingCache: null,
10413
+
10267
10414
  didError: false,
10268
10415
 
10269
10416
  pendingCommitExpirationTime: NoWork,
@@ -10287,6 +10434,8 @@ function createFiberRoot(containerInfo, isConcurrent, hydrate) {
10287
10434
  containerInfo: containerInfo,
10288
10435
  pendingChildren: null,
10289
10436
 
10437
+ pingCache: null,
10438
+
10290
10439
  earliestPendingTime: NoWork,
10291
10440
  latestPendingTime: NoWork,
10292
10441
  earliestSuspendedTime: NoWork,
@@ -10661,6 +10810,10 @@ function markCommittedPriorityLevels(root, earliestRemainingTime) {
10661
10810
  return;
10662
10811
  }
10663
10812
 
10813
+ if (earliestRemainingTime < root.latestPingedTime) {
10814
+ root.latestPingedTime = NoWork;
10815
+ }
10816
+
10664
10817
  // Let's see if the previous latest known pending level was just flushed.
10665
10818
  var latestPendingTime = root.latestPendingTime;
10666
10819
  if (latestPendingTime !== NoWork) {
@@ -10786,10 +10939,8 @@ function markPingedPriorityLevel(root, pingedTime) {
10786
10939
  }
10787
10940
 
10788
10941
  function clearPing(root, completedTime) {
10789
- // TODO: Track whether the root was pinged during the render phase. If so,
10790
- // we need to make sure we don't lose track of it.
10791
10942
  var latestPingedTime = root.latestPingedTime;
10792
- if (latestPingedTime !== NoWork && latestPingedTime >= completedTime) {
10943
+ if (latestPingedTime >= completedTime) {
10793
10944
  root.latestPingedTime = NoWork;
10794
10945
  }
10795
10946
  }
@@ -11740,7 +11891,7 @@ function cloneHook(hook) {
11740
11891
  return {
11741
11892
  memoizedState: hook.memoizedState,
11742
11893
 
11743
- baseState: hook.memoizedState,
11894
+ baseState: hook.baseState,
11744
11895
  queue: hook.queue,
11745
11896
  baseUpdate: hook.baseUpdate,
11746
11897
 
@@ -11985,10 +12136,6 @@ function useRef(initialValue) {
11985
12136
  return ref;
11986
12137
  }
11987
12138
 
11988
- function useMutationEffect(create, inputs) {
11989
- useEffectImpl(Snapshot | Update, UnmountSnapshot | MountMutation, create, inputs);
11990
- }
11991
-
11992
12139
  function useLayoutEffect(create, inputs) {
11993
12140
  useEffectImpl(Update, UnmountMutation | MountLayout, create, inputs);
11994
12141
  }
@@ -12023,7 +12170,7 @@ function useImperativeMethods(ref, create, inputs) {
12023
12170
  // TODO: I've implemented this on top of useEffect because it's almost the
12024
12171
  // same thing, and it would require an equal amount of code. It doesn't seem
12025
12172
  // like a common enough use case to justify the additional size.
12026
- useEffectImpl(Update, UnmountMutation | MountLayout, function () {
12173
+ useLayoutEffect(function () {
12027
12174
  if (typeof ref === 'function') {
12028
12175
  var refCallback = ref;
12029
12176
  var _inst = create();
@@ -14185,12 +14332,14 @@ var didWarnAboutBadClass = void 0;
14185
14332
  var didWarnAboutContextTypeOnFunctionComponent = void 0;
14186
14333
  var didWarnAboutGetDerivedStateOnFunctionComponent = void 0;
14187
14334
  var didWarnAboutFunctionRefs = void 0;
14335
+ var didWarnAboutReassigningProps = void 0;
14188
14336
 
14189
14337
  {
14190
14338
  didWarnAboutBadClass = {};
14191
14339
  didWarnAboutContextTypeOnFunctionComponent = {};
14192
14340
  didWarnAboutGetDerivedStateOnFunctionComponent = {};
14193
14341
  didWarnAboutFunctionRefs = {};
14342
+ didWarnAboutReassigningProps = false;
14194
14343
  }
14195
14344
 
14196
14345
  function reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime) {
@@ -14229,6 +14378,18 @@ function forceUnmountCurrentAndReconcile(current$$1, workInProgress, nextChildre
14229
14378
  }
14230
14379
 
14231
14380
  function updateForwardRef(current$$1, workInProgress, Component, nextProps, renderExpirationTime) {
14381
+ {
14382
+ if (workInProgress.type !== workInProgress.elementType) {
14383
+ // Lazy component props can't be validated in createElement
14384
+ // because they're only guaranteed to be resolved here.
14385
+ var innerPropTypes = Component.propTypes;
14386
+ if (innerPropTypes) {
14387
+ checkPropTypes_1(innerPropTypes, nextProps, // Resolved props
14388
+ 'prop', getComponentName(Component), getCurrentFiberStackInDev);
14389
+ }
14390
+ }
14391
+ }
14392
+
14232
14393
  var render = Component.render;
14233
14394
  var ref = workInProgress.ref;
14234
14395
 
@@ -14253,20 +14414,44 @@ function updateForwardRef(current$$1, workInProgress, Component, nextProps, rend
14253
14414
  function updateMemoComponent(current$$1, workInProgress, Component, nextProps, updateExpirationTime, renderExpirationTime) {
14254
14415
  if (current$$1 === null) {
14255
14416
  var type = Component.type;
14256
- if (isSimpleFunctionComponent(type) && Component.compare === null) {
14417
+ if (isSimpleFunctionComponent(type) && Component.compare === null &&
14418
+ // SimpleMemoComponent codepath doesn't resolve outer props either.
14419
+ Component.defaultProps === undefined) {
14257
14420
  // If this is a plain function component without default props,
14258
14421
  // and with only the default shallow comparison, we upgrade it
14259
14422
  // to a SimpleMemoComponent to allow fast path updates.
14260
14423
  workInProgress.tag = SimpleMemoComponent;
14261
14424
  workInProgress.type = type;
14425
+ {
14426
+ validateFunctionComponentInDev(workInProgress, type);
14427
+ }
14262
14428
  return updateSimpleMemoComponent(current$$1, workInProgress, type, nextProps, updateExpirationTime, renderExpirationTime);
14263
14429
  }
14430
+ {
14431
+ var innerPropTypes = type.propTypes;
14432
+ if (innerPropTypes) {
14433
+ // Inner memo component props aren't currently validated in createElement.
14434
+ // We could move it there, but we'd still need this for lazy code path.
14435
+ checkPropTypes_1(innerPropTypes, nextProps, // Resolved props
14436
+ 'prop', getComponentName(type), getCurrentFiberStackInDev);
14437
+ }
14438
+ }
14264
14439
  var child = createFiberFromTypeAndProps(Component.type, null, nextProps, null, workInProgress.mode, renderExpirationTime);
14265
14440
  child.ref = workInProgress.ref;
14266
14441
  child.return = workInProgress;
14267
14442
  workInProgress.child = child;
14268
14443
  return child;
14269
14444
  }
14445
+ {
14446
+ var _type = Component.type;
14447
+ var _innerPropTypes = _type.propTypes;
14448
+ if (_innerPropTypes) {
14449
+ // Inner memo component props aren't currently validated in createElement.
14450
+ // We could move it there, but we'd still need this for lazy code path.
14451
+ checkPropTypes_1(_innerPropTypes, nextProps, // Resolved props
14452
+ 'prop', getComponentName(_type), getCurrentFiberStackInDev);
14453
+ }
14454
+ }
14270
14455
  var currentChild = current$$1.child; // This is always exactly one child
14271
14456
  if (updateExpirationTime < renderExpirationTime) {
14272
14457
  // This will be the props with resolved defaultProps,
@@ -14289,6 +14474,25 @@ function updateMemoComponent(current$$1, workInProgress, Component, nextProps, u
14289
14474
  }
14290
14475
 
14291
14476
  function updateSimpleMemoComponent(current$$1, workInProgress, Component, nextProps, updateExpirationTime, renderExpirationTime) {
14477
+ {
14478
+ if (workInProgress.type !== workInProgress.elementType) {
14479
+ // Lazy component props can't be validated in createElement
14480
+ // because they're only guaranteed to be resolved here.
14481
+ var outerMemoType = workInProgress.elementType;
14482
+ if (outerMemoType.$$typeof === REACT_LAZY_TYPE) {
14483
+ // We warn when you define propTypes on lazy()
14484
+ // so let's just skip over it to find memo() outer wrapper.
14485
+ // Inner props for memo are validated later.
14486
+ outerMemoType = refineResolvedLazyComponent(outerMemoType);
14487
+ }
14488
+ var outerPropTypes = outerMemoType && outerMemoType.propTypes;
14489
+ if (outerPropTypes) {
14490
+ checkPropTypes_1(outerPropTypes, nextProps, // Resolved (SimpleMemoComponent has no defaultProps)
14491
+ 'prop', getComponentName(outerMemoType), getCurrentFiberStackInDev);
14492
+ }
14493
+ // Inner propTypes will be validated in the function component path.
14494
+ }
14495
+ }
14292
14496
  if (current$$1 !== null && updateExpirationTime < renderExpirationTime) {
14293
14497
  var prevProps = current$$1.memoizedProps;
14294
14498
  if (shallowEqual(prevProps, nextProps) && current$$1.ref === workInProgress.ref) {
@@ -14329,6 +14533,18 @@ function markRef(current$$1, workInProgress) {
14329
14533
  }
14330
14534
 
14331
14535
  function updateFunctionComponent(current$$1, workInProgress, Component, nextProps, renderExpirationTime) {
14536
+ {
14537
+ if (workInProgress.type !== workInProgress.elementType) {
14538
+ // Lazy component props can't be validated in createElement
14539
+ // because they're only guaranteed to be resolved here.
14540
+ var innerPropTypes = Component.propTypes;
14541
+ if (innerPropTypes) {
14542
+ checkPropTypes_1(innerPropTypes, nextProps, // Resolved props
14543
+ 'prop', getComponentName(Component), getCurrentFiberStackInDev);
14544
+ }
14545
+ }
14546
+ }
14547
+
14332
14548
  var unmaskedContext = getUnmaskedContext(workInProgress, Component, true);
14333
14549
  var context = getMaskedContext(workInProgress, unmaskedContext);
14334
14550
 
@@ -14350,6 +14566,18 @@ function updateFunctionComponent(current$$1, workInProgress, Component, nextProp
14350
14566
  }
14351
14567
 
14352
14568
  function updateClassComponent(current$$1, workInProgress, Component, nextProps, renderExpirationTime) {
14569
+ {
14570
+ if (workInProgress.type !== workInProgress.elementType) {
14571
+ // Lazy component props can't be validated in createElement
14572
+ // because they're only guaranteed to be resolved here.
14573
+ var innerPropTypes = Component.propTypes;
14574
+ if (innerPropTypes) {
14575
+ checkPropTypes_1(innerPropTypes, nextProps, // Resolved props
14576
+ 'prop', getComponentName(Component), getCurrentFiberStackInDev);
14577
+ }
14578
+ }
14579
+ }
14580
+
14353
14581
  // Push context providers early to prevent context stack mismatches.
14354
14582
  // During mounting we don't know the child context yet as the instance doesn't exist.
14355
14583
  // We will invalidate the child context in finishClassComponent() right after rendering.
@@ -14385,7 +14613,15 @@ function updateClassComponent(current$$1, workInProgress, Component, nextProps,
14385
14613
  } else {
14386
14614
  shouldUpdate = updateClassInstance(current$$1, workInProgress, Component, nextProps, renderExpirationTime);
14387
14615
  }
14388
- return finishClassComponent(current$$1, workInProgress, Component, shouldUpdate, hasContext, renderExpirationTime);
14616
+ var nextUnitOfWork = finishClassComponent(current$$1, workInProgress, Component, shouldUpdate, hasContext, renderExpirationTime);
14617
+ {
14618
+ var inst = workInProgress.stateNode;
14619
+ if (inst.props !== nextProps) {
14620
+ !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;
14621
+ didWarnAboutReassigningProps = true;
14622
+ }
14623
+ }
14624
+ return nextUnitOfWork;
14389
14625
  }
14390
14626
 
14391
14627
  function finishClassComponent(current$$1, workInProgress, Component, shouldUpdate, hasContext, renderExpirationTime) {
@@ -14598,16 +14834,31 @@ function mountLazyComponent(_current, workInProgress, elementType, updateExpirat
14598
14834
  }
14599
14835
  case MemoComponent:
14600
14836
  {
14837
+ {
14838
+ if (workInProgress.type !== workInProgress.elementType) {
14839
+ var outerPropTypes = Component.propTypes;
14840
+ if (outerPropTypes) {
14841
+ checkPropTypes_1(outerPropTypes, resolvedProps, // Resolved for outer only
14842
+ 'prop', getComponentName(Component), getCurrentFiberStackInDev);
14843
+ }
14844
+ }
14845
+ }
14601
14846
  child = updateMemoComponent(null, workInProgress, Component, resolveDefaultProps(Component.type, resolvedProps), // The inner type can have defaults too
14602
14847
  updateExpirationTime, renderExpirationTime);
14603
14848
  break;
14604
14849
  }
14605
14850
  default:
14606
14851
  {
14852
+ var hint = '';
14853
+ {
14854
+ if (Component !== null && typeof Component === 'object' && Component.$$typeof === REACT_LAZY_TYPE) {
14855
+ hint = ' Did you wrap a component in React.lazy() more than once?';
14856
+ }
14857
+ }
14607
14858
  // This message intentionally doesn't mention ForwardRef or MemoComponent
14608
14859
  // because the fact that it's a separate type of work is an
14609
14860
  // implementation detail.
14610
- invariant(false, 'Element type is invalid. Received a promise that resolves to: %s. Promise elements must resolve to a class or function.', Component);
14861
+ 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);
14611
14862
  }
14612
14863
  }
14613
14864
  return child;
@@ -14721,48 +14972,52 @@ function mountIndeterminateComponent(_current, workInProgress, Component, render
14721
14972
  // Proceed under the assumption that this is a function component
14722
14973
  workInProgress.tag = FunctionComponent;
14723
14974
  value = finishHooks(Component, props, value, context);
14975
+ reconcileChildren(null, workInProgress, value, renderExpirationTime);
14724
14976
  {
14725
- if (Component) {
14726
- !!Component.childContextTypes ? warningWithoutStack$1(false, '%s(...): childContextTypes cannot be defined on a function component.', Component.displayName || Component.name || 'Component') : void 0;
14727
- }
14728
- if (workInProgress.ref !== null) {
14729
- var info = '';
14730
- var ownerName = getCurrentFiberOwnerNameInDevOrNull();
14731
- if (ownerName) {
14732
- info += '\n\nCheck the render method of `' + ownerName + '`.';
14733
- }
14977
+ validateFunctionComponentInDev(workInProgress, Component);
14978
+ }
14979
+ return workInProgress.child;
14980
+ }
14981
+ }
14734
14982
 
14735
- var warningKey = ownerName || workInProgress._debugID || '';
14736
- var debugSource = workInProgress._debugSource;
14737
- if (debugSource) {
14738
- warningKey = debugSource.fileName + ':' + debugSource.lineNumber;
14739
- }
14740
- if (!didWarnAboutFunctionRefs[warningKey]) {
14741
- didWarnAboutFunctionRefs[warningKey] = true;
14742
- warning$1(false, 'Function components cannot be given refs. ' + 'Attempts to access this ref will fail.%s', info);
14743
- }
14744
- }
14983
+ function validateFunctionComponentInDev(workInProgress, Component) {
14984
+ if (Component) {
14985
+ !!Component.childContextTypes ? warningWithoutStack$1(false, '%s(...): childContextTypes cannot be defined on a function component.', Component.displayName || Component.name || 'Component') : void 0;
14986
+ }
14987
+ if (workInProgress.ref !== null) {
14988
+ var info = '';
14989
+ var ownerName = getCurrentFiberOwnerNameInDevOrNull();
14990
+ if (ownerName) {
14991
+ info += '\n\nCheck the render method of `' + ownerName + '`.';
14992
+ }
14745
14993
 
14746
- if (typeof Component.getDerivedStateFromProps === 'function') {
14747
- var _componentName = getComponentName(Component) || 'Unknown';
14994
+ var warningKey = ownerName || workInProgress._debugID || '';
14995
+ var debugSource = workInProgress._debugSource;
14996
+ if (debugSource) {
14997
+ warningKey = debugSource.fileName + ':' + debugSource.lineNumber;
14998
+ }
14999
+ if (!didWarnAboutFunctionRefs[warningKey]) {
15000
+ didWarnAboutFunctionRefs[warningKey] = true;
15001
+ warning$1(false, 'Function components cannot be given refs. ' + 'Attempts to access this ref will fail.%s', info);
15002
+ }
15003
+ }
14748
15004
 
14749
- if (!didWarnAboutGetDerivedStateOnFunctionComponent[_componentName]) {
14750
- warningWithoutStack$1(false, '%s: Function components do not support getDerivedStateFromProps.', _componentName);
14751
- didWarnAboutGetDerivedStateOnFunctionComponent[_componentName] = true;
14752
- }
14753
- }
15005
+ if (typeof Component.getDerivedStateFromProps === 'function') {
15006
+ var componentName = getComponentName(Component) || 'Unknown';
14754
15007
 
14755
- if (typeof Component.contextType === 'object' && Component.contextType !== null) {
14756
- var _componentName2 = getComponentName(Component) || 'Unknown';
15008
+ if (!didWarnAboutGetDerivedStateOnFunctionComponent[componentName]) {
15009
+ warningWithoutStack$1(false, '%s: Function components do not support getDerivedStateFromProps.', componentName);
15010
+ didWarnAboutGetDerivedStateOnFunctionComponent[componentName] = true;
15011
+ }
15012
+ }
14757
15013
 
14758
- if (!didWarnAboutContextTypeOnFunctionComponent[_componentName2]) {
14759
- warningWithoutStack$1(false, '%s: Function components do not support contextType.', _componentName2);
14760
- didWarnAboutContextTypeOnFunctionComponent[_componentName2] = true;
14761
- }
14762
- }
15014
+ if (typeof Component.contextType === 'object' && Component.contextType !== null) {
15015
+ var _componentName = getComponentName(Component) || 'Unknown';
15016
+
15017
+ if (!didWarnAboutContextTypeOnFunctionComponent[_componentName]) {
15018
+ warningWithoutStack$1(false, '%s: Function components do not support contextType.', _componentName);
15019
+ didWarnAboutContextTypeOnFunctionComponent[_componentName] = true;
14763
15020
  }
14764
- reconcileChildren(null, workInProgress, value, renderExpirationTime);
14765
- return workInProgress.child;
14766
15021
  }
14767
15022
  }
14768
15023
 
@@ -14964,6 +15219,7 @@ function updateSuspenseComponent(current$$1, workInProgress, renderExpirationTim
14964
15219
  next = child = reconcileChildFibers(workInProgress, _currentPrimaryChild, _nextPrimaryChildren2, renderExpirationTime);
14965
15220
  }
14966
15221
  }
15222
+ workInProgress.stateNode = current$$1.stateNode;
14967
15223
  }
14968
15224
 
14969
15225
  workInProgress.memoizedState = nextState;
@@ -15234,10 +15490,21 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
15234
15490
  return updateContextConsumer(current$$1, workInProgress, renderExpirationTime);
15235
15491
  case MemoComponent:
15236
15492
  {
15237
- var _type = workInProgress.type;
15493
+ var _type2 = workInProgress.type;
15238
15494
  var _unresolvedProps3 = workInProgress.pendingProps;
15239
- var _resolvedProps3 = resolveDefaultProps(_type.type, _unresolvedProps3);
15240
- return updateMemoComponent(current$$1, workInProgress, _type, _resolvedProps3, updateExpirationTime, renderExpirationTime);
15495
+ // Resolve outer props first, then resolve inner props.
15496
+ var _resolvedProps3 = resolveDefaultProps(_type2, _unresolvedProps3);
15497
+ {
15498
+ if (workInProgress.type !== workInProgress.elementType) {
15499
+ var outerPropTypes = _type2.propTypes;
15500
+ if (outerPropTypes) {
15501
+ checkPropTypes_1(outerPropTypes, _resolvedProps3, // Resolved for outer only
15502
+ 'prop', getComponentName(_type2), getCurrentFiberStackInDev);
15503
+ }
15504
+ }
15505
+ }
15506
+ _resolvedProps3 = resolveDefaultProps(_type2.type, _resolvedProps3);
15507
+ return updateMemoComponent(current$$1, workInProgress, _type2, _resolvedProps3, updateExpirationTime, renderExpirationTime);
15241
15508
  }
15242
15509
  case SimpleMemoComponent:
15243
15510
  {
@@ -15796,7 +16063,7 @@ function completeWork(current, workInProgress, renderExpirationTime) {
15796
16063
  return null;
15797
16064
  }
15798
16065
 
15799
- function shouldCaptureSuspense(current, workInProgress) {
16066
+ function shouldCaptureSuspense(workInProgress) {
15800
16067
  // In order to capture, the Suspense component must have a fallback prop.
15801
16068
  if (workInProgress.memoizedProps.fallback === undefined) {
15802
16069
  return false;
@@ -15879,6 +16146,8 @@ var didWarnAboutUndefinedSnapshotBeforeUpdate = null;
15879
16146
  didWarnAboutUndefinedSnapshotBeforeUpdate = new Set();
15880
16147
  }
15881
16148
 
16149
+ var PossiblyWeakSet = typeof WeakSet === 'function' ? WeakSet : Set;
16150
+
15882
16151
  function logError(boundary, errorInfo) {
15883
16152
  var source = errorInfo.source;
15884
16153
  var stack = errorInfo.stack;
@@ -15983,9 +16252,9 @@ function commitBeforeMutationLifeCycles(current$$1, finishedWork) {
15983
16252
  // but instead we rely on them being set during last render.
15984
16253
  // TODO: revisit this when we implement resuming.
15985
16254
  {
15986
- if (finishedWork.type === finishedWork.elementType) {
15987
- !(instance.props === finishedWork.memoizedProps) ? warning$1(false, 'Expected instance props to match memoized props before ' + 'getSnapshotBeforeUpdate. This is likely due to a bug in React. ' + 'Please file an issue.') : void 0;
15988
- !(instance.state === finishedWork.memoizedState) ? warning$1(false, 'Expected instance state to match memoized state before ' + 'getSnapshotBeforeUpdate. This is likely due to a bug in React. ' + 'Please file an issue.') : void 0;
16255
+ if (finishedWork.type === finishedWork.elementType && !didWarnAboutReassigningProps) {
16256
+ !(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;
16257
+ !(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;
15989
16258
  }
15990
16259
  }
15991
16260
  var snapshot = instance.getSnapshotBeforeUpdate(finishedWork.elementType === finishedWork.type ? prevProps : resolveDefaultProps(finishedWork.type, prevProps), prevState);
@@ -16041,7 +16310,7 @@ function commitHookEffectList(unmountTag, mountTag, finishedWork) {
16041
16310
  if (typeof _destroy !== 'function') {
16042
16311
  {
16043
16312
  if (_destroy !== null && _destroy !== undefined) {
16044
- warningWithoutStack$1(false, 'useEffect function must return a cleanup function or ' + 'nothing.%s%s', typeof _destroy.then === 'function' ? ' Promises and useEffect(async () => ...) are not ' + 'supported, but you can call an async function inside an ' + 'effect.' : '', getStackByFiberInDevAndProd(finishedWork));
16313
+ 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));
16045
16314
  }
16046
16315
  }
16047
16316
  _destroy = null;
@@ -16077,9 +16346,9 @@ function commitLifeCycles(finishedRoot, current$$1, finishedWork, committedExpir
16077
16346
  // but instead we rely on them being set during last render.
16078
16347
  // TODO: revisit this when we implement resuming.
16079
16348
  {
16080
- if (finishedWork.type === finishedWork.elementType) {
16081
- !(instance.props === finishedWork.memoizedProps) ? warning$1(false, 'Expected instance props to match memoized props before ' + 'componentDidMount. This is likely due to a bug in React. ' + 'Please file an issue.') : void 0;
16082
- !(instance.state === finishedWork.memoizedState) ? warning$1(false, 'Expected instance state to match memoized state before ' + 'componentDidMount. This is likely due to a bug in React. ' + 'Please file an issue.') : void 0;
16349
+ if (finishedWork.type === finishedWork.elementType && !didWarnAboutReassigningProps) {
16350
+ !(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;
16351
+ !(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;
16083
16352
  }
16084
16353
  }
16085
16354
  instance.componentDidMount();
@@ -16092,9 +16361,9 @@ function commitLifeCycles(finishedRoot, current$$1, finishedWork, committedExpir
16092
16361
  // but instead we rely on them being set during last render.
16093
16362
  // TODO: revisit this when we implement resuming.
16094
16363
  {
16095
- if (finishedWork.type === finishedWork.elementType) {
16096
- !(instance.props === finishedWork.memoizedProps) ? warning$1(false, 'Expected instance props to match memoized props before ' + 'componentDidUpdate. This is likely due to a bug in React. ' + 'Please file an issue.') : void 0;
16097
- !(instance.state === finishedWork.memoizedState) ? warning$1(false, 'Expected instance state to match memoized state before ' + 'componentDidUpdate. This is likely due to a bug in React. ' + 'Please file an issue.') : void 0;
16364
+ if (finishedWork.type === finishedWork.elementType && !didWarnAboutReassigningProps) {
16365
+ !(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;
16366
+ !(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;
16098
16367
  }
16099
16368
  }
16100
16369
  instance.componentDidUpdate(prevProps, prevState, instance.__reactInternalSnapshotBeforeUpdate);
@@ -16104,9 +16373,9 @@ function commitLifeCycles(finishedRoot, current$$1, finishedWork, committedExpir
16104
16373
  var updateQueue = finishedWork.updateQueue;
16105
16374
  if (updateQueue !== null) {
16106
16375
  {
16107
- if (finishedWork.type === finishedWork.elementType) {
16108
- !(instance.props === finishedWork.memoizedProps) ? warning$1(false, 'Expected instance props to match memoized props before ' + 'processing the update queue. This is likely due to a bug in React. ' + 'Please file an issue.') : void 0;
16109
- !(instance.state === finishedWork.memoizedState) ? warning$1(false, 'Expected instance state to match memoized state before ' + 'processing the update queue. This is likely due to a bug in React. ' + 'Please file an issue.') : void 0;
16376
+ if (finishedWork.type === finishedWork.elementType && !didWarnAboutReassigningProps) {
16377
+ !(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;
16378
+ !(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;
16110
16379
  }
16111
16380
  }
16112
16381
  // We could update instance props and state here,
@@ -16365,9 +16634,14 @@ function detachFiber(current$$1) {
16365
16634
  // itself will be GC:ed when the parent updates the next time.
16366
16635
  current$$1.return = null;
16367
16636
  current$$1.child = null;
16368
- if (current$$1.alternate) {
16369
- current$$1.alternate.child = null;
16370
- current$$1.alternate.return = null;
16637
+ current$$1.memoizedState = null;
16638
+ current$$1.updateQueue = null;
16639
+ var alternate = current$$1.alternate;
16640
+ if (alternate !== null) {
16641
+ alternate.return = null;
16642
+ alternate.child = null;
16643
+ alternate.memoizedState = null;
16644
+ alternate.updateQueue = null;
16371
16645
  }
16372
16646
  }
16373
16647
 
@@ -16656,6 +16930,8 @@ function commitWork(current$$1, finishedWork) {
16656
16930
  case MemoComponent:
16657
16931
  case SimpleMemoComponent:
16658
16932
  {
16933
+ // Note: We currently never use MountMutation, but useLayout uses
16934
+ // UnmountMutation.
16659
16935
  commitHookEffectList(UnmountMutation, MountMutation, finishedWork);
16660
16936
  return;
16661
16937
  }
@@ -16671,6 +16947,8 @@ function commitWork(current$$1, finishedWork) {
16671
16947
  case MemoComponent:
16672
16948
  case SimpleMemoComponent:
16673
16949
  {
16950
+ // Note: We currently never use MountMutation, but useLayout uses
16951
+ // UnmountMutation.
16674
16952
  commitHookEffectList(UnmountMutation, MountMutation, finishedWork);
16675
16953
  return;
16676
16954
  }
@@ -16740,6 +17018,30 @@ function commitWork(current$$1, finishedWork) {
16740
17018
  if (primaryChildParent !== null) {
16741
17019
  hideOrUnhideAllChildren(primaryChildParent, newDidTimeout);
16742
17020
  }
17021
+
17022
+ // If this boundary just timed out, then it will have a set of thenables.
17023
+ // For each thenable, attach a listener so that when it resolves, React
17024
+ // attempts to re-render the boundary in the primary (pre-timeout) state.
17025
+ var thenables = finishedWork.updateQueue;
17026
+ if (thenables !== null) {
17027
+ finishedWork.updateQueue = null;
17028
+ var retryCache = finishedWork.stateNode;
17029
+ if (retryCache === null) {
17030
+ retryCache = finishedWork.stateNode = new PossiblyWeakSet();
17031
+ }
17032
+ thenables.forEach(function (thenable) {
17033
+ // Memoize using the boundary fiber to prevent redundant listeners.
17034
+ var retry = retryTimedOutBoundary.bind(null, finishedWork, thenable);
17035
+ if (enableSchedulerTracing) {
17036
+ retry = unstable_wrap(retry);
17037
+ }
17038
+ if (!retryCache.has(thenable)) {
17039
+ retryCache.add(thenable);
17040
+ thenable.then(retry, retry);
17041
+ }
17042
+ });
17043
+ }
17044
+
16743
17045
  return;
16744
17046
  }
16745
17047
  case IncompleteClassComponent:
@@ -16760,6 +17062,8 @@ function commitResetTextContent(current$$1) {
16760
17062
  resetTextContent(current$$1.stateNode);
16761
17063
  }
16762
17064
 
17065
+ var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;
17066
+
16763
17067
  function createRootErrorUpdate(fiber, errorInfo, expirationTime) {
16764
17068
  var update = createUpdate(expirationTime);
16765
17069
  // Unmount the root by rendering null.
@@ -16863,19 +17167,16 @@ function throwException(root, returnFiber, sourceFiber, value, renderExpirationT
16863
17167
  // Schedule the nearest Suspense to re-render the timed out view.
16864
17168
  _workInProgress = returnFiber;
16865
17169
  do {
16866
- if (_workInProgress.tag === SuspenseComponent && shouldCaptureSuspense(_workInProgress.alternate, _workInProgress)) {
17170
+ if (_workInProgress.tag === SuspenseComponent && shouldCaptureSuspense(_workInProgress)) {
16867
17171
  // Found the nearest boundary.
16868
17172
 
16869
- // If the boundary is not in concurrent mode, we should not suspend, and
16870
- // likewise, when the promise resolves, we should ping synchronously.
16871
- var pingTime = (_workInProgress.mode & ConcurrentMode) === NoEffect ? Sync : renderExpirationTime;
16872
-
16873
- // Attach a listener to the promise to "ping" the root and retry.
16874
- var onResolveOrReject = retrySuspendedRoot.bind(null, root, _workInProgress, sourceFiber, pingTime);
16875
- if (enableSchedulerTracing) {
16876
- onResolveOrReject = unstable_wrap(onResolveOrReject);
17173
+ // Stash the promise on the boundary fiber. If the boundary times out, we'll
17174
+ var thenables = _workInProgress.updateQueue;
17175
+ if (thenables === null) {
17176
+ _workInProgress.updateQueue = new Set([thenable]);
17177
+ } else {
17178
+ thenables.add(thenable);
16877
17179
  }
16878
- thenable.then(onResolveOrReject, onResolveOrReject);
16879
17180
 
16880
17181
  // If the boundary is outside of concurrent mode, we should *not*
16881
17182
  // suspend the commit. Pretend as if the suspended component rendered
@@ -16894,18 +17195,25 @@ function throwException(root, returnFiber, sourceFiber, value, renderExpirationT
16894
17195
  sourceFiber.effectTag &= ~(LifecycleEffectMask | Incomplete);
16895
17196
 
16896
17197
  if (sourceFiber.tag === ClassComponent) {
16897
- var _current = sourceFiber.alternate;
16898
- if (_current === null) {
17198
+ var currentSourceFiber = sourceFiber.alternate;
17199
+ if (currentSourceFiber === null) {
16899
17200
  // This is a new mount. Change the tag so it's not mistaken for a
16900
17201
  // completed class component. For example, we should not call
16901
17202
  // componentWillUnmount if it is deleted.
16902
17203
  sourceFiber.tag = IncompleteClassComponent;
17204
+ } else {
17205
+ // When we try rendering again, we should not reuse the current fiber,
17206
+ // since it's known to be in an inconsistent state. Use a force updte to
17207
+ // prevent a bail out.
17208
+ var update = createUpdate(Sync);
17209
+ update.tag = ForceUpdate;
17210
+ enqueueUpdate(sourceFiber, update);
16903
17211
  }
16904
17212
  }
16905
17213
 
16906
- // The source fiber did not complete. Mark it with the current
16907
- // render priority to indicate that it still has pending work.
16908
- sourceFiber.expirationTime = renderExpirationTime;
17214
+ // The source fiber did not complete. Mark it with Sync priority to
17215
+ // indicate that it still has pending work.
17216
+ sourceFiber.expirationTime = Sync;
16909
17217
 
16910
17218
  // Exit without suspending.
16911
17219
  return;
@@ -16914,6 +17222,32 @@ function throwException(root, returnFiber, sourceFiber, value, renderExpirationT
16914
17222
  // Confirmed that the boundary is in a concurrent mode tree. Continue
16915
17223
  // with the normal suspend path.
16916
17224
 
17225
+ // Attach a listener to the promise to "ping" the root and retry. But
17226
+ // only if one does not already exist for the current render expiration
17227
+ // time (which acts like a "thread ID" here).
17228
+ var pingCache = root.pingCache;
17229
+ var threadIDs = void 0;
17230
+ if (pingCache === null) {
17231
+ pingCache = root.pingCache = new PossiblyWeakMap();
17232
+ threadIDs = new Set();
17233
+ pingCache.set(thenable, threadIDs);
17234
+ } else {
17235
+ threadIDs = pingCache.get(thenable);
17236
+ if (threadIDs === undefined) {
17237
+ threadIDs = new Set();
17238
+ pingCache.set(thenable, threadIDs);
17239
+ }
17240
+ }
17241
+ if (!threadIDs.has(renderExpirationTime)) {
17242
+ // Memoize using the thread ID to prevent redundant listeners.
17243
+ threadIDs.add(renderExpirationTime);
17244
+ var ping = pingSuspendedRoot.bind(null, root, thenable, renderExpirationTime);
17245
+ if (enableSchedulerTracing) {
17246
+ ping = unstable_wrap(ping);
17247
+ }
17248
+ thenable.then(ping, ping);
17249
+ }
17250
+
16917
17251
  var absoluteTimeoutMs = void 0;
16918
17252
  if (earliestTimeoutMs === -1) {
16919
17253
  // If no explicit threshold is given, default to an abitrarily large
@@ -16970,8 +17304,8 @@ function throwException(root, returnFiber, sourceFiber, value, renderExpirationT
16970
17304
  var _errorInfo = value;
16971
17305
  workInProgress.effectTag |= ShouldCapture;
16972
17306
  workInProgress.expirationTime = renderExpirationTime;
16973
- var update = createRootErrorUpdate(workInProgress, _errorInfo, renderExpirationTime);
16974
- enqueueCapturedUpdate(workInProgress, update);
17307
+ var _update = createRootErrorUpdate(workInProgress, _errorInfo, renderExpirationTime);
17308
+ enqueueCapturedUpdate(workInProgress, _update);
16975
17309
  return;
16976
17310
  }
16977
17311
  case ClassComponent:
@@ -16983,8 +17317,8 @@ function throwException(root, returnFiber, sourceFiber, value, renderExpirationT
16983
17317
  workInProgress.effectTag |= ShouldCapture;
16984
17318
  workInProgress.expirationTime = renderExpirationTime;
16985
17319
  // Schedule the error boundary to re-render using updated state
16986
- var _update = createClassErrorUpdate(workInProgress, errorInfo, renderExpirationTime);
16987
- enqueueCapturedUpdate(workInProgress, _update);
17320
+ var _update2 = createClassErrorUpdate(workInProgress, errorInfo, renderExpirationTime);
17321
+ enqueueCapturedUpdate(workInProgress, _update2);
16988
17322
  return;
16989
17323
  }
16990
17324
  break;
@@ -17085,7 +17419,6 @@ var Dispatcher = {
17085
17419
  useImperativeMethods: useImperativeMethods,
17086
17420
  useLayoutEffect: useLayoutEffect,
17087
17421
  useMemo: useMemo,
17088
- useMutationEffect: useMutationEffect,
17089
17422
  useReducer: useReducer,
17090
17423
  useRef: useRef,
17091
17424
  useState: useState
@@ -18360,56 +18693,54 @@ function renderDidError() {
18360
18693
  nextRenderDidError = true;
18361
18694
  }
18362
18695
 
18363
- function retrySuspendedRoot(root, boundaryFiber, sourceFiber, suspendedTime) {
18364
- var retryTime = void 0;
18696
+ function pingSuspendedRoot(root, thenable, pingTime) {
18697
+ // A promise that previously suspended React from committing has resolved.
18698
+ // If React is still suspended, try again at the previous level (pingTime).
18365
18699
 
18366
- if (isPriorityLevelSuspended(root, suspendedTime)) {
18367
- // Ping at the original level
18368
- retryTime = suspendedTime;
18369
-
18370
- markPingedPriorityLevel(root, retryTime);
18371
- } else {
18372
- // Suspense already timed out. Compute a new expiration time
18373
- var currentTime = requestCurrentTime();
18374
- retryTime = computeExpirationForFiber(currentTime, boundaryFiber);
18375
- markPendingPriorityLevel(root, retryTime);
18700
+ var pingCache = root.pingCache;
18701
+ if (pingCache !== null) {
18702
+ // The thenable resolved, so we no longer need to memoize, because it will
18703
+ // never be thrown again.
18704
+ pingCache.delete(thenable);
18376
18705
  }
18377
18706
 
18378
- // TODO: If the suspense fiber has already rendered the primary children
18379
- // without suspending (that is, all of the promises have already resolved),
18380
- // we should not trigger another update here. One case this happens is when
18381
- // we are in sync mode and a single promise is thrown both on initial render
18382
- // and on update; we attach two .then(retrySuspendedRoot) callbacks and each
18383
- // one performs Sync work, rerendering the Suspense.
18384
-
18385
- if ((boundaryFiber.mode & ConcurrentMode) !== NoContext) {
18386
- if (root === nextRoot && nextRenderExpirationTime === suspendedTime) {
18387
- // Received a ping at the same priority level at which we're currently
18388
- // rendering. Restart from the root.
18389
- nextRoot = null;
18707
+ if (nextRoot !== null && nextRenderExpirationTime === pingTime) {
18708
+ // Received a ping at the same priority level at which we're currently
18709
+ // rendering. Restart from the root.
18710
+ nextRoot = null;
18711
+ } else {
18712
+ // Confirm that the root is still suspended at this level. Otherwise exit.
18713
+ if (isPriorityLevelSuspended(root, pingTime)) {
18714
+ // Ping at the original level
18715
+ markPingedPriorityLevel(root, pingTime);
18716
+ var rootExpirationTime = root.expirationTime;
18717
+ if (rootExpirationTime !== NoWork) {
18718
+ requestWork(root, rootExpirationTime);
18719
+ }
18390
18720
  }
18391
18721
  }
18722
+ }
18392
18723
 
18393
- scheduleWorkToRoot(boundaryFiber, retryTime);
18394
- if ((boundaryFiber.mode & ConcurrentMode) === NoContext) {
18395
- // Outside of concurrent mode, we must schedule an update on the source
18396
- // fiber, too, since it already committed in an inconsistent state and
18397
- // therefore does not have any pending work.
18398
- scheduleWorkToRoot(sourceFiber, retryTime);
18399
- var sourceTag = sourceFiber.tag;
18400
- if (sourceTag === ClassComponent && sourceFiber.stateNode !== null) {
18401
- // When we try rendering again, we should not reuse the current fiber,
18402
- // since it's known to be in an inconsistent state. Use a force updte to
18403
- // prevent a bail out.
18404
- var update = createUpdate(retryTime);
18405
- update.tag = ForceUpdate;
18406
- enqueueUpdate(sourceFiber, update);
18407
- }
18724
+ function retryTimedOutBoundary(boundaryFiber, thenable) {
18725
+ // The boundary fiber (a Suspense component) previously timed out and was
18726
+ // rendered in its fallback state. One of the promises that suspended it has
18727
+ // resolved, which means at least part of the tree was likely unblocked. Try
18728
+ var retryCache = boundaryFiber.stateNode;
18729
+ if (retryCache !== null) {
18730
+ // The thenable resolved, so we no longer need to memoize, because it will
18731
+ // never be thrown again.
18732
+ retryCache.delete(thenable);
18408
18733
  }
18409
18734
 
18410
- var rootExpirationTime = root.expirationTime;
18411
- if (rootExpirationTime !== NoWork) {
18412
- requestWork(root, rootExpirationTime);
18735
+ var currentTime = requestCurrentTime();
18736
+ var retryTime = computeExpirationForFiber(currentTime, boundaryFiber);
18737
+ var root = scheduleWorkToRoot(boundaryFiber, retryTime);
18738
+ if (root !== null) {
18739
+ markPendingPriorityLevel(root, retryTime);
18740
+ var rootExpirationTime = root.expirationTime;
18741
+ if (rootExpirationTime !== NoWork) {
18742
+ requestWork(root, rootExpirationTime);
18743
+ }
18413
18744
  }
18414
18745
  }
18415
18746
 
@@ -19299,10 +19630,40 @@ function findHostInstanceWithNoPortals(fiber) {
19299
19630
  return hostFiber.stateNode;
19300
19631
  }
19301
19632
 
19633
+ var overrideProps = null;
19634
+
19635
+ {
19636
+ var copyWithSetImpl = function (obj, path, idx, value) {
19637
+ if (idx >= path.length) {
19638
+ return value;
19639
+ }
19640
+ var key = path[idx];
19641
+ var updated = Array.isArray(obj) ? obj.slice() : _assign({}, obj);
19642
+ // $FlowFixMe number or string is fine here
19643
+ updated[key] = copyWithSetImpl(obj[key], path, idx + 1, value);
19644
+ return updated;
19645
+ };
19646
+
19647
+ var copyWithSet = function (obj, path, value) {
19648
+ return copyWithSetImpl(obj, path, 0, value);
19649
+ };
19650
+
19651
+ // Support DevTools props for function components, forwardRef, memo, host components, etc.
19652
+ overrideProps = function (fiber, path, value) {
19653
+ flushPassiveEffects();
19654
+ fiber.pendingProps = copyWithSet(fiber.memoizedProps, path, value);
19655
+ if (fiber.alternate) {
19656
+ fiber.alternate.pendingProps = fiber.pendingProps;
19657
+ }
19658
+ scheduleWork(fiber, Sync);
19659
+ };
19660
+ }
19661
+
19302
19662
  function injectIntoDevTools(devToolsConfig) {
19303
19663
  var findFiberByHostInstance = devToolsConfig.findFiberByHostInstance;
19304
19664
 
19305
19665
  return injectInternals(_assign({}, devToolsConfig, {
19666
+ overrideProps: overrideProps,
19306
19667
  findHostInstanceByFiber: function (fiber) {
19307
19668
  var hostFiber = findCurrentHostFiber(fiber);
19308
19669
  if (hostFiber === null) {
@@ -19340,7 +19701,7 @@ implementation) {
19340
19701
 
19341
19702
  // TODO: this is special because it gets imported during build.
19342
19703
 
19343
- var ReactVersion = '16.6.3';
19704
+ var ReactVersion = '16.7.0';
19344
19705
 
19345
19706
  // TODO: This type is shared between the reconciler and ReactDOM, but will
19346
19707
  // eventually be lifted out to the renderer.
@@ -19698,7 +20059,7 @@ function legacyRenderSubtreeIntoContainer(parentComponent, children, container,
19698
20059
  return getPublicRootInstance(root._internalRoot);
19699
20060
  }
19700
20061
 
19701
- function createPortal(children, container) {
20062
+ function createPortal$$1(children, container) {
19702
20063
  var key = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
19703
20064
 
19704
20065
  !isValidContainer(container) ? invariant(false, 'Target container is not a DOM element.') : void 0;
@@ -19707,7 +20068,7 @@ function createPortal(children, container) {
19707
20068
  }
19708
20069
 
19709
20070
  var ReactDOM = {
19710
- createPortal: createPortal,
20071
+ createPortal: createPortal$$1,
19711
20072
 
19712
20073
  findDOMNode: function (componentOrElement) {
19713
20074
  {
@@ -19782,7 +20143,7 @@ var ReactDOM = {
19782
20143
  didWarnAboutUnstableCreatePortal = true;
19783
20144
  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.');
19784
20145
  }
19785
- return createPortal.apply(undefined, arguments);
20146
+ return createPortal$$1.apply(undefined, arguments);
19786
20147
  },
19787
20148
 
19788
20149
 
@@ -19792,6 +20153,7 @@ var ReactDOM = {
19792
20153
 
19793
20154
  flushSync: flushSync,
19794
20155
 
20156
+ unstable_createRoot: createRoot,
19795
20157
  unstable_flushControlled: flushControlled,
19796
20158
 
19797
20159
  __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: {
@@ -19810,8 +20172,7 @@ function createRoot(container, options) {
19810
20172
 
19811
20173
  if (enableStableConcurrentModeAPIs) {
19812
20174
  ReactDOM.createRoot = createRoot;
19813
- } else {
19814
- ReactDOM.unstable_createRoot = createRoot;
20175
+ ReactDOM.unstable_createRoot = undefined;
19815
20176
  }
19816
20177
 
19817
20178
  var foundDevTools = injectIntoDevTools({