react-dom 16.8.1 → 16.8.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build-info.json +5 -5
- package/cjs/react-dom-server.browser.development.js +67 -36
- package/cjs/react-dom-server.browser.production.min.js +17 -16
- package/cjs/react-dom-server.node.development.js +67 -36
- package/cjs/react-dom-server.node.production.min.js +18 -17
- package/cjs/react-dom-test-utils.development.js +2 -2
- package/cjs/react-dom-test-utils.production.min.js +1 -1
- package/cjs/react-dom-unstable-fire.development.js +709 -213
- package/cjs/react-dom-unstable-fire.production.min.js +252 -251
- package/cjs/react-dom-unstable-fire.profiling.min.js +176 -173
- package/cjs/react-dom-unstable-fizz.browser.development.js +1 -1
- package/cjs/react-dom-unstable-fizz.browser.production.min.js +1 -1
- package/cjs/react-dom-unstable-fizz.node.development.js +1 -1
- package/cjs/react-dom-unstable-fizz.node.production.min.js +1 -1
- package/cjs/react-dom-unstable-native-dependencies.development.js +2 -2
- package/cjs/react-dom-unstable-native-dependencies.production.min.js +1 -1
- package/cjs/react-dom.development.js +709 -213
- package/cjs/react-dom.production.min.js +252 -251
- package/cjs/react-dom.profiling.min.js +176 -173
- package/package.json +2 -2
- package/umd/react-dom-server.browser.development.js +67 -36
- package/umd/react-dom-server.browser.production.min.js +22 -21
- package/umd/react-dom-test-utils.development.js +2 -2
- package/umd/react-dom-test-utils.production.min.js +1 -1
- package/umd/react-dom-unstable-fire.development.js +717 -213
- package/umd/react-dom-unstable-fire.production.min.js +208 -207
- package/umd/react-dom-unstable-fire.profiling.min.js +208 -208
- package/umd/react-dom-unstable-fizz.browser.development.js +1 -1
- package/umd/react-dom-unstable-fizz.browser.production.min.js +1 -1
- package/umd/react-dom-unstable-native-dependencies.development.js +2 -2
- package/umd/react-dom-unstable-native-dependencies.production.min.js +1 -1
- package/umd/react-dom.development.js +717 -213
- package/umd/react-dom.production.min.js +208 -207
- package/umd/react-dom.profiling.min.js +208 -208
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license React v16.8.
|
|
1
|
+
/** @license React v16.8.5
|
|
2
2
|
* react-dom.development.js
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
@@ -85,7 +85,7 @@ var invokeGuardedCallbackImpl = function (name, func, context, a, b, c, d, e, f)
|
|
|
85
85
|
// invokeGuardedCallback uses a try-catch, all user exceptions are treated
|
|
86
86
|
// like caught exceptions, and the DevTools won't pause unless the developer
|
|
87
87
|
// takes the extra step of enabling pause on caught exceptions. This is
|
|
88
|
-
//
|
|
88
|
+
// unintuitive, though, because even though React has caught the error, from
|
|
89
89
|
// the developer's perspective, the error is uncaught.
|
|
90
90
|
//
|
|
91
91
|
// To preserve the expected "Pause on exceptions" behavior, we don't use a
|
|
@@ -842,6 +842,7 @@ var MemoComponent = 14;
|
|
|
842
842
|
var SimpleMemoComponent = 15;
|
|
843
843
|
var LazyComponent = 16;
|
|
844
844
|
var IncompleteClassComponent = 17;
|
|
845
|
+
var DehydratedSuspenseComponent = 18;
|
|
845
846
|
|
|
846
847
|
var randomKey = Math.random().toString(36).slice(2);
|
|
847
848
|
var internalInstanceKey = '__reactInternalInstance$' + randomKey;
|
|
@@ -2903,12 +2904,15 @@ var capitalize = function (token) {
|
|
|
2903
2904
|
attributeName, 'http://www.w3.org/XML/1998/namespace');
|
|
2904
2905
|
});
|
|
2905
2906
|
|
|
2906
|
-
//
|
|
2907
|
-
//
|
|
2908
|
-
//
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2907
|
+
// These attribute exists both in HTML and SVG.
|
|
2908
|
+
// The attribute name is case-sensitive in SVG so we can't just use
|
|
2909
|
+
// the React name like we do for attributes that exist only in HTML.
|
|
2910
|
+
['tabIndex', 'crossOrigin'].forEach(function (attributeName) {
|
|
2911
|
+
properties[attributeName] = new PropertyInfoRecord(attributeName, STRING, false, // mustUseProperty
|
|
2912
|
+
attributeName.toLowerCase(), // attributeName
|
|
2913
|
+
null);
|
|
2914
|
+
} // attributeNamespace
|
|
2915
|
+
);
|
|
2912
2916
|
|
|
2913
2917
|
/**
|
|
2914
2918
|
* Get the value for a property on a node. Only used in DEV for SSR validation.
|
|
@@ -3147,7 +3151,7 @@ var enableProfilerTimer = true;
|
|
|
3147
3151
|
var enableSchedulerTracing = true;
|
|
3148
3152
|
|
|
3149
3153
|
// Only used in www builds.
|
|
3150
|
-
// TODO: true? Here it might just be false.
|
|
3154
|
+
var enableSuspenseServerRenderer = false; // TODO: true? Here it might just be false.
|
|
3151
3155
|
|
|
3152
3156
|
// Only used in www builds.
|
|
3153
3157
|
|
|
@@ -7626,14 +7630,25 @@ function createElement(type, props, rootContainerElement, parentNamespace) {
|
|
|
7626
7630
|
// See discussion in https://github.com/facebook/react/pull/6896
|
|
7627
7631
|
// and discussion in https://bugzilla.mozilla.org/show_bug.cgi?id=1276240
|
|
7628
7632
|
domElement = ownerDocument.createElement(type);
|
|
7629
|
-
// Normally attributes are assigned in `setInitialDOMProperties`, however the `multiple`
|
|
7630
|
-
//
|
|
7631
|
-
//
|
|
7632
|
-
// `select`
|
|
7633
|
+
// Normally attributes are assigned in `setInitialDOMProperties`, however the `multiple` and `size`
|
|
7634
|
+
// attributes on `select`s needs to be added before `option`s are inserted.
|
|
7635
|
+
// This prevents:
|
|
7636
|
+
// - a bug where the `select` does not scroll to the correct option because singular
|
|
7637
|
+
// `select` elements automatically pick the first item #13222
|
|
7638
|
+
// - a bug where the `select` set the first item as selected despite the `size` attribute #14239
|
|
7633
7639
|
// See https://github.com/facebook/react/issues/13222
|
|
7634
|
-
|
|
7640
|
+
// and https://github.com/facebook/react/issues/14239
|
|
7641
|
+
if (type === 'select') {
|
|
7635
7642
|
var node = domElement;
|
|
7636
|
-
|
|
7643
|
+
if (props.multiple) {
|
|
7644
|
+
node.multiple = true;
|
|
7645
|
+
} else if (props.size) {
|
|
7646
|
+
// Setting a size greater than 1 causes a select to behave like `multiple=true`, where
|
|
7647
|
+
// it is possible that no option is selected.
|
|
7648
|
+
//
|
|
7649
|
+
// This is only necessary when a select in "single selection mode".
|
|
7650
|
+
node.size = props.size;
|
|
7651
|
+
}
|
|
7637
7652
|
}
|
|
7638
7653
|
}
|
|
7639
7654
|
} else {
|
|
@@ -8622,6 +8637,9 @@ var SUPPRESS_HYDRATION_WARNING = void 0;
|
|
|
8622
8637
|
SUPPRESS_HYDRATION_WARNING = 'suppressHydrationWarning';
|
|
8623
8638
|
}
|
|
8624
8639
|
|
|
8640
|
+
var SUSPENSE_START_DATA = '$';
|
|
8641
|
+
var SUSPENSE_END_DATA = '/$';
|
|
8642
|
+
|
|
8625
8643
|
var STYLE = 'style';
|
|
8626
8644
|
|
|
8627
8645
|
var eventsEnabled = null;
|
|
@@ -8850,6 +8868,43 @@ function removeChildFromContainer(container, child) {
|
|
|
8850
8868
|
}
|
|
8851
8869
|
}
|
|
8852
8870
|
|
|
8871
|
+
function clearSuspenseBoundary(parentInstance, suspenseInstance) {
|
|
8872
|
+
var node = suspenseInstance;
|
|
8873
|
+
// Delete all nodes within this suspense boundary.
|
|
8874
|
+
// There might be nested nodes so we need to keep track of how
|
|
8875
|
+
// deep we are and only break out when we're back on top.
|
|
8876
|
+
var depth = 0;
|
|
8877
|
+
do {
|
|
8878
|
+
var nextNode = node.nextSibling;
|
|
8879
|
+
parentInstance.removeChild(node);
|
|
8880
|
+
if (nextNode && nextNode.nodeType === COMMENT_NODE) {
|
|
8881
|
+
var data = nextNode.data;
|
|
8882
|
+
if (data === SUSPENSE_END_DATA) {
|
|
8883
|
+
if (depth === 0) {
|
|
8884
|
+
parentInstance.removeChild(nextNode);
|
|
8885
|
+
return;
|
|
8886
|
+
} else {
|
|
8887
|
+
depth--;
|
|
8888
|
+
}
|
|
8889
|
+
} else if (data === SUSPENSE_START_DATA) {
|
|
8890
|
+
depth++;
|
|
8891
|
+
}
|
|
8892
|
+
}
|
|
8893
|
+
node = nextNode;
|
|
8894
|
+
} while (node);
|
|
8895
|
+
// TODO: Warn, we didn't find the end comment boundary.
|
|
8896
|
+
}
|
|
8897
|
+
|
|
8898
|
+
function clearSuspenseBoundaryFromContainer(container, suspenseInstance) {
|
|
8899
|
+
if (container.nodeType === COMMENT_NODE) {
|
|
8900
|
+
clearSuspenseBoundary(container.parentNode, suspenseInstance);
|
|
8901
|
+
} else if (container.nodeType === ELEMENT_NODE) {
|
|
8902
|
+
clearSuspenseBoundary(container, suspenseInstance);
|
|
8903
|
+
} else {
|
|
8904
|
+
// Document nodes should never contain suspense boundaries.
|
|
8905
|
+
}
|
|
8906
|
+
}
|
|
8907
|
+
|
|
8853
8908
|
function hideInstance(instance) {
|
|
8854
8909
|
// TODO: Does this work for all element types? What about MathML? Should we
|
|
8855
8910
|
// pass host context to this method?
|
|
@@ -8895,10 +8950,19 @@ function canHydrateTextInstance(instance, text) {
|
|
|
8895
8950
|
return instance;
|
|
8896
8951
|
}
|
|
8897
8952
|
|
|
8953
|
+
function canHydrateSuspenseInstance(instance) {
|
|
8954
|
+
if (instance.nodeType !== COMMENT_NODE) {
|
|
8955
|
+
// Empty strings are not parsed by HTML so there won't be a correct match here.
|
|
8956
|
+
return null;
|
|
8957
|
+
}
|
|
8958
|
+
// This has now been refined to a suspense node.
|
|
8959
|
+
return instance;
|
|
8960
|
+
}
|
|
8961
|
+
|
|
8898
8962
|
function getNextHydratableSibling(instance) {
|
|
8899
8963
|
var node = instance.nextSibling;
|
|
8900
8964
|
// Skip non-hydratable nodes.
|
|
8901
|
-
while (node && node.nodeType !== ELEMENT_NODE && node.nodeType !== TEXT_NODE) {
|
|
8965
|
+
while (node && node.nodeType !== ELEMENT_NODE && node.nodeType !== TEXT_NODE && (!enableSuspenseServerRenderer || node.nodeType !== COMMENT_NODE || node.data !== SUSPENSE_START_DATA)) {
|
|
8902
8966
|
node = node.nextSibling;
|
|
8903
8967
|
}
|
|
8904
8968
|
return node;
|
|
@@ -8907,7 +8971,7 @@ function getNextHydratableSibling(instance) {
|
|
|
8907
8971
|
function getFirstHydratableChild(parentInstance) {
|
|
8908
8972
|
var next = parentInstance.firstChild;
|
|
8909
8973
|
// Skip non-hydratable nodes.
|
|
8910
|
-
while (next && next.nodeType !== ELEMENT_NODE && next.nodeType !== TEXT_NODE) {
|
|
8974
|
+
while (next && next.nodeType !== ELEMENT_NODE && next.nodeType !== TEXT_NODE && (!enableSuspenseServerRenderer || next.nodeType !== COMMENT_NODE || next.data !== SUSPENSE_START_DATA)) {
|
|
8911
8975
|
next = next.nextSibling;
|
|
8912
8976
|
}
|
|
8913
8977
|
return next;
|
|
@@ -8931,6 +8995,31 @@ function hydrateTextInstance(textInstance, text, internalInstanceHandle) {
|
|
|
8931
8995
|
return diffHydratedText(textInstance, text);
|
|
8932
8996
|
}
|
|
8933
8997
|
|
|
8998
|
+
function getNextHydratableInstanceAfterSuspenseInstance(suspenseInstance) {
|
|
8999
|
+
var node = suspenseInstance.nextSibling;
|
|
9000
|
+
// Skip past all nodes within this suspense boundary.
|
|
9001
|
+
// There might be nested nodes so we need to keep track of how
|
|
9002
|
+
// deep we are and only break out when we're back on top.
|
|
9003
|
+
var depth = 0;
|
|
9004
|
+
while (node) {
|
|
9005
|
+
if (node.nodeType === COMMENT_NODE) {
|
|
9006
|
+
var data = node.data;
|
|
9007
|
+
if (data === SUSPENSE_END_DATA) {
|
|
9008
|
+
if (depth === 0) {
|
|
9009
|
+
return getNextHydratableSibling(node);
|
|
9010
|
+
} else {
|
|
9011
|
+
depth--;
|
|
9012
|
+
}
|
|
9013
|
+
} else if (data === SUSPENSE_START_DATA) {
|
|
9014
|
+
depth++;
|
|
9015
|
+
}
|
|
9016
|
+
}
|
|
9017
|
+
node = node.nextSibling;
|
|
9018
|
+
}
|
|
9019
|
+
// TODO: Warn, we didn't find the end comment boundary.
|
|
9020
|
+
return null;
|
|
9021
|
+
}
|
|
9022
|
+
|
|
8934
9023
|
function didNotMatchHydratedContainerTextInstance(parentContainer, textInstance, text) {
|
|
8935
9024
|
{
|
|
8936
9025
|
warnForUnmatchedText(textInstance, text);
|
|
@@ -8947,6 +9036,8 @@ function didNotHydrateContainerInstance(parentContainer, instance) {
|
|
|
8947
9036
|
{
|
|
8948
9037
|
if (instance.nodeType === ELEMENT_NODE) {
|
|
8949
9038
|
warnForDeletedHydratableElement(parentContainer, instance);
|
|
9039
|
+
} else if (instance.nodeType === COMMENT_NODE) {
|
|
9040
|
+
// TODO: warnForDeletedHydratableSuspenseBoundary
|
|
8950
9041
|
} else {
|
|
8951
9042
|
warnForDeletedHydratableText(parentContainer, instance);
|
|
8952
9043
|
}
|
|
@@ -8957,6 +9048,8 @@ function didNotHydrateInstance(parentType, parentProps, parentInstance, instance
|
|
|
8957
9048
|
if (true && parentProps[SUPPRESS_HYDRATION_WARNING] !== true) {
|
|
8958
9049
|
if (instance.nodeType === ELEMENT_NODE) {
|
|
8959
9050
|
warnForDeletedHydratableElement(parentInstance, instance);
|
|
9051
|
+
} else if (instance.nodeType === COMMENT_NODE) {
|
|
9052
|
+
// TODO: warnForDeletedHydratableSuspenseBoundary
|
|
8960
9053
|
} else {
|
|
8961
9054
|
warnForDeletedHydratableText(parentInstance, instance);
|
|
8962
9055
|
}
|
|
@@ -8975,6 +9068,8 @@ function didNotFindHydratableContainerTextInstance(parentContainer, text) {
|
|
|
8975
9068
|
}
|
|
8976
9069
|
}
|
|
8977
9070
|
|
|
9071
|
+
|
|
9072
|
+
|
|
8978
9073
|
function didNotFindHydratableInstance(parentType, parentProps, parentInstance, type, props) {
|
|
8979
9074
|
if (true && parentProps[SUPPRESS_HYDRATION_WARNING] !== true) {
|
|
8980
9075
|
warnForInsertedHydratedElement(parentInstance, type, props);
|
|
@@ -8987,6 +9082,12 @@ function didNotFindHydratableTextInstance(parentType, parentProps, parentInstanc
|
|
|
8987
9082
|
}
|
|
8988
9083
|
}
|
|
8989
9084
|
|
|
9085
|
+
function didNotFindHydratableSuspenseInstance(parentType, parentProps, parentInstance) {
|
|
9086
|
+
if (true && parentProps[SUPPRESS_HYDRATION_WARNING] !== true) {
|
|
9087
|
+
// TODO: warnForInsertedHydratedSuspense(parentInstance);
|
|
9088
|
+
}
|
|
9089
|
+
}
|
|
9090
|
+
|
|
8990
9091
|
// Prefix measurements so that it's possible to filter them.
|
|
8991
9092
|
// Longer prefixes are hard to read in DevTools.
|
|
8992
9093
|
var reactEmoji = '\u269B';
|
|
@@ -9242,7 +9343,7 @@ function stopFailedWorkTimer(fiber) {
|
|
|
9242
9343
|
return;
|
|
9243
9344
|
}
|
|
9244
9345
|
fiber._debugIsCurrentlyTiming = false;
|
|
9245
|
-
var warning = fiber.tag === SuspenseComponent ? 'Rendering was suspended' : 'An error was thrown inside this error boundary';
|
|
9346
|
+
var warning = fiber.tag === SuspenseComponent || fiber.tag === DehydratedSuspenseComponent ? 'Rendering was suspended' : 'An error was thrown inside this error boundary';
|
|
9246
9347
|
endFiberMark(fiber, null, warning);
|
|
9247
9348
|
}
|
|
9248
9349
|
}
|
|
@@ -9911,6 +10012,7 @@ function FiberNode(tag, pendingProps, key, mode) {
|
|
|
9911
10012
|
this._debugSource = null;
|
|
9912
10013
|
this._debugOwner = null;
|
|
9913
10014
|
this._debugIsCurrentlyTiming = false;
|
|
10015
|
+
this._debugHookTypes = null;
|
|
9914
10016
|
if (!hasBadMapPolyfill && typeof Object.preventExtensions === 'function') {
|
|
9915
10017
|
Object.preventExtensions(this);
|
|
9916
10018
|
}
|
|
@@ -9978,6 +10080,7 @@ function createWorkInProgress(current, pendingProps, expirationTime) {
|
|
|
9978
10080
|
workInProgress._debugID = current._debugID;
|
|
9979
10081
|
workInProgress._debugSource = current._debugSource;
|
|
9980
10082
|
workInProgress._debugOwner = current._debugOwner;
|
|
10083
|
+
workInProgress._debugHookTypes = current._debugHookTypes;
|
|
9981
10084
|
}
|
|
9982
10085
|
|
|
9983
10086
|
workInProgress.alternate = current;
|
|
@@ -10245,6 +10348,7 @@ function assignFiberPropertiesInDEV(target, source) {
|
|
|
10245
10348
|
target._debugSource = source._debugSource;
|
|
10246
10349
|
target._debugOwner = source._debugOwner;
|
|
10247
10350
|
target._debugIsCurrentlyTiming = source._debugIsCurrentlyTiming;
|
|
10351
|
+
target._debugHookTypes = source._debugHookTypes;
|
|
10248
10352
|
return target;
|
|
10249
10353
|
}
|
|
10250
10354
|
|
|
@@ -12049,7 +12153,7 @@ function ChildReconciler(shouldTrackSideEffects) {
|
|
|
12049
12153
|
}
|
|
12050
12154
|
|
|
12051
12155
|
function reconcileChildrenArray(returnFiber, currentFirstChild, newChildren, expirationTime) {
|
|
12052
|
-
// This algorithm can't optimize by searching from
|
|
12156
|
+
// This algorithm can't optimize by searching from both ends since we
|
|
12053
12157
|
// don't have backpointers on fibers. I'm trying to see how far we can get
|
|
12054
12158
|
// with that model. If it ends up not being worth the tradeoffs, we can
|
|
12055
12159
|
// add it later.
|
|
@@ -12630,7 +12734,6 @@ var currentlyRenderingFiber$1 = null;
|
|
|
12630
12734
|
// current hook list is the list that belongs to the current fiber. The
|
|
12631
12735
|
// work-in-progress hook list is a new list that will be added to the
|
|
12632
12736
|
// work-in-progress fiber.
|
|
12633
|
-
var firstCurrentHook = null;
|
|
12634
12737
|
var currentHook = null;
|
|
12635
12738
|
var nextCurrentHook = null;
|
|
12636
12739
|
var firstWorkInProgressHook = null;
|
|
@@ -12660,45 +12763,73 @@ var RE_RENDER_LIMIT = 25;
|
|
|
12660
12763
|
// In DEV, this is the name of the currently executing primitive hook
|
|
12661
12764
|
var currentHookNameInDev = null;
|
|
12662
12765
|
|
|
12663
|
-
|
|
12766
|
+
// In DEV, this list ensures that hooks are called in the same order between renders.
|
|
12767
|
+
// The list stores the order of hooks used during the initial render (mount).
|
|
12768
|
+
// Subsequent renders (updates) reference this list.
|
|
12769
|
+
var hookTypesDev = null;
|
|
12770
|
+
var hookTypesUpdateIndexDev = -1;
|
|
12771
|
+
|
|
12772
|
+
function mountHookTypesDev() {
|
|
12773
|
+
{
|
|
12774
|
+
var hookName = currentHookNameInDev;
|
|
12775
|
+
|
|
12776
|
+
if (hookTypesDev === null) {
|
|
12777
|
+
hookTypesDev = [hookName];
|
|
12778
|
+
} else {
|
|
12779
|
+
hookTypesDev.push(hookName);
|
|
12780
|
+
}
|
|
12781
|
+
}
|
|
12782
|
+
}
|
|
12783
|
+
|
|
12784
|
+
function updateHookTypesDev() {
|
|
12785
|
+
{
|
|
12786
|
+
var hookName = currentHookNameInDev;
|
|
12787
|
+
|
|
12788
|
+
if (hookTypesDev !== null) {
|
|
12789
|
+
hookTypesUpdateIndexDev++;
|
|
12790
|
+
if (hookTypesDev[hookTypesUpdateIndexDev] !== hookName) {
|
|
12791
|
+
warnOnHookMismatchInDev(hookName);
|
|
12792
|
+
}
|
|
12793
|
+
}
|
|
12794
|
+
}
|
|
12795
|
+
}
|
|
12796
|
+
|
|
12797
|
+
function warnOnHookMismatchInDev(currentHookName) {
|
|
12664
12798
|
{
|
|
12665
12799
|
var componentName = getComponentName(currentlyRenderingFiber$1.type);
|
|
12666
12800
|
if (!didWarnAboutMismatchedHooksForComponent.has(componentName)) {
|
|
12667
12801
|
didWarnAboutMismatchedHooksForComponent.add(componentName);
|
|
12668
12802
|
|
|
12669
|
-
|
|
12803
|
+
if (hookTypesDev !== null) {
|
|
12804
|
+
var table = '';
|
|
12670
12805
|
|
|
12671
|
-
|
|
12672
|
-
var prevHook = firstCurrentHook;
|
|
12673
|
-
var nextHook = firstWorkInProgressHook;
|
|
12674
|
-
var n = 1;
|
|
12675
|
-
while (prevHook !== null && nextHook !== null) {
|
|
12676
|
-
var oldHookName = prevHook._debugType;
|
|
12677
|
-
var newHookName = nextHook._debugType;
|
|
12806
|
+
var secondColumnStart = 30;
|
|
12678
12807
|
|
|
12679
|
-
var
|
|
12808
|
+
for (var i = 0; i <= hookTypesUpdateIndexDev; i++) {
|
|
12809
|
+
var oldHookName = hookTypesDev[i];
|
|
12810
|
+
var newHookName = i === hookTypesUpdateIndexDev ? currentHookName : oldHookName;
|
|
12680
12811
|
|
|
12681
|
-
|
|
12682
|
-
// lol @ IE not supporting String#repeat
|
|
12683
|
-
while (row.length < secondColumnStart) {
|
|
12684
|
-
row += ' ';
|
|
12685
|
-
}
|
|
12812
|
+
var row = i + 1 + '. ' + oldHookName;
|
|
12686
12813
|
|
|
12687
|
-
|
|
12814
|
+
// Extra space so second column lines up
|
|
12815
|
+
// lol @ IE not supporting String#repeat
|
|
12816
|
+
while (row.length < secondColumnStart) {
|
|
12817
|
+
row += ' ';
|
|
12818
|
+
}
|
|
12688
12819
|
|
|
12689
|
-
|
|
12690
|
-
|
|
12691
|
-
|
|
12692
|
-
|
|
12693
|
-
}
|
|
12820
|
+
row += newHookName + '\n';
|
|
12821
|
+
|
|
12822
|
+
table += row;
|
|
12823
|
+
}
|
|
12694
12824
|
|
|
12695
|
-
|
|
12825
|
+
warning$1(false, 'React has detected a change in the order of Hooks called by %s. ' + 'This will lead to bugs and errors if not fixed. ' + 'For more information, read the Rules of Hooks: https://fb.me/rules-of-hooks\n\n' + ' Previous render Next render\n' + ' ------------------------------------------------------\n' + '%s' + ' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n', componentName, table);
|
|
12826
|
+
}
|
|
12696
12827
|
}
|
|
12697
12828
|
}
|
|
12698
12829
|
}
|
|
12699
12830
|
|
|
12700
12831
|
function throwInvalidHookError() {
|
|
12701
|
-
invariant(false, 'Hooks can only be called inside the body of a function component. (https://fb.me/react-invalid-hook-call
|
|
12832
|
+
invariant(false, 'Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem.');
|
|
12702
12833
|
}
|
|
12703
12834
|
|
|
12704
12835
|
function areHookInputsEqual(nextDeps, prevDeps) {
|
|
@@ -12728,7 +12859,12 @@ function areHookInputsEqual(nextDeps, prevDeps) {
|
|
|
12728
12859
|
function renderWithHooks(current, workInProgress, Component, props, refOrContext, nextRenderExpirationTime) {
|
|
12729
12860
|
renderExpirationTime = nextRenderExpirationTime;
|
|
12730
12861
|
currentlyRenderingFiber$1 = workInProgress;
|
|
12731
|
-
|
|
12862
|
+
nextCurrentHook = current !== null ? current.memoizedState : null;
|
|
12863
|
+
|
|
12864
|
+
{
|
|
12865
|
+
hookTypesDev = current !== null ? current._debugHookTypes : null;
|
|
12866
|
+
hookTypesUpdateIndexDev = -1;
|
|
12867
|
+
}
|
|
12732
12868
|
|
|
12733
12869
|
// The following should have already been reset
|
|
12734
12870
|
// currentHook = null;
|
|
@@ -12742,8 +12878,26 @@ function renderWithHooks(current, workInProgress, Component, props, refOrContext
|
|
|
12742
12878
|
// numberOfReRenders = 0;
|
|
12743
12879
|
// sideEffectTag = 0;
|
|
12744
12880
|
|
|
12881
|
+
// TODO Warn if no hooks are used at all during mount, then some are used during update.
|
|
12882
|
+
// Currently we will identify the update render as a mount because nextCurrentHook === null.
|
|
12883
|
+
// This is tricky because it's valid for certain types of components (e.g. React.lazy)
|
|
12884
|
+
|
|
12885
|
+
// Using nextCurrentHook to differentiate between mount/update only works if at least one stateful hook is used.
|
|
12886
|
+
// Non-stateful hooks (e.g. context) don't get added to memoizedState,
|
|
12887
|
+
// so nextCurrentHook would be null during updates and mounts.
|
|
12745
12888
|
{
|
|
12746
|
-
|
|
12889
|
+
if (nextCurrentHook !== null) {
|
|
12890
|
+
ReactCurrentDispatcher$1.current = HooksDispatcherOnUpdateInDEV;
|
|
12891
|
+
} else if (hookTypesDev !== null) {
|
|
12892
|
+
// This dispatcher handles an edge case where a component is updating,
|
|
12893
|
+
// but no stateful hooks have been used.
|
|
12894
|
+
// We want to match the production code behavior (which will use HooksDispatcherOnMount),
|
|
12895
|
+
// but with the extra DEV validation to ensure hooks ordering hasn't changed.
|
|
12896
|
+
// This dispatcher does that.
|
|
12897
|
+
ReactCurrentDispatcher$1.current = HooksDispatcherOnMountWithHookTypesInDEV;
|
|
12898
|
+
} else {
|
|
12899
|
+
ReactCurrentDispatcher$1.current = HooksDispatcherOnMountInDEV;
|
|
12900
|
+
}
|
|
12747
12901
|
}
|
|
12748
12902
|
|
|
12749
12903
|
var children = Component(props, refOrContext);
|
|
@@ -12754,13 +12908,18 @@ function renderWithHooks(current, workInProgress, Component, props, refOrContext
|
|
|
12754
12908
|
numberOfReRenders += 1;
|
|
12755
12909
|
|
|
12756
12910
|
// Start over from the beginning of the list
|
|
12757
|
-
|
|
12911
|
+
nextCurrentHook = current !== null ? current.memoizedState : null;
|
|
12758
12912
|
nextWorkInProgressHook = firstWorkInProgressHook;
|
|
12759
12913
|
|
|
12760
12914
|
currentHook = null;
|
|
12761
12915
|
workInProgressHook = null;
|
|
12762
12916
|
componentUpdateQueue = null;
|
|
12763
12917
|
|
|
12918
|
+
{
|
|
12919
|
+
// Also validate hook order for cascading updates.
|
|
12920
|
+
hookTypesUpdateIndexDev = -1;
|
|
12921
|
+
}
|
|
12922
|
+
|
|
12764
12923
|
ReactCurrentDispatcher$1.current = HooksDispatcherOnUpdateInDEV;
|
|
12765
12924
|
|
|
12766
12925
|
children = Component(props, refOrContext);
|
|
@@ -12770,10 +12929,6 @@ function renderWithHooks(current, workInProgress, Component, props, refOrContext
|
|
|
12770
12929
|
numberOfReRenders = 0;
|
|
12771
12930
|
}
|
|
12772
12931
|
|
|
12773
|
-
{
|
|
12774
|
-
currentHookNameInDev = null;
|
|
12775
|
-
}
|
|
12776
|
-
|
|
12777
12932
|
// We can assume the previous dispatcher is always this one, since we set it
|
|
12778
12933
|
// at the beginning of the render phase and there's no re-entrancy.
|
|
12779
12934
|
ReactCurrentDispatcher$1.current = ContextOnlyDispatcher;
|
|
@@ -12785,18 +12940,29 @@ function renderWithHooks(current, workInProgress, Component, props, refOrContext
|
|
|
12785
12940
|
renderedWork.updateQueue = componentUpdateQueue;
|
|
12786
12941
|
renderedWork.effectTag |= sideEffectTag;
|
|
12787
12942
|
|
|
12943
|
+
{
|
|
12944
|
+
renderedWork._debugHookTypes = hookTypesDev;
|
|
12945
|
+
}
|
|
12946
|
+
|
|
12947
|
+
// This check uses currentHook so that it works the same in DEV and prod bundles.
|
|
12948
|
+
// hookTypesDev could catch more cases (e.g. context) but only in DEV bundles.
|
|
12788
12949
|
var didRenderTooFewHooks = currentHook !== null && currentHook.next !== null;
|
|
12789
12950
|
|
|
12790
12951
|
renderExpirationTime = NoWork;
|
|
12791
12952
|
currentlyRenderingFiber$1 = null;
|
|
12792
12953
|
|
|
12793
|
-
firstCurrentHook = null;
|
|
12794
12954
|
currentHook = null;
|
|
12795
12955
|
nextCurrentHook = null;
|
|
12796
12956
|
firstWorkInProgressHook = null;
|
|
12797
12957
|
workInProgressHook = null;
|
|
12798
12958
|
nextWorkInProgressHook = null;
|
|
12799
12959
|
|
|
12960
|
+
{
|
|
12961
|
+
currentHookNameInDev = null;
|
|
12962
|
+
hookTypesDev = null;
|
|
12963
|
+
hookTypesUpdateIndexDev = -1;
|
|
12964
|
+
}
|
|
12965
|
+
|
|
12800
12966
|
remainingExpirationTime = NoWork;
|
|
12801
12967
|
componentUpdateQueue = null;
|
|
12802
12968
|
sideEffectTag = 0;
|
|
@@ -12830,21 +12996,23 @@ function resetHooks() {
|
|
|
12830
12996
|
renderExpirationTime = NoWork;
|
|
12831
12997
|
currentlyRenderingFiber$1 = null;
|
|
12832
12998
|
|
|
12833
|
-
firstCurrentHook = null;
|
|
12834
12999
|
currentHook = null;
|
|
12835
13000
|
nextCurrentHook = null;
|
|
12836
13001
|
firstWorkInProgressHook = null;
|
|
12837
13002
|
workInProgressHook = null;
|
|
12838
13003
|
nextWorkInProgressHook = null;
|
|
12839
13004
|
|
|
12840
|
-
remainingExpirationTime = NoWork;
|
|
12841
|
-
componentUpdateQueue = null;
|
|
12842
|
-
sideEffectTag = 0;
|
|
12843
|
-
|
|
12844
13005
|
{
|
|
13006
|
+
hookTypesDev = null;
|
|
13007
|
+
hookTypesUpdateIndexDev = -1;
|
|
13008
|
+
|
|
12845
13009
|
currentHookNameInDev = null;
|
|
12846
13010
|
}
|
|
12847
13011
|
|
|
13012
|
+
remainingExpirationTime = NoWork;
|
|
13013
|
+
componentUpdateQueue = null;
|
|
13014
|
+
sideEffectTag = 0;
|
|
13015
|
+
|
|
12848
13016
|
didScheduleRenderPhaseUpdate = false;
|
|
12849
13017
|
renderPhaseUpdates = null;
|
|
12850
13018
|
numberOfReRenders = 0;
|
|
@@ -12861,12 +13029,6 @@ function mountWorkInProgressHook() {
|
|
|
12861
13029
|
next: null
|
|
12862
13030
|
};
|
|
12863
13031
|
|
|
12864
|
-
{
|
|
12865
|
-
hook._debugType = currentHookNameInDev;
|
|
12866
|
-
if (currentlyRenderingFiber$1 !== null && currentlyRenderingFiber$1.alternate !== null) {
|
|
12867
|
-
warning$1(false, '%s: Rendered more hooks than during the previous render. This is ' + 'not currently supported and may lead to unexpected behavior.', getComponentName(currentlyRenderingFiber$1.type));
|
|
12868
|
-
}
|
|
12869
|
-
}
|
|
12870
13032
|
if (workInProgressHook === null) {
|
|
12871
13033
|
// This is the first hook in the list
|
|
12872
13034
|
firstWorkInProgressHook = workInProgressHook = hook;
|
|
@@ -12913,13 +13075,6 @@ function updateWorkInProgressHook() {
|
|
|
12913
13075
|
workInProgressHook = workInProgressHook.next = newHook;
|
|
12914
13076
|
}
|
|
12915
13077
|
nextCurrentHook = currentHook.next;
|
|
12916
|
-
|
|
12917
|
-
{
|
|
12918
|
-
newHook._debugType = currentHookNameInDev;
|
|
12919
|
-
if (currentHookNameInDev !== currentHook._debugType) {
|
|
12920
|
-
warnOnHookMismatchInDev();
|
|
12921
|
-
}
|
|
12922
|
-
}
|
|
12923
13078
|
}
|
|
12924
13079
|
return workInProgressHook;
|
|
12925
13080
|
}
|
|
@@ -12934,20 +13089,6 @@ function basicStateReducer(state, action) {
|
|
|
12934
13089
|
return typeof action === 'function' ? action(state) : action;
|
|
12935
13090
|
}
|
|
12936
13091
|
|
|
12937
|
-
function mountContext(context, observedBits) {
|
|
12938
|
-
{
|
|
12939
|
-
mountWorkInProgressHook();
|
|
12940
|
-
}
|
|
12941
|
-
return readContext(context, observedBits);
|
|
12942
|
-
}
|
|
12943
|
-
|
|
12944
|
-
function updateContext(context, observedBits) {
|
|
12945
|
-
{
|
|
12946
|
-
updateWorkInProgressHook();
|
|
12947
|
-
}
|
|
12948
|
-
return readContext(context, observedBits);
|
|
12949
|
-
}
|
|
12950
|
-
|
|
12951
13092
|
function mountReducer(reducer, initialArg, init) {
|
|
12952
13093
|
var hook = mountWorkInProgressHook();
|
|
12953
13094
|
var initialState = void 0;
|
|
@@ -13000,7 +13141,6 @@ function updateReducer(reducer, initialArg, init) {
|
|
|
13000
13141
|
}
|
|
13001
13142
|
|
|
13002
13143
|
hook.memoizedState = newState;
|
|
13003
|
-
|
|
13004
13144
|
// Don't persist the state accumlated from the render phase updates to
|
|
13005
13145
|
// the base state unless the queue is empty.
|
|
13006
13146
|
// TODO: Not sure if this is the desired semantics, but it's what we
|
|
@@ -13009,6 +13149,9 @@ function updateReducer(reducer, initialArg, init) {
|
|
|
13009
13149
|
hook.baseState = newState;
|
|
13010
13150
|
}
|
|
13011
13151
|
|
|
13152
|
+
queue.eagerReducer = reducer;
|
|
13153
|
+
queue.eagerState = newState;
|
|
13154
|
+
|
|
13012
13155
|
return [newState, _dispatch];
|
|
13013
13156
|
}
|
|
13014
13157
|
}
|
|
@@ -13228,7 +13371,7 @@ function mountImperativeHandle(ref, create, deps) {
|
|
|
13228
13371
|
}
|
|
13229
13372
|
|
|
13230
13373
|
// TODO: If deps are provided, should we skip comparing the ref itself?
|
|
13231
|
-
var effectDeps = deps !== null && deps !== undefined ? deps.concat([ref]) :
|
|
13374
|
+
var effectDeps = deps !== null && deps !== undefined ? deps.concat([ref]) : null;
|
|
13232
13375
|
|
|
13233
13376
|
return mountEffectImpl(Update, UnmountMutation | MountLayout, imperativeHandleEffect.bind(null, create, ref), effectDeps);
|
|
13234
13377
|
}
|
|
@@ -13239,7 +13382,7 @@ function updateImperativeHandle(ref, create, deps) {
|
|
|
13239
13382
|
}
|
|
13240
13383
|
|
|
13241
13384
|
// TODO: If deps are provided, should we skip comparing the ref itself?
|
|
13242
|
-
var effectDeps = deps !== null && deps !== undefined ? deps.concat([ref]) :
|
|
13385
|
+
var effectDeps = deps !== null && deps !== undefined ? deps.concat([ref]) : null;
|
|
13243
13386
|
|
|
13244
13387
|
return updateEffectImpl(Update, UnmountMutation | MountLayout, imperativeHandleEffect.bind(null, create, ref), effectDeps);
|
|
13245
13388
|
}
|
|
@@ -13306,7 +13449,7 @@ function updateMemo(nextCreate, deps) {
|
|
|
13306
13449
|
var shouldWarnForUnbatchedSetState = false;
|
|
13307
13450
|
|
|
13308
13451
|
{
|
|
13309
|
-
// jest
|
|
13452
|
+
// jest isn't a 'global', it's just exposed to tests via a wrapped function
|
|
13310
13453
|
// further, this isn't a test file, so flow doesn't recognize the symbol. So...
|
|
13311
13454
|
// $FlowExpectedError - because requirements don't give a damn about your type sigs.
|
|
13312
13455
|
if ('undefined' !== typeof jest) {
|
|
@@ -13438,6 +13581,7 @@ var ContextOnlyDispatcher = {
|
|
|
13438
13581
|
};
|
|
13439
13582
|
|
|
13440
13583
|
var HooksDispatcherOnMountInDEV = null;
|
|
13584
|
+
var HooksDispatcherOnMountWithHookTypesInDEV = null;
|
|
13441
13585
|
var HooksDispatcherOnUpdateInDEV = null;
|
|
13442
13586
|
var InvalidNestedHooksDispatcherOnMountInDEV = null;
|
|
13443
13587
|
var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
@@ -13457,26 +13601,106 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
|
13457
13601
|
},
|
|
13458
13602
|
useCallback: function (callback, deps) {
|
|
13459
13603
|
currentHookNameInDev = 'useCallback';
|
|
13604
|
+
mountHookTypesDev();
|
|
13605
|
+
return mountCallback(callback, deps);
|
|
13606
|
+
},
|
|
13607
|
+
useContext: function (context, observedBits) {
|
|
13608
|
+
currentHookNameInDev = 'useContext';
|
|
13609
|
+
mountHookTypesDev();
|
|
13610
|
+
return readContext(context, observedBits);
|
|
13611
|
+
},
|
|
13612
|
+
useEffect: function (create, deps) {
|
|
13613
|
+
currentHookNameInDev = 'useEffect';
|
|
13614
|
+
mountHookTypesDev();
|
|
13615
|
+
return mountEffect(create, deps);
|
|
13616
|
+
},
|
|
13617
|
+
useImperativeHandle: function (ref, create, deps) {
|
|
13618
|
+
currentHookNameInDev = 'useImperativeHandle';
|
|
13619
|
+
mountHookTypesDev();
|
|
13620
|
+
return mountImperativeHandle(ref, create, deps);
|
|
13621
|
+
},
|
|
13622
|
+
useLayoutEffect: function (create, deps) {
|
|
13623
|
+
currentHookNameInDev = 'useLayoutEffect';
|
|
13624
|
+
mountHookTypesDev();
|
|
13625
|
+
return mountLayoutEffect(create, deps);
|
|
13626
|
+
},
|
|
13627
|
+
useMemo: function (create, deps) {
|
|
13628
|
+
currentHookNameInDev = 'useMemo';
|
|
13629
|
+
mountHookTypesDev();
|
|
13630
|
+
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
|
13631
|
+
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
|
|
13632
|
+
try {
|
|
13633
|
+
return mountMemo(create, deps);
|
|
13634
|
+
} finally {
|
|
13635
|
+
ReactCurrentDispatcher$1.current = prevDispatcher;
|
|
13636
|
+
}
|
|
13637
|
+
},
|
|
13638
|
+
useReducer: function (reducer, initialArg, init) {
|
|
13639
|
+
currentHookNameInDev = 'useReducer';
|
|
13640
|
+
mountHookTypesDev();
|
|
13641
|
+
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
|
13642
|
+
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
|
|
13643
|
+
try {
|
|
13644
|
+
return mountReducer(reducer, initialArg, init);
|
|
13645
|
+
} finally {
|
|
13646
|
+
ReactCurrentDispatcher$1.current = prevDispatcher;
|
|
13647
|
+
}
|
|
13648
|
+
},
|
|
13649
|
+
useRef: function (initialValue) {
|
|
13650
|
+
currentHookNameInDev = 'useRef';
|
|
13651
|
+
mountHookTypesDev();
|
|
13652
|
+
return mountRef(initialValue);
|
|
13653
|
+
},
|
|
13654
|
+
useState: function (initialState) {
|
|
13655
|
+
currentHookNameInDev = 'useState';
|
|
13656
|
+
mountHookTypesDev();
|
|
13657
|
+
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
|
13658
|
+
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
|
|
13659
|
+
try {
|
|
13660
|
+
return mountState(initialState);
|
|
13661
|
+
} finally {
|
|
13662
|
+
ReactCurrentDispatcher$1.current = prevDispatcher;
|
|
13663
|
+
}
|
|
13664
|
+
},
|
|
13665
|
+
useDebugValue: function (value, formatterFn) {
|
|
13666
|
+
currentHookNameInDev = 'useDebugValue';
|
|
13667
|
+
mountHookTypesDev();
|
|
13668
|
+
return mountDebugValue(value, formatterFn);
|
|
13669
|
+
}
|
|
13670
|
+
};
|
|
13671
|
+
|
|
13672
|
+
HooksDispatcherOnMountWithHookTypesInDEV = {
|
|
13673
|
+
readContext: function (context, observedBits) {
|
|
13674
|
+
return readContext(context, observedBits);
|
|
13675
|
+
},
|
|
13676
|
+
useCallback: function (callback, deps) {
|
|
13677
|
+
currentHookNameInDev = 'useCallback';
|
|
13678
|
+
updateHookTypesDev();
|
|
13460
13679
|
return mountCallback(callback, deps);
|
|
13461
13680
|
},
|
|
13462
13681
|
useContext: function (context, observedBits) {
|
|
13463
13682
|
currentHookNameInDev = 'useContext';
|
|
13464
|
-
|
|
13683
|
+
updateHookTypesDev();
|
|
13684
|
+
return readContext(context, observedBits);
|
|
13465
13685
|
},
|
|
13466
13686
|
useEffect: function (create, deps) {
|
|
13467
13687
|
currentHookNameInDev = 'useEffect';
|
|
13688
|
+
updateHookTypesDev();
|
|
13468
13689
|
return mountEffect(create, deps);
|
|
13469
13690
|
},
|
|
13470
13691
|
useImperativeHandle: function (ref, create, deps) {
|
|
13471
13692
|
currentHookNameInDev = 'useImperativeHandle';
|
|
13693
|
+
updateHookTypesDev();
|
|
13472
13694
|
return mountImperativeHandle(ref, create, deps);
|
|
13473
13695
|
},
|
|
13474
13696
|
useLayoutEffect: function (create, deps) {
|
|
13475
13697
|
currentHookNameInDev = 'useLayoutEffect';
|
|
13698
|
+
updateHookTypesDev();
|
|
13476
13699
|
return mountLayoutEffect(create, deps);
|
|
13477
13700
|
},
|
|
13478
13701
|
useMemo: function (create, deps) {
|
|
13479
13702
|
currentHookNameInDev = 'useMemo';
|
|
13703
|
+
updateHookTypesDev();
|
|
13480
13704
|
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
|
13481
13705
|
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
|
|
13482
13706
|
try {
|
|
@@ -13487,6 +13711,7 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
|
13487
13711
|
},
|
|
13488
13712
|
useReducer: function (reducer, initialArg, init) {
|
|
13489
13713
|
currentHookNameInDev = 'useReducer';
|
|
13714
|
+
updateHookTypesDev();
|
|
13490
13715
|
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
|
13491
13716
|
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
|
|
13492
13717
|
try {
|
|
@@ -13497,10 +13722,12 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
|
13497
13722
|
},
|
|
13498
13723
|
useRef: function (initialValue) {
|
|
13499
13724
|
currentHookNameInDev = 'useRef';
|
|
13725
|
+
updateHookTypesDev();
|
|
13500
13726
|
return mountRef(initialValue);
|
|
13501
13727
|
},
|
|
13502
13728
|
useState: function (initialState) {
|
|
13503
13729
|
currentHookNameInDev = 'useState';
|
|
13730
|
+
updateHookTypesDev();
|
|
13504
13731
|
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
|
13505
13732
|
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
|
|
13506
13733
|
try {
|
|
@@ -13511,6 +13738,7 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
|
13511
13738
|
},
|
|
13512
13739
|
useDebugValue: function (value, formatterFn) {
|
|
13513
13740
|
currentHookNameInDev = 'useDebugValue';
|
|
13741
|
+
updateHookTypesDev();
|
|
13514
13742
|
return mountDebugValue(value, formatterFn);
|
|
13515
13743
|
}
|
|
13516
13744
|
};
|
|
@@ -13521,26 +13749,32 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
|
13521
13749
|
},
|
|
13522
13750
|
useCallback: function (callback, deps) {
|
|
13523
13751
|
currentHookNameInDev = 'useCallback';
|
|
13752
|
+
updateHookTypesDev();
|
|
13524
13753
|
return updateCallback(callback, deps);
|
|
13525
13754
|
},
|
|
13526
13755
|
useContext: function (context, observedBits) {
|
|
13527
13756
|
currentHookNameInDev = 'useContext';
|
|
13528
|
-
|
|
13757
|
+
updateHookTypesDev();
|
|
13758
|
+
return readContext(context, observedBits);
|
|
13529
13759
|
},
|
|
13530
13760
|
useEffect: function (create, deps) {
|
|
13531
13761
|
currentHookNameInDev = 'useEffect';
|
|
13762
|
+
updateHookTypesDev();
|
|
13532
13763
|
return updateEffect(create, deps);
|
|
13533
13764
|
},
|
|
13534
13765
|
useImperativeHandle: function (ref, create, deps) {
|
|
13535
13766
|
currentHookNameInDev = 'useImperativeHandle';
|
|
13767
|
+
updateHookTypesDev();
|
|
13536
13768
|
return updateImperativeHandle(ref, create, deps);
|
|
13537
13769
|
},
|
|
13538
13770
|
useLayoutEffect: function (create, deps) {
|
|
13539
13771
|
currentHookNameInDev = 'useLayoutEffect';
|
|
13772
|
+
updateHookTypesDev();
|
|
13540
13773
|
return updateLayoutEffect(create, deps);
|
|
13541
13774
|
},
|
|
13542
13775
|
useMemo: function (create, deps) {
|
|
13543
13776
|
currentHookNameInDev = 'useMemo';
|
|
13777
|
+
updateHookTypesDev();
|
|
13544
13778
|
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
|
13545
13779
|
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
|
|
13546
13780
|
try {
|
|
@@ -13551,6 +13785,7 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
|
13551
13785
|
},
|
|
13552
13786
|
useReducer: function (reducer, initialArg, init) {
|
|
13553
13787
|
currentHookNameInDev = 'useReducer';
|
|
13788
|
+
updateHookTypesDev();
|
|
13554
13789
|
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
|
13555
13790
|
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
|
|
13556
13791
|
try {
|
|
@@ -13561,10 +13796,12 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
|
13561
13796
|
},
|
|
13562
13797
|
useRef: function (initialValue) {
|
|
13563
13798
|
currentHookNameInDev = 'useRef';
|
|
13799
|
+
updateHookTypesDev();
|
|
13564
13800
|
return updateRef(initialValue);
|
|
13565
13801
|
},
|
|
13566
13802
|
useState: function (initialState) {
|
|
13567
13803
|
currentHookNameInDev = 'useState';
|
|
13804
|
+
updateHookTypesDev();
|
|
13568
13805
|
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
|
13569
13806
|
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
|
|
13570
13807
|
try {
|
|
@@ -13575,6 +13812,7 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
|
13575
13812
|
},
|
|
13576
13813
|
useDebugValue: function (value, formatterFn) {
|
|
13577
13814
|
currentHookNameInDev = 'useDebugValue';
|
|
13815
|
+
updateHookTypesDev();
|
|
13578
13816
|
return updateDebugValue(value, formatterFn);
|
|
13579
13817
|
}
|
|
13580
13818
|
};
|
|
@@ -13587,31 +13825,37 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
|
13587
13825
|
useCallback: function (callback, deps) {
|
|
13588
13826
|
currentHookNameInDev = 'useCallback';
|
|
13589
13827
|
warnInvalidHookAccess();
|
|
13828
|
+
mountHookTypesDev();
|
|
13590
13829
|
return mountCallback(callback, deps);
|
|
13591
13830
|
},
|
|
13592
13831
|
useContext: function (context, observedBits) {
|
|
13593
13832
|
currentHookNameInDev = 'useContext';
|
|
13594
13833
|
warnInvalidHookAccess();
|
|
13595
|
-
|
|
13834
|
+
mountHookTypesDev();
|
|
13835
|
+
return readContext(context, observedBits);
|
|
13596
13836
|
},
|
|
13597
13837
|
useEffect: function (create, deps) {
|
|
13598
13838
|
currentHookNameInDev = 'useEffect';
|
|
13599
13839
|
warnInvalidHookAccess();
|
|
13840
|
+
mountHookTypesDev();
|
|
13600
13841
|
return mountEffect(create, deps);
|
|
13601
13842
|
},
|
|
13602
13843
|
useImperativeHandle: function (ref, create, deps) {
|
|
13603
13844
|
currentHookNameInDev = 'useImperativeHandle';
|
|
13604
13845
|
warnInvalidHookAccess();
|
|
13846
|
+
mountHookTypesDev();
|
|
13605
13847
|
return mountImperativeHandle(ref, create, deps);
|
|
13606
13848
|
},
|
|
13607
13849
|
useLayoutEffect: function (create, deps) {
|
|
13608
13850
|
currentHookNameInDev = 'useLayoutEffect';
|
|
13609
13851
|
warnInvalidHookAccess();
|
|
13852
|
+
mountHookTypesDev();
|
|
13610
13853
|
return mountLayoutEffect(create, deps);
|
|
13611
13854
|
},
|
|
13612
13855
|
useMemo: function (create, deps) {
|
|
13613
13856
|
currentHookNameInDev = 'useMemo';
|
|
13614
13857
|
warnInvalidHookAccess();
|
|
13858
|
+
mountHookTypesDev();
|
|
13615
13859
|
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
|
13616
13860
|
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
|
|
13617
13861
|
try {
|
|
@@ -13623,6 +13867,7 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
|
13623
13867
|
useReducer: function (reducer, initialArg, init) {
|
|
13624
13868
|
currentHookNameInDev = 'useReducer';
|
|
13625
13869
|
warnInvalidHookAccess();
|
|
13870
|
+
mountHookTypesDev();
|
|
13626
13871
|
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
|
13627
13872
|
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
|
|
13628
13873
|
try {
|
|
@@ -13634,11 +13879,13 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
|
13634
13879
|
useRef: function (initialValue) {
|
|
13635
13880
|
currentHookNameInDev = 'useRef';
|
|
13636
13881
|
warnInvalidHookAccess();
|
|
13882
|
+
mountHookTypesDev();
|
|
13637
13883
|
return mountRef(initialValue);
|
|
13638
13884
|
},
|
|
13639
13885
|
useState: function (initialState) {
|
|
13640
13886
|
currentHookNameInDev = 'useState';
|
|
13641
13887
|
warnInvalidHookAccess();
|
|
13888
|
+
mountHookTypesDev();
|
|
13642
13889
|
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
|
13643
13890
|
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
|
|
13644
13891
|
try {
|
|
@@ -13650,6 +13897,7 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
|
13650
13897
|
useDebugValue: function (value, formatterFn) {
|
|
13651
13898
|
currentHookNameInDev = 'useDebugValue';
|
|
13652
13899
|
warnInvalidHookAccess();
|
|
13900
|
+
mountHookTypesDev();
|
|
13653
13901
|
return mountDebugValue(value, formatterFn);
|
|
13654
13902
|
}
|
|
13655
13903
|
};
|
|
@@ -13662,31 +13910,37 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
|
13662
13910
|
useCallback: function (callback, deps) {
|
|
13663
13911
|
currentHookNameInDev = 'useCallback';
|
|
13664
13912
|
warnInvalidHookAccess();
|
|
13913
|
+
updateHookTypesDev();
|
|
13665
13914
|
return updateCallback(callback, deps);
|
|
13666
13915
|
},
|
|
13667
13916
|
useContext: function (context, observedBits) {
|
|
13668
13917
|
currentHookNameInDev = 'useContext';
|
|
13669
13918
|
warnInvalidHookAccess();
|
|
13670
|
-
|
|
13919
|
+
updateHookTypesDev();
|
|
13920
|
+
return readContext(context, observedBits);
|
|
13671
13921
|
},
|
|
13672
13922
|
useEffect: function (create, deps) {
|
|
13673
13923
|
currentHookNameInDev = 'useEffect';
|
|
13674
13924
|
warnInvalidHookAccess();
|
|
13925
|
+
updateHookTypesDev();
|
|
13675
13926
|
return updateEffect(create, deps);
|
|
13676
13927
|
},
|
|
13677
13928
|
useImperativeHandle: function (ref, create, deps) {
|
|
13678
13929
|
currentHookNameInDev = 'useImperativeHandle';
|
|
13679
13930
|
warnInvalidHookAccess();
|
|
13931
|
+
updateHookTypesDev();
|
|
13680
13932
|
return updateImperativeHandle(ref, create, deps);
|
|
13681
13933
|
},
|
|
13682
13934
|
useLayoutEffect: function (create, deps) {
|
|
13683
13935
|
currentHookNameInDev = 'useLayoutEffect';
|
|
13684
13936
|
warnInvalidHookAccess();
|
|
13937
|
+
updateHookTypesDev();
|
|
13685
13938
|
return updateLayoutEffect(create, deps);
|
|
13686
13939
|
},
|
|
13687
13940
|
useMemo: function (create, deps) {
|
|
13688
13941
|
currentHookNameInDev = 'useMemo';
|
|
13689
13942
|
warnInvalidHookAccess();
|
|
13943
|
+
updateHookTypesDev();
|
|
13690
13944
|
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
|
13691
13945
|
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
|
|
13692
13946
|
try {
|
|
@@ -13698,6 +13952,7 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
|
13698
13952
|
useReducer: function (reducer, initialArg, init) {
|
|
13699
13953
|
currentHookNameInDev = 'useReducer';
|
|
13700
13954
|
warnInvalidHookAccess();
|
|
13955
|
+
updateHookTypesDev();
|
|
13701
13956
|
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
|
13702
13957
|
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
|
|
13703
13958
|
try {
|
|
@@ -13709,11 +13964,13 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
|
13709
13964
|
useRef: function (initialValue) {
|
|
13710
13965
|
currentHookNameInDev = 'useRef';
|
|
13711
13966
|
warnInvalidHookAccess();
|
|
13967
|
+
updateHookTypesDev();
|
|
13712
13968
|
return updateRef(initialValue);
|
|
13713
13969
|
},
|
|
13714
13970
|
useState: function (initialState) {
|
|
13715
13971
|
currentHookNameInDev = 'useState';
|
|
13716
13972
|
warnInvalidHookAccess();
|
|
13973
|
+
updateHookTypesDev();
|
|
13717
13974
|
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
|
13718
13975
|
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
|
|
13719
13976
|
try {
|
|
@@ -13725,6 +13982,7 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
|
13725
13982
|
useDebugValue: function (value, formatterFn) {
|
|
13726
13983
|
currentHookNameInDev = 'useDebugValue';
|
|
13727
13984
|
warnInvalidHookAccess();
|
|
13985
|
+
updateHookTypesDev();
|
|
13728
13986
|
return updateDebugValue(value, formatterFn);
|
|
13729
13987
|
}
|
|
13730
13988
|
};
|
|
@@ -13796,6 +14054,18 @@ function enterHydrationState(fiber) {
|
|
|
13796
14054
|
return true;
|
|
13797
14055
|
}
|
|
13798
14056
|
|
|
14057
|
+
function reenterHydrationStateFromDehydratedSuspenseInstance(fiber) {
|
|
14058
|
+
if (!supportsHydration) {
|
|
14059
|
+
return false;
|
|
14060
|
+
}
|
|
14061
|
+
|
|
14062
|
+
var suspenseInstance = fiber.stateNode;
|
|
14063
|
+
nextHydratableInstance = getNextHydratableSibling(suspenseInstance);
|
|
14064
|
+
popToNextHostParent(fiber);
|
|
14065
|
+
isHydrating = true;
|
|
14066
|
+
return true;
|
|
14067
|
+
}
|
|
14068
|
+
|
|
13799
14069
|
function deleteHydratableInstance(returnFiber, instance) {
|
|
13800
14070
|
{
|
|
13801
14071
|
switch (returnFiber.tag) {
|
|
@@ -13842,6 +14112,9 @@ function insertNonHydratedInstance(returnFiber, fiber) {
|
|
|
13842
14112
|
case HostText:
|
|
13843
14113
|
var text = fiber.pendingProps;
|
|
13844
14114
|
didNotFindHydratableContainerTextInstance(parentContainer, text);
|
|
14115
|
+
break;
|
|
14116
|
+
case SuspenseComponent:
|
|
14117
|
+
|
|
13845
14118
|
break;
|
|
13846
14119
|
}
|
|
13847
14120
|
break;
|
|
@@ -13861,6 +14134,9 @@ function insertNonHydratedInstance(returnFiber, fiber) {
|
|
|
13861
14134
|
var _text = fiber.pendingProps;
|
|
13862
14135
|
didNotFindHydratableTextInstance(parentType, parentProps, parentInstance, _text);
|
|
13863
14136
|
break;
|
|
14137
|
+
case SuspenseComponent:
|
|
14138
|
+
didNotFindHydratableSuspenseInstance(parentType, parentProps, parentInstance);
|
|
14139
|
+
break;
|
|
13864
14140
|
}
|
|
13865
14141
|
break;
|
|
13866
14142
|
}
|
|
@@ -13893,6 +14169,19 @@ function tryHydrate(fiber, nextInstance) {
|
|
|
13893
14169
|
}
|
|
13894
14170
|
return false;
|
|
13895
14171
|
}
|
|
14172
|
+
case SuspenseComponent:
|
|
14173
|
+
{
|
|
14174
|
+
if (enableSuspenseServerRenderer) {
|
|
14175
|
+
var suspenseInstance = canHydrateSuspenseInstance(nextInstance);
|
|
14176
|
+
if (suspenseInstance !== null) {
|
|
14177
|
+
// Downgrade the tag to a dehydrated component until we've hydrated it.
|
|
14178
|
+
fiber.tag = DehydratedSuspenseComponent;
|
|
14179
|
+
fiber.stateNode = suspenseInstance;
|
|
14180
|
+
return true;
|
|
14181
|
+
}
|
|
14182
|
+
}
|
|
14183
|
+
return false;
|
|
14184
|
+
}
|
|
13896
14185
|
default:
|
|
13897
14186
|
return false;
|
|
13898
14187
|
}
|
|
@@ -13986,9 +14275,18 @@ function prepareToHydrateHostTextInstance(fiber) {
|
|
|
13986
14275
|
return shouldUpdate;
|
|
13987
14276
|
}
|
|
13988
14277
|
|
|
14278
|
+
function skipPastDehydratedSuspenseInstance(fiber) {
|
|
14279
|
+
if (!supportsHydration) {
|
|
14280
|
+
invariant(false, 'Expected skipPastDehydratedSuspenseInstance() to never be called. This error is likely caused by a bug in React. Please file an issue.');
|
|
14281
|
+
}
|
|
14282
|
+
var suspenseInstance = fiber.stateNode;
|
|
14283
|
+
!suspenseInstance ? invariant(false, 'Expected to have a hydrated suspense instance. This error is likely caused by a bug in React. Please file an issue.') : void 0;
|
|
14284
|
+
nextHydratableInstance = getNextHydratableInstanceAfterSuspenseInstance(suspenseInstance);
|
|
14285
|
+
}
|
|
14286
|
+
|
|
13989
14287
|
function popToNextHostParent(fiber) {
|
|
13990
14288
|
var parent = fiber.return;
|
|
13991
|
-
while (parent !== null && parent.tag !== HostComponent && parent.tag !== HostRoot) {
|
|
14289
|
+
while (parent !== null && parent.tag !== HostComponent && parent.tag !== HostRoot && parent.tag !== DehydratedSuspenseComponent) {
|
|
13992
14290
|
parent = parent.return;
|
|
13993
14291
|
}
|
|
13994
14292
|
hydrationParentFiber = parent;
|
|
@@ -14096,6 +14394,10 @@ function forceUnmountCurrentAndReconcile(current$$1, workInProgress, nextChildre
|
|
|
14096
14394
|
}
|
|
14097
14395
|
|
|
14098
14396
|
function updateForwardRef(current$$1, workInProgress, Component, nextProps, renderExpirationTime) {
|
|
14397
|
+
// TODO: current can be non-null here even if the component
|
|
14398
|
+
// hasn't yet mounted. This happens after the first render suspends.
|
|
14399
|
+
// We'll need to figure out if this is fine or can cause issues.
|
|
14400
|
+
|
|
14099
14401
|
{
|
|
14100
14402
|
if (workInProgress.type !== workInProgress.elementType) {
|
|
14101
14403
|
// Lazy component props can't be validated in createElement
|
|
@@ -14201,6 +14503,10 @@ function updateMemoComponent(current$$1, workInProgress, Component, nextProps, u
|
|
|
14201
14503
|
}
|
|
14202
14504
|
|
|
14203
14505
|
function updateSimpleMemoComponent(current$$1, workInProgress, Component, nextProps, updateExpirationTime, renderExpirationTime) {
|
|
14506
|
+
// TODO: current can be non-null here even if the component
|
|
14507
|
+
// hasn't yet mounted. This happens when the inner render suspends.
|
|
14508
|
+
// We'll need to figure out if this is fine or can cause issues.
|
|
14509
|
+
|
|
14204
14510
|
{
|
|
14205
14511
|
if (workInProgress.type !== workInProgress.elementType) {
|
|
14206
14512
|
// Lazy component props can't be validated in createElement
|
|
@@ -14824,6 +15130,18 @@ function updateSuspenseComponent(current$$1, workInProgress, renderExpirationTim
|
|
|
14824
15130
|
// children -- we skip over the primary children entirely.
|
|
14825
15131
|
var next = void 0;
|
|
14826
15132
|
if (current$$1 === null) {
|
|
15133
|
+
if (enableSuspenseServerRenderer) {
|
|
15134
|
+
// If we're currently hydrating, try to hydrate this boundary.
|
|
15135
|
+
// But only if this has a fallback.
|
|
15136
|
+
if (nextProps.fallback !== undefined) {
|
|
15137
|
+
tryToClaimNextHydratableInstance(workInProgress);
|
|
15138
|
+
// This could've changed the tag if this was a dehydrated suspense component.
|
|
15139
|
+
if (workInProgress.tag === DehydratedSuspenseComponent) {
|
|
15140
|
+
return updateDehydratedSuspenseComponent(null, workInProgress, renderExpirationTime);
|
|
15141
|
+
}
|
|
15142
|
+
}
|
|
15143
|
+
}
|
|
15144
|
+
|
|
14827
15145
|
// This is the initial mount. This branch is pretty simple because there's
|
|
14828
15146
|
// no previous state that needs to be preserved.
|
|
14829
15147
|
if (nextDidTimeout) {
|
|
@@ -14975,6 +15293,65 @@ function updateSuspenseComponent(current$$1, workInProgress, renderExpirationTim
|
|
|
14975
15293
|
return next;
|
|
14976
15294
|
}
|
|
14977
15295
|
|
|
15296
|
+
function updateDehydratedSuspenseComponent(current$$1, workInProgress, renderExpirationTime) {
|
|
15297
|
+
if (current$$1 === null) {
|
|
15298
|
+
// During the first pass, we'll bail out and not drill into the children.
|
|
15299
|
+
// Instead, we'll leave the content in place and try to hydrate it later.
|
|
15300
|
+
workInProgress.expirationTime = Never;
|
|
15301
|
+
return null;
|
|
15302
|
+
}
|
|
15303
|
+
// We use childExpirationTime to indicate that a child might depend on context, so if
|
|
15304
|
+
// any context has changed, we need to treat is as if the input might have changed.
|
|
15305
|
+
var hasContextChanged$$1 = current$$1.childExpirationTime >= renderExpirationTime;
|
|
15306
|
+
if (didReceiveUpdate || hasContextChanged$$1) {
|
|
15307
|
+
// This boundary has changed since the first render. This means that we are now unable to
|
|
15308
|
+
// hydrate it. We might still be able to hydrate it using an earlier expiration time but
|
|
15309
|
+
// during this render we can't. Instead, we're going to delete the whole subtree and
|
|
15310
|
+
// instead inject a new real Suspense boundary to take its place, which may render content
|
|
15311
|
+
// or fallback. The real Suspense boundary will suspend for a while so we have some time
|
|
15312
|
+
// to ensure it can produce real content, but all state and pending events will be lost.
|
|
15313
|
+
|
|
15314
|
+
// Detach from the current dehydrated boundary.
|
|
15315
|
+
current$$1.alternate = null;
|
|
15316
|
+
workInProgress.alternate = null;
|
|
15317
|
+
|
|
15318
|
+
// Insert a deletion in the effect list.
|
|
15319
|
+
var returnFiber = workInProgress.return;
|
|
15320
|
+
!(returnFiber !== null) ? invariant(false, 'Suspense boundaries are never on the root. This is probably a bug in React.') : void 0;
|
|
15321
|
+
var last = returnFiber.lastEffect;
|
|
15322
|
+
if (last !== null) {
|
|
15323
|
+
last.nextEffect = current$$1;
|
|
15324
|
+
returnFiber.lastEffect = current$$1;
|
|
15325
|
+
} else {
|
|
15326
|
+
returnFiber.firstEffect = returnFiber.lastEffect = current$$1;
|
|
15327
|
+
}
|
|
15328
|
+
current$$1.nextEffect = null;
|
|
15329
|
+
current$$1.effectTag = Deletion;
|
|
15330
|
+
|
|
15331
|
+
// Upgrade this work in progress to a real Suspense component.
|
|
15332
|
+
workInProgress.tag = SuspenseComponent;
|
|
15333
|
+
workInProgress.stateNode = null;
|
|
15334
|
+
workInProgress.memoizedState = null;
|
|
15335
|
+
// This is now an insertion.
|
|
15336
|
+
workInProgress.effectTag |= Placement;
|
|
15337
|
+
// Retry as a real Suspense component.
|
|
15338
|
+
return updateSuspenseComponent(null, workInProgress, renderExpirationTime);
|
|
15339
|
+
}
|
|
15340
|
+
if ((workInProgress.effectTag & DidCapture) === NoEffect) {
|
|
15341
|
+
// This is the first attempt.
|
|
15342
|
+
reenterHydrationStateFromDehydratedSuspenseInstance(workInProgress);
|
|
15343
|
+
var nextProps = workInProgress.pendingProps;
|
|
15344
|
+
var nextChildren = nextProps.children;
|
|
15345
|
+
workInProgress.child = mountChildFibers(workInProgress, null, nextChildren, renderExpirationTime);
|
|
15346
|
+
return workInProgress.child;
|
|
15347
|
+
} else {
|
|
15348
|
+
// Something suspended. Leave the existing children in place.
|
|
15349
|
+
// TODO: In non-concurrent mode, should we commit the nodes we have hydrated so far?
|
|
15350
|
+
workInProgress.child = null;
|
|
15351
|
+
return null;
|
|
15352
|
+
}
|
|
15353
|
+
}
|
|
15354
|
+
|
|
14978
15355
|
function updatePortalComponent(current$$1, workInProgress, renderExpirationTime) {
|
|
14979
15356
|
pushHostContainer(workInProgress, workInProgress.stateNode.containerInfo);
|
|
14980
15357
|
var nextChildren = workInProgress.pendingProps;
|
|
@@ -15186,6 +15563,16 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
|
|
|
15186
15563
|
}
|
|
15187
15564
|
break;
|
|
15188
15565
|
}
|
|
15566
|
+
case DehydratedSuspenseComponent:
|
|
15567
|
+
{
|
|
15568
|
+
if (enableSuspenseServerRenderer) {
|
|
15569
|
+
// We know that this component will suspend again because if it has
|
|
15570
|
+
// been unsuspended it has committed as a regular Suspense component.
|
|
15571
|
+
// If it needs to be retried, it should have work scheduled on it.
|
|
15572
|
+
workInProgress.effectTag |= DidCapture;
|
|
15573
|
+
break;
|
|
15574
|
+
}
|
|
15575
|
+
}
|
|
15189
15576
|
}
|
|
15190
15577
|
return bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
|
|
15191
15578
|
}
|
|
@@ -15277,9 +15664,15 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
|
|
|
15277
15664
|
var _resolvedProps4 = workInProgress.elementType === _Component3 ? _unresolvedProps4 : resolveDefaultProps(_Component3, _unresolvedProps4);
|
|
15278
15665
|
return mountIncompleteClassComponent(current$$1, workInProgress, _Component3, _resolvedProps4, renderExpirationTime);
|
|
15279
15666
|
}
|
|
15280
|
-
|
|
15281
|
-
|
|
15667
|
+
case DehydratedSuspenseComponent:
|
|
15668
|
+
{
|
|
15669
|
+
if (enableSuspenseServerRenderer) {
|
|
15670
|
+
return updateDehydratedSuspenseComponent(current$$1, workInProgress, renderExpirationTime);
|
|
15671
|
+
}
|
|
15672
|
+
break;
|
|
15673
|
+
}
|
|
15282
15674
|
}
|
|
15675
|
+
invariant(false, 'Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue.');
|
|
15283
15676
|
}
|
|
15284
15677
|
|
|
15285
15678
|
var valueCursor = createCursor(null);
|
|
@@ -15368,6 +15761,28 @@ function calculateChangedBits(context, newValue, oldValue) {
|
|
|
15368
15761
|
}
|
|
15369
15762
|
}
|
|
15370
15763
|
|
|
15764
|
+
function scheduleWorkOnParentPath(parent, renderExpirationTime) {
|
|
15765
|
+
// Update the child expiration time of all the ancestors, including
|
|
15766
|
+
// the alternates.
|
|
15767
|
+
var node = parent;
|
|
15768
|
+
while (node !== null) {
|
|
15769
|
+
var alternate = node.alternate;
|
|
15770
|
+
if (node.childExpirationTime < renderExpirationTime) {
|
|
15771
|
+
node.childExpirationTime = renderExpirationTime;
|
|
15772
|
+
if (alternate !== null && alternate.childExpirationTime < renderExpirationTime) {
|
|
15773
|
+
alternate.childExpirationTime = renderExpirationTime;
|
|
15774
|
+
}
|
|
15775
|
+
} else if (alternate !== null && alternate.childExpirationTime < renderExpirationTime) {
|
|
15776
|
+
alternate.childExpirationTime = renderExpirationTime;
|
|
15777
|
+
} else {
|
|
15778
|
+
// Neither alternate was updated, which means the rest of the
|
|
15779
|
+
// ancestor path already has sufficient priority.
|
|
15780
|
+
break;
|
|
15781
|
+
}
|
|
15782
|
+
node = node.return;
|
|
15783
|
+
}
|
|
15784
|
+
}
|
|
15785
|
+
|
|
15371
15786
|
function propagateContextChange(workInProgress, context, changedBits, renderExpirationTime) {
|
|
15372
15787
|
var fiber = workInProgress.child;
|
|
15373
15788
|
if (fiber !== null) {
|
|
@@ -15406,25 +15821,8 @@ function propagateContextChange(workInProgress, context, changedBits, renderExpi
|
|
|
15406
15821
|
if (alternate !== null && alternate.expirationTime < renderExpirationTime) {
|
|
15407
15822
|
alternate.expirationTime = renderExpirationTime;
|
|
15408
15823
|
}
|
|
15409
|
-
|
|
15410
|
-
|
|
15411
|
-
var node = fiber.return;
|
|
15412
|
-
while (node !== null) {
|
|
15413
|
-
alternate = node.alternate;
|
|
15414
|
-
if (node.childExpirationTime < renderExpirationTime) {
|
|
15415
|
-
node.childExpirationTime = renderExpirationTime;
|
|
15416
|
-
if (alternate !== null && alternate.childExpirationTime < renderExpirationTime) {
|
|
15417
|
-
alternate.childExpirationTime = renderExpirationTime;
|
|
15418
|
-
}
|
|
15419
|
-
} else if (alternate !== null && alternate.childExpirationTime < renderExpirationTime) {
|
|
15420
|
-
alternate.childExpirationTime = renderExpirationTime;
|
|
15421
|
-
} else {
|
|
15422
|
-
// Neither alternate was updated, which means the rest of the
|
|
15423
|
-
// ancestor path already has sufficient priority.
|
|
15424
|
-
break;
|
|
15425
|
-
}
|
|
15426
|
-
node = node.return;
|
|
15427
|
-
}
|
|
15824
|
+
|
|
15825
|
+
scheduleWorkOnParentPath(fiber.return, renderExpirationTime);
|
|
15428
15826
|
|
|
15429
15827
|
// Mark the expiration time on the list, too.
|
|
15430
15828
|
if (list.expirationTime < renderExpirationTime) {
|
|
@@ -15440,6 +15838,23 @@ function propagateContextChange(workInProgress, context, changedBits, renderExpi
|
|
|
15440
15838
|
} else if (fiber.tag === ContextProvider) {
|
|
15441
15839
|
// Don't scan deeper if this is a matching provider
|
|
15442
15840
|
nextFiber = fiber.type === workInProgress.type ? null : fiber.child;
|
|
15841
|
+
} else if (enableSuspenseServerRenderer && fiber.tag === DehydratedSuspenseComponent) {
|
|
15842
|
+
// If a dehydrated suspense component is in this subtree, we don't know
|
|
15843
|
+
// if it will have any context consumers in it. The best we can do is
|
|
15844
|
+
// mark it as having updates on its children.
|
|
15845
|
+
if (fiber.expirationTime < renderExpirationTime) {
|
|
15846
|
+
fiber.expirationTime = renderExpirationTime;
|
|
15847
|
+
}
|
|
15848
|
+
var _alternate = fiber.alternate;
|
|
15849
|
+
if (_alternate !== null && _alternate.expirationTime < renderExpirationTime) {
|
|
15850
|
+
_alternate.expirationTime = renderExpirationTime;
|
|
15851
|
+
}
|
|
15852
|
+
// This is intentionally passing this fiber as the parent
|
|
15853
|
+
// because we want to schedule this fiber as having work
|
|
15854
|
+
// on its children. We'll use the childExpirationTime on
|
|
15855
|
+
// this fiber to indicate that a context has changed.
|
|
15856
|
+
scheduleWorkOnParentPath(fiber, renderExpirationTime);
|
|
15857
|
+
nextFiber = fiber.sibling;
|
|
15443
15858
|
} else {
|
|
15444
15859
|
// Traverse down.
|
|
15445
15860
|
nextFiber = fiber.child;
|
|
@@ -16563,6 +16978,26 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
16563
16978
|
}
|
|
16564
16979
|
break;
|
|
16565
16980
|
}
|
|
16981
|
+
case DehydratedSuspenseComponent:
|
|
16982
|
+
{
|
|
16983
|
+
if (enableSuspenseServerRenderer) {
|
|
16984
|
+
if (current === null) {
|
|
16985
|
+
var _wasHydrated2 = popHydrationState(workInProgress);
|
|
16986
|
+
!_wasHydrated2 ? invariant(false, 'A dehydrated suspense component was completed without a hydrated node. This is probably a bug in React.') : void 0;
|
|
16987
|
+
skipPastDehydratedSuspenseInstance(workInProgress);
|
|
16988
|
+
} else if ((workInProgress.effectTag & DidCapture) === NoEffect) {
|
|
16989
|
+
// This boundary did not suspend so it's now hydrated.
|
|
16990
|
+
// To handle any future suspense cases, we're going to now upgrade it
|
|
16991
|
+
// to a Suspense component. We detach it from the existing current fiber.
|
|
16992
|
+
current.alternate = null;
|
|
16993
|
+
workInProgress.alternate = null;
|
|
16994
|
+
workInProgress.tag = SuspenseComponent;
|
|
16995
|
+
workInProgress.memoizedState = null;
|
|
16996
|
+
workInProgress.stateNode = null;
|
|
16997
|
+
}
|
|
16998
|
+
}
|
|
16999
|
+
break;
|
|
17000
|
+
}
|
|
16566
17001
|
default:
|
|
16567
17002
|
invariant(false, 'Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue.');
|
|
16568
17003
|
}
|
|
@@ -16653,7 +17088,7 @@ var didWarnAboutUndefinedSnapshotBeforeUpdate = null;
|
|
|
16653
17088
|
didWarnAboutUndefinedSnapshotBeforeUpdate = new Set();
|
|
16654
17089
|
}
|
|
16655
17090
|
|
|
16656
|
-
var PossiblyWeakSet = typeof WeakSet === 'function' ? WeakSet : Set;
|
|
17091
|
+
var PossiblyWeakSet$1 = typeof WeakSet === 'function' ? WeakSet : Set;
|
|
16657
17092
|
|
|
16658
17093
|
function logError(boundary, errorInfo) {
|
|
16659
17094
|
var source = errorInfo.source;
|
|
@@ -16819,11 +17254,11 @@ function commitHookEffectList(unmountTag, mountTag, finishedWork) {
|
|
|
16819
17254
|
if (_destroy === null) {
|
|
16820
17255
|
addendum = ' You returned null. If your effect does not require clean ' + 'up, return undefined (or nothing).';
|
|
16821
17256
|
} else if (typeof _destroy.then === 'function') {
|
|
16822
|
-
addendum = '\n\nIt looks like you wrote useEffect(async () => ...) or returned a Promise. ' + 'Instead,
|
|
17257
|
+
addendum = '\n\nIt looks like you wrote useEffect(async () => ...) or returned a Promise. ' + 'Instead, write the async function inside your effect ' + 'and call it immediately:\n\n' + 'useEffect(() => {\n' + ' async function fetchData() {\n' + ' // You can await here\n' + ' const response = await MyAPI.getData(someId);\n' + ' // ...\n' + ' }\n' + ' fetchData();\n' + '}, [someId]); // Or [] if effect doesn\'t need props or state\n\n' + 'Learn more about data fetching with Hooks: https://fb.me/react-hooks-data-fetching';
|
|
16823
17258
|
} else {
|
|
16824
17259
|
addendum = ' You returned: ' + _destroy;
|
|
16825
17260
|
}
|
|
16826
|
-
warningWithoutStack$1(false, 'An
|
|
17261
|
+
warningWithoutStack$1(false, 'An effect function must not return anything besides a function, ' + 'which is used for clean-up.%s%s', addendum, getStackByFiberInDevAndProd(finishedWork));
|
|
16827
17262
|
}
|
|
16828
17263
|
}
|
|
16829
17264
|
}
|
|
@@ -16966,7 +17401,7 @@ function commitLifeCycles(finishedRoot, current$$1, finishedWork, committedExpir
|
|
|
16966
17401
|
|
|
16967
17402
|
function hideOrUnhideAllChildren(finishedWork, isHidden) {
|
|
16968
17403
|
if (supportsMutation) {
|
|
16969
|
-
// We only have the top Fiber that was inserted but we need recurse down its
|
|
17404
|
+
// We only have the top Fiber that was inserted but we need to recurse down its
|
|
16970
17405
|
var node = finishedWork;
|
|
16971
17406
|
while (true) {
|
|
16972
17407
|
if (node.tag === HostComponent) {
|
|
@@ -17234,7 +17669,7 @@ function getHostSibling(fiber) {
|
|
|
17234
17669
|
}
|
|
17235
17670
|
node.sibling.return = node.return;
|
|
17236
17671
|
node = node.sibling;
|
|
17237
|
-
while (node.tag !== HostComponent && node.tag !== HostText) {
|
|
17672
|
+
while (node.tag !== HostComponent && node.tag !== HostText && node.tag !== DehydratedSuspenseComponent) {
|
|
17238
17673
|
// If it is not host node and, we might have a host node inside it.
|
|
17239
17674
|
// Try to search down until we find one.
|
|
17240
17675
|
if (node.effectTag & Placement) {
|
|
@@ -17294,7 +17729,7 @@ function commitPlacement(finishedWork) {
|
|
|
17294
17729
|
}
|
|
17295
17730
|
|
|
17296
17731
|
var before = getHostSibling(finishedWork);
|
|
17297
|
-
// We only have the top Fiber that was inserted but we need recurse down its
|
|
17732
|
+
// We only have the top Fiber that was inserted but we need to recurse down its
|
|
17298
17733
|
// children to find all the terminal nodes.
|
|
17299
17734
|
var node = finishedWork;
|
|
17300
17735
|
while (true) {
|
|
@@ -17336,7 +17771,7 @@ function commitPlacement(finishedWork) {
|
|
|
17336
17771
|
}
|
|
17337
17772
|
|
|
17338
17773
|
function unmountHostComponents(current$$1) {
|
|
17339
|
-
// We only have the top Fiber that was deleted but we need recurse down its
|
|
17774
|
+
// We only have the top Fiber that was deleted but we need to recurse down its
|
|
17340
17775
|
var node = current$$1;
|
|
17341
17776
|
|
|
17342
17777
|
// Each iteration, currentParent is populated with node's host parent if not
|
|
@@ -17381,13 +17816,20 @@ function unmountHostComponents(current$$1) {
|
|
|
17381
17816
|
removeChild(currentParent, node.stateNode);
|
|
17382
17817
|
}
|
|
17383
17818
|
// Don't visit children because we already visited them.
|
|
17819
|
+
} else if (enableSuspenseServerRenderer && node.tag === DehydratedSuspenseComponent) {
|
|
17820
|
+
// Delete the dehydrated suspense boundary and all of its content.
|
|
17821
|
+
if (currentParentIsContainer) {
|
|
17822
|
+
clearSuspenseBoundaryFromContainer(currentParent, node.stateNode);
|
|
17823
|
+
} else {
|
|
17824
|
+
clearSuspenseBoundary(currentParent, node.stateNode);
|
|
17825
|
+
}
|
|
17384
17826
|
} else if (node.tag === HostPortal) {
|
|
17385
|
-
// When we go into a portal, it becomes the parent to remove from.
|
|
17386
|
-
// We will reassign it back when we pop the portal on the way up.
|
|
17387
|
-
currentParent = node.stateNode.containerInfo;
|
|
17388
|
-
currentParentIsContainer = true;
|
|
17389
|
-
// Visit children because portals might contain host components.
|
|
17390
17827
|
if (node.child !== null) {
|
|
17828
|
+
// When we go into a portal, it becomes the parent to remove from.
|
|
17829
|
+
// We will reassign it back when we pop the portal on the way up.
|
|
17830
|
+
currentParent = node.stateNode.containerInfo;
|
|
17831
|
+
currentParentIsContainer = true;
|
|
17832
|
+
// Visit children because portals might contain host components.
|
|
17391
17833
|
node.child.return = node;
|
|
17392
17834
|
node = node.child;
|
|
17393
17835
|
continue;
|
|
@@ -17537,7 +17979,7 @@ function commitWork(current$$1, finishedWork) {
|
|
|
17537
17979
|
finishedWork.updateQueue = null;
|
|
17538
17980
|
var retryCache = finishedWork.stateNode;
|
|
17539
17981
|
if (retryCache === null) {
|
|
17540
|
-
retryCache = finishedWork.stateNode = new PossiblyWeakSet();
|
|
17982
|
+
retryCache = finishedWork.stateNode = new PossiblyWeakSet$1();
|
|
17541
17983
|
}
|
|
17542
17984
|
thenables.forEach(function (thenable) {
|
|
17543
17985
|
// Memoize using the boundary fiber to prevent redundant listeners.
|
|
@@ -17572,6 +18014,7 @@ function commitResetTextContent(current$$1) {
|
|
|
17572
18014
|
resetTextContent(current$$1.stateNode);
|
|
17573
18015
|
}
|
|
17574
18016
|
|
|
18017
|
+
var PossiblyWeakSet = typeof WeakSet === 'function' ? WeakSet : Set;
|
|
17575
18018
|
var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;
|
|
17576
18019
|
|
|
17577
18020
|
function createRootErrorUpdate(fiber, errorInfo, expirationTime) {
|
|
@@ -17630,6 +18073,34 @@ function createClassErrorUpdate(fiber, errorInfo, expirationTime) {
|
|
|
17630
18073
|
return update;
|
|
17631
18074
|
}
|
|
17632
18075
|
|
|
18076
|
+
function attachPingListener(root, renderExpirationTime, thenable) {
|
|
18077
|
+
// Attach a listener to the promise to "ping" the root and retry. But
|
|
18078
|
+
// only if one does not already exist for the current render expiration
|
|
18079
|
+
// time (which acts like a "thread ID" here).
|
|
18080
|
+
var pingCache = root.pingCache;
|
|
18081
|
+
var threadIDs = void 0;
|
|
18082
|
+
if (pingCache === null) {
|
|
18083
|
+
pingCache = root.pingCache = new PossiblyWeakMap();
|
|
18084
|
+
threadIDs = new Set();
|
|
18085
|
+
pingCache.set(thenable, threadIDs);
|
|
18086
|
+
} else {
|
|
18087
|
+
threadIDs = pingCache.get(thenable);
|
|
18088
|
+
if (threadIDs === undefined) {
|
|
18089
|
+
threadIDs = new Set();
|
|
18090
|
+
pingCache.set(thenable, threadIDs);
|
|
18091
|
+
}
|
|
18092
|
+
}
|
|
18093
|
+
if (!threadIDs.has(renderExpirationTime)) {
|
|
18094
|
+
// Memoize using the thread ID to prevent redundant listeners.
|
|
18095
|
+
threadIDs.add(renderExpirationTime);
|
|
18096
|
+
var ping = pingSuspendedRoot.bind(null, root, thenable, renderExpirationTime);
|
|
18097
|
+
if (enableSchedulerTracing) {
|
|
18098
|
+
ping = tracing.unstable_wrap(ping);
|
|
18099
|
+
}
|
|
18100
|
+
thenable.then(ping, ping);
|
|
18101
|
+
}
|
|
18102
|
+
}
|
|
18103
|
+
|
|
17633
18104
|
function throwException(root, returnFiber, sourceFiber, value, renderExpirationTime) {
|
|
17634
18105
|
// The source fiber did not complete.
|
|
17635
18106
|
sourceFiber.effectTag |= Incomplete;
|
|
@@ -17671,6 +18142,9 @@ function throwException(root, returnFiber, sourceFiber, value, renderExpirationT
|
|
|
17671
18142
|
}
|
|
17672
18143
|
}
|
|
17673
18144
|
}
|
|
18145
|
+
// If there is a DehydratedSuspenseComponent we don't have to do anything because
|
|
18146
|
+
// if something suspends inside it, we will simply leave that as dehydrated. It
|
|
18147
|
+
// will never timeout.
|
|
17674
18148
|
_workInProgress = _workInProgress.return;
|
|
17675
18149
|
} while (_workInProgress !== null);
|
|
17676
18150
|
|
|
@@ -17734,31 +18208,7 @@ function throwException(root, returnFiber, sourceFiber, value, renderExpirationT
|
|
|
17734
18208
|
// Confirmed that the boundary is in a concurrent mode tree. Continue
|
|
17735
18209
|
// with the normal suspend path.
|
|
17736
18210
|
|
|
17737
|
-
|
|
17738
|
-
// only if one does not already exist for the current render expiration
|
|
17739
|
-
// time (which acts like a "thread ID" here).
|
|
17740
|
-
var pingCache = root.pingCache;
|
|
17741
|
-
var threadIDs = void 0;
|
|
17742
|
-
if (pingCache === null) {
|
|
17743
|
-
pingCache = root.pingCache = new PossiblyWeakMap();
|
|
17744
|
-
threadIDs = new Set();
|
|
17745
|
-
pingCache.set(thenable, threadIDs);
|
|
17746
|
-
} else {
|
|
17747
|
-
threadIDs = pingCache.get(thenable);
|
|
17748
|
-
if (threadIDs === undefined) {
|
|
17749
|
-
threadIDs = new Set();
|
|
17750
|
-
pingCache.set(thenable, threadIDs);
|
|
17751
|
-
}
|
|
17752
|
-
}
|
|
17753
|
-
if (!threadIDs.has(renderExpirationTime)) {
|
|
17754
|
-
// Memoize using the thread ID to prevent redundant listeners.
|
|
17755
|
-
threadIDs.add(renderExpirationTime);
|
|
17756
|
-
var ping = pingSuspendedRoot.bind(null, root, thenable, renderExpirationTime);
|
|
17757
|
-
if (enableSchedulerTracing) {
|
|
17758
|
-
ping = tracing.unstable_wrap(ping);
|
|
17759
|
-
}
|
|
17760
|
-
thenable.then(ping, ping);
|
|
17761
|
-
}
|
|
18211
|
+
attachPingListener(root, renderExpirationTime, thenable);
|
|
17762
18212
|
|
|
17763
18213
|
var absoluteTimeoutMs = void 0;
|
|
17764
18214
|
if (earliestTimeoutMs === -1) {
|
|
@@ -17790,6 +18240,29 @@ function throwException(root, returnFiber, sourceFiber, value, renderExpirationT
|
|
|
17790
18240
|
// whole tree.
|
|
17791
18241
|
renderDidSuspend(root, absoluteTimeoutMs, renderExpirationTime);
|
|
17792
18242
|
|
|
18243
|
+
_workInProgress.effectTag |= ShouldCapture;
|
|
18244
|
+
_workInProgress.expirationTime = renderExpirationTime;
|
|
18245
|
+
return;
|
|
18246
|
+
} else if (enableSuspenseServerRenderer && _workInProgress.tag === DehydratedSuspenseComponent) {
|
|
18247
|
+
attachPingListener(root, renderExpirationTime, thenable);
|
|
18248
|
+
|
|
18249
|
+
// Since we already have a current fiber, we can eagerly add a retry listener.
|
|
18250
|
+
var retryCache = _workInProgress.memoizedState;
|
|
18251
|
+
if (retryCache === null) {
|
|
18252
|
+
retryCache = _workInProgress.memoizedState = new PossiblyWeakSet();
|
|
18253
|
+
var _current = _workInProgress.alternate;
|
|
18254
|
+
!_current ? invariant(false, 'A dehydrated suspense boundary must commit before trying to render. This is probably a bug in React.') : void 0;
|
|
18255
|
+
_current.memoizedState = retryCache;
|
|
18256
|
+
}
|
|
18257
|
+
// Memoize using the boundary fiber to prevent redundant listeners.
|
|
18258
|
+
if (!retryCache.has(thenable)) {
|
|
18259
|
+
retryCache.add(thenable);
|
|
18260
|
+
var retry = retryTimedOutBoundary.bind(null, _workInProgress, thenable);
|
|
18261
|
+
if (enableSchedulerTracing) {
|
|
18262
|
+
retry = tracing.unstable_wrap(retry);
|
|
18263
|
+
}
|
|
18264
|
+
thenable.then(retry, retry);
|
|
18265
|
+
}
|
|
17793
18266
|
_workInProgress.effectTag |= ShouldCapture;
|
|
17794
18267
|
_workInProgress.expirationTime = renderExpirationTime;
|
|
17795
18268
|
return;
|
|
@@ -17867,6 +18340,7 @@ function unwindWork(workInProgress, renderExpirationTime) {
|
|
|
17867
18340
|
}
|
|
17868
18341
|
case HostComponent:
|
|
17869
18342
|
{
|
|
18343
|
+
// TODO: popHydrationState
|
|
17870
18344
|
popHostContext(workInProgress);
|
|
17871
18345
|
return null;
|
|
17872
18346
|
}
|
|
@@ -17880,6 +18354,19 @@ function unwindWork(workInProgress, renderExpirationTime) {
|
|
|
17880
18354
|
}
|
|
17881
18355
|
return null;
|
|
17882
18356
|
}
|
|
18357
|
+
case DehydratedSuspenseComponent:
|
|
18358
|
+
{
|
|
18359
|
+
if (enableSuspenseServerRenderer) {
|
|
18360
|
+
// TODO: popHydrationState
|
|
18361
|
+
var _effectTag3 = workInProgress.effectTag;
|
|
18362
|
+
if (_effectTag3 & ShouldCapture) {
|
|
18363
|
+
workInProgress.effectTag = _effectTag3 & ~ShouldCapture | DidCapture;
|
|
18364
|
+
// Captured a suspense effect. Re-render the boundary.
|
|
18365
|
+
return workInProgress;
|
|
18366
|
+
}
|
|
18367
|
+
}
|
|
18368
|
+
return null;
|
|
18369
|
+
}
|
|
17883
18370
|
case HostPortal:
|
|
17884
18371
|
popHostContainer(workInProgress);
|
|
17885
18372
|
return null;
|
|
@@ -17977,11 +18464,6 @@ if (enableSchedulerTracing) {
|
|
|
17977
18464
|
// Used to ensure computeUniqueAsyncExpiration is monotonically decreasing.
|
|
17978
18465
|
var lastUniqueAsyncExpiration = Sync - 1;
|
|
17979
18466
|
|
|
17980
|
-
// Represents the expiration time that incoming updates should use. (If this
|
|
17981
|
-
// is NoWork, use the default strategy: async updates in async mode, sync
|
|
17982
|
-
// updates in sync mode.)
|
|
17983
|
-
var expirationContext = NoWork;
|
|
17984
|
-
|
|
17985
18467
|
var isWorking = false;
|
|
17986
18468
|
|
|
17987
18469
|
// The next work in progress fiber that we're currently working on.
|
|
@@ -18277,6 +18759,10 @@ function commitPassiveEffects(root, firstEffect) {
|
|
|
18277
18759
|
if (rootExpirationTime !== NoWork) {
|
|
18278
18760
|
requestWork(root, rootExpirationTime);
|
|
18279
18761
|
}
|
|
18762
|
+
// Flush any sync work that was scheduled by effects
|
|
18763
|
+
if (!isBatchingUpdates && !isRendering) {
|
|
18764
|
+
performSyncWork();
|
|
18765
|
+
}
|
|
18280
18766
|
}
|
|
18281
18767
|
|
|
18282
18768
|
function isAlreadyFailedLegacyErrorBoundary(instance) {
|
|
@@ -18451,7 +18937,9 @@ function commitRoot(root, finishedWork) {
|
|
|
18451
18937
|
// here because that code is still in flux.
|
|
18452
18938
|
callback = tracing.unstable_wrap(callback);
|
|
18453
18939
|
}
|
|
18454
|
-
passiveEffectCallbackHandle =
|
|
18940
|
+
passiveEffectCallbackHandle = scheduler.unstable_runWithPriority(scheduler.unstable_NormalPriority, function () {
|
|
18941
|
+
return schedulePassiveEffects(callback);
|
|
18942
|
+
});
|
|
18455
18943
|
passiveEffectCallback = callback;
|
|
18456
18944
|
}
|
|
18457
18945
|
|
|
@@ -19040,7 +19528,7 @@ function renderRoot(root, isYieldy) {
|
|
|
19040
19528
|
return;
|
|
19041
19529
|
} else if (
|
|
19042
19530
|
// There's no lower priority work, but we're rendering asynchronously.
|
|
19043
|
-
//
|
|
19531
|
+
// Synchronously attempt to render the same level one more time. This is
|
|
19044
19532
|
// similar to a suspend, but without a timeout because we're not waiting
|
|
19045
19533
|
// for a promise to resolve.
|
|
19046
19534
|
!root.didError && isYieldy) {
|
|
@@ -19145,49 +19633,50 @@ function computeUniqueAsyncExpiration() {
|
|
|
19145
19633
|
}
|
|
19146
19634
|
|
|
19147
19635
|
function computeExpirationForFiber(currentTime, fiber) {
|
|
19636
|
+
var priorityLevel = scheduler.unstable_getCurrentPriorityLevel();
|
|
19637
|
+
|
|
19148
19638
|
var expirationTime = void 0;
|
|
19149
|
-
if (
|
|
19150
|
-
//
|
|
19151
|
-
expirationTime =
|
|
19152
|
-
} else if (isWorking) {
|
|
19153
|
-
|
|
19154
|
-
|
|
19155
|
-
// by default.
|
|
19156
|
-
expirationTime = Sync;
|
|
19157
|
-
} else {
|
|
19158
|
-
// Updates during the render phase should expire at the same time as
|
|
19159
|
-
// the work that is being rendered.
|
|
19160
|
-
expirationTime = nextRenderExpirationTime;
|
|
19161
|
-
}
|
|
19639
|
+
if ((fiber.mode & ConcurrentMode) === NoContext) {
|
|
19640
|
+
// Outside of concurrent mode, updates are always synchronous.
|
|
19641
|
+
expirationTime = Sync;
|
|
19642
|
+
} else if (isWorking && !isCommitting$1) {
|
|
19643
|
+
// During render phase, updates expire during as the current render.
|
|
19644
|
+
expirationTime = nextRenderExpirationTime;
|
|
19162
19645
|
} else {
|
|
19163
|
-
|
|
19164
|
-
|
|
19165
|
-
|
|
19166
|
-
|
|
19167
|
-
|
|
19646
|
+
switch (priorityLevel) {
|
|
19647
|
+
case scheduler.unstable_ImmediatePriority:
|
|
19648
|
+
expirationTime = Sync;
|
|
19649
|
+
break;
|
|
19650
|
+
case scheduler.unstable_UserBlockingPriority:
|
|
19168
19651
|
expirationTime = computeInteractiveExpiration(currentTime);
|
|
19169
|
-
|
|
19170
|
-
|
|
19652
|
+
break;
|
|
19653
|
+
case scheduler.unstable_NormalPriority:
|
|
19654
|
+
// This is a normal, concurrent update
|
|
19171
19655
|
expirationTime = computeAsyncExpiration(currentTime);
|
|
19172
|
-
|
|
19173
|
-
|
|
19174
|
-
|
|
19175
|
-
|
|
19176
|
-
|
|
19177
|
-
|
|
19178
|
-
|
|
19179
|
-
// This is a sync update
|
|
19180
|
-
expirationTime = Sync;
|
|
19656
|
+
break;
|
|
19657
|
+
case scheduler.unstable_LowPriority:
|
|
19658
|
+
case scheduler.unstable_IdlePriority:
|
|
19659
|
+
expirationTime = Never;
|
|
19660
|
+
break;
|
|
19661
|
+
default:
|
|
19662
|
+
invariant(false, 'Unknown priority level. This error is likely caused by a bug in React. Please file an issue.');
|
|
19181
19663
|
}
|
|
19182
|
-
|
|
19183
|
-
|
|
19184
|
-
//
|
|
19185
|
-
|
|
19186
|
-
|
|
19187
|
-
if (lowestPriorityPendingInteractiveExpirationTime === NoWork || expirationTime < lowestPriorityPendingInteractiveExpirationTime) {
|
|
19188
|
-
lowestPriorityPendingInteractiveExpirationTime = expirationTime;
|
|
19664
|
+
|
|
19665
|
+
// If we're in the middle of rendering a tree, do not update at the same
|
|
19666
|
+
// expiration time that is already rendering.
|
|
19667
|
+
if (nextRoot !== null && expirationTime === nextRenderExpirationTime) {
|
|
19668
|
+
expirationTime -= 1;
|
|
19189
19669
|
}
|
|
19190
19670
|
}
|
|
19671
|
+
|
|
19672
|
+
// Keep track of the lowest pending interactive expiration time. This
|
|
19673
|
+
// allows us to synchronously flush all interactive updates
|
|
19674
|
+
// when needed.
|
|
19675
|
+
// TODO: Move this to renderer?
|
|
19676
|
+
if (priorityLevel === scheduler.unstable_UserBlockingPriority && (lowestPriorityPendingInteractiveExpirationTime === NoWork || expirationTime < lowestPriorityPendingInteractiveExpirationTime)) {
|
|
19677
|
+
lowestPriorityPendingInteractiveExpirationTime = expirationTime;
|
|
19678
|
+
}
|
|
19679
|
+
|
|
19191
19680
|
return expirationTime;
|
|
19192
19681
|
}
|
|
19193
19682
|
|
|
@@ -19234,7 +19723,21 @@ function retryTimedOutBoundary(boundaryFiber, thenable) {
|
|
|
19234
19723
|
// The boundary fiber (a Suspense component) previously timed out and was
|
|
19235
19724
|
// rendered in its fallback state. One of the promises that suspended it has
|
|
19236
19725
|
// resolved, which means at least part of the tree was likely unblocked. Try
|
|
19237
|
-
var retryCache =
|
|
19726
|
+
var retryCache = void 0;
|
|
19727
|
+
if (enableSuspenseServerRenderer) {
|
|
19728
|
+
switch (boundaryFiber.tag) {
|
|
19729
|
+
case SuspenseComponent:
|
|
19730
|
+
retryCache = boundaryFiber.stateNode;
|
|
19731
|
+
break;
|
|
19732
|
+
case DehydratedSuspenseComponent:
|
|
19733
|
+
retryCache = boundaryFiber.memoizedState;
|
|
19734
|
+
break;
|
|
19735
|
+
default:
|
|
19736
|
+
invariant(false, 'Pinged unknown suspense boundary type. This is probably a bug in React.');
|
|
19737
|
+
}
|
|
19738
|
+
} else {
|
|
19739
|
+
retryCache = boundaryFiber.stateNode;
|
|
19740
|
+
}
|
|
19238
19741
|
if (retryCache !== null) {
|
|
19239
19742
|
// The thenable resolved, so we no longer need to memoize, because it will
|
|
19240
19743
|
// never be thrown again.
|
|
@@ -19333,7 +19836,7 @@ function scheduleWorkToRoot(fiber, expirationTime) {
|
|
|
19333
19836
|
function warnIfNotCurrentlyBatchingInDev(fiber) {
|
|
19334
19837
|
{
|
|
19335
19838
|
if (isRendering === false && isBatchingUpdates === false) {
|
|
19336
|
-
warningWithoutStack$1(false, 'An update to %s inside a test was not wrapped in act(...).\n\n' + 'When testing, code that causes React state updates should be wrapped into act(...):\n\n' + 'act(() => {\n' + ' /* fire events that update state */\n' + '});\n' + '/* assert on the output */\n\n' + "This ensures that you're testing the behavior the user would see in the browser." + ' Learn more at https://fb.me/react-wrap-tests-with-act', getComponentName(fiber.type));
|
|
19839
|
+
warningWithoutStack$1(false, 'An update to %s inside a test was not wrapped in act(...).\n\n' + 'When testing, code that causes React state updates should be wrapped into act(...):\n\n' + 'act(() => {\n' + ' /* fire events that update state */\n' + '});\n' + '/* assert on the output */\n\n' + "This ensures that you're testing the behavior the user would see in the browser." + ' Learn more at https://fb.me/react-wrap-tests-with-act' + '%s', getComponentName(fiber.type), getStackByFiberInDevAndProd(fiber));
|
|
19337
19840
|
}
|
|
19338
19841
|
}
|
|
19339
19842
|
}
|
|
@@ -19380,13 +19883,9 @@ function scheduleWork(fiber, expirationTime) {
|
|
|
19380
19883
|
}
|
|
19381
19884
|
|
|
19382
19885
|
function syncUpdates(fn, a, b, c, d) {
|
|
19383
|
-
|
|
19384
|
-
expirationContext = Sync;
|
|
19385
|
-
try {
|
|
19886
|
+
return scheduler.unstable_runWithPriority(scheduler.unstable_ImmediatePriority, function () {
|
|
19386
19887
|
return fn(a, b, c, d);
|
|
19387
|
-
}
|
|
19388
|
-
expirationContext = previousExpirationContext;
|
|
19389
|
-
}
|
|
19888
|
+
});
|
|
19390
19889
|
}
|
|
19391
19890
|
|
|
19392
19891
|
// TODO: Everything below this is written as if it has been lifted to the
|
|
@@ -19407,7 +19906,6 @@ var unhandledError = null;
|
|
|
19407
19906
|
|
|
19408
19907
|
var isBatchingUpdates = false;
|
|
19409
19908
|
var isUnbatchingUpdates = false;
|
|
19410
|
-
var isBatchingInteractiveUpdates = false;
|
|
19411
19909
|
|
|
19412
19910
|
var completedBatches = null;
|
|
19413
19911
|
|
|
@@ -19881,7 +20379,9 @@ function completeRoot(root, finishedWork, expirationTime) {
|
|
|
19881
20379
|
lastCommittedRootDuringThisBatch = root;
|
|
19882
20380
|
nestedUpdateCount = 0;
|
|
19883
20381
|
}
|
|
19884
|
-
|
|
20382
|
+
scheduler.unstable_runWithPriority(scheduler.unstable_ImmediatePriority, function () {
|
|
20383
|
+
commitRoot(root, finishedWork);
|
|
20384
|
+
});
|
|
19885
20385
|
}
|
|
19886
20386
|
|
|
19887
20387
|
function onUncaughtError(error) {
|
|
@@ -19939,9 +20439,6 @@ function flushSync(fn, a) {
|
|
|
19939
20439
|
}
|
|
19940
20440
|
|
|
19941
20441
|
function interactiveUpdates$1(fn, a, b) {
|
|
19942
|
-
if (isBatchingInteractiveUpdates) {
|
|
19943
|
-
return fn(a, b);
|
|
19944
|
-
}
|
|
19945
20442
|
// If there are any pending interactive updates, synchronously flush them.
|
|
19946
20443
|
// This needs to happen before we read any handlers, because the effect of
|
|
19947
20444
|
// the previous event may influence which handlers are called during
|
|
@@ -19951,14 +20448,13 @@ function interactiveUpdates$1(fn, a, b) {
|
|
|
19951
20448
|
performWork(lowestPriorityPendingInteractiveExpirationTime, false);
|
|
19952
20449
|
lowestPriorityPendingInteractiveExpirationTime = NoWork;
|
|
19953
20450
|
}
|
|
19954
|
-
var previousIsBatchingInteractiveUpdates = isBatchingInteractiveUpdates;
|
|
19955
20451
|
var previousIsBatchingUpdates = isBatchingUpdates;
|
|
19956
|
-
isBatchingInteractiveUpdates = true;
|
|
19957
20452
|
isBatchingUpdates = true;
|
|
19958
20453
|
try {
|
|
19959
|
-
return
|
|
20454
|
+
return scheduler.unstable_runWithPriority(scheduler.unstable_UserBlockingPriority, function () {
|
|
20455
|
+
return fn(a, b);
|
|
20456
|
+
});
|
|
19960
20457
|
} finally {
|
|
19961
|
-
isBatchingInteractiveUpdates = previousIsBatchingInteractiveUpdates;
|
|
19962
20458
|
isBatchingUpdates = previousIsBatchingUpdates;
|
|
19963
20459
|
if (!isBatchingUpdates && !isRendering) {
|
|
19964
20460
|
performSyncWork();
|
|
@@ -20221,7 +20717,7 @@ implementation) {
|
|
|
20221
20717
|
|
|
20222
20718
|
// TODO: this is special because it gets imported during build.
|
|
20223
20719
|
|
|
20224
|
-
var ReactVersion = '16.8.
|
|
20720
|
+
var ReactVersion = '16.8.5';
|
|
20225
20721
|
|
|
20226
20722
|
// TODO: This type is shared between the reconciler and ReactDOM, but will
|
|
20227
20723
|
// eventually be lifted out to the renderer.
|
|
@@ -20611,7 +21107,7 @@ var ReactDOM = {
|
|
|
20611
21107
|
hydrate: function (element, container, callback) {
|
|
20612
21108
|
!isValidContainer(container) ? invariant(false, 'Target container is not a DOM element.') : void 0;
|
|
20613
21109
|
{
|
|
20614
|
-
!!container._reactHasBeenPassedToCreateRootDEV ? warningWithoutStack$1(false, 'You are calling ReactDOM.hydrate() on a container that was previously ' + 'passed to ReactDOM.%s(). This is not supported. ' + 'Did you mean to call
|
|
21110
|
+
!!container._reactHasBeenPassedToCreateRootDEV ? warningWithoutStack$1(false, 'You are calling ReactDOM.hydrate() on a container that was previously ' + 'passed to ReactDOM.%s(). This is not supported. ' + 'Did you mean to call createRoot(container, {hydrate: true}).render(element)?', enableStableConcurrentModeAPIs ? 'createRoot' : 'unstable_createRoot') : void 0;
|
|
20615
21111
|
}
|
|
20616
21112
|
// TODO: throw or warn if we couldn't hydrate?
|
|
20617
21113
|
return legacyRenderSubtreeIntoContainer(null, element, container, true, callback);
|