react-dom 16.6.0-alpha.8af6728 → 16.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- /** @license React v16.6.0-alpha.8af6728
1
+ /** @license React v16.6.0
2
2
  * react-dom.development.js
3
3
  *
4
4
  * Copyright (c) Facebook, Inc. and its affiliates.
@@ -867,24 +867,23 @@ function runExtractedEventsInBatch(topLevelType, targetInst, nativeEvent, native
867
867
  }
868
868
 
869
869
  var FunctionComponent = 0;
870
- var FunctionComponentLazy = 1;
871
- var ClassComponent = 2;
872
- var ClassComponentLazy = 3;
873
- var IndeterminateComponent = 4; // Before we know whether it is function or class
874
- var HostRoot = 5; // Root of a host tree. Could be nested inside another node.
875
- var HostPortal = 6; // A subtree. Could be an entry point to a different renderer.
876
- var HostComponent = 7;
877
- var HostText = 8;
878
- var Fragment = 9;
879
- var Mode = 10;
880
- var ContextConsumer = 11;
881
- var ContextProvider = 12;
882
- var ForwardRef = 13;
883
- var ForwardRefLazy = 14;
884
- var Profiler = 15;
885
- var SuspenseComponent = 16;
886
- var PureComponent = 17;
887
- var PureComponentLazy = 18;
870
+ var ClassComponent = 1;
871
+ var IndeterminateComponent = 2; // Before we know whether it is function or class
872
+ var HostRoot = 3; // Root of a host tree. Could be nested inside another node.
873
+ var HostPortal = 4; // A subtree. Could be an entry point to a different renderer.
874
+ var HostComponent = 5;
875
+ var HostText = 6;
876
+ var Fragment = 7;
877
+ var Mode = 8;
878
+ var ContextConsumer = 9;
879
+ var ContextProvider = 10;
880
+ var ForwardRef = 11;
881
+ var Profiler = 12;
882
+ var SuspenseComponent = 13;
883
+ var MemoComponent = 14;
884
+ var SimpleMemoComponent = 15;
885
+ var LazyComponent = 16;
886
+ var IncompleteClassComponent = 17;
888
887
 
889
888
  var randomKey = Math.random().toString(36).slice(2);
890
889
  var internalInstanceKey = '__reactInternalInstance$' + randomKey;
@@ -2473,7 +2472,8 @@ var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace;
2473
2472
  var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
2474
2473
  var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
2475
2474
  var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
2476
- var REACT_PURE_TYPE = hasSymbol ? Symbol.for('react.pure') : 0xead3;
2475
+ var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
2476
+ var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
2477
2477
 
2478
2478
  var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
2479
2479
  var FAUX_ITERATOR_SYMBOL = '@@iterator';
@@ -2493,12 +2493,13 @@ var Pending = 0;
2493
2493
  var Resolved = 1;
2494
2494
  var Rejected = 2;
2495
2495
 
2496
- function getResultFromResolvedThenable(thenable) {
2497
- return thenable._reactResult;
2496
+ function refineResolvedLazyComponent(lazyComponent) {
2497
+ return lazyComponent._status === Resolved ? lazyComponent._result : null;
2498
2498
  }
2499
2499
 
2500
- function refineResolvedThenable(thenable) {
2501
- return thenable._reactStatus === Resolved ? thenable._reactResult : null;
2500
+ function getWrappedName(outerType, innerType, wrapperName) {
2501
+ var functionName = innerType.displayName || innerType.name || '';
2502
+ return outerType.displayName || (functionName !== '' ? wrapperName + '(' + functionName + ')' : wrapperName);
2502
2503
  }
2503
2504
 
2504
2505
  function getComponentName(type) {
@@ -2538,16 +2539,17 @@ function getComponentName(type) {
2538
2539
  case REACT_PROVIDER_TYPE:
2539
2540
  return 'Context.Provider';
2540
2541
  case REACT_FORWARD_REF_TYPE:
2541
- var renderFn = type.render;
2542
- var functionName = renderFn.displayName || renderFn.name || '';
2543
- return type.displayName || (functionName !== '' ? 'ForwardRef(' + functionName + ')' : 'ForwardRef');
2544
- }
2545
- if (typeof type.then === 'function') {
2546
- var thenable = type;
2547
- var resolvedThenable = refineResolvedThenable(thenable);
2548
- if (resolvedThenable) {
2549
- return getComponentName(resolvedThenable);
2550
- }
2542
+ return getWrappedName(type, type.render, 'ForwardRef');
2543
+ case REACT_MEMO_TYPE:
2544
+ return getComponentName(type.type);
2545
+ case REACT_LAZY_TYPE:
2546
+ {
2547
+ var thenable = type;
2548
+ var resolvedThenable = refineResolvedLazyComponent(thenable);
2549
+ if (resolvedThenable) {
2550
+ return getComponentName(resolvedThenable);
2551
+ }
2552
+ }
2551
2553
  }
2552
2554
  }
2553
2555
  return null;
@@ -2558,10 +2560,9 @@ var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
2558
2560
  function describeFiber(fiber) {
2559
2561
  switch (fiber.tag) {
2560
2562
  case IndeterminateComponent:
2563
+ case LazyComponent:
2561
2564
  case FunctionComponent:
2562
- case FunctionComponentLazy:
2563
2565
  case ClassComponent:
2564
- case ClassComponentLazy:
2565
2566
  case HostComponent:
2566
2567
  case Mode:
2567
2568
  var owner = fiber._debugOwner;
@@ -3486,7 +3487,7 @@ function postMountWrapper(element, props, isHydrating) {
3486
3487
  }
3487
3488
  } else {
3488
3489
  // When syncing the value attribute, the value property should use
3489
- // the the wrapperState._initialValue property. This uses:
3490
+ // the wrapperState._initialValue property. This uses:
3490
3491
  //
3491
3492
  // 1. The value React property when present
3492
3493
  // 2. The defaultValue React property when present
@@ -3539,7 +3540,7 @@ function postMountWrapper(element, props, isHydrating) {
3539
3540
  node.defaultChecked = !!props.defaultChecked;
3540
3541
  }
3541
3542
  } else {
3542
- // When syncing the checked attribute, both the the checked property and
3543
+ // When syncing the checked attribute, both the checked property and
3543
3544
  // attribute are assigned at the same time using defaultChecked. This uses:
3544
3545
  //
3545
3546
  // 1. The checked React property when present
@@ -3875,11 +3876,6 @@ var SyntheticUIEvent = SyntheticEvent.extend({
3875
3876
  detail: null
3876
3877
  });
3877
3878
 
3878
- /**
3879
- * Translation from modifier key to the associated property in the event.
3880
- * @see http://www.w3.org/TR/DOM-Level-3-Events/#keys-Modifiers
3881
- */
3882
-
3883
3879
  var modifierKeyToProp = {
3884
3880
  Alt: 'altKey',
3885
3881
  Control: 'ctrlKey',
@@ -3890,6 +3886,11 @@ var modifierKeyToProp = {
3890
3886
  // IE8 does not implement getModifierState so we simply map it to the only
3891
3887
  // modifier keys exposed by the event itself, does not support Lock-keys.
3892
3888
  // Currently, all major browsers except Chrome seems to support Lock-keys.
3889
+ /**
3890
+ * Translation from modifier key to the associated property in the event.
3891
+ * @see http://www.w3.org/TR/DOM-Level-3-Events/#keys-Modifiers
3892
+ */
3893
+
3893
3894
  function modifierStateGetter(keyArg) {
3894
3895
  var syntheticEvent = this;
3895
3896
  var nativeEvent = syntheticEvent.nativeEvent;
@@ -4236,7 +4237,7 @@ function isFiberMounted(fiber) {
4236
4237
  function isMounted(component) {
4237
4238
  {
4238
4239
  var owner = ReactCurrentOwner$1.current;
4239
- if (owner !== null && (owner.tag === ClassComponent || owner.tag === ClassComponentLazy)) {
4240
+ if (owner !== null && owner.tag === ClassComponent) {
4240
4241
  var ownerFiber = owner;
4241
4242
  var instance = ownerFiber.stateNode;
4242
4243
  !instance._warnedAboutRefsInRender ? warningWithoutStack$1(false, '%s is accessing isMounted inside its render() function. ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', getComponentName(ownerFiber.type) || 'A component') : void 0;
@@ -7388,7 +7389,7 @@ var SUPPRESS_CONTENT_EDITABLE_WARNING = 'suppressContentEditableWarning';
7388
7389
  var SUPPRESS_HYDRATION_WARNING$1 = 'suppressHydrationWarning';
7389
7390
  var AUTOFOCUS = 'autoFocus';
7390
7391
  var CHILDREN = 'children';
7391
- var STYLE = 'style';
7392
+ var STYLE$1 = 'style';
7392
7393
  var HTML = '__html';
7393
7394
 
7394
7395
  var HTML_NAMESPACE = Namespaces.html;
@@ -7543,7 +7544,7 @@ function setInitialDOMProperties(tag, domElement, rootContainerElement, nextProp
7543
7544
  continue;
7544
7545
  }
7545
7546
  var nextProp = nextProps[propKey];
7546
- if (propKey === STYLE) {
7547
+ if (propKey === STYLE$1) {
7547
7548
  {
7548
7549
  if (nextProp) {
7549
7550
  // Freeze the next style object so that we can assume it won't be
@@ -7596,7 +7597,7 @@ function updateDOMProperties(domElement, updatePayload, wasCustomComponentTag, i
7596
7597
  for (var i = 0; i < updatePayload.length; i += 2) {
7597
7598
  var propKey = updatePayload[i];
7598
7599
  var propValue = updatePayload[i + 1];
7599
- if (propKey === STYLE) {
7600
+ if (propKey === STYLE$1) {
7600
7601
  setValueForStyles(domElement, propValue);
7601
7602
  } else if (propKey === DANGEROUSLY_SET_INNER_HTML) {
7602
7603
  setInnerHTML(domElement, propValue);
@@ -7833,7 +7834,7 @@ function diffProperties(domElement, tag, lastRawProps, nextRawProps, rootContain
7833
7834
  if (nextProps.hasOwnProperty(propKey) || !lastProps.hasOwnProperty(propKey) || lastProps[propKey] == null) {
7834
7835
  continue;
7835
7836
  }
7836
- if (propKey === STYLE) {
7837
+ if (propKey === STYLE$1) {
7837
7838
  var lastStyle = lastProps[propKey];
7838
7839
  for (styleName in lastStyle) {
7839
7840
  if (lastStyle.hasOwnProperty(styleName)) {
@@ -7868,7 +7869,7 @@ function diffProperties(domElement, tag, lastRawProps, nextRawProps, rootContain
7868
7869
  if (!nextProps.hasOwnProperty(propKey) || nextProp === lastProp || nextProp == null && lastProp == null) {
7869
7870
  continue;
7870
7871
  }
7871
- if (propKey === STYLE) {
7872
+ if (propKey === STYLE$1) {
7872
7873
  {
7873
7874
  if (nextProp) {
7874
7875
  // Freeze the next style object so that we can assume it won't be
@@ -7943,7 +7944,7 @@ function diffProperties(domElement, tag, lastRawProps, nextRawProps, rootContain
7943
7944
  }
7944
7945
  }
7945
7946
  if (styleUpdates) {
7946
- (updatePayload = updatePayload || []).push(STYLE, styleUpdates);
7947
+ (updatePayload = updatePayload || []).push(STYLE$1, styleUpdates);
7947
7948
  }
7948
7949
  return updatePayload;
7949
7950
  }
@@ -8147,7 +8148,7 @@ function diffHydratedProperties(domElement, tag, rawProps, parentNamespace, root
8147
8148
  if (expectedHTML !== serverHTML) {
8148
8149
  warnForPropDifference(propKey, serverHTML, expectedHTML);
8149
8150
  }
8150
- } else if (propKey === STYLE) {
8151
+ } else if (propKey === STYLE$1) {
8151
8152
  // $FlowFixMe - Should be inferred as not undefined.
8152
8153
  extraAttributeNames.delete(propKey);
8153
8154
 
@@ -8634,12 +8635,17 @@ var createContainerChildSet = shim;
8634
8635
  var appendChildToContainerChildSet = shim;
8635
8636
  var finalizeContainerChildren = shim;
8636
8637
  var replaceContainerChildren = shim;
8638
+ var cloneHiddenInstance = shim;
8639
+ var cloneUnhiddenInstance = shim;
8640
+ var createHiddenTextInstance = shim;
8637
8641
 
8638
8642
  var SUPPRESS_HYDRATION_WARNING = void 0;
8639
8643
  {
8640
8644
  SUPPRESS_HYDRATION_WARNING = 'suppressHydrationWarning';
8641
8645
  }
8642
8646
 
8647
+ var STYLE = 'style';
8648
+
8643
8649
  var eventsEnabled = null;
8644
8650
  var selectionInformation = null;
8645
8651
 
@@ -8861,6 +8867,29 @@ function removeChildFromContainer(container, child) {
8861
8867
  }
8862
8868
  }
8863
8869
 
8870
+ function hideInstance(instance) {
8871
+ // TODO: Does this work for all element types? What about MathML? Should we
8872
+ // pass host context to this method?
8873
+ instance = instance;
8874
+ instance.style.display = 'none';
8875
+ }
8876
+
8877
+ function hideTextInstance(textInstance) {
8878
+ textInstance.nodeValue = '';
8879
+ }
8880
+
8881
+ function unhideInstance(instance, props) {
8882
+ instance = instance;
8883
+ var styleProp = props[STYLE];
8884
+ var display = styleProp !== undefined && styleProp !== null && styleProp.hasOwnProperty('display') ? styleProp.display : null;
8885
+ // $FlowFixMe Setting a style property to null is the valid way to reset it.
8886
+ instance.style.display = display;
8887
+ }
8888
+
8889
+ function unhideTextInstance(textInstance, text) {
8890
+ textInstance.nodeValue = text;
8891
+ }
8892
+
8864
8893
  // -------------------
8865
8894
  // Hydration
8866
8895
  // -------------------
@@ -9231,7 +9260,7 @@ function stopFailedWorkTimer(fiber) {
9231
9260
  return;
9232
9261
  }
9233
9262
  fiber._debugIsCurrentlyTiming = false;
9234
- var warning = 'An error was thrown inside this error boundary';
9263
+ var warning = fiber.tag === SuspenseComponent ? 'Rendering was suspended' : 'An error was thrown inside this error boundary';
9235
9264
  endFiberMark(fiber, null, warning);
9236
9265
  }
9237
9266
  }
@@ -9653,7 +9682,7 @@ function invalidateContextProvider(workInProgress, type, didChange) {
9653
9682
  function findCurrentUnmaskedContext(fiber) {
9654
9683
  // Currently this is only used with renderSubtreeIntoContainer; not sure if it
9655
9684
  // makes sense elsewhere
9656
- !(isFiberMounted(fiber) && (fiber.tag === ClassComponent || fiber.tag === ClassComponentLazy)) ? invariant(false, 'Expected subtree parent to be a mounted class component. This error is likely caused by a bug in React. Please file an issue.') : void 0;
9685
+ !(isFiberMounted(fiber) && fiber.tag === ClassComponent) ? invariant(false, 'Expected subtree parent to be a mounted class component. This error is likely caused by a bug in React. Please file an issue.') : void 0;
9657
9686
 
9658
9687
  var node = fiber;
9659
9688
  do {
@@ -9668,14 +9697,6 @@ function findCurrentUnmaskedContext(fiber) {
9668
9697
  }
9669
9698
  break;
9670
9699
  }
9671
- case ClassComponentLazy:
9672
- {
9673
- var _Component = getResultFromResolvedThenable(node.type);
9674
- if (isContextProvider(_Component)) {
9675
- return node.stateNode.__reactInternalMemoizedMergedChildContext;
9676
- }
9677
- break;
9678
- }
9679
9700
  }
9680
9701
  node = node.return;
9681
9702
  } while (node !== null);
@@ -9844,6 +9865,7 @@ function FiberNode(tag, pendingProps, key, mode) {
9844
9865
  // Instance
9845
9866
  this.tag = tag;
9846
9867
  this.key = key;
9868
+ this.elementType = null;
9847
9869
  this.type = null;
9848
9870
  this.stateNode = null;
9849
9871
 
@@ -9916,16 +9938,20 @@ function shouldConstruct(Component) {
9916
9938
  return !!(prototype && prototype.isReactComponent);
9917
9939
  }
9918
9940
 
9919
- function resolveLazyComponentTag(fiber, Component) {
9941
+ function isSimpleFunctionComponent(type) {
9942
+ return typeof type === 'function' && !shouldConstruct(type) && type.defaultProps === undefined;
9943
+ }
9944
+
9945
+ function resolveLazyComponentTag(Component) {
9920
9946
  if (typeof Component === 'function') {
9921
- return shouldConstruct(Component) ? ClassComponentLazy : FunctionComponentLazy;
9947
+ return shouldConstruct(Component) ? ClassComponent : FunctionComponent;
9922
9948
  } else if (Component !== undefined && Component !== null) {
9923
9949
  var $$typeof = Component.$$typeof;
9924
9950
  if ($$typeof === REACT_FORWARD_REF_TYPE) {
9925
- return ForwardRefLazy;
9951
+ return ForwardRef;
9926
9952
  }
9927
- if ($$typeof === REACT_PURE_TYPE) {
9928
- return PureComponentLazy;
9953
+ if ($$typeof === REACT_MEMO_TYPE) {
9954
+ return MemoComponent;
9929
9955
  }
9930
9956
  }
9931
9957
  return IndeterminateComponent;
@@ -9941,6 +9967,7 @@ function createWorkInProgress(current, pendingProps, expirationTime) {
9941
9967
  // extra objects for things that are never updated. It also allow us to
9942
9968
  // reclaim the extra memory if needed.
9943
9969
  workInProgress = createFiber(current.tag, pendingProps, current.key, current.mode);
9970
+ workInProgress.elementType = current.elementType;
9944
9971
  workInProgress.type = current.type;
9945
9972
  workInProgress.stateNode = current.stateNode;
9946
9973
 
@@ -10010,20 +10037,17 @@ function createHostRootFiber(isConcurrent) {
10010
10037
  return createFiber(HostRoot, null, null, mode);
10011
10038
  }
10012
10039
 
10013
- function createFiberFromElement(element, mode, expirationTime) {
10014
- var owner = null;
10015
- {
10016
- owner = element._owner;
10017
- }
10018
-
10040
+ function createFiberFromTypeAndProps(type, // React$ElementType
10041
+ key, pendingProps, owner, mode, expirationTime) {
10019
10042
  var fiber = void 0;
10020
- var type = element.type;
10021
- var key = element.key;
10022
- var pendingProps = element.props;
10023
10043
 
10024
- var fiberTag = void 0;
10044
+ var fiberTag = IndeterminateComponent;
10045
+ // The resolved type is set if we know what the final type will be. I.e. it's not lazy.
10046
+ var resolvedType = type;
10025
10047
  if (typeof type === 'function') {
10026
- fiberTag = shouldConstruct(type) ? ClassComponent : IndeterminateComponent;
10048
+ if (shouldConstruct(type)) {
10049
+ fiberTag = ClassComponent;
10050
+ }
10027
10051
  } else if (typeof type === 'string') {
10028
10052
  fiberTag = HostComponent;
10029
10053
  } else {
@@ -10031,18 +10055,13 @@ function createFiberFromElement(element, mode, expirationTime) {
10031
10055
  case REACT_FRAGMENT_TYPE:
10032
10056
  return createFiberFromFragment(pendingProps.children, mode, expirationTime, key);
10033
10057
  case REACT_CONCURRENT_MODE_TYPE:
10034
- fiberTag = Mode;
10035
- mode |= ConcurrentMode | StrictMode;
10036
- break;
10058
+ return createFiberFromMode(pendingProps, mode | ConcurrentMode | StrictMode, expirationTime, key);
10037
10059
  case REACT_STRICT_MODE_TYPE:
10038
- fiberTag = Mode;
10039
- mode |= StrictMode;
10040
- break;
10060
+ return createFiberFromMode(pendingProps, mode | StrictMode, expirationTime, key);
10041
10061
  case REACT_PROFILER_TYPE:
10042
10062
  return createFiberFromProfiler(pendingProps, mode, expirationTime, key);
10043
10063
  case REACT_SUSPENSE_TYPE:
10044
- fiberTag = SuspenseComponent;
10045
- break;
10064
+ return createFiberFromSuspense(pendingProps, mode, expirationTime, key);
10046
10065
  default:
10047
10066
  {
10048
10067
  if (typeof type === 'object' && type !== null) {
@@ -10057,16 +10076,13 @@ function createFiberFromElement(element, mode, expirationTime) {
10057
10076
  case REACT_FORWARD_REF_TYPE:
10058
10077
  fiberTag = ForwardRef;
10059
10078
  break getTag;
10060
- case REACT_PURE_TYPE:
10061
- fiberTag = PureComponent;
10079
+ case REACT_MEMO_TYPE:
10080
+ fiberTag = MemoComponent;
10081
+ break getTag;
10082
+ case REACT_LAZY_TYPE:
10083
+ fiberTag = LazyComponent;
10084
+ resolvedType = null;
10062
10085
  break getTag;
10063
- default:
10064
- {
10065
- if (typeof type.then === 'function') {
10066
- fiberTag = IndeterminateComponent;
10067
- break getTag;
10068
- }
10069
- }
10070
10086
  }
10071
10087
  }
10072
10088
  var info = '';
@@ -10085,14 +10101,26 @@ function createFiberFromElement(element, mode, expirationTime) {
10085
10101
  }
10086
10102
 
10087
10103
  fiber = createFiber(fiberTag, pendingProps, key, mode);
10088
- fiber.type = type;
10104
+ fiber.elementType = type;
10105
+ fiber.type = resolvedType;
10089
10106
  fiber.expirationTime = expirationTime;
10090
10107
 
10108
+ return fiber;
10109
+ }
10110
+
10111
+ function createFiberFromElement(element, mode, expirationTime) {
10112
+ var owner = null;
10113
+ {
10114
+ owner = element._owner;
10115
+ }
10116
+ var type = element.type;
10117
+ var key = element.key;
10118
+ var pendingProps = element.props;
10119
+ var fiber = createFiberFromTypeAndProps(type, key, pendingProps, owner, mode, expirationTime);
10091
10120
  {
10092
10121
  fiber._debugSource = element._source;
10093
10122
  fiber._debugOwner = element._owner;
10094
10123
  }
10095
-
10096
10124
  return fiber;
10097
10125
  }
10098
10126
 
@@ -10110,12 +10138,38 @@ function createFiberFromProfiler(pendingProps, mode, expirationTime, key) {
10110
10138
  }
10111
10139
 
10112
10140
  var fiber = createFiber(Profiler, pendingProps, key, mode | ProfileMode);
10141
+ // TODO: The Profiler fiber shouldn't have a type. It has a tag.
10142
+ fiber.elementType = REACT_PROFILER_TYPE;
10113
10143
  fiber.type = REACT_PROFILER_TYPE;
10114
10144
  fiber.expirationTime = expirationTime;
10115
10145
 
10116
10146
  return fiber;
10117
10147
  }
10118
10148
 
10149
+ function createFiberFromMode(pendingProps, mode, expirationTime, key) {
10150
+ var fiber = createFiber(Mode, pendingProps, key, mode);
10151
+
10152
+ // TODO: The Mode fiber shouldn't have a type. It has a tag.
10153
+ var type = (mode & ConcurrentMode) === NoContext ? REACT_STRICT_MODE_TYPE : REACT_CONCURRENT_MODE_TYPE;
10154
+ fiber.elementType = type;
10155
+ fiber.type = type;
10156
+
10157
+ fiber.expirationTime = expirationTime;
10158
+ return fiber;
10159
+ }
10160
+
10161
+ function createFiberFromSuspense(pendingProps, mode, expirationTime, key) {
10162
+ var fiber = createFiber(SuspenseComponent, pendingProps, key, mode);
10163
+
10164
+ // TODO: The SuspenseComponent fiber shouldn't have a type. It has a tag.
10165
+ var type = REACT_SUSPENSE_TYPE;
10166
+ fiber.elementType = type;
10167
+ fiber.type = type;
10168
+
10169
+ fiber.expirationTime = expirationTime;
10170
+ return fiber;
10171
+ }
10172
+
10119
10173
  function createFiberFromText(content, mode, expirationTime) {
10120
10174
  var fiber = createFiber(HostText, content, null, mode);
10121
10175
  fiber.expirationTime = expirationTime;
@@ -10124,6 +10178,8 @@ function createFiberFromText(content, mode, expirationTime) {
10124
10178
 
10125
10179
  function createFiberFromHostInstanceForDeletion() {
10126
10180
  var fiber = createFiber(HostComponent, null, null, NoContext);
10181
+ // TODO: These should not need a type.
10182
+ fiber.elementType = 'DELETED';
10127
10183
  fiber.type = 'DELETED';
10128
10184
  return fiber;
10129
10185
  }
@@ -10156,6 +10212,7 @@ function assignFiberPropertiesInDEV(target, source) {
10156
10212
 
10157
10213
  target.tag = source.tag;
10158
10214
  target.key = source.key;
10215
+ target.elementType = source.elementType;
10159
10216
  target.type = source.type;
10160
10217
  target.stateNode = source.stateNode;
10161
10218
  target.return = source.return;
@@ -11029,7 +11086,7 @@ function enqueueUpdate(fiber, update) {
11029
11086
  }
11030
11087
 
11031
11088
  {
11032
- if ((fiber.tag === ClassComponent || fiber.tag === ClassComponentLazy) && (currentlyProcessingQueue === queue1 || queue2 !== null && currentlyProcessingQueue === queue2) && !didWarnUpdateInsideUpdate) {
11089
+ if (fiber.tag === ClassComponent && (currentlyProcessingQueue === queue1 || queue2 !== null && currentlyProcessingQueue === queue2) && !didWarnUpdateInsideUpdate) {
11033
11090
  warningWithoutStack$1(false, 'An update (setState, replaceState, or forceUpdate) was scheduled ' + 'from inside an update function. Update functions should be pure, ' + 'with zero side-effects. Consider using componentDidUpdate or a ' + 'callback.');
11034
11091
  didWarnUpdateInsideUpdate = true;
11035
11092
  }
@@ -11402,7 +11459,7 @@ function propagateContextChange(workInProgress, context, changedBits, renderExpi
11402
11459
  if (dependency.context === context && (dependency.observedBits & changedBits) !== 0) {
11403
11460
  // Match! Schedule an update on this fiber.
11404
11461
 
11405
- if (fiber.tag === ClassComponent || fiber.tag === ClassComponentLazy) {
11462
+ if (fiber.tag === ClassComponent) {
11406
11463
  // Schedule a force update on the work-in-progress.
11407
11464
  var update = createUpdate(renderExpirationTime);
11408
11465
  update.tag = ForceUpdate;
@@ -11509,7 +11566,7 @@ function readContext(context, observedBits) {
11509
11566
  };
11510
11567
 
11511
11568
  if (lastContextDependency === null) {
11512
- !(currentlyRenderingFiber !== null) ? invariant(false, 'Context.unstable_read(): Context can only be read while React is rendering, e.g. inside the render method or getDerivedStateFromProps.') : void 0;
11569
+ !(currentlyRenderingFiber !== null) ? invariant(false, 'Context can only be read while React is rendering, e.g. inside the render method or getDerivedStateFromProps.') : void 0;
11513
11570
  // This is the first dependency in the list
11514
11571
  currentlyRenderingFiber.firstContextDependency = lastContextDependency = contextItem;
11515
11572
  } else {
@@ -11642,6 +11699,13 @@ function stopProfilerTimerIfRunningAndRecordDelta(fiber, overrideBaseTime) {
11642
11699
  }
11643
11700
  }
11644
11701
 
11702
+ var ReactCurrentOwner$4 = ReactSharedInternals.ReactCurrentOwner;
11703
+
11704
+ function readContext$1(contextType) {
11705
+ var dispatcher = ReactCurrentOwner$4.currentDispatcher;
11706
+ return dispatcher.readContext(contextType);
11707
+ }
11708
+
11645
11709
  var fakeInternalInstance = {};
11646
11710
  var isArray$1 = Array.isArray;
11647
11711
 
@@ -11899,13 +11963,13 @@ function constructClassInstance(workInProgress, ctor, props, renderExpirationTim
11899
11963
  var contextType = ctor.contextType;
11900
11964
  if (typeof contextType === 'object' && contextType !== null) {
11901
11965
  {
11902
- if (typeof contextType.unstable_read !== 'function' && !didWarnAboutInvalidateContextType.has(ctor)) {
11966
+ if (contextType.$$typeof !== REACT_CONTEXT_TYPE && !didWarnAboutInvalidateContextType.has(ctor)) {
11903
11967
  didWarnAboutInvalidateContextType.add(ctor);
11904
11968
  warningWithoutStack$1(false, '%s defines an invalid contextType. ' + 'contextType should point to the Context object returned by React.createContext(). ' + 'Did you accidentally pass the Context.Provider instead?', getComponentName(ctor) || 'Component');
11905
11969
  }
11906
11970
  }
11907
11971
 
11908
- context = contextType.unstable_read();
11972
+ context = readContext$1(contextType);
11909
11973
  } else {
11910
11974
  unmaskedContext = getUnmaskedContext(workInProgress, ctor, true);
11911
11975
  var contextTypes = ctor.contextTypes;
@@ -12032,7 +12096,7 @@ function mountClassInstance(workInProgress, ctor, newProps, renderExpirationTime
12032
12096
 
12033
12097
  var contextType = ctor.contextType;
12034
12098
  if (typeof contextType === 'object' && contextType !== null) {
12035
- instance.context = contextType.unstable_read();
12099
+ instance.context = readContext$1(contextType);
12036
12100
  } else {
12037
12101
  var unmaskedContext = getUnmaskedContext(workInProgress, ctor, true);
12038
12102
  instance.context = getMaskedContext(workInProgress, unmaskedContext);
@@ -12098,7 +12162,7 @@ function resumeMountClassInstance(workInProgress, ctor, newProps, renderExpirati
12098
12162
  var contextType = ctor.contextType;
12099
12163
  var nextContext = void 0;
12100
12164
  if (typeof contextType === 'object' && contextType !== null) {
12101
- nextContext = contextType.unstable_read();
12165
+ nextContext = readContext$1(contextType);
12102
12166
  } else {
12103
12167
  var nextLegacyUnmaskedContext = getUnmaskedContext(workInProgress, ctor, true);
12104
12168
  nextContext = getMaskedContext(workInProgress, nextLegacyUnmaskedContext);
@@ -12193,7 +12257,7 @@ function updateClassInstance(current, workInProgress, ctor, newProps, renderExpi
12193
12257
  var contextType = ctor.contextType;
12194
12258
  var nextContext = void 0;
12195
12259
  if (typeof contextType === 'object' && contextType !== null) {
12196
- nextContext = contextType.unstable_read();
12260
+ nextContext = readContext$1(contextType);
12197
12261
  } else {
12198
12262
  var nextUnmaskedContext = getUnmaskedContext(workInProgress, ctor, true);
12199
12263
  nextContext = getMaskedContext(workInProgress, nextUnmaskedContext);
@@ -12355,7 +12419,7 @@ function coerceRef(returnFiber, current$$1, element) {
12355
12419
  var inst = void 0;
12356
12420
  if (owner) {
12357
12421
  var ownerFiber = owner;
12358
- !(ownerFiber.tag === ClassComponent || ownerFiber.tag === ClassComponentLazy) ? invariant(false, 'Function components cannot have refs.') : void 0;
12422
+ !(ownerFiber.tag === ClassComponent) ? invariant(false, 'Function components cannot have refs.') : void 0;
12359
12423
  inst = ownerFiber.stateNode;
12360
12424
  }
12361
12425
  !inst ? invariant(false, 'Missing owner for string ref %s. This error is likely caused by a bug in React. Please file an issue.', mixedRef) : void 0;
@@ -12523,7 +12587,7 @@ function ChildReconciler(shouldTrackSideEffects) {
12523
12587
  }
12524
12588
 
12525
12589
  function updateElement(returnFiber, current$$1, element, expirationTime) {
12526
- if (current$$1 !== null && current$$1.type === element.type) {
12590
+ if (current$$1 !== null && current$$1.elementType === element.type) {
12527
12591
  // Move based on index
12528
12592
  var existing = useFiber(current$$1, element.props, expirationTime);
12529
12593
  existing.ref = coerceRef(returnFiber, current$$1, element);
@@ -13065,7 +13129,7 @@ function ChildReconciler(shouldTrackSideEffects) {
13065
13129
  // TODO: If key === null and child.key === null, then this only applies to
13066
13130
  // the first item in the list.
13067
13131
  if (child.key === key) {
13068
- if (child.tag === Fragment ? element.type === REACT_FRAGMENT_TYPE : child.type === element.type) {
13132
+ if (child.tag === Fragment ? element.type === REACT_FRAGMENT_TYPE : child.elementType === element.type) {
13069
13133
  deleteRemainingChildren(returnFiber, child.sibling);
13070
13134
  var existing = useFiber(child, element.type === REACT_FRAGMENT_TYPE ? element.props.children : element.props, expirationTime);
13071
13135
  existing.ref = coerceRef(returnFiber, child, element);
@@ -13180,7 +13244,6 @@ function ChildReconciler(shouldTrackSideEffects) {
13180
13244
  // we already threw above.
13181
13245
  switch (returnFiber.tag) {
13182
13246
  case ClassComponent:
13183
- case ClassComponentLazy:
13184
13247
  {
13185
13248
  {
13186
13249
  var instance = returnFiber.stateNode;
@@ -13495,40 +13558,49 @@ function resetHydrationState() {
13495
13558
  isHydrating = false;
13496
13559
  }
13497
13560
 
13498
- function readLazyComponentType(thenable) {
13499
- var status = thenable._reactStatus;
13561
+ function readLazyComponentType(lazyComponent) {
13562
+ var status = lazyComponent._status;
13563
+ var result = lazyComponent._result;
13500
13564
  switch (status) {
13501
13565
  case Resolved:
13502
- var Component = thenable._reactResult;
13503
- return Component;
13566
+ {
13567
+ var Component = result;
13568
+ return Component;
13569
+ }
13504
13570
  case Rejected:
13505
- throw thenable._reactResult;
13571
+ {
13572
+ var error = result;
13573
+ throw error;
13574
+ }
13506
13575
  case Pending:
13507
- throw thenable;
13576
+ {
13577
+ var thenable = result;
13578
+ throw thenable;
13579
+ }
13508
13580
  default:
13509
13581
  {
13510
- thenable._reactStatus = Pending;
13511
- thenable.then(function (resolvedValue) {
13512
- if (thenable._reactStatus === Pending) {
13513
- thenable._reactStatus = Resolved;
13514
- if (typeof resolvedValue === 'object' && resolvedValue !== null) {
13515
- // If the `default` property is not empty, assume it's the result
13516
- // of an async import() and use that. Otherwise, use the
13517
- // resolved value itself.
13518
- var defaultExport = resolvedValue.default;
13519
- resolvedValue = defaultExport !== undefined && defaultExport !== null ? defaultExport : resolvedValue;
13520
- } else {
13521
- resolvedValue = resolvedValue;
13582
+ lazyComponent._status = Pending;
13583
+ var ctor = lazyComponent._ctor;
13584
+ var _thenable = ctor();
13585
+ _thenable.then(function (moduleObject) {
13586
+ if (lazyComponent._status === Pending) {
13587
+ var defaultExport = moduleObject.default;
13588
+ {
13589
+ if (defaultExport === undefined) {
13590
+ warning$1(false, 'lazy: Expected the result of a dynamic import() call. ' + 'Instead received: %s\n\nYour code should look like: \n ' + "const MyComponent = lazy(() => import('./MyComponent'))", moduleObject);
13591
+ }
13522
13592
  }
13523
- thenable._reactResult = resolvedValue;
13593
+ lazyComponent._status = Resolved;
13594
+ lazyComponent._result = defaultExport;
13524
13595
  }
13525
13596
  }, function (error) {
13526
- if (thenable._reactStatus === Pending) {
13527
- thenable._reactStatus = Rejected;
13528
- thenable._reactResult = error;
13597
+ if (lazyComponent._status === Pending) {
13598
+ lazyComponent._status = Rejected;
13599
+ lazyComponent._result = error;
13529
13600
  }
13530
13601
  });
13531
- throw thenable;
13602
+ lazyComponent._result = _thenable;
13603
+ throw _thenable;
13532
13604
  }
13533
13605
  }
13534
13606
  }
@@ -13604,51 +13676,64 @@ function updateForwardRef(current$$1, workInProgress, type, nextProps, renderExp
13604
13676
  }
13605
13677
 
13606
13678
  reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
13607
- memoizeProps(workInProgress, nextProps);
13608
13679
  return workInProgress.child;
13609
13680
  }
13610
13681
 
13611
- function updatePureComponent(current$$1, workInProgress, Component, nextProps, updateExpirationTime, renderExpirationTime) {
13612
- var render = Component.render;
13613
-
13614
- if (current$$1 !== null && (updateExpirationTime === NoWork || updateExpirationTime > renderExpirationTime)) {
13615
- var prevProps = current$$1.memoizedProps;
13682
+ function updateMemoComponent(current$$1, workInProgress, Component, nextProps, updateExpirationTime, renderExpirationTime) {
13683
+ if (current$$1 === null) {
13684
+ var type = Component.type;
13685
+ if (isSimpleFunctionComponent(type) && Component.compare === null) {
13686
+ // If this is a plain function component without default props,
13687
+ // and with only the default shallow comparison, we upgrade it
13688
+ // to a SimpleMemoComponent to allow fast path updates.
13689
+ workInProgress.tag = SimpleMemoComponent;
13690
+ workInProgress.type = type;
13691
+ return updateSimpleMemoComponent(current$$1, workInProgress, type, nextProps, updateExpirationTime, renderExpirationTime);
13692
+ }
13693
+ var child = createFiberFromTypeAndProps(Component.type, null, nextProps, null, workInProgress.mode, renderExpirationTime);
13694
+ child.ref = workInProgress.ref;
13695
+ child.return = workInProgress;
13696
+ workInProgress.child = child;
13697
+ return child;
13698
+ }
13699
+ var currentChild = current$$1.child; // This is always exactly one child
13700
+ if (updateExpirationTime === NoWork || updateExpirationTime > renderExpirationTime) {
13701
+ // This will be the props with resolved defaultProps,
13702
+ // unlike current.memoizedProps which will be the unresolved ones.
13703
+ var prevProps = currentChild.memoizedProps;
13616
13704
  // Default to shallow comparison
13617
13705
  var compare = Component.compare;
13618
13706
  compare = compare !== null ? compare : shallowEqual;
13619
- if (compare(prevProps, nextProps)) {
13707
+ if (compare(prevProps, nextProps) && current$$1.ref === workInProgress.ref) {
13620
13708
  return bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
13621
13709
  }
13622
13710
  }
13711
+ var newChild = createWorkInProgress(currentChild, nextProps, renderExpirationTime);
13712
+ newChild.ref = workInProgress.ref;
13713
+ newChild.return = workInProgress;
13714
+ workInProgress.child = newChild;
13715
+ return newChild;
13716
+ }
13623
13717
 
13624
- // The rest is a fork of updateFunctionComponent
13625
- var nextChildren = void 0;
13626
- prepareToReadContext(workInProgress, renderExpirationTime);
13627
- {
13628
- ReactCurrentOwner$3.current = workInProgress;
13629
- setCurrentPhase('render');
13630
- nextChildren = render(nextProps);
13631
- setCurrentPhase(null);
13718
+ function updateSimpleMemoComponent(current$$1, workInProgress, Component, nextProps, updateExpirationTime, renderExpirationTime) {
13719
+ if (current$$1 !== null && (updateExpirationTime === NoWork || updateExpirationTime > renderExpirationTime)) {
13720
+ var prevProps = current$$1.memoizedProps;
13721
+ if (shallowEqual(prevProps, nextProps) && current$$1.ref === workInProgress.ref) {
13722
+ return bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
13723
+ }
13632
13724
  }
13633
-
13634
- // React DevTools reads this flag.
13635
- workInProgress.effectTag |= PerformedWork;
13636
- reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
13637
- memoizeProps(workInProgress, nextProps);
13638
- return workInProgress.child;
13725
+ return updateFunctionComponent(current$$1, workInProgress, Component, nextProps, renderExpirationTime);
13639
13726
  }
13640
13727
 
13641
13728
  function updateFragment(current$$1, workInProgress, renderExpirationTime) {
13642
13729
  var nextChildren = workInProgress.pendingProps;
13643
13730
  reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
13644
- memoizeProps(workInProgress, nextChildren);
13645
13731
  return workInProgress.child;
13646
13732
  }
13647
13733
 
13648
13734
  function updateMode(current$$1, workInProgress, renderExpirationTime) {
13649
13735
  var nextChildren = workInProgress.pendingProps.children;
13650
13736
  reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
13651
- memoizeProps(workInProgress, nextChildren);
13652
13737
  return workInProgress.child;
13653
13738
  }
13654
13739
 
@@ -13659,7 +13744,6 @@ function updateProfiler(current$$1, workInProgress, renderExpirationTime) {
13659
13744
  var nextProps = workInProgress.pendingProps;
13660
13745
  var nextChildren = nextProps.children;
13661
13746
  reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
13662
- memoizeProps(workInProgress, nextProps);
13663
13747
  return workInProgress.child;
13664
13748
  }
13665
13749
 
@@ -13687,7 +13771,6 @@ function updateFunctionComponent(current$$1, workInProgress, Component, nextProp
13687
13771
  // React DevTools reads this flag.
13688
13772
  workInProgress.effectTag |= PerformedWork;
13689
13773
  reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
13690
- memoizeProps(workInProgress, nextProps);
13691
13774
  return workInProgress.child;
13692
13775
  }
13693
13776
 
@@ -13704,17 +13787,26 @@ function updateClassComponent(current$$1, workInProgress, Component, nextProps,
13704
13787
  }
13705
13788
  prepareToReadContext(workInProgress, renderExpirationTime);
13706
13789
 
13790
+ var instance = workInProgress.stateNode;
13707
13791
  var shouldUpdate = void 0;
13708
- if (current$$1 === null) {
13709
- if (workInProgress.stateNode === null) {
13710
- // In the initial pass we might need to construct the instance.
13711
- constructClassInstance(workInProgress, Component, nextProps, renderExpirationTime);
13712
- mountClassInstance(workInProgress, Component, nextProps, renderExpirationTime);
13713
- shouldUpdate = true;
13714
- } else {
13715
- // In a resume, we'll already have an instance we can reuse.
13716
- shouldUpdate = resumeMountClassInstance(workInProgress, Component, nextProps, renderExpirationTime);
13717
- }
13792
+ if (instance === null) {
13793
+ if (current$$1 !== null) {
13794
+ // An class component without an instance only mounts if it suspended
13795
+ // inside a non- concurrent tree, in an inconsistent state. We want to
13796
+ // tree it like a new mount, even though an empty version of it already
13797
+ // committed. Disconnect the alternate pointers.
13798
+ current$$1.alternate = null;
13799
+ workInProgress.alternate = null;
13800
+ // Since this is conceptually a new fiber, schedule a Placement effect
13801
+ workInProgress.effectTag |= Placement;
13802
+ }
13803
+ // In the initial pass we might need to construct the instance.
13804
+ constructClassInstance(workInProgress, Component, nextProps, renderExpirationTime);
13805
+ mountClassInstance(workInProgress, Component, nextProps, renderExpirationTime);
13806
+ shouldUpdate = true;
13807
+ } else if (current$$1 === null) {
13808
+ // In a resume, we'll already have an instance we can reuse.
13809
+ shouldUpdate = resumeMountClassInstance(workInProgress, Component, nextProps, renderExpirationTime);
13718
13810
  } else {
13719
13811
  shouldUpdate = updateClassInstance(current$$1, workInProgress, Component, nextProps, renderExpirationTime);
13720
13812
  }
@@ -13775,10 +13867,9 @@ function finishClassComponent(current$$1, workInProgress, Component, shouldUpdat
13775
13867
  reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
13776
13868
  }
13777
13869
 
13778
- // Memoize props and state using the values we just used to render.
13870
+ // Memoize state using the values we just used to render.
13779
13871
  // TODO: Restructure so we never read values from the instance.
13780
- memoizeState(workInProgress, instance.state);
13781
- memoizeProps(workInProgress, instance.props);
13872
+ workInProgress.memoizedState = instance.state;
13782
13873
 
13783
13874
  // The context might have changed so we need to recalculate it.
13784
13875
  if (hasContext) {
@@ -13875,12 +13966,10 @@ function updateHostComponent(current$$1, workInProgress, renderExpirationTime) {
13875
13966
  if (renderExpirationTime !== Never && workInProgress.mode & ConcurrentMode && shouldDeprioritizeSubtree(type, nextProps)) {
13876
13967
  // Schedule this fiber to re-render at offscreen priority. Then bailout.
13877
13968
  workInProgress.expirationTime = Never;
13878
- workInProgress.memoizedProps = nextProps;
13879
13969
  return null;
13880
13970
  }
13881
13971
 
13882
13972
  reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
13883
- memoizeProps(workInProgress, nextProps);
13884
13973
  return workInProgress.child;
13885
13974
  }
13886
13975
 
@@ -13888,8 +13977,6 @@ function updateHostText(current$$1, workInProgress) {
13888
13977
  if (current$$1 === null) {
13889
13978
  tryToClaimNextHydratableInstance(workInProgress);
13890
13979
  }
13891
- var nextProps = workInProgress.pendingProps;
13892
- memoizeProps(workInProgress, nextProps);
13893
13980
  // Nothing to do here. This is terminal. We'll do the completion step
13894
13981
  // immediately after.
13895
13982
  return null;
@@ -13910,48 +13997,110 @@ function resolveDefaultProps(Component, baseProps) {
13910
13997
  return baseProps;
13911
13998
  }
13912
13999
 
13913
- function mountIndeterminateComponent(current$$1, workInProgress, Component, updateExpirationTime, renderExpirationTime) {
13914
- !(current$$1 === null) ? invariant(false, 'An indeterminate component should never have mounted. This error is likely caused by a bug in React. Please file an issue.') : void 0;
14000
+ function mountLazyComponent(_current, workInProgress, elementType, updateExpirationTime, renderExpirationTime) {
14001
+ if (_current !== null) {
14002
+ // An lazy component only mounts if it suspended inside a non-
14003
+ // concurrent tree, in an inconsistent state. We want to tree it like
14004
+ // a new mount, even though an empty version of it already committed.
14005
+ // Disconnect the alternate pointers.
14006
+ _current.alternate = null;
14007
+ workInProgress.alternate = null;
14008
+ // Since this is conceptually a new fiber, schedule a Placement effect
14009
+ workInProgress.effectTag |= Placement;
14010
+ }
13915
14011
 
13916
14012
  var props = workInProgress.pendingProps;
13917
- if (typeof Component === 'object' && Component !== null && typeof Component.then === 'function') {
13918
- Component = readLazyComponentType(Component);
13919
- var resolvedTag = workInProgress.tag = resolveLazyComponentTag(workInProgress, Component);
13920
- var resolvedProps = resolveDefaultProps(Component, props);
13921
- var child = void 0;
13922
- switch (resolvedTag) {
13923
- case FunctionComponentLazy:
13924
- {
13925
- child = updateFunctionComponent(current$$1, workInProgress, Component, resolvedProps, renderExpirationTime);
13926
- break;
13927
- }
13928
- case ClassComponentLazy:
13929
- {
13930
- child = updateClassComponent(current$$1, workInProgress, Component, resolvedProps, renderExpirationTime);
13931
- break;
13932
- }
13933
- case ForwardRefLazy:
13934
- {
13935
- child = updateForwardRef(current$$1, workInProgress, Component, resolvedProps, renderExpirationTime);
13936
- break;
13937
- }
13938
- case PureComponentLazy:
13939
- {
13940
- child = updatePureComponent(current$$1, workInProgress, Component, resolvedProps, updateExpirationTime, renderExpirationTime);
13941
- break;
13942
- }
13943
- default:
13944
- {
13945
- // This message intentionally doesn't metion ForwardRef or PureComponent
13946
- // because the fact that it's a separate type of work is an
13947
- // implementation detail.
13948
- invariant(false, 'Element type is invalid. Received a promise that resolves to: %s. Promise elements must resolve to a class or function.', Component);
13949
- }
13950
- }
13951
- workInProgress.memoizedProps = props;
13952
- return child;
14013
+ // We can't start a User Timing measurement with correct label yet.
14014
+ // Cancel and resume right after we know the tag.
14015
+ cancelWorkTimer(workInProgress);
14016
+ var Component = readLazyComponentType(elementType);
14017
+ // Store the unwrapped component in the type.
14018
+ workInProgress.type = Component;
14019
+ var resolvedTag = workInProgress.tag = resolveLazyComponentTag(Component);
14020
+ startWorkTimer(workInProgress);
14021
+ var resolvedProps = resolveDefaultProps(Component, props);
14022
+ var child = void 0;
14023
+ switch (resolvedTag) {
14024
+ case FunctionComponent:
14025
+ {
14026
+ child = updateFunctionComponent(null, workInProgress, Component, resolvedProps, renderExpirationTime);
14027
+ break;
14028
+ }
14029
+ case ClassComponent:
14030
+ {
14031
+ child = updateClassComponent(null, workInProgress, Component, resolvedProps, renderExpirationTime);
14032
+ break;
14033
+ }
14034
+ case ForwardRef:
14035
+ {
14036
+ child = updateForwardRef(null, workInProgress, Component, resolvedProps, renderExpirationTime);
14037
+ break;
14038
+ }
14039
+ case MemoComponent:
14040
+ {
14041
+ child = updateMemoComponent(null, workInProgress, Component, resolveDefaultProps(Component.type, resolvedProps), // The inner type can have defaults too
14042
+ updateExpirationTime, renderExpirationTime);
14043
+ break;
14044
+ }
14045
+ default:
14046
+ {
14047
+ // This message intentionally doesn't metion ForwardRef or MemoComponent
14048
+ // because the fact that it's a separate type of work is an
14049
+ // implementation detail.
14050
+ invariant(false, 'Element type is invalid. Received a promise that resolves to: %s. Promise elements must resolve to a class or function.', Component);
14051
+ }
14052
+ }
14053
+ return child;
14054
+ }
14055
+
14056
+ function mountIncompleteClassComponent(_current, workInProgress, Component, nextProps, renderExpirationTime) {
14057
+ if (_current !== null) {
14058
+ // An incomplete component only mounts if it suspended inside a non-
14059
+ // concurrent tree, in an inconsistent state. We want to tree it like
14060
+ // a new mount, even though an empty version of it already committed.
14061
+ // Disconnect the alternate pointers.
14062
+ _current.alternate = null;
14063
+ workInProgress.alternate = null;
14064
+ // Since this is conceptually a new fiber, schedule a Placement effect
14065
+ workInProgress.effectTag |= Placement;
13953
14066
  }
13954
14067
 
14068
+ // Promote the fiber to a class and try rendering again.
14069
+ workInProgress.tag = ClassComponent;
14070
+
14071
+ // The rest of this function is a fork of `updateClassComponent`
14072
+
14073
+ // Push context providers early to prevent context stack mismatches.
14074
+ // During mounting we don't know the child context yet as the instance doesn't exist.
14075
+ // We will invalidate the child context in finishClassComponent() right after rendering.
14076
+ var hasContext = void 0;
14077
+ if (isContextProvider(Component)) {
14078
+ hasContext = true;
14079
+ pushContextProvider(workInProgress);
14080
+ } else {
14081
+ hasContext = false;
14082
+ }
14083
+ prepareToReadContext(workInProgress, renderExpirationTime);
14084
+
14085
+ constructClassInstance(workInProgress, Component, nextProps, renderExpirationTime);
14086
+ mountClassInstance(workInProgress, Component, nextProps, renderExpirationTime);
14087
+
14088
+ return finishClassComponent(null, workInProgress, Component, true, hasContext, renderExpirationTime);
14089
+ }
14090
+
14091
+ function mountIndeterminateComponent(_current, workInProgress, Component, renderExpirationTime) {
14092
+ if (_current !== null) {
14093
+ // An indeterminate component only mounts if it suspended inside a non-
14094
+ // concurrent tree, in an inconsistent state. We want to tree it like
14095
+ // a new mount, even though an empty version of it already committed.
14096
+ // Disconnect the alternate pointers.
14097
+ _current.alternate = null;
14098
+ workInProgress.alternate = null;
14099
+ // Since this is conceptually a new fiber, schedule a Placement effect
14100
+ workInProgress.effectTag |= Placement;
14101
+ }
14102
+
14103
+ var props = workInProgress.pendingProps;
13955
14104
  var unmaskedContext = getUnmaskedContext(workInProgress, Component, false);
13956
14105
  var context = getMaskedContext(workInProgress, unmaskedContext);
13957
14106
 
@@ -14003,7 +14152,7 @@ function mountIndeterminateComponent(current$$1, workInProgress, Component, upda
14003
14152
 
14004
14153
  adoptClassInstance(workInProgress, value);
14005
14154
  mountClassInstance(workInProgress, Component, props, renderExpirationTime);
14006
- return finishClassComponent(current$$1, workInProgress, Component, true, hasContext, renderExpirationTime);
14155
+ return finishClassComponent(null, workInProgress, Component, true, hasContext, renderExpirationTime);
14007
14156
  } else {
14008
14157
  // Proceed under the assumption that this is a function component
14009
14158
  workInProgress.tag = FunctionComponent;
@@ -14047,64 +14196,166 @@ function mountIndeterminateComponent(current$$1, workInProgress, Component, upda
14047
14196
  }
14048
14197
  }
14049
14198
  }
14050
- reconcileChildren(current$$1, workInProgress, value, renderExpirationTime);
14051
- memoizeProps(workInProgress, props);
14199
+ reconcileChildren(null, workInProgress, value, renderExpirationTime);
14052
14200
  return workInProgress.child;
14053
14201
  }
14054
14202
  }
14055
14203
 
14056
14204
  function updateSuspenseComponent(current$$1, workInProgress, renderExpirationTime) {
14205
+ var mode = workInProgress.mode;
14057
14206
  var nextProps = workInProgress.pendingProps;
14058
14207
 
14059
- // Check if we already attempted to render the normal state. If we did,
14060
- // and we timed out, render the placeholder state.
14061
- var alreadyCaptured = (workInProgress.effectTag & DidCapture) === NoEffect;
14062
-
14063
- var nextDidTimeout = void 0;
14064
- if (current$$1 !== null && workInProgress.updateQueue !== null) {
14065
- // We're outside strict mode. Something inside this Placeholder boundary
14066
- // suspended during the last commit. Switch to the placholder.
14067
- workInProgress.updateQueue = null;
14068
- nextDidTimeout = true;
14208
+ // We should attempt to render the primary children unless this boundary
14209
+ // already suspended during this render (`alreadyCaptured` is true).
14210
+ var nextState = workInProgress.memoizedState;
14211
+ if (nextState === null) {
14212
+ // An empty suspense state means this boundary has not yet timed out.
14069
14213
  } else {
14070
- nextDidTimeout = !alreadyCaptured;
14214
+ if (!nextState.alreadyCaptured) {
14215
+ // Since we haven't already suspended during this commit, clear the
14216
+ // existing suspense state. We'll try rendering again.
14217
+ nextState = null;
14218
+ } else {
14219
+ // Something in this boundary's subtree already suspended. Switch to
14220
+ // rendering the fallback children. Set `alreadyCaptured` to true.
14221
+ if (current$$1 !== null && nextState === current$$1.memoizedState) {
14222
+ // Create a new suspense state to avoid mutating the current tree's.
14223
+ nextState = {
14224
+ alreadyCaptured: true,
14225
+ didTimeout: true,
14226
+ timedOutAt: nextState.timedOutAt
14227
+ };
14228
+ } else {
14229
+ // Already have a clone, so it's safe to mutate.
14230
+ nextState.alreadyCaptured = true;
14231
+ nextState.didTimeout = true;
14232
+ }
14233
+ }
14071
14234
  }
14235
+ var nextDidTimeout = nextState !== null && nextState.didTimeout;
14072
14236
 
14073
- if ((workInProgress.mode & StrictMode) !== NoEffect) {
14237
+ // This next part is a bit confusing. If the children timeout, we switch to
14238
+ // showing the fallback children in place of the "primary" children.
14239
+ // However, we don't want to delete the primary children because then their
14240
+ // state will be lost (both the React state and the host state, e.g.
14241
+ // uncontrolled form inputs). Instead we keep them mounted and hide them.
14242
+ // Both the fallback children AND the primary children are rendered at the
14243
+ // same time. Once the primary children are un-suspended, we can delete
14244
+ // the fallback children — don't need to preserve their state.
14245
+ //
14246
+ // The two sets of children are siblings in the host environment, but
14247
+ // semantically, for purposes of reconciliation, they are two separate sets.
14248
+ // So we store them using two fragment fibers.
14249
+ //
14250
+ // However, we want to avoid allocating extra fibers for every placeholder.
14251
+ // They're only necessary when the children time out, because that's the
14252
+ // only time when both sets are mounted.
14253
+ //
14254
+ // So, the extra fragment fibers are only used if the children time out.
14255
+ // Otherwise, we render the primary children directly. This requires some
14256
+ // custom reconciliation logic to preserve the state of the primary
14257
+ // children. It's essentially a very basic form of re-parenting.
14258
+
14259
+ // `child` points to the child fiber. In the normal case, this is the first
14260
+ // fiber of the primary children set. In the timed-out case, it's a
14261
+ // a fragment fiber containing the primary children.
14262
+ var child = void 0;
14263
+ // `next` points to the next fiber React should render. In the normal case,
14264
+ // it's the same as `child`: the first fiber of the primary children set.
14265
+ // In the timed-out case, it's a fragment fiber containing the *fallback*
14266
+ // children -- we skip over the primary children entirely.
14267
+ var next = void 0;
14268
+ if (current$$1 === null) {
14269
+ // This is the initial mount. This branch is pretty simple because there's
14270
+ // no previous state that needs to be preserved.
14074
14271
  if (nextDidTimeout) {
14075
- // If the timed-out view commits, schedule an update effect to record
14076
- // the committed time.
14077
- workInProgress.effectTag |= Update;
14272
+ // Mount separate fragments for primary and fallback children.
14273
+ var nextFallbackChildren = nextProps.fallback;
14274
+ var primaryChildFragment = createFiberFromFragment(null, mode, NoWork, null);
14275
+ var fallbackChildFragment = createFiberFromFragment(nextFallbackChildren, mode, renderExpirationTime, null);
14276
+ primaryChildFragment.sibling = fallbackChildFragment;
14277
+ child = primaryChildFragment;
14278
+ // Skip the primary children, and continue working on the
14279
+ // fallback children.
14280
+ next = fallbackChildFragment;
14281
+ child.return = next.return = workInProgress;
14078
14282
  } else {
14079
- // The state node points to the time at which placeholder timed out.
14080
- // We can clear it once we switch back to the normal children.
14081
- workInProgress.stateNode = null;
14283
+ // Mount the primary children without an intermediate fragment fiber.
14284
+ var nextPrimaryChildren = nextProps.children;
14285
+ child = next = mountChildFibers(workInProgress, null, nextPrimaryChildren, renderExpirationTime);
14082
14286
  }
14083
- }
14084
-
14085
- // If the `children` prop is a function, treat it like a render prop.
14086
- // TODO: This is temporary until we finalize a lower level API.
14087
- var children = nextProps.children;
14088
- var nextChildren = void 0;
14089
- if (typeof children === 'function') {
14090
- nextChildren = children(nextDidTimeout);
14091
14287
  } else {
14092
- nextChildren = nextDidTimeout ? nextProps.fallback : children;
14288
+ // This is an update. This branch is more complicated because we need to
14289
+ // ensure the state of the primary children is preserved.
14290
+ var prevState = current$$1.memoizedState;
14291
+ var prevDidTimeout = prevState !== null && prevState.didTimeout;
14292
+ if (prevDidTimeout) {
14293
+ // The current tree already timed out. That means each child set is
14294
+ var currentPrimaryChildFragment = current$$1.child;
14295
+ var currentFallbackChildFragment = currentPrimaryChildFragment.sibling;
14296
+ if (nextDidTimeout) {
14297
+ // Still timed out. Reuse the current primary children by cloning
14298
+ // its fragment. We're going to skip over these entirely.
14299
+ var _nextFallbackChildren = nextProps.fallback;
14300
+ var _primaryChildFragment = createWorkInProgress(currentPrimaryChildFragment, currentPrimaryChildFragment.pendingProps, NoWork);
14301
+ _primaryChildFragment.effectTag |= Placement;
14302
+ // Clone the fallback child fragment, too. These we'll continue
14303
+ // working on.
14304
+ var _fallbackChildFragment = _primaryChildFragment.sibling = createWorkInProgress(currentFallbackChildFragment, _nextFallbackChildren, currentFallbackChildFragment.expirationTime);
14305
+ _fallbackChildFragment.effectTag |= Placement;
14306
+ child = _primaryChildFragment;
14307
+ _primaryChildFragment.childExpirationTime = NoWork;
14308
+ // Skip the primary children, and continue working on the
14309
+ // fallback children.
14310
+ next = _fallbackChildFragment;
14311
+ child.return = next.return = workInProgress;
14312
+ } else {
14313
+ // No longer suspended. Switch back to showing the primary children,
14314
+ // and remove the intermediate fragment fiber.
14315
+ var _nextPrimaryChildren = nextProps.children;
14316
+ var currentPrimaryChild = currentPrimaryChildFragment.child;
14317
+ var currentFallbackChild = currentFallbackChildFragment.child;
14318
+ var primaryChild = reconcileChildFibers(workInProgress, currentPrimaryChild, _nextPrimaryChildren, renderExpirationTime);
14319
+ // Delete the fallback children.
14320
+ reconcileChildFibers(workInProgress, currentFallbackChild, null, renderExpirationTime);
14321
+ // Continue rendering the children, like we normally do.
14322
+ child = next = primaryChild;
14323
+ }
14324
+ } else {
14325
+ // The current tree has not already timed out. That means the primary
14326
+ var _currentPrimaryChild = current$$1.child;
14327
+ if (nextDidTimeout) {
14328
+ // Timed out. Wrap the children in a fragment fiber to keep them
14329
+ // separate from the fallback children.
14330
+ var _nextFallbackChildren2 = nextProps.fallback;
14331
+ var _primaryChildFragment2 = createFiberFromFragment(
14332
+ // It shouldn't matter what the pending props are because we aren't
14333
+ // going to render this fragment.
14334
+ null, mode, NoWork, null);
14335
+ _primaryChildFragment2.effectTag |= Placement;
14336
+ _primaryChildFragment2.child = _currentPrimaryChild;
14337
+ _currentPrimaryChild.return = _primaryChildFragment2;
14338
+ // Create a fragment from the fallback children, too.
14339
+ var _fallbackChildFragment2 = _primaryChildFragment2.sibling = createFiberFromFragment(_nextFallbackChildren2, mode, renderExpirationTime, null);
14340
+ _fallbackChildFragment2.effectTag |= Placement;
14341
+ child = _primaryChildFragment2;
14342
+ _primaryChildFragment2.childExpirationTime = NoWork;
14343
+ // Skip the primary children, and continue working on the
14344
+ // fallback children.
14345
+ next = _fallbackChildFragment2;
14346
+ child.return = next.return = workInProgress;
14347
+ } else {
14348
+ // Still haven't timed out. Continue rendering the children, like we
14349
+ // normally do.
14350
+ var _nextPrimaryChildren2 = nextProps.children;
14351
+ next = child = reconcileChildFibers(workInProgress, _currentPrimaryChild, _nextPrimaryChildren2, renderExpirationTime);
14352
+ }
14353
+ }
14093
14354
  }
14094
14355
 
14095
- if (current$$1 !== null && nextDidTimeout !== workInProgress.memoizedState) {
14096
- // We're about to switch from the placeholder children to the normal
14097
- // children, or vice versa. These are two different conceptual sets that
14098
- // happen to be stored in the same set. Call this special function to
14099
- // force the new set not to match with the current set.
14100
- // TODO: The proper way to model this is by storing each set separately.
14101
- forceUnmountCurrentAndReconcile(current$$1, workInProgress, nextChildren, renderExpirationTime);
14102
- } else {
14103
- reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
14104
- }
14105
- workInProgress.memoizedProps = nextProps;
14106
- workInProgress.memoizedState = nextDidTimeout;
14107
- return workInProgress.child;
14356
+ workInProgress.memoizedState = nextState;
14357
+ workInProgress.child = child;
14358
+ return next;
14108
14359
  }
14109
14360
 
14110
14361
  function updatePortalComponent(current$$1, workInProgress, renderExpirationTime) {
@@ -14117,10 +14368,8 @@ function updatePortalComponent(current$$1, workInProgress, renderExpirationTime)
14117
14368
  // the root always starts with a "current" with a null child.
14118
14369
  // TODO: Consider unifying this with how the root works.
14119
14370
  workInProgress.child = reconcileChildFibers(workInProgress, null, nextChildren, renderExpirationTime);
14120
- memoizeProps(workInProgress, nextChildren);
14121
14371
  } else {
14122
14372
  reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
14123
- memoizeProps(workInProgress, nextChildren);
14124
14373
  }
14125
14374
  return workInProgress.child;
14126
14375
  }
@@ -14133,7 +14382,6 @@ function updateContextProvider(current$$1, workInProgress, renderExpirationTime)
14133
14382
  var oldProps = workInProgress.memoizedProps;
14134
14383
 
14135
14384
  var newValue = newProps.value;
14136
- workInProgress.memoizedProps = newProps;
14137
14385
 
14138
14386
  {
14139
14387
  var providerPropTypes = workInProgress.type.propTypes;
@@ -14165,8 +14413,32 @@ function updateContextProvider(current$$1, workInProgress, renderExpirationTime)
14165
14413
  return workInProgress.child;
14166
14414
  }
14167
14415
 
14416
+ var hasWarnedAboutUsingContextAsConsumer = false;
14417
+
14168
14418
  function updateContextConsumer(current$$1, workInProgress, renderExpirationTime) {
14169
14419
  var context = workInProgress.type;
14420
+ // The logic below for Context differs depending on PROD or DEV mode. In
14421
+ // DEV mode, we create a separate object for Context.Consumer that acts
14422
+ // like a proxy to Context. This proxy object adds unnecessary code in PROD
14423
+ // so we use the old behaviour (Context.Consumer references Context) to
14424
+ // reduce size and overhead. The separate object references context via
14425
+ // a property called "_context", which also gives us the ability to check
14426
+ // in DEV mode if this property exists or not and warn if it does not.
14427
+ {
14428
+ if (context._context === undefined) {
14429
+ // This may be because it's a Context (rather than a Consumer).
14430
+ // Or it may be because it's older React where they're the same thing.
14431
+ // We only want to warn if we're sure it's a new React.
14432
+ if (context !== context.Consumer) {
14433
+ if (!hasWarnedAboutUsingContextAsConsumer) {
14434
+ hasWarnedAboutUsingContextAsConsumer = true;
14435
+ warning$1(false, 'Rendering <Context> directly is not supported and will be removed in ' + 'a future major release. Did you mean to render <Context.Consumer> instead?');
14436
+ }
14437
+ }
14438
+ } else {
14439
+ context = context._context;
14440
+ }
14441
+ }
14170
14442
  var newProps = workInProgress.pendingProps;
14171
14443
  var render = newProps.children;
14172
14444
 
@@ -14187,7 +14459,6 @@ function updateContextConsumer(current$$1, workInProgress, renderExpirationTime)
14187
14459
  // React DevTools reads this flag.
14188
14460
  workInProgress.effectTag |= PerformedWork;
14189
14461
  reconcileChildren(current$$1, workInProgress, newChildren, renderExpirationTime);
14190
- workInProgress.memoizedProps = newProps;
14191
14462
  return workInProgress.child;
14192
14463
  }
14193
14464
 
@@ -14238,17 +14509,6 @@ function bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirati
14238
14509
  }
14239
14510
  }
14240
14511
 
14241
- // TODO: Delete memoizeProps/State and move to reconcile/bailout instead
14242
- function memoizeProps(workInProgress, nextProps) {
14243
- workInProgress.memoizedProps = nextProps;
14244
- }
14245
-
14246
- function memoizeState(workInProgress, nextState) {
14247
- workInProgress.memoizedState = nextState;
14248
- // Don't reset the updateQueue, in case there are pending updates. Resetting
14249
- // is handled by processUpdateQueue.
14250
- }
14251
-
14252
14512
  function beginWork(current$$1, workInProgress, renderExpirationTime) {
14253
14513
  var updateExpirationTime = workInProgress.expirationTime;
14254
14514
 
@@ -14275,15 +14535,6 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
14275
14535
  }
14276
14536
  break;
14277
14537
  }
14278
- case ClassComponentLazy:
14279
- {
14280
- var thenable = workInProgress.type;
14281
- var _Component = getResultFromResolvedThenable(thenable);
14282
- if (isContextProvider(_Component)) {
14283
- pushContextProvider(workInProgress);
14284
- }
14285
- break;
14286
- }
14287
14538
  case HostPortal:
14288
14539
  pushHostContainer(workInProgress, workInProgress.stateNode.containerInfo);
14289
14540
  break;
@@ -14298,6 +14549,35 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
14298
14549
  workInProgress.effectTag |= Update;
14299
14550
  }
14300
14551
  break;
14552
+ case SuspenseComponent:
14553
+ {
14554
+ var state = workInProgress.memoizedState;
14555
+ var didTimeout = state !== null && state.didTimeout;
14556
+ if (didTimeout) {
14557
+ // If this boundary is currently timed out, we need to decide
14558
+ // whether to retry the primary children, or to skip over it and
14559
+ // go straight to the fallback. Check the priority of the primary
14560
+ var primaryChildFragment = workInProgress.child;
14561
+ var primaryChildExpirationTime = primaryChildFragment.childExpirationTime;
14562
+ if (primaryChildExpirationTime !== NoWork && primaryChildExpirationTime <= renderExpirationTime) {
14563
+ // The primary children have pending work. Use the normal path
14564
+ // to attempt to render the primary children again.
14565
+ return updateSuspenseComponent(current$$1, workInProgress, renderExpirationTime);
14566
+ } else {
14567
+ // The primary children do not have pending work with sufficient
14568
+ // priority. Bailout.
14569
+ var child = bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
14570
+ if (child !== null) {
14571
+ // The fallback children have pending work. Skip over the
14572
+ // primary children and work on the fallback.
14573
+ return child.sibling;
14574
+ } else {
14575
+ return null;
14576
+ }
14577
+ }
14578
+ }
14579
+ break;
14580
+ }
14301
14581
  }
14302
14582
  return bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
14303
14583
  }
@@ -14309,38 +14589,27 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
14309
14589
  switch (workInProgress.tag) {
14310
14590
  case IndeterminateComponent:
14311
14591
  {
14312
- var _Component2 = workInProgress.type;
14313
- return mountIndeterminateComponent(current$$1, workInProgress, _Component2, updateExpirationTime, renderExpirationTime);
14592
+ var elementType = workInProgress.elementType;
14593
+ return mountIndeterminateComponent(current$$1, workInProgress, elementType, renderExpirationTime);
14314
14594
  }
14315
- case FunctionComponent:
14595
+ case LazyComponent:
14316
14596
  {
14317
- var _Component3 = workInProgress.type;
14318
- var unresolvedProps = workInProgress.pendingProps;
14319
- return updateFunctionComponent(current$$1, workInProgress, _Component3, unresolvedProps, renderExpirationTime);
14597
+ var _elementType = workInProgress.elementType;
14598
+ return mountLazyComponent(current$$1, workInProgress, _elementType, updateExpirationTime, renderExpirationTime);
14320
14599
  }
14321
- case FunctionComponentLazy:
14600
+ case FunctionComponent:
14322
14601
  {
14323
- var _thenable = workInProgress.type;
14324
- var _Component4 = getResultFromResolvedThenable(_thenable);
14325
- var _unresolvedProps = workInProgress.pendingProps;
14326
- var child = updateFunctionComponent(current$$1, workInProgress, _Component4, resolveDefaultProps(_Component4, _unresolvedProps), renderExpirationTime);
14327
- workInProgress.memoizedProps = _unresolvedProps;
14328
- return child;
14602
+ var _Component = workInProgress.type;
14603
+ var unresolvedProps = workInProgress.pendingProps;
14604
+ var resolvedProps = workInProgress.elementType === _Component ? unresolvedProps : resolveDefaultProps(_Component, unresolvedProps);
14605
+ return updateFunctionComponent(current$$1, workInProgress, _Component, resolvedProps, renderExpirationTime);
14329
14606
  }
14330
14607
  case ClassComponent:
14331
14608
  {
14332
- var _Component5 = workInProgress.type;
14333
- var _unresolvedProps2 = workInProgress.pendingProps;
14334
- return updateClassComponent(current$$1, workInProgress, _Component5, _unresolvedProps2, renderExpirationTime);
14335
- }
14336
- case ClassComponentLazy:
14337
- {
14338
- var _thenable2 = workInProgress.type;
14339
- var _Component6 = getResultFromResolvedThenable(_thenable2);
14340
- var _unresolvedProps3 = workInProgress.pendingProps;
14341
- var _child = updateClassComponent(current$$1, workInProgress, _Component6, resolveDefaultProps(_Component6, _unresolvedProps3), renderExpirationTime);
14342
- workInProgress.memoizedProps = _unresolvedProps3;
14343
- return _child;
14609
+ var _Component2 = workInProgress.type;
14610
+ var _unresolvedProps = workInProgress.pendingProps;
14611
+ var _resolvedProps = workInProgress.elementType === _Component2 ? _unresolvedProps : resolveDefaultProps(_Component2, _unresolvedProps);
14612
+ return updateClassComponent(current$$1, workInProgress, _Component2, _resolvedProps, renderExpirationTime);
14344
14613
  }
14345
14614
  case HostRoot:
14346
14615
  return updateHostRoot(current$$1, workInProgress, renderExpirationTime);
@@ -14355,16 +14624,9 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
14355
14624
  case ForwardRef:
14356
14625
  {
14357
14626
  var type = workInProgress.type;
14358
- return updateForwardRef(current$$1, workInProgress, type, workInProgress.pendingProps, renderExpirationTime);
14359
- }
14360
- case ForwardRefLazy:
14361
- {
14362
- var _thenable3 = workInProgress.type;
14363
- var _Component7 = getResultFromResolvedThenable(_thenable3);
14364
- var _unresolvedProps4 = workInProgress.pendingProps;
14365
- var _child2 = updateForwardRef(current$$1, workInProgress, _Component7, resolveDefaultProps(_Component7, _unresolvedProps4), renderExpirationTime);
14366
- workInProgress.memoizedProps = _unresolvedProps4;
14367
- return _child2;
14627
+ var _unresolvedProps2 = workInProgress.pendingProps;
14628
+ var _resolvedProps2 = workInProgress.elementType === type ? _unresolvedProps2 : resolveDefaultProps(type, _unresolvedProps2);
14629
+ return updateForwardRef(current$$1, workInProgress, type, _resolvedProps2, renderExpirationTime);
14368
14630
  }
14369
14631
  case Fragment:
14370
14632
  return updateFragment(current$$1, workInProgress, renderExpirationTime);
@@ -14376,19 +14638,23 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
14376
14638
  return updateContextProvider(current$$1, workInProgress, renderExpirationTime);
14377
14639
  case ContextConsumer:
14378
14640
  return updateContextConsumer(current$$1, workInProgress, renderExpirationTime);
14379
- case PureComponent:
14641
+ case MemoComponent:
14380
14642
  {
14381
14643
  var _type = workInProgress.type;
14382
- return updatePureComponent(current$$1, workInProgress, _type, workInProgress.pendingProps, updateExpirationTime, renderExpirationTime);
14644
+ var _unresolvedProps3 = workInProgress.pendingProps;
14645
+ var _resolvedProps3 = resolveDefaultProps(_type.type, _unresolvedProps3);
14646
+ return updateMemoComponent(current$$1, workInProgress, _type, _resolvedProps3, updateExpirationTime, renderExpirationTime);
14647
+ }
14648
+ case SimpleMemoComponent:
14649
+ {
14650
+ return updateSimpleMemoComponent(current$$1, workInProgress, workInProgress.type, workInProgress.pendingProps, updateExpirationTime, renderExpirationTime);
14383
14651
  }
14384
- case PureComponentLazy:
14652
+ case IncompleteClassComponent:
14385
14653
  {
14386
- var _thenable4 = workInProgress.type;
14387
- var _Component8 = getResultFromResolvedThenable(_thenable4);
14388
- var _unresolvedProps5 = workInProgress.pendingProps;
14389
- var _child3 = updatePureComponent(current$$1, workInProgress, _Component8, resolveDefaultProps(_Component8, _unresolvedProps5), updateExpirationTime, renderExpirationTime);
14390
- workInProgress.memoizedProps = _unresolvedProps5;
14391
- return _child3;
14654
+ var _Component3 = workInProgress.type;
14655
+ var _unresolvedProps4 = workInProgress.pendingProps;
14656
+ var _resolvedProps4 = workInProgress.elementType === _Component3 ? _unresolvedProps4 : resolveDefaultProps(_Component3, _unresolvedProps4);
14657
+ return mountIncompleteClassComponent(current$$1, workInProgress, _Component3, _resolvedProps4, renderExpirationTime);
14392
14658
  }
14393
14659
  default:
14394
14660
  invariant(false, 'Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue.');
@@ -14405,42 +14671,43 @@ function markRef$1(workInProgress) {
14405
14671
  workInProgress.effectTag |= Ref;
14406
14672
  }
14407
14673
 
14408
- function appendAllChildren(parent, workInProgress) {
14409
- // We only have the top Fiber that was created but we need recurse down its
14410
- // children to find all the terminal nodes.
14411
- var node = workInProgress.child;
14412
- while (node !== null) {
14413
- if (node.tag === HostComponent || node.tag === HostText) {
14414
- appendInitialChild(parent, node.stateNode);
14415
- } else if (node.tag === HostPortal) {
14416
- // If we have a portal child, then we don't want to traverse
14417
- // down its children. Instead, we'll get insertions from each child in
14418
- // the portal directly.
14419
- } else if (node.child !== null) {
14420
- node.child.return = node;
14421
- node = node.child;
14422
- continue;
14423
- }
14424
- if (node === workInProgress) {
14425
- return;
14426
- }
14427
- while (node.sibling === null) {
14428
- if (node.return === null || node.return === workInProgress) {
14429
- return;
14430
- }
14431
- node = node.return;
14432
- }
14433
- node.sibling.return = node.return;
14434
- node = node.sibling;
14435
- }
14436
- }
14437
-
14674
+ var appendAllChildren = void 0;
14438
14675
  var updateHostContainer = void 0;
14439
14676
  var updateHostComponent$1 = void 0;
14440
14677
  var updateHostText$1 = void 0;
14441
14678
  if (supportsMutation) {
14442
14679
  // Mutation mode
14443
14680
 
14681
+ appendAllChildren = function (parent, workInProgress, needsVisibilityToggle, isHidden) {
14682
+ // We only have the top Fiber that was created but we need recurse down its
14683
+ // children to find all the terminal nodes.
14684
+ var node = workInProgress.child;
14685
+ while (node !== null) {
14686
+ if (node.tag === HostComponent || node.tag === HostText) {
14687
+ appendInitialChild(parent, node.stateNode);
14688
+ } else if (node.tag === HostPortal) {
14689
+ // If we have a portal child, then we don't want to traverse
14690
+ // down its children. Instead, we'll get insertions from each child in
14691
+ // the portal directly.
14692
+ } else if (node.child !== null) {
14693
+ node.child.return = node;
14694
+ node = node.child;
14695
+ continue;
14696
+ }
14697
+ if (node === workInProgress) {
14698
+ return;
14699
+ }
14700
+ while (node.sibling === null) {
14701
+ if (node.return === null || node.return === workInProgress) {
14702
+ return;
14703
+ }
14704
+ node = node.return;
14705
+ }
14706
+ node.sibling.return = node.return;
14707
+ node = node.sibling;
14708
+ }
14709
+ };
14710
+
14444
14711
  updateHostContainer = function (workInProgress) {
14445
14712
  // Noop
14446
14713
  };
@@ -14481,23 +14748,167 @@ if (supportsMutation) {
14481
14748
  } else if (supportsPersistence) {
14482
14749
  // Persistent host tree mode
14483
14750
 
14751
+ appendAllChildren = function (parent, workInProgress, needsVisibilityToggle, isHidden) {
14752
+ // We only have the top Fiber that was created but we need recurse down its
14753
+ // children to find all the terminal nodes.
14754
+ var node = workInProgress.child;
14755
+ while (node !== null) {
14756
+ // eslint-disable-next-line no-labels
14757
+ branches: if (node.tag === HostComponent) {
14758
+ var instance = node.stateNode;
14759
+ if (needsVisibilityToggle) {
14760
+ var props = node.memoizedProps;
14761
+ var type = node.type;
14762
+ if (isHidden) {
14763
+ // This child is inside a timed out tree. Hide it.
14764
+ instance = cloneHiddenInstance(instance, type, props, node);
14765
+ } else {
14766
+ // This child was previously inside a timed out tree. If it was not
14767
+ // updated during this render, it may need to be unhidden. Clone
14768
+ // again to be sure.
14769
+ instance = cloneUnhiddenInstance(instance, type, props, node);
14770
+ }
14771
+ node.stateNode = instance;
14772
+ }
14773
+ appendInitialChild(parent, instance);
14774
+ } else if (node.tag === HostText) {
14775
+ var _instance = node.stateNode;
14776
+ if (needsVisibilityToggle) {
14777
+ var text = node.memoizedProps;
14778
+ var rootContainerInstance = getRootHostContainer();
14779
+ var currentHostContext = getHostContext();
14780
+ if (isHidden) {
14781
+ _instance = createHiddenTextInstance(text, rootContainerInstance, currentHostContext, workInProgress);
14782
+ } else {
14783
+ _instance = createTextInstance(text, rootContainerInstance, currentHostContext, workInProgress);
14784
+ }
14785
+ node.stateNode = _instance;
14786
+ }
14787
+ appendInitialChild(parent, _instance);
14788
+ } else if (node.tag === HostPortal) {
14789
+ // If we have a portal child, then we don't want to traverse
14790
+ // down its children. Instead, we'll get insertions from each child in
14791
+ // the portal directly.
14792
+ } else if (node.tag === SuspenseComponent) {
14793
+ var current = node.alternate;
14794
+ if (current !== null) {
14795
+ var oldState = current.memoizedState;
14796
+ var newState = node.memoizedState;
14797
+ var oldIsHidden = oldState !== null && oldState.didTimeout;
14798
+ var newIsHidden = newState !== null && newState.didTimeout;
14799
+ if (oldIsHidden !== newIsHidden) {
14800
+ // The placeholder either just timed out or switched back to the normal
14801
+ // children after having previously timed out. Toggle the visibility of
14802
+ // the direct host children.
14803
+ var primaryChildParent = newIsHidden ? node.child : node;
14804
+ if (primaryChildParent !== null) {
14805
+ appendAllChildren(parent, primaryChildParent, true, newIsHidden);
14806
+ }
14807
+ // eslint-disable-next-line no-labels
14808
+ break branches;
14809
+ }
14810
+ }
14811
+ if (node.child !== null) {
14812
+ // Continue traversing like normal
14813
+ node.child.return = node;
14814
+ node = node.child;
14815
+ continue;
14816
+ }
14817
+ } else if (node.child !== null) {
14818
+ node.child.return = node;
14819
+ node = node.child;
14820
+ continue;
14821
+ }
14822
+ // $FlowFixMe This is correct but Flow is confused by the labeled break.
14823
+ node = node;
14824
+ if (node === workInProgress) {
14825
+ return;
14826
+ }
14827
+ while (node.sibling === null) {
14828
+ if (node.return === null || node.return === workInProgress) {
14829
+ return;
14830
+ }
14831
+ node = node.return;
14832
+ }
14833
+ node.sibling.return = node.return;
14834
+ node = node.sibling;
14835
+ }
14836
+ };
14837
+
14484
14838
  // An unfortunate fork of appendAllChildren because we have two different parent types.
14485
- var appendAllChildrenToContainer = function (containerChildSet, workInProgress) {
14839
+ var appendAllChildrenToContainer = function (containerChildSet, workInProgress, needsVisibilityToggle, isHidden) {
14486
14840
  // We only have the top Fiber that was created but we need recurse down its
14487
14841
  // children to find all the terminal nodes.
14488
14842
  var node = workInProgress.child;
14489
14843
  while (node !== null) {
14490
- if (node.tag === HostComponent || node.tag === HostText) {
14491
- appendChildToContainerChildSet(containerChildSet, node.stateNode);
14844
+ // eslint-disable-next-line no-labels
14845
+ branches: if (node.tag === HostComponent) {
14846
+ var instance = node.stateNode;
14847
+ if (needsVisibilityToggle) {
14848
+ var props = node.memoizedProps;
14849
+ var type = node.type;
14850
+ if (isHidden) {
14851
+ // This child is inside a timed out tree. Hide it.
14852
+ instance = cloneHiddenInstance(instance, type, props, node);
14853
+ } else {
14854
+ // This child was previously inside a timed out tree. If it was not
14855
+ // updated during this render, it may need to be unhidden. Clone
14856
+ // again to be sure.
14857
+ instance = cloneUnhiddenInstance(instance, type, props, node);
14858
+ }
14859
+ node.stateNode = instance;
14860
+ }
14861
+ appendChildToContainerChildSet(containerChildSet, instance);
14862
+ } else if (node.tag === HostText) {
14863
+ var _instance2 = node.stateNode;
14864
+ if (needsVisibilityToggle) {
14865
+ var text = node.memoizedProps;
14866
+ var rootContainerInstance = getRootHostContainer();
14867
+ var currentHostContext = getHostContext();
14868
+ if (isHidden) {
14869
+ _instance2 = createHiddenTextInstance(text, rootContainerInstance, currentHostContext, workInProgress);
14870
+ } else {
14871
+ _instance2 = createTextInstance(text, rootContainerInstance, currentHostContext, workInProgress);
14872
+ }
14873
+ node.stateNode = _instance2;
14874
+ }
14875
+ appendChildToContainerChildSet(containerChildSet, _instance2);
14492
14876
  } else if (node.tag === HostPortal) {
14493
14877
  // If we have a portal child, then we don't want to traverse
14494
14878
  // down its children. Instead, we'll get insertions from each child in
14495
14879
  // the portal directly.
14880
+ } else if (node.tag === SuspenseComponent) {
14881
+ var current = node.alternate;
14882
+ if (current !== null) {
14883
+ var oldState = current.memoizedState;
14884
+ var newState = node.memoizedState;
14885
+ var oldIsHidden = oldState !== null && oldState.didTimeout;
14886
+ var newIsHidden = newState !== null && newState.didTimeout;
14887
+ if (oldIsHidden !== newIsHidden) {
14888
+ // The placeholder either just timed out or switched back to the normal
14889
+ // children after having previously timed out. Toggle the visibility of
14890
+ // the direct host children.
14891
+ var primaryChildParent = newIsHidden ? node.child : node;
14892
+ if (primaryChildParent !== null) {
14893
+ appendAllChildrenToContainer(containerChildSet, primaryChildParent, true, newIsHidden);
14894
+ }
14895
+ // eslint-disable-next-line no-labels
14896
+ break branches;
14897
+ }
14898
+ }
14899
+ if (node.child !== null) {
14900
+ // Continue traversing like normal
14901
+ node.child.return = node;
14902
+ node = node.child;
14903
+ continue;
14904
+ }
14496
14905
  } else if (node.child !== null) {
14497
14906
  node.child.return = node;
14498
14907
  node = node.child;
14499
14908
  continue;
14500
14909
  }
14910
+ // $FlowFixMe This is correct but Flow is confused by the labeled break.
14911
+ node = node;
14501
14912
  if (node === workInProgress) {
14502
14913
  return;
14503
14914
  }
@@ -14520,7 +14931,7 @@ if (supportsMutation) {
14520
14931
  var container = portalOrRoot.containerInfo;
14521
14932
  var newChildSet = createContainerChildSet(container);
14522
14933
  // If children might have changed, we have to add them all to the set.
14523
- appendAllChildrenToContainer(newChildSet, workInProgress);
14934
+ appendAllChildrenToContainer(newChildSet, workInProgress, false, false);
14524
14935
  portalOrRoot.pendingChildren = newChildSet;
14525
14936
  // Schedule an update on the container to swap out the container.
14526
14937
  markUpdate(workInProgress);
@@ -14563,7 +14974,7 @@ if (supportsMutation) {
14563
14974
  markUpdate(workInProgress);
14564
14975
  } else {
14565
14976
  // If children might have changed, we have to add them all to the set.
14566
- appendAllChildren(newInstance, workInProgress);
14977
+ appendAllChildren(newInstance, workInProgress, false, false);
14567
14978
  }
14568
14979
  };
14569
14980
  updateHostText$1 = function (current, workInProgress, oldText, newText) {
@@ -14594,8 +15005,12 @@ function completeWork(current, workInProgress, renderExpirationTime) {
14594
15005
  var newProps = workInProgress.pendingProps;
14595
15006
 
14596
15007
  switch (workInProgress.tag) {
15008
+ case IndeterminateComponent:
15009
+ break;
15010
+ case LazyComponent:
15011
+ break;
15012
+ case SimpleMemoComponent:
14597
15013
  case FunctionComponent:
14598
- case FunctionComponentLazy:
14599
15014
  break;
14600
15015
  case ClassComponent:
14601
15016
  {
@@ -14605,14 +15020,6 @@ function completeWork(current, workInProgress, renderExpirationTime) {
14605
15020
  }
14606
15021
  break;
14607
15022
  }
14608
- case ClassComponentLazy:
14609
- {
14610
- var _Component = getResultFromResolvedThenable(workInProgress.type);
14611
- if (isContextProvider(_Component)) {
14612
- popContext(workInProgress);
14613
- }
14614
- break;
14615
- }
14616
15023
  case HostRoot:
14617
15024
  {
14618
15025
  popHostContainer(workInProgress);
@@ -14668,7 +15075,7 @@ function completeWork(current, workInProgress, renderExpirationTime) {
14668
15075
  } else {
14669
15076
  var instance = createInstance(type, newProps, rootContainerInstance, currentHostContext, workInProgress);
14670
15077
 
14671
- appendAllChildren(instance, workInProgress);
15078
+ appendAllChildren(instance, workInProgress, false, false);
14672
15079
 
14673
15080
  // Certain renderers require commit-time effects for initial mount.
14674
15081
  // (eg DOM renderer supports auto-focus for certain elements).
@@ -14713,10 +15120,20 @@ function completeWork(current, workInProgress, renderExpirationTime) {
14713
15120
  break;
14714
15121
  }
14715
15122
  case ForwardRef:
14716
- case ForwardRefLazy:
14717
15123
  break;
14718
15124
  case SuspenseComponent:
14719
- break;
15125
+ {
15126
+ var nextState = workInProgress.memoizedState;
15127
+ var prevState = current !== null ? current.memoizedState : null;
15128
+ var nextDidTimeout = nextState !== null && nextState.didTimeout;
15129
+ var prevDidTimeout = prevState !== null && prevState.didTimeout;
15130
+ if (nextDidTimeout !== prevDidTimeout) {
15131
+ // If this render commits, and it switches between the normal state
15132
+ // and the timed-out state, schedule an effect.
15133
+ workInProgress.effectTag |= Update;
15134
+ }
15135
+ break;
15136
+ }
14720
15137
  case Fragment:
14721
15138
  break;
14722
15139
  case Mode:
@@ -14733,13 +15150,18 @@ function completeWork(current, workInProgress, renderExpirationTime) {
14733
15150
  break;
14734
15151
  case ContextConsumer:
14735
15152
  break;
14736
- case PureComponent:
14737
- case PureComponentLazy:
15153
+ case MemoComponent:
14738
15154
  break;
14739
- // Error cases
14740
- case IndeterminateComponent:
14741
- invariant(false, 'An indeterminate component should have become determinate before completing. This error is likely caused by a bug in React. Please file an issue.');
14742
- // eslint-disable-next-line no-fallthrough
15155
+ case IncompleteClassComponent:
15156
+ {
15157
+ // Same as class component case. I put it down here so that the tags are
15158
+ // sequential to ensure this switch is compiled to a jump table.
15159
+ var _Component = workInProgress.type;
15160
+ if (isContextProvider(_Component)) {
15161
+ popContext(workInProgress);
15162
+ }
15163
+ break;
15164
+ }
14743
15165
  default:
14744
15166
  invariant(false, 'Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue.');
14745
15167
  }
@@ -14747,6 +15169,17 @@ function completeWork(current, workInProgress, renderExpirationTime) {
14747
15169
  return null;
14748
15170
  }
14749
15171
 
15172
+ function shouldCaptureSuspense(current, workInProgress) {
15173
+ // In order to capture, the Suspense component must have a fallback prop.
15174
+ if (workInProgress.memoizedProps.fallback === undefined) {
15175
+ return false;
15176
+ }
15177
+ // If it was the primary children that just suspended, capture and render the
15178
+ // fallback. Otherwise, don't capture and bubble to the next boundary.
15179
+ var nextState = workInProgress.memoizedState;
15180
+ return nextState === null || !nextState.didTimeout;
15181
+ }
15182
+
14750
15183
  // This module is forked in different environments.
14751
15184
  // By default, return `true` to log errors to the console.
14752
15185
  // Forks can return `false` if this isn't desirable.
@@ -14814,8 +15247,6 @@ function logCapturedError(capturedError) {
14814
15247
  }
14815
15248
  }
14816
15249
 
14817
- var emptyObject = {};
14818
-
14819
15250
  var didWarnAboutUndefinedSnapshotBeforeUpdate = null;
14820
15251
  {
14821
15252
  didWarnAboutUndefinedSnapshotBeforeUpdate = new Set();
@@ -14897,7 +15328,6 @@ function safelyDetachRef(current$$1) {
14897
15328
  function commitBeforeMutationLifeCycles(current$$1, finishedWork) {
14898
15329
  switch (finishedWork.tag) {
14899
15330
  case ClassComponent:
14900
- case ClassComponentLazy:
14901
15331
  {
14902
15332
  if (finishedWork.effectTag & Snapshot) {
14903
15333
  if (current$$1 !== null) {
@@ -14925,6 +15355,7 @@ function commitBeforeMutationLifeCycles(current$$1, finishedWork) {
14925
15355
  case HostComponent:
14926
15356
  case HostText:
14927
15357
  case HostPortal:
15358
+ case IncompleteClassComponent:
14928
15359
  // Nothing to do for these component types
14929
15360
  return;
14930
15361
  default:
@@ -14937,7 +15368,6 @@ function commitBeforeMutationLifeCycles(current$$1, finishedWork) {
14937
15368
  function commitLifeCycles(finishedRoot, current$$1, finishedWork, committedExpirationTime) {
14938
15369
  switch (finishedWork.tag) {
14939
15370
  case ClassComponent:
14940
- case ClassComponentLazy:
14941
15371
  {
14942
15372
  var instance = finishedWork.stateNode;
14943
15373
  if (finishedWork.effectTag & Update) {
@@ -14976,7 +15406,6 @@ function commitLifeCycles(finishedRoot, current$$1, finishedWork, committedExpir
14976
15406
  _instance = getPublicInstance(finishedWork.child.stateNode);
14977
15407
  break;
14978
15408
  case ClassComponent:
14979
- case ClassComponentLazy:
14980
15409
  _instance = finishedWork.child.stateNode;
14981
15410
  break;
14982
15411
  }
@@ -15026,22 +15455,48 @@ function commitLifeCycles(finishedRoot, current$$1, finishedWork, committedExpir
15026
15455
  }
15027
15456
  case SuspenseComponent:
15028
15457
  {
15029
- if ((finishedWork.mode & StrictMode) === NoEffect) {
15030
- // In loose mode, a placeholder times out by scheduling a synchronous
15031
- // update in the commit phase. Use `updateQueue` field to signal that
15032
- // the Timeout needs to switch to the placeholder. We don't need an
15033
- // entire queue. Any non-null value works.
15034
- // $FlowFixMe - Intentionally using a value other than an UpdateQueue.
15035
- finishedWork.updateQueue = emptyObject;
15458
+ if (finishedWork.effectTag & Callback) {
15459
+ // In non-strict mode, a suspense boundary times out by commiting
15460
+ // twice: first, by committing the children in an inconsistent state,
15461
+ // then hiding them and showing the fallback children in a subsequent
15462
+ var _newState = {
15463
+ alreadyCaptured: true,
15464
+ didTimeout: false,
15465
+ timedOutAt: NoWork
15466
+ };
15467
+ finishedWork.memoizedState = _newState;
15036
15468
  scheduleWork(finishedWork, Sync);
15469
+ return;
15470
+ }
15471
+ var oldState = current$$1 !== null ? current$$1.memoizedState : null;
15472
+ var newState = finishedWork.memoizedState;
15473
+ var oldDidTimeout = oldState !== null ? oldState.didTimeout : false;
15474
+
15475
+ var newDidTimeout = void 0;
15476
+ var primaryChildParent = finishedWork;
15477
+ if (newState === null) {
15478
+ newDidTimeout = false;
15037
15479
  } else {
15038
- // In strict mode, the Update effect is used to record the time at
15039
- // which the placeholder timed out.
15040
- var currentTime = requestCurrentTime();
15041
- finishedWork.stateNode = { timedOutAt: currentTime };
15480
+ newDidTimeout = newState.didTimeout;
15481
+ if (newDidTimeout) {
15482
+ primaryChildParent = finishedWork.child;
15483
+ newState.alreadyCaptured = false;
15484
+ if (newState.timedOutAt === NoWork) {
15485
+ // If the children had not already timed out, record the time.
15486
+ // This is used to compute the elapsed time during subsequent
15487
+ // attempts to render the children.
15488
+ newState.timedOutAt = requestCurrentTime();
15489
+ }
15490
+ }
15491
+ }
15492
+
15493
+ if (newDidTimeout !== oldDidTimeout && primaryChildParent !== null) {
15494
+ hideOrUnhideAllChildren(primaryChildParent, newDidTimeout);
15042
15495
  }
15043
15496
  return;
15044
15497
  }
15498
+ case IncompleteClassComponent:
15499
+ break;
15045
15500
  default:
15046
15501
  {
15047
15502
  invariant(false, 'This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue.');
@@ -15049,6 +15504,45 @@ function commitLifeCycles(finishedRoot, current$$1, finishedWork, committedExpir
15049
15504
  }
15050
15505
  }
15051
15506
 
15507
+ function hideOrUnhideAllChildren(finishedWork, isHidden) {
15508
+ if (supportsMutation) {
15509
+ // We only have the top Fiber that was inserted but we need recurse down its
15510
+ var node = finishedWork;
15511
+ while (true) {
15512
+ if (node.tag === HostComponent) {
15513
+ var instance = node.stateNode;
15514
+ if (isHidden) {
15515
+ hideInstance(instance);
15516
+ } else {
15517
+ unhideInstance(node.stateNode, node.memoizedProps);
15518
+ }
15519
+ } else if (node.tag === HostText) {
15520
+ var _instance3 = node.stateNode;
15521
+ if (isHidden) {
15522
+ hideTextInstance(_instance3);
15523
+ } else {
15524
+ unhideTextInstance(_instance3, node.memoizedProps);
15525
+ }
15526
+ } else if (node.child !== null) {
15527
+ node.child.return = node;
15528
+ node = node.child;
15529
+ continue;
15530
+ }
15531
+ if (node === finishedWork) {
15532
+ return;
15533
+ }
15534
+ while (node.sibling === null) {
15535
+ if (node.return === null || node.return === finishedWork) {
15536
+ return;
15537
+ }
15538
+ node = node.return;
15539
+ }
15540
+ node.sibling.return = node.return;
15541
+ node = node.sibling;
15542
+ }
15543
+ }
15544
+ }
15545
+
15052
15546
  function commitAttachRef(finishedWork) {
15053
15547
  var ref = finishedWork.ref;
15054
15548
  if (ref !== null) {
@@ -15094,7 +15588,6 @@ function commitUnmount(current$$1) {
15094
15588
 
15095
15589
  switch (current$$1.tag) {
15096
15590
  case ClassComponent:
15097
- case ClassComponentLazy:
15098
15591
  {
15099
15592
  safelyDetachRef(current$$1);
15100
15593
  var instance = current$$1.stateNode;
@@ -15188,7 +15681,6 @@ function commitContainer(finishedWork) {
15188
15681
 
15189
15682
  switch (finishedWork.tag) {
15190
15683
  case ClassComponent:
15191
- case ClassComponentLazy:
15192
15684
  {
15193
15685
  return;
15194
15686
  }
@@ -15455,7 +15947,6 @@ function commitWork(current$$1, finishedWork) {
15455
15947
 
15456
15948
  switch (finishedWork.tag) {
15457
15949
  case ClassComponent:
15458
- case ClassComponentLazy:
15459
15950
  {
15460
15951
  return;
15461
15952
  }
@@ -15503,6 +15994,10 @@ function commitWork(current$$1, finishedWork) {
15503
15994
  {
15504
15995
  return;
15505
15996
  }
15997
+ case IncompleteClassComponent:
15998
+ {
15999
+ return;
16000
+ }
15506
16001
  default:
15507
16002
  {
15508
16003
  invariant(false, 'This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue.');
@@ -15517,10 +16012,6 @@ function commitResetTextContent(current$$1) {
15517
16012
  resetTextContent(current$$1.stateNode);
15518
16013
  }
15519
16014
 
15520
- function NoopComponent() {
15521
- return null;
15522
- }
15523
-
15524
16015
  function createRootErrorUpdate(fiber, errorInfo, expirationTime) {
15525
16016
  var update = createUpdate(expirationTime);
15526
16017
  // Unmount the root by rendering null.
@@ -15598,17 +16089,16 @@ function throwException(root, returnFiber, sourceFiber, value, renderExpirationT
15598
16089
  do {
15599
16090
  if (_workInProgress.tag === SuspenseComponent) {
15600
16091
  var current = _workInProgress.alternate;
15601
- if (current !== null && current.memoizedState === true && current.stateNode !== null) {
15602
- // Reached a placeholder that already timed out. Each timed out
15603
- // placeholder acts as the root of a new suspense boundary.
15604
-
15605
- // Use the time at which the placeholder timed out as the start time
15606
- // for the current render.
15607
- var timedOutAt = current.stateNode.timedOutAt;
15608
- startTimeMs = expirationTimeToMs(timedOutAt);
15609
-
15610
- // Do not search any further.
15611
- break;
16092
+ if (current !== null) {
16093
+ var currentState = current.memoizedState;
16094
+ if (currentState !== null && currentState.didTimeout) {
16095
+ // Reached a boundary that already timed out. Do not search
16096
+ // any further.
16097
+ var timedOutAt = currentState.timedOutAt;
16098
+ startTimeMs = expirationTimeToMs(timedOutAt);
16099
+ // Do not search any further.
16100
+ break;
16101
+ }
15612
16102
  }
15613
16103
  var timeoutPropMs = _workInProgress.pendingProps.maxDuration;
15614
16104
  if (typeof timeoutPropMs === 'number') {
@@ -15625,103 +16115,93 @@ function throwException(root, returnFiber, sourceFiber, value, renderExpirationT
15625
16115
  // Schedule the nearest Suspense to re-render the timed out view.
15626
16116
  _workInProgress = returnFiber;
15627
16117
  do {
15628
- if (_workInProgress.tag === SuspenseComponent) {
15629
- var didTimeout = _workInProgress.memoizedState;
15630
- if (!didTimeout) {
15631
- // Found the nearest boundary.
16118
+ if (_workInProgress.tag === SuspenseComponent && shouldCaptureSuspense(_workInProgress.alternate, _workInProgress)) {
16119
+ // Found the nearest boundary.
15632
16120
 
15633
- // If the boundary is not in concurrent mode, we should not suspend, and
15634
- // likewise, when the promise resolves, we should ping synchronously.
15635
- var pingTime = (_workInProgress.mode & ConcurrentMode) === NoEffect ? Sync : renderExpirationTime;
16121
+ // If the boundary is not in concurrent mode, we should not suspend, and
16122
+ // likewise, when the promise resolves, we should ping synchronously.
16123
+ var pingTime = (_workInProgress.mode & ConcurrentMode) === NoEffect ? Sync : renderExpirationTime;
15636
16124
 
15637
- // Attach a listener to the promise to "ping" the root and retry.
15638
- var onResolveOrReject = retrySuspendedRoot.bind(null, root, _workInProgress, pingTime);
15639
- if (enableSchedulerTracing) {
15640
- onResolveOrReject = unstable_wrap(onResolveOrReject);
15641
- }
15642
- thenable.then(onResolveOrReject, onResolveOrReject);
15643
-
15644
- // If the boundary is outside of strict mode, we should *not* suspend
15645
- // the commit. Pretend as if the suspended component rendered null and
15646
- // keep rendering. In the commit phase, we'll schedule a subsequent
15647
- // synchronous update to re-render the Suspense.
15648
- //
15649
- // Note: It doesn't matter whether the component that suspended was
15650
- // inside a strict mode tree. If the Suspense is outside of it, we
15651
- // should *not* suspend the commit.
15652
- if ((_workInProgress.mode & StrictMode) === NoEffect) {
15653
- _workInProgress.effectTag |= Update;
15654
-
15655
- // Unmount the source fiber's children
15656
- var nextChildren = null;
15657
- reconcileChildren(sourceFiber.alternate, sourceFiber, nextChildren, renderExpirationTime);
15658
- sourceFiber.effectTag &= ~Incomplete;
15659
- if (sourceFiber.tag === IndeterminateComponent) {
15660
- // Let's just assume it's a function component. This fiber will
15661
- // be unmounted in the immediate next commit, anyway.
15662
- sourceFiber.tag = FunctionComponent;
15663
- }
16125
+ // Attach a listener to the promise to "ping" the root and retry.
16126
+ var onResolveOrReject = retrySuspendedRoot.bind(null, root, _workInProgress, sourceFiber, pingTime);
16127
+ if (enableSchedulerTracing) {
16128
+ onResolveOrReject = unstable_wrap(onResolveOrReject);
16129
+ }
16130
+ thenable.then(onResolveOrReject, onResolveOrReject);
15664
16131
 
15665
- if (sourceFiber.tag === ClassComponent || sourceFiber.tag === ClassComponentLazy) {
15666
- // We're going to commit this fiber even though it didn't
15667
- // complete. But we shouldn't call any lifecycle methods or
15668
- // callbacks. Remove all lifecycle effect tags.
15669
- sourceFiber.effectTag &= ~LifecycleEffectMask;
15670
- if (sourceFiber.alternate === null) {
15671
- // We're about to mount a class component that doesn't have an
15672
- // instance. Turn this into a dummy function component instead,
15673
- // to prevent type errors. This is a bit weird but it's an edge
15674
- // case and we're about to synchronously delete this
15675
- // component, anyway.
15676
- sourceFiber.tag = FunctionComponent;
15677
- sourceFiber.type = NoopComponent;
15678
- }
16132
+ // If the boundary is outside of concurrent mode, we should *not*
16133
+ // suspend the commit. Pretend as if the suspended component rendered
16134
+ // null and keep rendering. In the commit phase, we'll schedule a
16135
+ // subsequent synchronous update to re-render the Suspense.
16136
+ //
16137
+ // Note: It doesn't matter whether the component that suspended was
16138
+ // inside a concurrent mode tree. If the Suspense is outside of it, we
16139
+ // should *not* suspend the commit.
16140
+ if ((_workInProgress.mode & ConcurrentMode) === NoEffect) {
16141
+ _workInProgress.effectTag |= Callback;
16142
+
16143
+ // Unmount the source fiber's children
16144
+ var nextChildren = null;
16145
+ reconcileChildren(sourceFiber.alternate, sourceFiber, nextChildren, renderExpirationTime);
16146
+ sourceFiber.effectTag &= ~Incomplete;
16147
+
16148
+ if (sourceFiber.tag === ClassComponent) {
16149
+ // We're going to commit this fiber even though it didn't complete.
16150
+ // But we shouldn't call any lifecycle methods or callbacks. Remove
16151
+ // all lifecycle effect tags.
16152
+ sourceFiber.effectTag &= ~LifecycleEffectMask;
16153
+ var _current = sourceFiber.alternate;
16154
+ if (_current === null) {
16155
+ // This is a new mount. Change the tag so it's not mistaken for a
16156
+ // completed component. For example, we should not call
16157
+ // componentWillUnmount if it is deleted.
16158
+ sourceFiber.tag = IncompleteClassComponent;
15679
16159
  }
15680
-
15681
- // Exit without suspending.
15682
- return;
15683
16160
  }
15684
16161
 
15685
- // Confirmed that the boundary is in a strict mode tree. Continue with
15686
- // the normal suspend path.
16162
+ // Exit without suspending.
16163
+ return;
16164
+ }
16165
+
16166
+ // Confirmed that the boundary is in a concurrent mode tree. Continue
16167
+ // with the normal suspend path.
15687
16168
 
15688
- var absoluteTimeoutMs = void 0;
15689
- if (earliestTimeoutMs === -1) {
15690
- // If no explicit threshold is given, default to an abitrarily large
15691
- // value. The actual size doesn't matter because the threshold for the
15692
- // whole tree will be clamped to the expiration time.
15693
- absoluteTimeoutMs = maxSigned31BitInt;
15694
- } else {
15695
- if (startTimeMs === -1) {
15696
- // This suspend happened outside of any already timed-out
15697
- // placeholders. We don't know exactly when the update was scheduled,
15698
- // but we can infer an approximate start time from the expiration
15699
- // time. First, find the earliest uncommitted expiration time in the
15700
- // tree, including work that is suspended. Then subtract the offset
15701
- // used to compute an async update's expiration time. This will cause
15702
- // high priority (interactive) work to expire earlier than necessary,
15703
- // but we can account for this by adjusting for the Just Noticeable
15704
- // Difference.
15705
- var earliestExpirationTime = findEarliestOutstandingPriorityLevel(root, renderExpirationTime);
15706
- var earliestExpirationTimeMs = expirationTimeToMs(earliestExpirationTime);
15707
- startTimeMs = earliestExpirationTimeMs - LOW_PRIORITY_EXPIRATION;
15708
- }
15709
- absoluteTimeoutMs = startTimeMs + earliestTimeoutMs;
16169
+ var absoluteTimeoutMs = void 0;
16170
+ if (earliestTimeoutMs === -1) {
16171
+ // If no explicit threshold is given, default to an abitrarily large
16172
+ // value. The actual size doesn't matter because the threshold for the
16173
+ // whole tree will be clamped to the expiration time.
16174
+ absoluteTimeoutMs = maxSigned31BitInt;
16175
+ } else {
16176
+ if (startTimeMs === -1) {
16177
+ // This suspend happened outside of any already timed-out
16178
+ // placeholders. We don't know exactly when the update was
16179
+ // scheduled, but we can infer an approximate start time from the
16180
+ // expiration time. First, find the earliest uncommitted expiration
16181
+ // time in the tree, including work that is suspended. Then subtract
16182
+ // the offset used to compute an async update's expiration time.
16183
+ // This will cause high priority (interactive) work to expire
16184
+ // earlier than necessary, but we can account for this by adjusting
16185
+ // for the Just Noticeable Difference.
16186
+ var earliestExpirationTime = findEarliestOutstandingPriorityLevel(root, renderExpirationTime);
16187
+ var earliestExpirationTimeMs = expirationTimeToMs(earliestExpirationTime);
16188
+ startTimeMs = earliestExpirationTimeMs - LOW_PRIORITY_EXPIRATION;
15710
16189
  }
16190
+ absoluteTimeoutMs = startTimeMs + earliestTimeoutMs;
16191
+ }
15711
16192
 
15712
- // Mark the earliest timeout in the suspended fiber's ancestor path.
15713
- // After completing the root, we'll take the largest of all the
15714
- // suspended fiber's timeouts and use it to compute a timeout for the
15715
- // whole tree.
15716
- renderDidSuspend(root, absoluteTimeoutMs, renderExpirationTime);
16193
+ // Mark the earliest timeout in the suspended fiber's ancestor path.
16194
+ // After completing the root, we'll take the largest of all the
16195
+ // suspended fiber's timeouts and use it to compute a timeout for the
16196
+ // whole tree.
16197
+ renderDidSuspend(root, absoluteTimeoutMs, renderExpirationTime);
15717
16198
 
15718
- _workInProgress.effectTag |= ShouldCapture;
15719
- _workInProgress.expirationTime = renderExpirationTime;
15720
- return;
15721
- }
15722
- // This boundary already captured during this render. Continue to the
15723
- // next boundary.
16199
+ _workInProgress.effectTag |= ShouldCapture;
16200
+ _workInProgress.expirationTime = renderExpirationTime;
16201
+ return;
15724
16202
  }
16203
+ // This boundary already captured during this render. Continue to the next
16204
+ // boundary.
15725
16205
  _workInProgress = _workInProgress.return;
15726
16206
  } while (_workInProgress !== null);
15727
16207
  // No boundary was found. Fallthrough to error mode.
@@ -15746,7 +16226,6 @@ function throwException(root, returnFiber, sourceFiber, value, renderExpirationT
15746
16226
  return;
15747
16227
  }
15748
16228
  case ClassComponent:
15749
- case ClassComponentLazy:
15750
16229
  // Capture and retry
15751
16230
  var errorInfo = value;
15752
16231
  var ctor = workInProgress.type;
@@ -15782,26 +16261,13 @@ function unwindWork(workInProgress, renderExpirationTime) {
15782
16261
  }
15783
16262
  return null;
15784
16263
  }
15785
- case ClassComponentLazy:
15786
- {
15787
- var _Component = workInProgress.type._reactResult;
15788
- if (isContextProvider(_Component)) {
15789
- popContext(workInProgress);
15790
- }
15791
- var _effectTag = workInProgress.effectTag;
15792
- if (_effectTag & ShouldCapture) {
15793
- workInProgress.effectTag = _effectTag & ~ShouldCapture | DidCapture;
15794
- return workInProgress;
15795
- }
15796
- return null;
15797
- }
15798
16264
  case HostRoot:
15799
16265
  {
15800
16266
  popHostContainer(workInProgress);
15801
16267
  popTopLevelContextObject(workInProgress);
15802
- var _effectTag2 = workInProgress.effectTag;
15803
- !((_effectTag2 & DidCapture) === NoEffect) ? invariant(false, 'The root failed to unmount after an error. This is likely a bug in React. Please file an issue.') : void 0;
15804
- workInProgress.effectTag = _effectTag2 & ~ShouldCapture | DidCapture;
16268
+ var _effectTag = workInProgress.effectTag;
16269
+ !((_effectTag & DidCapture) === NoEffect) ? invariant(false, 'The root failed to unmount after an error. This is likely a bug in React. Please file an issue.') : void 0;
16270
+ workInProgress.effectTag = _effectTag & ~ShouldCapture | DidCapture;
15805
16271
  return workInProgress;
15806
16272
  }
15807
16273
  case HostComponent:
@@ -15811,9 +16277,35 @@ function unwindWork(workInProgress, renderExpirationTime) {
15811
16277
  }
15812
16278
  case SuspenseComponent:
15813
16279
  {
15814
- var _effectTag3 = workInProgress.effectTag;
15815
- if (_effectTag3 & ShouldCapture) {
15816
- workInProgress.effectTag = _effectTag3 & ~ShouldCapture | DidCapture;
16280
+ var _effectTag2 = workInProgress.effectTag;
16281
+ if (_effectTag2 & ShouldCapture) {
16282
+ workInProgress.effectTag = _effectTag2 & ~ShouldCapture | DidCapture;
16283
+ // Captured a suspense effect. Set the boundary's `alreadyCaptured`
16284
+ // state to true so we know to render the fallback.
16285
+ var current = workInProgress.alternate;
16286
+ var currentState = current !== null ? current.memoizedState : null;
16287
+ var nextState = workInProgress.memoizedState;
16288
+ if (nextState === null) {
16289
+ // No existing state. Create a new object.
16290
+ nextState = {
16291
+ alreadyCaptured: true,
16292
+ didTimeout: false,
16293
+ timedOutAt: NoWork
16294
+ };
16295
+ } else if (currentState === nextState) {
16296
+ // There is an existing state but it's the same as the current tree's.
16297
+ // Clone the object.
16298
+ nextState = {
16299
+ alreadyCaptured: true,
16300
+ didTimeout: nextState.didTimeout,
16301
+ timedOutAt: nextState.timedOutAt
16302
+ };
16303
+ } else {
16304
+ // Already have a clone, so it's safe to mutate.
16305
+ nextState.alreadyCaptured = true;
16306
+ }
16307
+ workInProgress.memoizedState = nextState;
16308
+ // Re-render the boundary.
15817
16309
  return workInProgress;
15818
16310
  }
15819
16311
  return null;
@@ -15839,14 +16331,6 @@ function unwindInterruptedWork(interruptedWork) {
15839
16331
  }
15840
16332
  break;
15841
16333
  }
15842
- case ClassComponentLazy:
15843
- {
15844
- var _childContextTypes = interruptedWork.type._reactResult.childContextTypes;
15845
- if (_childContextTypes !== null && _childContextTypes !== undefined) {
15846
- popContext(interruptedWork);
15847
- }
15848
- break;
15849
- }
15850
16334
  case HostRoot:
15851
16335
  {
15852
16336
  popHostContainer(interruptedWork);
@@ -15992,14 +16476,6 @@ if (true && replayFailedUnitOfWorkWithInvokeGuardedCallback) {
15992
16476
  }
15993
16477
  break;
15994
16478
  }
15995
- case ClassComponentLazy:
15996
- {
15997
- var _Component = getResultFromResolvedThenable(failedUnitOfWork.type);
15998
- if (isContextProvider(_Component)) {
15999
- popContext(failedUnitOfWork);
16000
- }
16001
- break;
16002
- }
16003
16479
  case HostPortal:
16004
16480
  popHostContainer(failedUnitOfWork);
16005
16481
  break;
@@ -16659,6 +17135,7 @@ function performUnitOfWork(workInProgress) {
16659
17135
  }
16660
17136
 
16661
17137
  next = beginWork(current$$1, workInProgress, nextRenderExpirationTime);
17138
+ workInProgress.memoizedProps = workInProgress.pendingProps;
16662
17139
 
16663
17140
  if (workInProgress.mode & ProfileMode) {
16664
17141
  // Record the render duration assuming we didn't bailout (or error).
@@ -16666,6 +17143,7 @@ function performUnitOfWork(workInProgress) {
16666
17143
  }
16667
17144
  } else {
16668
17145
  next = beginWork(current$$1, workInProgress, nextRenderExpirationTime);
17146
+ workInProgress.memoizedProps = workInProgress.pendingProps;
16669
17147
  }
16670
17148
 
16671
17149
  {
@@ -16939,7 +17417,6 @@ function dispatch(sourceFiber, value, expirationTime) {
16939
17417
  while (fiber !== null) {
16940
17418
  switch (fiber.tag) {
16941
17419
  case ClassComponent:
16942
- case ClassComponentLazy:
16943
17420
  var ctor = fiber.type;
16944
17421
  var instance = fiber.stateNode;
16945
17422
  if (typeof ctor.getDerivedStateFromError === 'function' || typeof instance.componentDidCatch === 'function' && !isAlreadyFailedLegacyErrorBoundary(instance)) {
@@ -17054,7 +17531,7 @@ function renderDidError() {
17054
17531
  nextRenderDidError = true;
17055
17532
  }
17056
17533
 
17057
- function retrySuspendedRoot(root, fiber, suspendedTime) {
17534
+ function retrySuspendedRoot(root, boundaryFiber, sourceFiber, suspendedTime) {
17058
17535
  var retryTime = void 0;
17059
17536
 
17060
17537
  if (isPriorityLevelSuspended(root, suspendedTime)) {
@@ -17065,18 +17542,18 @@ function retrySuspendedRoot(root, fiber, suspendedTime) {
17065
17542
  } else {
17066
17543
  // Suspense already timed out. Compute a new expiration time
17067
17544
  var currentTime = requestCurrentTime();
17068
- retryTime = computeExpirationForFiber(currentTime, fiber);
17545
+ retryTime = computeExpirationForFiber(currentTime, boundaryFiber);
17069
17546
  markPendingPriorityLevel(root, retryTime);
17070
17547
  }
17071
17548
 
17072
- // TODO: If the placeholder fiber has already rendered the primary children
17549
+ // TODO: If the suspense fiber has already rendered the primary children
17073
17550
  // without suspending (that is, all of the promises have already resolved),
17074
17551
  // we should not trigger another update here. One case this happens is when
17075
17552
  // we are in sync mode and a single promise is thrown both on initial render
17076
17553
  // and on update; we attach two .then(retrySuspendedRoot) callbacks and each
17077
17554
  // one performs Sync work, rerendering the Suspense.
17078
17555
 
17079
- if ((fiber.mode & ConcurrentMode) !== NoContext) {
17556
+ if ((boundaryFiber.mode & ConcurrentMode) !== NoContext) {
17080
17557
  if (root === nextRoot && nextRenderExpirationTime === suspendedTime) {
17081
17558
  // Received a ping at the same priority level at which we're currently
17082
17559
  // rendering. Restart from the root.
@@ -17084,7 +17561,23 @@ function retrySuspendedRoot(root, fiber, suspendedTime) {
17084
17561
  }
17085
17562
  }
17086
17563
 
17087
- scheduleWorkToRoot(fiber, retryTime);
17564
+ scheduleWorkToRoot(boundaryFiber, retryTime);
17565
+ if ((boundaryFiber.mode & ConcurrentMode) === NoContext) {
17566
+ // Outside of concurrent mode, we must schedule an update on the source
17567
+ // fiber, too, since it already committed in an inconsistent state and
17568
+ // therefore does not have any pending work.
17569
+ scheduleWorkToRoot(sourceFiber, retryTime);
17570
+ var sourceTag = sourceFiber.tag;
17571
+ if (sourceTag === ClassComponent && sourceFiber.stateNode !== null) {
17572
+ // When we try rendering again, we should not reuse the current fiber,
17573
+ // since it's known to be in an inconsistent state. Use a force updte to
17574
+ // prevent a bail out.
17575
+ var update = createUpdate(retryTime);
17576
+ update.tag = ForceUpdate;
17577
+ enqueueUpdate(sourceFiber, update);
17578
+ }
17579
+ }
17580
+
17088
17581
  var rootExpirationTime = root.expirationTime;
17089
17582
  if (rootExpirationTime !== NoWork) {
17090
17583
  requestWork(root, rootExpirationTime);
@@ -17095,7 +17588,7 @@ function scheduleWorkToRoot(fiber, expirationTime) {
17095
17588
  recordScheduleUpdate();
17096
17589
 
17097
17590
  {
17098
- if (fiber.tag === ClassComponent || fiber.tag === ClassComponentLazy) {
17591
+ if (fiber.tag === ClassComponent) {
17099
17592
  var instance = fiber.stateNode;
17100
17593
  warnAboutInvalidUpdates(instance);
17101
17594
  }
@@ -17134,7 +17627,7 @@ function scheduleWorkToRoot(fiber, expirationTime) {
17134
17627
  }
17135
17628
 
17136
17629
  if (root === null) {
17137
- if (true && (fiber.tag === ClassComponent || fiber.tag === ClassComponentLazy)) {
17630
+ if (true && fiber.tag === ClassComponent) {
17138
17631
  warnAboutUpdateOnUnmounted(fiber);
17139
17632
  }
17140
17633
  return null;
@@ -17822,9 +18315,11 @@ function flushControlled(fn) {
17822
18315
 
17823
18316
 
17824
18317
  var didWarnAboutNestedUpdates = void 0;
18318
+ var didWarnAboutFindNodeInStrictMode = void 0;
17825
18319
 
17826
18320
  {
17827
18321
  didWarnAboutNestedUpdates = false;
18322
+ didWarnAboutFindNodeInStrictMode = {};
17828
18323
  }
17829
18324
 
17830
18325
  function getContextForSubtree(parentComponent) {
@@ -17840,11 +18335,6 @@ function getContextForSubtree(parentComponent) {
17840
18335
  if (isContextProvider(Component)) {
17841
18336
  return processChildContext(fiber, Component, parentContext);
17842
18337
  }
17843
- } else if (fiber.tag === ClassComponentLazy) {
17844
- var _Component = getResultFromResolvedThenable(fiber.type);
17845
- if (isContextProvider(_Component)) {
17846
- return processChildContext(fiber, _Component, parentContext);
17847
- }
17848
18338
  }
17849
18339
 
17850
18340
  return parentContext;
@@ -17916,6 +18406,36 @@ function findHostInstance(component) {
17916
18406
  return hostFiber.stateNode;
17917
18407
  }
17918
18408
 
18409
+ function findHostInstanceWithWarning(component, methodName) {
18410
+ {
18411
+ var fiber = get(component);
18412
+ if (fiber === undefined) {
18413
+ if (typeof component.render === 'function') {
18414
+ invariant(false, 'Unable to find node on an unmounted component.');
18415
+ } else {
18416
+ invariant(false, 'Argument appears to not be a ReactComponent. Keys: %s', Object.keys(component));
18417
+ }
18418
+ }
18419
+ var hostFiber = findCurrentHostFiber(fiber);
18420
+ if (hostFiber === null) {
18421
+ return null;
18422
+ }
18423
+ if (hostFiber.mode & StrictMode) {
18424
+ var componentName = getComponentName(fiber.type) || 'Component';
18425
+ if (!didWarnAboutFindNodeInStrictMode[componentName]) {
18426
+ didWarnAboutFindNodeInStrictMode[componentName] = true;
18427
+ if (fiber.mode & StrictMode) {
18428
+ warningWithoutStack$1(false, '%s is deprecated in StrictMode. ' + '%s was passed an instance of %s which is inside StrictMode. ' + 'Instead, add a ref directly to the element you want to reference.' + '\n%s' + '\n\nLearn more about using refs safely here:' + '\nhttps://fb.me/react-strict-mode-find-node', methodName, methodName, componentName, getStackByFiberInDevAndProd(hostFiber));
18429
+ } else {
18430
+ warningWithoutStack$1(false, '%s is deprecated in StrictMode. ' + '%s was passed an instance of %s which renders StrictMode children. ' + 'Instead, add a ref directly to the element you want to reference.' + '\n%s' + '\n\nLearn more about using refs safely here:' + '\nhttps://fb.me/react-strict-mode-find-node', methodName, methodName, componentName, getStackByFiberInDevAndProd(hostFiber));
18431
+ }
18432
+ }
18433
+ }
18434
+ return hostFiber.stateNode;
18435
+ }
18436
+ return findHostInstance(component);
18437
+ }
18438
+
17919
18439
  function createContainer(containerInfo, isConcurrent, hydrate) {
17920
18440
  return createFiberRoot(containerInfo, isConcurrent, hydrate);
17921
18441
  }
@@ -17989,7 +18509,7 @@ implementation) {
17989
18509
 
17990
18510
  // TODO: this is special because it gets imported during build.
17991
18511
 
17992
- var ReactVersion = '16.6.0-alpha.8af6728';
18512
+ var ReactVersion = '16.6.0';
17993
18513
 
17994
18514
  // TODO: This type is shared between the reconciler and ReactDOM, but will
17995
18515
  // eventually be lifted out to the renderer.
@@ -18373,7 +18893,9 @@ var ReactDOM = {
18373
18893
  if (componentOrElement.nodeType === ELEMENT_NODE) {
18374
18894
  return componentOrElement;
18375
18895
  }
18376
-
18896
+ {
18897
+ return findHostInstanceWithWarning(componentOrElement, 'findDOMNode');
18898
+ }
18377
18899
  return findHostInstance(componentOrElement);
18378
18900
  },
18379
18901
  hydrate: function (element, container, callback) {