react-dom 16.8.0 → 16.8.4
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 +74 -34
- package/cjs/react-dom-server.browser.production.min.js +35 -33
- package/cjs/react-dom-server.node.development.js +74 -34
- package/cjs/react-dom-server.node.production.min.js +36 -34
- package/cjs/react-dom-test-utils.development.js +23 -5
- package/cjs/react-dom-test-utils.production.min.js +23 -23
- package/cjs/react-dom-unstable-fire.development.js +698 -204
- package/cjs/react-dom-unstable-fire.production.min.js +252 -251
- package/cjs/react-dom-unstable-fire.profiling.min.js +179 -177
- 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 +698 -204
- package/cjs/react-dom.production.min.js +252 -251
- package/cjs/react-dom.profiling.min.js +179 -177
- package/package.json +2 -2
- package/umd/react-dom-server.browser.development.js +74 -34
- package/umd/react-dom-server.browser.production.min.js +22 -21
- package/umd/react-dom-test-utils.development.js +23 -5
- package/umd/react-dom-test-utils.production.min.js +22 -21
- package/umd/react-dom-unstable-fire.development.js +706 -204
- package/umd/react-dom-unstable-fire.production.min.js +208 -207
- package/umd/react-dom-unstable-fire.profiling.min.js +208 -207
- 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 +706 -204
- package/umd/react-dom.production.min.js +208 -207
- package/umd/react-dom.profiling.min.js +208 -207
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license React v16.8.
|
|
1
|
+
/** @license React v16.8.4
|
|
2
2
|
* react-dom-unstable-fire.development.js
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
@@ -79,7 +79,7 @@ var invokeGuardedCallbackImpl = function (name, func, context, a, b, c, d, e, f)
|
|
|
79
79
|
// invokeGuardedCallback uses a try-catch, all user exceptions are treated
|
|
80
80
|
// like caught exceptions, and the DevTools won't pause unless the developer
|
|
81
81
|
// takes the extra step of enabling pause on caught exceptions. This is
|
|
82
|
-
//
|
|
82
|
+
// unintuitive, though, because even though React has caught the error, from
|
|
83
83
|
// the developer's perspective, the error is uncaught.
|
|
84
84
|
//
|
|
85
85
|
// To preserve the expected "Pause on exceptions" behavior, we don't use a
|
|
@@ -836,6 +836,7 @@ var MemoComponent = 14;
|
|
|
836
836
|
var SimpleMemoComponent = 15;
|
|
837
837
|
var LazyComponent = 16;
|
|
838
838
|
var IncompleteClassComponent = 17;
|
|
839
|
+
var DehydratedSuspenseComponent = 18;
|
|
839
840
|
|
|
840
841
|
var randomKey = Math.random().toString(36).slice(2);
|
|
841
842
|
var internalInstanceKey = '__reactInternalInstance$' + randomKey;
|
|
@@ -2382,6 +2383,15 @@ function updateValueIfChanged(node) {
|
|
|
2382
2383
|
|
|
2383
2384
|
var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
2384
2385
|
|
|
2386
|
+
// Prevent newer renderers from RTE when used with older react package versions.
|
|
2387
|
+
// Current owner and dispatcher used to share the same ref,
|
|
2388
|
+
// but PR #14548 split them out to better support the react-debug-tools package.
|
|
2389
|
+
if (!ReactSharedInternals.hasOwnProperty('ReactCurrentDispatcher')) {
|
|
2390
|
+
ReactSharedInternals.ReactCurrentDispatcher = {
|
|
2391
|
+
current: null
|
|
2392
|
+
};
|
|
2393
|
+
}
|
|
2394
|
+
|
|
2385
2395
|
var BEFORE_SLASH_RE = /^(.*)[\\\/]/;
|
|
2386
2396
|
|
|
2387
2397
|
var describeComponentFrame = function (name, source, ownerName) {
|
|
@@ -2892,12 +2902,15 @@ var capitalize = function (token) {
|
|
|
2892
2902
|
attributeName, 'http://www.w3.org/XML/1998/namespace');
|
|
2893
2903
|
});
|
|
2894
2904
|
|
|
2895
|
-
//
|
|
2896
|
-
//
|
|
2897
|
-
//
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2905
|
+
// These attribute exists both in HTML and SVG.
|
|
2906
|
+
// The attribute name is case-sensitive in SVG so we can't just use
|
|
2907
|
+
// the React name like we do for attributes that exist only in HTML.
|
|
2908
|
+
['tabIndex', 'crossOrigin'].forEach(function (attributeName) {
|
|
2909
|
+
properties[attributeName] = new PropertyInfoRecord(attributeName, STRING, false, // mustUseProperty
|
|
2910
|
+
attributeName.toLowerCase(), // attributeName
|
|
2911
|
+
null);
|
|
2912
|
+
} // attributeNamespace
|
|
2913
|
+
);
|
|
2901
2914
|
|
|
2902
2915
|
/**
|
|
2903
2916
|
* Get the value for a property on a node. Only used in DEV for SSR validation.
|
|
@@ -3241,7 +3254,7 @@ var enableProfilerTimer = true;
|
|
|
3241
3254
|
var enableSchedulerTracing = true;
|
|
3242
3255
|
|
|
3243
3256
|
// Only used in www builds.
|
|
3244
|
-
// TODO: true? Here it might just be false.
|
|
3257
|
+
var enableSuspenseServerRenderer = false; // TODO: true? Here it might just be false.
|
|
3245
3258
|
|
|
3246
3259
|
// Only used in www builds.
|
|
3247
3260
|
|
|
@@ -8701,8 +8714,16 @@ var unstable_now = _ReactInternals$Sched.unstable_now;
|
|
|
8701
8714
|
var unstable_scheduleCallback = _ReactInternals$Sched.unstable_scheduleCallback;
|
|
8702
8715
|
var unstable_shouldYield = _ReactInternals$Sched.unstable_shouldYield;
|
|
8703
8716
|
var unstable_getFirstCallbackNode = _ReactInternals$Sched.unstable_getFirstCallbackNode;
|
|
8717
|
+
var unstable_runWithPriority = _ReactInternals$Sched.unstable_runWithPriority;
|
|
8718
|
+
var unstable_next = _ReactInternals$Sched.unstable_next;
|
|
8704
8719
|
var unstable_continueExecution = _ReactInternals$Sched.unstable_continueExecution;
|
|
8705
8720
|
var unstable_pauseExecution = _ReactInternals$Sched.unstable_pauseExecution;
|
|
8721
|
+
var unstable_getCurrentPriorityLevel = _ReactInternals$Sched.unstable_getCurrentPriorityLevel;
|
|
8722
|
+
var unstable_ImmediatePriority = _ReactInternals$Sched.unstable_ImmediatePriority;
|
|
8723
|
+
var unstable_UserBlockingPriority = _ReactInternals$Sched.unstable_UserBlockingPriority;
|
|
8724
|
+
var unstable_NormalPriority = _ReactInternals$Sched.unstable_NormalPriority;
|
|
8725
|
+
var unstable_LowPriority = _ReactInternals$Sched.unstable_LowPriority;
|
|
8726
|
+
var unstable_IdlePriority = _ReactInternals$Sched.unstable_IdlePriority;
|
|
8706
8727
|
|
|
8707
8728
|
// Renderers that don't support persistence
|
|
8708
8729
|
// can re-export everything from this module.
|
|
@@ -8727,6 +8748,9 @@ var SUPPRESS_HYDRATION_WARNING = void 0;
|
|
|
8727
8748
|
SUPPRESS_HYDRATION_WARNING = 'suppressHydrationWarning';
|
|
8728
8749
|
}
|
|
8729
8750
|
|
|
8751
|
+
var SUSPENSE_START_DATA = '$';
|
|
8752
|
+
var SUSPENSE_END_DATA = '/$';
|
|
8753
|
+
|
|
8730
8754
|
var STYLE = 'style';
|
|
8731
8755
|
|
|
8732
8756
|
var eventsEnabled = null;
|
|
@@ -8955,6 +8979,43 @@ function removeChildFromContainer(container, child) {
|
|
|
8955
8979
|
}
|
|
8956
8980
|
}
|
|
8957
8981
|
|
|
8982
|
+
function clearSuspenseBoundary(parentInstance, suspenseInstance) {
|
|
8983
|
+
var node = suspenseInstance;
|
|
8984
|
+
// Delete all nodes within this suspense boundary.
|
|
8985
|
+
// There might be nested nodes so we need to keep track of how
|
|
8986
|
+
// deep we are and only break out when we're back on top.
|
|
8987
|
+
var depth = 0;
|
|
8988
|
+
do {
|
|
8989
|
+
var nextNode = node.nextSibling;
|
|
8990
|
+
parentInstance.removeChild(node);
|
|
8991
|
+
if (nextNode && nextNode.nodeType === COMMENT_NODE) {
|
|
8992
|
+
var data = nextNode.data;
|
|
8993
|
+
if (data === SUSPENSE_END_DATA) {
|
|
8994
|
+
if (depth === 0) {
|
|
8995
|
+
parentInstance.removeChild(nextNode);
|
|
8996
|
+
return;
|
|
8997
|
+
} else {
|
|
8998
|
+
depth--;
|
|
8999
|
+
}
|
|
9000
|
+
} else if (data === SUSPENSE_START_DATA) {
|
|
9001
|
+
depth++;
|
|
9002
|
+
}
|
|
9003
|
+
}
|
|
9004
|
+
node = nextNode;
|
|
9005
|
+
} while (node);
|
|
9006
|
+
// TODO: Warn, we didn't find the end comment boundary.
|
|
9007
|
+
}
|
|
9008
|
+
|
|
9009
|
+
function clearSuspenseBoundaryFromContainer(container, suspenseInstance) {
|
|
9010
|
+
if (container.nodeType === COMMENT_NODE) {
|
|
9011
|
+
clearSuspenseBoundary(container.parentNode, suspenseInstance);
|
|
9012
|
+
} else if (container.nodeType === ELEMENT_NODE) {
|
|
9013
|
+
clearSuspenseBoundary(container, suspenseInstance);
|
|
9014
|
+
} else {
|
|
9015
|
+
// Document nodes should never contain suspense boundaries.
|
|
9016
|
+
}
|
|
9017
|
+
}
|
|
9018
|
+
|
|
8958
9019
|
function hideInstance(instance) {
|
|
8959
9020
|
// TODO: Does this work for all element types? What about MathML? Should we
|
|
8960
9021
|
// pass host context to this method?
|
|
@@ -9000,10 +9061,19 @@ function canHydrateTextInstance(instance, text) {
|
|
|
9000
9061
|
return instance;
|
|
9001
9062
|
}
|
|
9002
9063
|
|
|
9064
|
+
function canHydrateSuspenseInstance(instance) {
|
|
9065
|
+
if (instance.nodeType !== COMMENT_NODE) {
|
|
9066
|
+
// Empty strings are not parsed by HTML so there won't be a correct match here.
|
|
9067
|
+
return null;
|
|
9068
|
+
}
|
|
9069
|
+
// This has now been refined to a suspense node.
|
|
9070
|
+
return instance;
|
|
9071
|
+
}
|
|
9072
|
+
|
|
9003
9073
|
function getNextHydratableSibling(instance) {
|
|
9004
9074
|
var node = instance.nextSibling;
|
|
9005
9075
|
// Skip non-hydratable nodes.
|
|
9006
|
-
while (node && node.nodeType !== ELEMENT_NODE && node.nodeType !== TEXT_NODE) {
|
|
9076
|
+
while (node && node.nodeType !== ELEMENT_NODE && node.nodeType !== TEXT_NODE && (!enableSuspenseServerRenderer || node.nodeType !== COMMENT_NODE || node.data !== SUSPENSE_START_DATA)) {
|
|
9007
9077
|
node = node.nextSibling;
|
|
9008
9078
|
}
|
|
9009
9079
|
return node;
|
|
@@ -9012,7 +9082,7 @@ function getNextHydratableSibling(instance) {
|
|
|
9012
9082
|
function getFirstHydratableChild(parentInstance) {
|
|
9013
9083
|
var next = parentInstance.firstChild;
|
|
9014
9084
|
// Skip non-hydratable nodes.
|
|
9015
|
-
while (next && next.nodeType !== ELEMENT_NODE && next.nodeType !== TEXT_NODE) {
|
|
9085
|
+
while (next && next.nodeType !== ELEMENT_NODE && next.nodeType !== TEXT_NODE && (!enableSuspenseServerRenderer || next.nodeType !== COMMENT_NODE || next.data !== SUSPENSE_START_DATA)) {
|
|
9016
9086
|
next = next.nextSibling;
|
|
9017
9087
|
}
|
|
9018
9088
|
return next;
|
|
@@ -9036,6 +9106,31 @@ function hydrateTextInstance(textInstance, text, internalInstanceHandle) {
|
|
|
9036
9106
|
return diffHydratedText(textInstance, text);
|
|
9037
9107
|
}
|
|
9038
9108
|
|
|
9109
|
+
function getNextHydratableInstanceAfterSuspenseInstance(suspenseInstance) {
|
|
9110
|
+
var node = suspenseInstance.nextSibling;
|
|
9111
|
+
// Skip past all nodes within this suspense boundary.
|
|
9112
|
+
// There might be nested nodes so we need to keep track of how
|
|
9113
|
+
// deep we are and only break out when we're back on top.
|
|
9114
|
+
var depth = 0;
|
|
9115
|
+
while (node) {
|
|
9116
|
+
if (node.nodeType === COMMENT_NODE) {
|
|
9117
|
+
var data = node.data;
|
|
9118
|
+
if (data === SUSPENSE_END_DATA) {
|
|
9119
|
+
if (depth === 0) {
|
|
9120
|
+
return getNextHydratableSibling(node);
|
|
9121
|
+
} else {
|
|
9122
|
+
depth--;
|
|
9123
|
+
}
|
|
9124
|
+
} else if (data === SUSPENSE_START_DATA) {
|
|
9125
|
+
depth++;
|
|
9126
|
+
}
|
|
9127
|
+
}
|
|
9128
|
+
node = node.nextSibling;
|
|
9129
|
+
}
|
|
9130
|
+
// TODO: Warn, we didn't find the end comment boundary.
|
|
9131
|
+
return null;
|
|
9132
|
+
}
|
|
9133
|
+
|
|
9039
9134
|
function didNotMatchHydratedContainerTextInstance(parentContainer, textInstance, text) {
|
|
9040
9135
|
{
|
|
9041
9136
|
warnForUnmatchedText(textInstance, text);
|
|
@@ -9052,6 +9147,8 @@ function didNotHydrateContainerInstance(parentContainer, instance) {
|
|
|
9052
9147
|
{
|
|
9053
9148
|
if (instance.nodeType === ELEMENT_NODE) {
|
|
9054
9149
|
warnForDeletedHydratableElement(parentContainer, instance);
|
|
9150
|
+
} else if (instance.nodeType === COMMENT_NODE) {
|
|
9151
|
+
// TODO: warnForDeletedHydratableSuspenseBoundary
|
|
9055
9152
|
} else {
|
|
9056
9153
|
warnForDeletedHydratableText(parentContainer, instance);
|
|
9057
9154
|
}
|
|
@@ -9062,6 +9159,8 @@ function didNotHydrateInstance(parentType, parentProps, parentInstance, instance
|
|
|
9062
9159
|
if (true && parentProps[SUPPRESS_HYDRATION_WARNING] !== true) {
|
|
9063
9160
|
if (instance.nodeType === ELEMENT_NODE) {
|
|
9064
9161
|
warnForDeletedHydratableElement(parentInstance, instance);
|
|
9162
|
+
} else if (instance.nodeType === COMMENT_NODE) {
|
|
9163
|
+
// TODO: warnForDeletedHydratableSuspenseBoundary
|
|
9065
9164
|
} else {
|
|
9066
9165
|
warnForDeletedHydratableText(parentInstance, instance);
|
|
9067
9166
|
}
|
|
@@ -9080,6 +9179,8 @@ function didNotFindHydratableContainerTextInstance(parentContainer, text) {
|
|
|
9080
9179
|
}
|
|
9081
9180
|
}
|
|
9082
9181
|
|
|
9182
|
+
|
|
9183
|
+
|
|
9083
9184
|
function didNotFindHydratableInstance(parentType, parentProps, parentInstance, type, props) {
|
|
9084
9185
|
if (true && parentProps[SUPPRESS_HYDRATION_WARNING] !== true) {
|
|
9085
9186
|
warnForInsertedHydratedElement(parentInstance, type, props);
|
|
@@ -9092,6 +9193,12 @@ function didNotFindHydratableTextInstance(parentType, parentProps, parentInstanc
|
|
|
9092
9193
|
}
|
|
9093
9194
|
}
|
|
9094
9195
|
|
|
9196
|
+
function didNotFindHydratableSuspenseInstance(parentType, parentProps, parentInstance) {
|
|
9197
|
+
if (true && parentProps[SUPPRESS_HYDRATION_WARNING] !== true) {
|
|
9198
|
+
// TODO: warnForInsertedHydratedSuspense(parentInstance);
|
|
9199
|
+
}
|
|
9200
|
+
}
|
|
9201
|
+
|
|
9095
9202
|
// This is just to get the setup running.
|
|
9096
9203
|
// TODO: real implementation.
|
|
9097
9204
|
// console.log('Hello from Fire host config.');
|
|
@@ -9351,7 +9458,7 @@ function stopFailedWorkTimer(fiber) {
|
|
|
9351
9458
|
return;
|
|
9352
9459
|
}
|
|
9353
9460
|
fiber._debugIsCurrentlyTiming = false;
|
|
9354
|
-
var warning = fiber.tag === SuspenseComponent ? 'Rendering was suspended' : 'An error was thrown inside this error boundary';
|
|
9461
|
+
var warning = fiber.tag === SuspenseComponent || fiber.tag === DehydratedSuspenseComponent ? 'Rendering was suspended' : 'An error was thrown inside this error boundary';
|
|
9355
9462
|
endFiberMark(fiber, null, warning);
|
|
9356
9463
|
}
|
|
9357
9464
|
}
|
|
@@ -10020,6 +10127,7 @@ function FiberNode(tag, pendingProps, key, mode) {
|
|
|
10020
10127
|
this._debugSource = null;
|
|
10021
10128
|
this._debugOwner = null;
|
|
10022
10129
|
this._debugIsCurrentlyTiming = false;
|
|
10130
|
+
this._debugHookTypes = null;
|
|
10023
10131
|
if (!hasBadMapPolyfill && typeof Object.preventExtensions === 'function') {
|
|
10024
10132
|
Object.preventExtensions(this);
|
|
10025
10133
|
}
|
|
@@ -10087,6 +10195,7 @@ function createWorkInProgress(current, pendingProps, expirationTime) {
|
|
|
10087
10195
|
workInProgress._debugID = current._debugID;
|
|
10088
10196
|
workInProgress._debugSource = current._debugSource;
|
|
10089
10197
|
workInProgress._debugOwner = current._debugOwner;
|
|
10198
|
+
workInProgress._debugHookTypes = current._debugHookTypes;
|
|
10090
10199
|
}
|
|
10091
10200
|
|
|
10092
10201
|
workInProgress.alternate = current;
|
|
@@ -10354,6 +10463,7 @@ function assignFiberPropertiesInDEV(target, source) {
|
|
|
10354
10463
|
target._debugSource = source._debugSource;
|
|
10355
10464
|
target._debugOwner = source._debugOwner;
|
|
10356
10465
|
target._debugIsCurrentlyTiming = source._debugIsCurrentlyTiming;
|
|
10466
|
+
target._debugHookTypes = source._debugHookTypes;
|
|
10357
10467
|
return target;
|
|
10358
10468
|
}
|
|
10359
10469
|
|
|
@@ -12171,7 +12281,7 @@ function ChildReconciler(shouldTrackSideEffects) {
|
|
|
12171
12281
|
}
|
|
12172
12282
|
|
|
12173
12283
|
function reconcileChildrenArray(returnFiber, currentFirstChild, newChildren, expirationTime) {
|
|
12174
|
-
// This algorithm can't optimize by searching from
|
|
12284
|
+
// This algorithm can't optimize by searching from both ends since we
|
|
12175
12285
|
// don't have backpointers on fibers. I'm trying to see how far we can get
|
|
12176
12286
|
// with that model. If it ends up not being worth the tradeoffs, we can
|
|
12177
12287
|
// add it later.
|
|
@@ -12752,7 +12862,6 @@ var currentlyRenderingFiber$1 = null;
|
|
|
12752
12862
|
// current hook list is the list that belongs to the current fiber. The
|
|
12753
12863
|
// work-in-progress hook list is a new list that will be added to the
|
|
12754
12864
|
// work-in-progress fiber.
|
|
12755
|
-
var firstCurrentHook = null;
|
|
12756
12865
|
var currentHook = null;
|
|
12757
12866
|
var nextCurrentHook = null;
|
|
12758
12867
|
var firstWorkInProgressHook = null;
|
|
@@ -12782,39 +12891,67 @@ var RE_RENDER_LIMIT = 25;
|
|
|
12782
12891
|
// In DEV, this is the name of the currently executing primitive hook
|
|
12783
12892
|
var currentHookNameInDev = null;
|
|
12784
12893
|
|
|
12785
|
-
|
|
12894
|
+
// In DEV, this list ensures that hooks are called in the same order between renders.
|
|
12895
|
+
// The list stores the order of hooks used during the initial render (mount).
|
|
12896
|
+
// Subsequent renders (updates) reference this list.
|
|
12897
|
+
var hookTypesDev = null;
|
|
12898
|
+
var hookTypesUpdateIndexDev = -1;
|
|
12899
|
+
|
|
12900
|
+
function mountHookTypesDev() {
|
|
12901
|
+
{
|
|
12902
|
+
var hookName = currentHookNameInDev;
|
|
12903
|
+
|
|
12904
|
+
if (hookTypesDev === null) {
|
|
12905
|
+
hookTypesDev = [hookName];
|
|
12906
|
+
} else {
|
|
12907
|
+
hookTypesDev.push(hookName);
|
|
12908
|
+
}
|
|
12909
|
+
}
|
|
12910
|
+
}
|
|
12911
|
+
|
|
12912
|
+
function updateHookTypesDev() {
|
|
12913
|
+
{
|
|
12914
|
+
var hookName = currentHookNameInDev;
|
|
12915
|
+
|
|
12916
|
+
if (hookTypesDev !== null) {
|
|
12917
|
+
hookTypesUpdateIndexDev++;
|
|
12918
|
+
if (hookTypesDev[hookTypesUpdateIndexDev] !== hookName) {
|
|
12919
|
+
warnOnHookMismatchInDev(hookName);
|
|
12920
|
+
}
|
|
12921
|
+
}
|
|
12922
|
+
}
|
|
12923
|
+
}
|
|
12924
|
+
|
|
12925
|
+
function warnOnHookMismatchInDev(currentHookName) {
|
|
12786
12926
|
{
|
|
12787
12927
|
var componentName = getComponentName(currentlyRenderingFiber$1.type);
|
|
12788
12928
|
if (!didWarnAboutMismatchedHooksForComponent.has(componentName)) {
|
|
12789
12929
|
didWarnAboutMismatchedHooksForComponent.add(componentName);
|
|
12790
12930
|
|
|
12791
|
-
|
|
12931
|
+
if (hookTypesDev !== null) {
|
|
12932
|
+
var table = '';
|
|
12792
12933
|
|
|
12793
|
-
|
|
12794
|
-
var prevHook = firstCurrentHook;
|
|
12795
|
-
var nextHook = firstWorkInProgressHook;
|
|
12796
|
-
var n = 1;
|
|
12797
|
-
while (prevHook !== null && nextHook !== null) {
|
|
12798
|
-
var oldHookName = prevHook._debugType;
|
|
12799
|
-
var newHookName = nextHook._debugType;
|
|
12934
|
+
var secondColumnStart = 30;
|
|
12800
12935
|
|
|
12801
|
-
var
|
|
12936
|
+
for (var i = 0; i <= hookTypesUpdateIndexDev; i++) {
|
|
12937
|
+
var oldHookName = hookTypesDev[i];
|
|
12938
|
+
var newHookName = i === hookTypesUpdateIndexDev ? currentHookName : oldHookName;
|
|
12802
12939
|
|
|
12803
|
-
|
|
12804
|
-
// lol @ IE not supporting String#repeat
|
|
12805
|
-
while (row.length < secondColumnStart) {
|
|
12806
|
-
row += ' ';
|
|
12807
|
-
}
|
|
12940
|
+
var row = i + 1 + '. ' + oldHookName;
|
|
12808
12941
|
|
|
12809
|
-
|
|
12942
|
+
// Extra space so second column lines up
|
|
12943
|
+
// lol @ IE not supporting String#repeat
|
|
12944
|
+
while (row.length < secondColumnStart) {
|
|
12945
|
+
row += ' ';
|
|
12946
|
+
}
|
|
12810
12947
|
|
|
12811
|
-
|
|
12812
|
-
prevHook = prevHook.next;
|
|
12813
|
-
nextHook = nextHook.next;
|
|
12814
|
-
n++;
|
|
12815
|
-
}
|
|
12948
|
+
row += newHookName + '\n';
|
|
12816
12949
|
|
|
12817
|
-
|
|
12950
|
+
table += row;
|
|
12951
|
+
}
|
|
12952
|
+
|
|
12953
|
+
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);
|
|
12954
|
+
}
|
|
12818
12955
|
}
|
|
12819
12956
|
}
|
|
12820
12957
|
}
|
|
@@ -12850,7 +12987,12 @@ function areHookInputsEqual(nextDeps, prevDeps) {
|
|
|
12850
12987
|
function renderWithHooks(current, workInProgress, Component, props, refOrContext, nextRenderExpirationTime) {
|
|
12851
12988
|
renderExpirationTime = nextRenderExpirationTime;
|
|
12852
12989
|
currentlyRenderingFiber$1 = workInProgress;
|
|
12853
|
-
|
|
12990
|
+
nextCurrentHook = current !== null ? current.memoizedState : null;
|
|
12991
|
+
|
|
12992
|
+
{
|
|
12993
|
+
hookTypesDev = current !== null ? current._debugHookTypes : null;
|
|
12994
|
+
hookTypesUpdateIndexDev = -1;
|
|
12995
|
+
}
|
|
12854
12996
|
|
|
12855
12997
|
// The following should have already been reset
|
|
12856
12998
|
// currentHook = null;
|
|
@@ -12864,8 +13006,26 @@ function renderWithHooks(current, workInProgress, Component, props, refOrContext
|
|
|
12864
13006
|
// numberOfReRenders = 0;
|
|
12865
13007
|
// sideEffectTag = 0;
|
|
12866
13008
|
|
|
13009
|
+
// TODO Warn if no hooks are used at all during mount, then some are used during update.
|
|
13010
|
+
// Currently we will identify the update render as a mount because nextCurrentHook === null.
|
|
13011
|
+
// This is tricky because it's valid for certain types of components (e.g. React.lazy)
|
|
13012
|
+
|
|
13013
|
+
// Using nextCurrentHook to differentiate between mount/update only works if at least one stateful hook is used.
|
|
13014
|
+
// Non-stateful hooks (e.g. context) don't get added to memoizedState,
|
|
13015
|
+
// so nextCurrentHook would be null during updates and mounts.
|
|
12867
13016
|
{
|
|
12868
|
-
|
|
13017
|
+
if (nextCurrentHook !== null) {
|
|
13018
|
+
ReactCurrentDispatcher$1.current = HooksDispatcherOnUpdateInDEV;
|
|
13019
|
+
} else if (hookTypesDev !== null) {
|
|
13020
|
+
// This dispatcher handles an edge case where a component is updating,
|
|
13021
|
+
// but no stateful hooks have been used.
|
|
13022
|
+
// We want to match the production code behavior (which will use HooksDispatcherOnMount),
|
|
13023
|
+
// but with the extra DEV validation to ensure hooks ordering hasn't changed.
|
|
13024
|
+
// This dispatcher does that.
|
|
13025
|
+
ReactCurrentDispatcher$1.current = HooksDispatcherOnMountWithHookTypesInDEV;
|
|
13026
|
+
} else {
|
|
13027
|
+
ReactCurrentDispatcher$1.current = HooksDispatcherOnMountInDEV;
|
|
13028
|
+
}
|
|
12869
13029
|
}
|
|
12870
13030
|
|
|
12871
13031
|
var children = Component(props, refOrContext);
|
|
@@ -12876,13 +13036,18 @@ function renderWithHooks(current, workInProgress, Component, props, refOrContext
|
|
|
12876
13036
|
numberOfReRenders += 1;
|
|
12877
13037
|
|
|
12878
13038
|
// Start over from the beginning of the list
|
|
12879
|
-
|
|
13039
|
+
nextCurrentHook = current !== null ? current.memoizedState : null;
|
|
12880
13040
|
nextWorkInProgressHook = firstWorkInProgressHook;
|
|
12881
13041
|
|
|
12882
13042
|
currentHook = null;
|
|
12883
13043
|
workInProgressHook = null;
|
|
12884
13044
|
componentUpdateQueue = null;
|
|
12885
13045
|
|
|
13046
|
+
{
|
|
13047
|
+
// Also validate hook order for cascading updates.
|
|
13048
|
+
hookTypesUpdateIndexDev = -1;
|
|
13049
|
+
}
|
|
13050
|
+
|
|
12886
13051
|
ReactCurrentDispatcher$1.current = HooksDispatcherOnUpdateInDEV;
|
|
12887
13052
|
|
|
12888
13053
|
children = Component(props, refOrContext);
|
|
@@ -12892,10 +13057,6 @@ function renderWithHooks(current, workInProgress, Component, props, refOrContext
|
|
|
12892
13057
|
numberOfReRenders = 0;
|
|
12893
13058
|
}
|
|
12894
13059
|
|
|
12895
|
-
{
|
|
12896
|
-
currentHookNameInDev = null;
|
|
12897
|
-
}
|
|
12898
|
-
|
|
12899
13060
|
// We can assume the previous dispatcher is always this one, since we set it
|
|
12900
13061
|
// at the beginning of the render phase and there's no re-entrancy.
|
|
12901
13062
|
ReactCurrentDispatcher$1.current = ContextOnlyDispatcher;
|
|
@@ -12907,18 +13068,29 @@ function renderWithHooks(current, workInProgress, Component, props, refOrContext
|
|
|
12907
13068
|
renderedWork.updateQueue = componentUpdateQueue;
|
|
12908
13069
|
renderedWork.effectTag |= sideEffectTag;
|
|
12909
13070
|
|
|
13071
|
+
{
|
|
13072
|
+
renderedWork._debugHookTypes = hookTypesDev;
|
|
13073
|
+
}
|
|
13074
|
+
|
|
13075
|
+
// This check uses currentHook so that it works the same in DEV and prod bundles.
|
|
13076
|
+
// hookTypesDev could catch more cases (e.g. context) but only in DEV bundles.
|
|
12910
13077
|
var didRenderTooFewHooks = currentHook !== null && currentHook.next !== null;
|
|
12911
13078
|
|
|
12912
13079
|
renderExpirationTime = NoWork;
|
|
12913
13080
|
currentlyRenderingFiber$1 = null;
|
|
12914
13081
|
|
|
12915
|
-
firstCurrentHook = null;
|
|
12916
13082
|
currentHook = null;
|
|
12917
13083
|
nextCurrentHook = null;
|
|
12918
13084
|
firstWorkInProgressHook = null;
|
|
12919
13085
|
workInProgressHook = null;
|
|
12920
13086
|
nextWorkInProgressHook = null;
|
|
12921
13087
|
|
|
13088
|
+
{
|
|
13089
|
+
currentHookNameInDev = null;
|
|
13090
|
+
hookTypesDev = null;
|
|
13091
|
+
hookTypesUpdateIndexDev = -1;
|
|
13092
|
+
}
|
|
13093
|
+
|
|
12922
13094
|
remainingExpirationTime = NoWork;
|
|
12923
13095
|
componentUpdateQueue = null;
|
|
12924
13096
|
sideEffectTag = 0;
|
|
@@ -12952,21 +13124,23 @@ function resetHooks() {
|
|
|
12952
13124
|
renderExpirationTime = NoWork;
|
|
12953
13125
|
currentlyRenderingFiber$1 = null;
|
|
12954
13126
|
|
|
12955
|
-
firstCurrentHook = null;
|
|
12956
13127
|
currentHook = null;
|
|
12957
13128
|
nextCurrentHook = null;
|
|
12958
13129
|
firstWorkInProgressHook = null;
|
|
12959
13130
|
workInProgressHook = null;
|
|
12960
13131
|
nextWorkInProgressHook = null;
|
|
12961
13132
|
|
|
12962
|
-
remainingExpirationTime = NoWork;
|
|
12963
|
-
componentUpdateQueue = null;
|
|
12964
|
-
sideEffectTag = 0;
|
|
12965
|
-
|
|
12966
13133
|
{
|
|
13134
|
+
hookTypesDev = null;
|
|
13135
|
+
hookTypesUpdateIndexDev = -1;
|
|
13136
|
+
|
|
12967
13137
|
currentHookNameInDev = null;
|
|
12968
13138
|
}
|
|
12969
13139
|
|
|
13140
|
+
remainingExpirationTime = NoWork;
|
|
13141
|
+
componentUpdateQueue = null;
|
|
13142
|
+
sideEffectTag = 0;
|
|
13143
|
+
|
|
12970
13144
|
didScheduleRenderPhaseUpdate = false;
|
|
12971
13145
|
renderPhaseUpdates = null;
|
|
12972
13146
|
numberOfReRenders = 0;
|
|
@@ -12983,12 +13157,6 @@ function mountWorkInProgressHook() {
|
|
|
12983
13157
|
next: null
|
|
12984
13158
|
};
|
|
12985
13159
|
|
|
12986
|
-
{
|
|
12987
|
-
hook._debugType = currentHookNameInDev;
|
|
12988
|
-
if (currentlyRenderingFiber$1 !== null && currentlyRenderingFiber$1.alternate !== null) {
|
|
12989
|
-
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));
|
|
12990
|
-
}
|
|
12991
|
-
}
|
|
12992
13160
|
if (workInProgressHook === null) {
|
|
12993
13161
|
// This is the first hook in the list
|
|
12994
13162
|
firstWorkInProgressHook = workInProgressHook = hook;
|
|
@@ -13035,13 +13203,6 @@ function updateWorkInProgressHook() {
|
|
|
13035
13203
|
workInProgressHook = workInProgressHook.next = newHook;
|
|
13036
13204
|
}
|
|
13037
13205
|
nextCurrentHook = currentHook.next;
|
|
13038
|
-
|
|
13039
|
-
{
|
|
13040
|
-
newHook._debugType = currentHookNameInDev;
|
|
13041
|
-
if (currentHookNameInDev !== currentHook._debugType) {
|
|
13042
|
-
warnOnHookMismatchInDev();
|
|
13043
|
-
}
|
|
13044
|
-
}
|
|
13045
13206
|
}
|
|
13046
13207
|
return workInProgressHook;
|
|
13047
13208
|
}
|
|
@@ -13056,20 +13217,6 @@ function basicStateReducer(state, action) {
|
|
|
13056
13217
|
return typeof action === 'function' ? action(state) : action;
|
|
13057
13218
|
}
|
|
13058
13219
|
|
|
13059
|
-
function mountContext(context, observedBits) {
|
|
13060
|
-
{
|
|
13061
|
-
mountWorkInProgressHook();
|
|
13062
|
-
}
|
|
13063
|
-
return readContext(context, observedBits);
|
|
13064
|
-
}
|
|
13065
|
-
|
|
13066
|
-
function updateContext(context, observedBits) {
|
|
13067
|
-
{
|
|
13068
|
-
updateWorkInProgressHook();
|
|
13069
|
-
}
|
|
13070
|
-
return readContext(context, observedBits);
|
|
13071
|
-
}
|
|
13072
|
-
|
|
13073
13220
|
function mountReducer(reducer, initialArg, init) {
|
|
13074
13221
|
var hook = mountWorkInProgressHook();
|
|
13075
13222
|
var initialState = void 0;
|
|
@@ -13122,7 +13269,6 @@ function updateReducer(reducer, initialArg, init) {
|
|
|
13122
13269
|
}
|
|
13123
13270
|
|
|
13124
13271
|
hook.memoizedState = newState;
|
|
13125
|
-
|
|
13126
13272
|
// Don't persist the state accumlated from the render phase updates to
|
|
13127
13273
|
// the base state unless the queue is empty.
|
|
13128
13274
|
// TODO: Not sure if this is the desired semantics, but it's what we
|
|
@@ -13131,6 +13277,9 @@ function updateReducer(reducer, initialArg, init) {
|
|
|
13131
13277
|
hook.baseState = newState;
|
|
13132
13278
|
}
|
|
13133
13279
|
|
|
13280
|
+
queue.eagerReducer = reducer;
|
|
13281
|
+
queue.eagerState = newState;
|
|
13282
|
+
|
|
13134
13283
|
return [newState, _dispatch];
|
|
13135
13284
|
}
|
|
13136
13285
|
}
|
|
@@ -13350,7 +13499,7 @@ function mountImperativeHandle(ref, create, deps) {
|
|
|
13350
13499
|
}
|
|
13351
13500
|
|
|
13352
13501
|
// TODO: If deps are provided, should we skip comparing the ref itself?
|
|
13353
|
-
var effectDeps = deps !== null && deps !== undefined ? deps.concat([ref]) :
|
|
13502
|
+
var effectDeps = deps !== null && deps !== undefined ? deps.concat([ref]) : null;
|
|
13354
13503
|
|
|
13355
13504
|
return mountEffectImpl(Update, UnmountMutation | MountLayout, imperativeHandleEffect.bind(null, create, ref), effectDeps);
|
|
13356
13505
|
}
|
|
@@ -13361,7 +13510,7 @@ function updateImperativeHandle(ref, create, deps) {
|
|
|
13361
13510
|
}
|
|
13362
13511
|
|
|
13363
13512
|
// TODO: If deps are provided, should we skip comparing the ref itself?
|
|
13364
|
-
var effectDeps = deps !== null && deps !== undefined ? deps.concat([ref]) :
|
|
13513
|
+
var effectDeps = deps !== null && deps !== undefined ? deps.concat([ref]) : null;
|
|
13365
13514
|
|
|
13366
13515
|
return updateEffectImpl(Update, UnmountMutation | MountLayout, imperativeHandleEffect.bind(null, create, ref), effectDeps);
|
|
13367
13516
|
}
|
|
@@ -13428,7 +13577,7 @@ function updateMemo(nextCreate, deps) {
|
|
|
13428
13577
|
var shouldWarnForUnbatchedSetState = false;
|
|
13429
13578
|
|
|
13430
13579
|
{
|
|
13431
|
-
// jest
|
|
13580
|
+
// jest isn't a 'global', it's just exposed to tests via a wrapped function
|
|
13432
13581
|
// further, this isn't a test file, so flow doesn't recognize the symbol. So...
|
|
13433
13582
|
// $FlowExpectedError - because requirements don't give a damn about your type sigs.
|
|
13434
13583
|
if ('undefined' !== typeof jest) {
|
|
@@ -13560,6 +13709,7 @@ var ContextOnlyDispatcher = {
|
|
|
13560
13709
|
};
|
|
13561
13710
|
|
|
13562
13711
|
var HooksDispatcherOnMountInDEV = null;
|
|
13712
|
+
var HooksDispatcherOnMountWithHookTypesInDEV = null;
|
|
13563
13713
|
var HooksDispatcherOnUpdateInDEV = null;
|
|
13564
13714
|
var InvalidNestedHooksDispatcherOnMountInDEV = null;
|
|
13565
13715
|
var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
@@ -13579,26 +13729,32 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
|
13579
13729
|
},
|
|
13580
13730
|
useCallback: function (callback, deps) {
|
|
13581
13731
|
currentHookNameInDev = 'useCallback';
|
|
13732
|
+
mountHookTypesDev();
|
|
13582
13733
|
return mountCallback(callback, deps);
|
|
13583
13734
|
},
|
|
13584
13735
|
useContext: function (context, observedBits) {
|
|
13585
13736
|
currentHookNameInDev = 'useContext';
|
|
13586
|
-
|
|
13737
|
+
mountHookTypesDev();
|
|
13738
|
+
return readContext(context, observedBits);
|
|
13587
13739
|
},
|
|
13588
13740
|
useEffect: function (create, deps) {
|
|
13589
13741
|
currentHookNameInDev = 'useEffect';
|
|
13742
|
+
mountHookTypesDev();
|
|
13590
13743
|
return mountEffect(create, deps);
|
|
13591
13744
|
},
|
|
13592
13745
|
useImperativeHandle: function (ref, create, deps) {
|
|
13593
13746
|
currentHookNameInDev = 'useImperativeHandle';
|
|
13747
|
+
mountHookTypesDev();
|
|
13594
13748
|
return mountImperativeHandle(ref, create, deps);
|
|
13595
13749
|
},
|
|
13596
13750
|
useLayoutEffect: function (create, deps) {
|
|
13597
13751
|
currentHookNameInDev = 'useLayoutEffect';
|
|
13752
|
+
mountHookTypesDev();
|
|
13598
13753
|
return mountLayoutEffect(create, deps);
|
|
13599
13754
|
},
|
|
13600
13755
|
useMemo: function (create, deps) {
|
|
13601
13756
|
currentHookNameInDev = 'useMemo';
|
|
13757
|
+
mountHookTypesDev();
|
|
13602
13758
|
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
|
13603
13759
|
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
|
|
13604
13760
|
try {
|
|
@@ -13609,6 +13765,7 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
|
13609
13765
|
},
|
|
13610
13766
|
useReducer: function (reducer, initialArg, init) {
|
|
13611
13767
|
currentHookNameInDev = 'useReducer';
|
|
13768
|
+
mountHookTypesDev();
|
|
13612
13769
|
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
|
13613
13770
|
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
|
|
13614
13771
|
try {
|
|
@@ -13619,10 +13776,12 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
|
13619
13776
|
},
|
|
13620
13777
|
useRef: function (initialValue) {
|
|
13621
13778
|
currentHookNameInDev = 'useRef';
|
|
13779
|
+
mountHookTypesDev();
|
|
13622
13780
|
return mountRef(initialValue);
|
|
13623
13781
|
},
|
|
13624
13782
|
useState: function (initialState) {
|
|
13625
13783
|
currentHookNameInDev = 'useState';
|
|
13784
|
+
mountHookTypesDev();
|
|
13626
13785
|
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
|
13627
13786
|
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
|
|
13628
13787
|
try {
|
|
@@ -13633,6 +13792,81 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
|
13633
13792
|
},
|
|
13634
13793
|
useDebugValue: function (value, formatterFn) {
|
|
13635
13794
|
currentHookNameInDev = 'useDebugValue';
|
|
13795
|
+
mountHookTypesDev();
|
|
13796
|
+
return mountDebugValue(value, formatterFn);
|
|
13797
|
+
}
|
|
13798
|
+
};
|
|
13799
|
+
|
|
13800
|
+
HooksDispatcherOnMountWithHookTypesInDEV = {
|
|
13801
|
+
readContext: function (context, observedBits) {
|
|
13802
|
+
return readContext(context, observedBits);
|
|
13803
|
+
},
|
|
13804
|
+
useCallback: function (callback, deps) {
|
|
13805
|
+
currentHookNameInDev = 'useCallback';
|
|
13806
|
+
updateHookTypesDev();
|
|
13807
|
+
return mountCallback(callback, deps);
|
|
13808
|
+
},
|
|
13809
|
+
useContext: function (context, observedBits) {
|
|
13810
|
+
currentHookNameInDev = 'useContext';
|
|
13811
|
+
updateHookTypesDev();
|
|
13812
|
+
return readContext(context, observedBits);
|
|
13813
|
+
},
|
|
13814
|
+
useEffect: function (create, deps) {
|
|
13815
|
+
currentHookNameInDev = 'useEffect';
|
|
13816
|
+
updateHookTypesDev();
|
|
13817
|
+
return mountEffect(create, deps);
|
|
13818
|
+
},
|
|
13819
|
+
useImperativeHandle: function (ref, create, deps) {
|
|
13820
|
+
currentHookNameInDev = 'useImperativeHandle';
|
|
13821
|
+
updateHookTypesDev();
|
|
13822
|
+
return mountImperativeHandle(ref, create, deps);
|
|
13823
|
+
},
|
|
13824
|
+
useLayoutEffect: function (create, deps) {
|
|
13825
|
+
currentHookNameInDev = 'useLayoutEffect';
|
|
13826
|
+
updateHookTypesDev();
|
|
13827
|
+
return mountLayoutEffect(create, deps);
|
|
13828
|
+
},
|
|
13829
|
+
useMemo: function (create, deps) {
|
|
13830
|
+
currentHookNameInDev = 'useMemo';
|
|
13831
|
+
updateHookTypesDev();
|
|
13832
|
+
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
|
13833
|
+
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
|
|
13834
|
+
try {
|
|
13835
|
+
return mountMemo(create, deps);
|
|
13836
|
+
} finally {
|
|
13837
|
+
ReactCurrentDispatcher$1.current = prevDispatcher;
|
|
13838
|
+
}
|
|
13839
|
+
},
|
|
13840
|
+
useReducer: function (reducer, initialArg, init) {
|
|
13841
|
+
currentHookNameInDev = 'useReducer';
|
|
13842
|
+
updateHookTypesDev();
|
|
13843
|
+
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
|
13844
|
+
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
|
|
13845
|
+
try {
|
|
13846
|
+
return mountReducer(reducer, initialArg, init);
|
|
13847
|
+
} finally {
|
|
13848
|
+
ReactCurrentDispatcher$1.current = prevDispatcher;
|
|
13849
|
+
}
|
|
13850
|
+
},
|
|
13851
|
+
useRef: function (initialValue) {
|
|
13852
|
+
currentHookNameInDev = 'useRef';
|
|
13853
|
+
updateHookTypesDev();
|
|
13854
|
+
return mountRef(initialValue);
|
|
13855
|
+
},
|
|
13856
|
+
useState: function (initialState) {
|
|
13857
|
+
currentHookNameInDev = 'useState';
|
|
13858
|
+
updateHookTypesDev();
|
|
13859
|
+
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
|
13860
|
+
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
|
|
13861
|
+
try {
|
|
13862
|
+
return mountState(initialState);
|
|
13863
|
+
} finally {
|
|
13864
|
+
ReactCurrentDispatcher$1.current = prevDispatcher;
|
|
13865
|
+
}
|
|
13866
|
+
},
|
|
13867
|
+
useDebugValue: function (value, formatterFn) {
|
|
13868
|
+
currentHookNameInDev = 'useDebugValue';
|
|
13869
|
+
updateHookTypesDev();
|
|
13636
13870
|
return mountDebugValue(value, formatterFn);
|
|
13637
13871
|
}
|
|
13638
13872
|
};
|
|
@@ -13643,26 +13877,32 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
|
13643
13877
|
},
|
|
13644
13878
|
useCallback: function (callback, deps) {
|
|
13645
13879
|
currentHookNameInDev = 'useCallback';
|
|
13880
|
+
updateHookTypesDev();
|
|
13646
13881
|
return updateCallback(callback, deps);
|
|
13647
13882
|
},
|
|
13648
13883
|
useContext: function (context, observedBits) {
|
|
13649
13884
|
currentHookNameInDev = 'useContext';
|
|
13650
|
-
|
|
13885
|
+
updateHookTypesDev();
|
|
13886
|
+
return readContext(context, observedBits);
|
|
13651
13887
|
},
|
|
13652
13888
|
useEffect: function (create, deps) {
|
|
13653
13889
|
currentHookNameInDev = 'useEffect';
|
|
13890
|
+
updateHookTypesDev();
|
|
13654
13891
|
return updateEffect(create, deps);
|
|
13655
13892
|
},
|
|
13656
13893
|
useImperativeHandle: function (ref, create, deps) {
|
|
13657
13894
|
currentHookNameInDev = 'useImperativeHandle';
|
|
13895
|
+
updateHookTypesDev();
|
|
13658
13896
|
return updateImperativeHandle(ref, create, deps);
|
|
13659
13897
|
},
|
|
13660
13898
|
useLayoutEffect: function (create, deps) {
|
|
13661
13899
|
currentHookNameInDev = 'useLayoutEffect';
|
|
13900
|
+
updateHookTypesDev();
|
|
13662
13901
|
return updateLayoutEffect(create, deps);
|
|
13663
13902
|
},
|
|
13664
13903
|
useMemo: function (create, deps) {
|
|
13665
13904
|
currentHookNameInDev = 'useMemo';
|
|
13905
|
+
updateHookTypesDev();
|
|
13666
13906
|
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
|
13667
13907
|
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
|
|
13668
13908
|
try {
|
|
@@ -13673,6 +13913,7 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
|
13673
13913
|
},
|
|
13674
13914
|
useReducer: function (reducer, initialArg, init) {
|
|
13675
13915
|
currentHookNameInDev = 'useReducer';
|
|
13916
|
+
updateHookTypesDev();
|
|
13676
13917
|
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
|
13677
13918
|
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
|
|
13678
13919
|
try {
|
|
@@ -13683,10 +13924,12 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
|
13683
13924
|
},
|
|
13684
13925
|
useRef: function (initialValue) {
|
|
13685
13926
|
currentHookNameInDev = 'useRef';
|
|
13927
|
+
updateHookTypesDev();
|
|
13686
13928
|
return updateRef(initialValue);
|
|
13687
13929
|
},
|
|
13688
13930
|
useState: function (initialState) {
|
|
13689
13931
|
currentHookNameInDev = 'useState';
|
|
13932
|
+
updateHookTypesDev();
|
|
13690
13933
|
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
|
13691
13934
|
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
|
|
13692
13935
|
try {
|
|
@@ -13697,6 +13940,7 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
|
13697
13940
|
},
|
|
13698
13941
|
useDebugValue: function (value, formatterFn) {
|
|
13699
13942
|
currentHookNameInDev = 'useDebugValue';
|
|
13943
|
+
updateHookTypesDev();
|
|
13700
13944
|
return updateDebugValue(value, formatterFn);
|
|
13701
13945
|
}
|
|
13702
13946
|
};
|
|
@@ -13709,31 +13953,37 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
|
13709
13953
|
useCallback: function (callback, deps) {
|
|
13710
13954
|
currentHookNameInDev = 'useCallback';
|
|
13711
13955
|
warnInvalidHookAccess();
|
|
13956
|
+
mountHookTypesDev();
|
|
13712
13957
|
return mountCallback(callback, deps);
|
|
13713
13958
|
},
|
|
13714
13959
|
useContext: function (context, observedBits) {
|
|
13715
13960
|
currentHookNameInDev = 'useContext';
|
|
13716
13961
|
warnInvalidHookAccess();
|
|
13717
|
-
|
|
13962
|
+
mountHookTypesDev();
|
|
13963
|
+
return readContext(context, observedBits);
|
|
13718
13964
|
},
|
|
13719
13965
|
useEffect: function (create, deps) {
|
|
13720
13966
|
currentHookNameInDev = 'useEffect';
|
|
13721
13967
|
warnInvalidHookAccess();
|
|
13968
|
+
mountHookTypesDev();
|
|
13722
13969
|
return mountEffect(create, deps);
|
|
13723
13970
|
},
|
|
13724
13971
|
useImperativeHandle: function (ref, create, deps) {
|
|
13725
13972
|
currentHookNameInDev = 'useImperativeHandle';
|
|
13726
13973
|
warnInvalidHookAccess();
|
|
13974
|
+
mountHookTypesDev();
|
|
13727
13975
|
return mountImperativeHandle(ref, create, deps);
|
|
13728
13976
|
},
|
|
13729
13977
|
useLayoutEffect: function (create, deps) {
|
|
13730
13978
|
currentHookNameInDev = 'useLayoutEffect';
|
|
13731
13979
|
warnInvalidHookAccess();
|
|
13980
|
+
mountHookTypesDev();
|
|
13732
13981
|
return mountLayoutEffect(create, deps);
|
|
13733
13982
|
},
|
|
13734
13983
|
useMemo: function (create, deps) {
|
|
13735
13984
|
currentHookNameInDev = 'useMemo';
|
|
13736
13985
|
warnInvalidHookAccess();
|
|
13986
|
+
mountHookTypesDev();
|
|
13737
13987
|
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
|
13738
13988
|
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
|
|
13739
13989
|
try {
|
|
@@ -13745,6 +13995,7 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
|
13745
13995
|
useReducer: function (reducer, initialArg, init) {
|
|
13746
13996
|
currentHookNameInDev = 'useReducer';
|
|
13747
13997
|
warnInvalidHookAccess();
|
|
13998
|
+
mountHookTypesDev();
|
|
13748
13999
|
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
|
13749
14000
|
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
|
|
13750
14001
|
try {
|
|
@@ -13756,11 +14007,13 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
|
13756
14007
|
useRef: function (initialValue) {
|
|
13757
14008
|
currentHookNameInDev = 'useRef';
|
|
13758
14009
|
warnInvalidHookAccess();
|
|
14010
|
+
mountHookTypesDev();
|
|
13759
14011
|
return mountRef(initialValue);
|
|
13760
14012
|
},
|
|
13761
14013
|
useState: function (initialState) {
|
|
13762
14014
|
currentHookNameInDev = 'useState';
|
|
13763
14015
|
warnInvalidHookAccess();
|
|
14016
|
+
mountHookTypesDev();
|
|
13764
14017
|
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
|
13765
14018
|
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
|
|
13766
14019
|
try {
|
|
@@ -13772,6 +14025,7 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
|
13772
14025
|
useDebugValue: function (value, formatterFn) {
|
|
13773
14026
|
currentHookNameInDev = 'useDebugValue';
|
|
13774
14027
|
warnInvalidHookAccess();
|
|
14028
|
+
mountHookTypesDev();
|
|
13775
14029
|
return mountDebugValue(value, formatterFn);
|
|
13776
14030
|
}
|
|
13777
14031
|
};
|
|
@@ -13784,31 +14038,37 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
|
13784
14038
|
useCallback: function (callback, deps) {
|
|
13785
14039
|
currentHookNameInDev = 'useCallback';
|
|
13786
14040
|
warnInvalidHookAccess();
|
|
14041
|
+
updateHookTypesDev();
|
|
13787
14042
|
return updateCallback(callback, deps);
|
|
13788
14043
|
},
|
|
13789
14044
|
useContext: function (context, observedBits) {
|
|
13790
14045
|
currentHookNameInDev = 'useContext';
|
|
13791
14046
|
warnInvalidHookAccess();
|
|
13792
|
-
|
|
14047
|
+
updateHookTypesDev();
|
|
14048
|
+
return readContext(context, observedBits);
|
|
13793
14049
|
},
|
|
13794
14050
|
useEffect: function (create, deps) {
|
|
13795
14051
|
currentHookNameInDev = 'useEffect';
|
|
13796
14052
|
warnInvalidHookAccess();
|
|
14053
|
+
updateHookTypesDev();
|
|
13797
14054
|
return updateEffect(create, deps);
|
|
13798
14055
|
},
|
|
13799
14056
|
useImperativeHandle: function (ref, create, deps) {
|
|
13800
14057
|
currentHookNameInDev = 'useImperativeHandle';
|
|
13801
14058
|
warnInvalidHookAccess();
|
|
14059
|
+
updateHookTypesDev();
|
|
13802
14060
|
return updateImperativeHandle(ref, create, deps);
|
|
13803
14061
|
},
|
|
13804
14062
|
useLayoutEffect: function (create, deps) {
|
|
13805
14063
|
currentHookNameInDev = 'useLayoutEffect';
|
|
13806
14064
|
warnInvalidHookAccess();
|
|
14065
|
+
updateHookTypesDev();
|
|
13807
14066
|
return updateLayoutEffect(create, deps);
|
|
13808
14067
|
},
|
|
13809
14068
|
useMemo: function (create, deps) {
|
|
13810
14069
|
currentHookNameInDev = 'useMemo';
|
|
13811
14070
|
warnInvalidHookAccess();
|
|
14071
|
+
updateHookTypesDev();
|
|
13812
14072
|
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
|
13813
14073
|
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
|
|
13814
14074
|
try {
|
|
@@ -13820,6 +14080,7 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
|
13820
14080
|
useReducer: function (reducer, initialArg, init) {
|
|
13821
14081
|
currentHookNameInDev = 'useReducer';
|
|
13822
14082
|
warnInvalidHookAccess();
|
|
14083
|
+
updateHookTypesDev();
|
|
13823
14084
|
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
|
13824
14085
|
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
|
|
13825
14086
|
try {
|
|
@@ -13831,11 +14092,13 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
|
13831
14092
|
useRef: function (initialValue) {
|
|
13832
14093
|
currentHookNameInDev = 'useRef';
|
|
13833
14094
|
warnInvalidHookAccess();
|
|
14095
|
+
updateHookTypesDev();
|
|
13834
14096
|
return updateRef(initialValue);
|
|
13835
14097
|
},
|
|
13836
14098
|
useState: function (initialState) {
|
|
13837
14099
|
currentHookNameInDev = 'useState';
|
|
13838
14100
|
warnInvalidHookAccess();
|
|
14101
|
+
updateHookTypesDev();
|
|
13839
14102
|
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
|
13840
14103
|
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
|
|
13841
14104
|
try {
|
|
@@ -13847,6 +14110,7 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
|
13847
14110
|
useDebugValue: function (value, formatterFn) {
|
|
13848
14111
|
currentHookNameInDev = 'useDebugValue';
|
|
13849
14112
|
warnInvalidHookAccess();
|
|
14113
|
+
updateHookTypesDev();
|
|
13850
14114
|
return updateDebugValue(value, formatterFn);
|
|
13851
14115
|
}
|
|
13852
14116
|
};
|
|
@@ -13918,6 +14182,18 @@ function enterHydrationState(fiber) {
|
|
|
13918
14182
|
return true;
|
|
13919
14183
|
}
|
|
13920
14184
|
|
|
14185
|
+
function reenterHydrationStateFromDehydratedSuspenseInstance(fiber) {
|
|
14186
|
+
if (!supportsHydration) {
|
|
14187
|
+
return false;
|
|
14188
|
+
}
|
|
14189
|
+
|
|
14190
|
+
var suspenseInstance = fiber.stateNode;
|
|
14191
|
+
nextHydratableInstance = getNextHydratableSibling(suspenseInstance);
|
|
14192
|
+
popToNextHostParent(fiber);
|
|
14193
|
+
isHydrating = true;
|
|
14194
|
+
return true;
|
|
14195
|
+
}
|
|
14196
|
+
|
|
13921
14197
|
function deleteHydratableInstance(returnFiber, instance) {
|
|
13922
14198
|
{
|
|
13923
14199
|
switch (returnFiber.tag) {
|
|
@@ -13964,6 +14240,9 @@ function insertNonHydratedInstance(returnFiber, fiber) {
|
|
|
13964
14240
|
case HostText:
|
|
13965
14241
|
var text = fiber.pendingProps;
|
|
13966
14242
|
didNotFindHydratableContainerTextInstance(parentContainer, text);
|
|
14243
|
+
break;
|
|
14244
|
+
case SuspenseComponent:
|
|
14245
|
+
|
|
13967
14246
|
break;
|
|
13968
14247
|
}
|
|
13969
14248
|
break;
|
|
@@ -13983,6 +14262,9 @@ function insertNonHydratedInstance(returnFiber, fiber) {
|
|
|
13983
14262
|
var _text = fiber.pendingProps;
|
|
13984
14263
|
didNotFindHydratableTextInstance(parentType, parentProps, parentInstance, _text);
|
|
13985
14264
|
break;
|
|
14265
|
+
case SuspenseComponent:
|
|
14266
|
+
didNotFindHydratableSuspenseInstance(parentType, parentProps, parentInstance);
|
|
14267
|
+
break;
|
|
13986
14268
|
}
|
|
13987
14269
|
break;
|
|
13988
14270
|
}
|
|
@@ -14015,6 +14297,19 @@ function tryHydrate(fiber, nextInstance) {
|
|
|
14015
14297
|
}
|
|
14016
14298
|
return false;
|
|
14017
14299
|
}
|
|
14300
|
+
case SuspenseComponent:
|
|
14301
|
+
{
|
|
14302
|
+
if (enableSuspenseServerRenderer) {
|
|
14303
|
+
var suspenseInstance = canHydrateSuspenseInstance(nextInstance);
|
|
14304
|
+
if (suspenseInstance !== null) {
|
|
14305
|
+
// Downgrade the tag to a dehydrated component until we've hydrated it.
|
|
14306
|
+
fiber.tag = DehydratedSuspenseComponent;
|
|
14307
|
+
fiber.stateNode = suspenseInstance;
|
|
14308
|
+
return true;
|
|
14309
|
+
}
|
|
14310
|
+
}
|
|
14311
|
+
return false;
|
|
14312
|
+
}
|
|
14018
14313
|
default:
|
|
14019
14314
|
return false;
|
|
14020
14315
|
}
|
|
@@ -14108,9 +14403,18 @@ function prepareToHydrateHostTextInstance(fiber) {
|
|
|
14108
14403
|
return shouldUpdate;
|
|
14109
14404
|
}
|
|
14110
14405
|
|
|
14406
|
+
function skipPastDehydratedSuspenseInstance(fiber) {
|
|
14407
|
+
if (!supportsHydration) {
|
|
14408
|
+
invariant(false, 'Expected skipPastDehydratedSuspenseInstance() to never be called. This error is likely caused by a bug in React. Please file an issue.');
|
|
14409
|
+
}
|
|
14410
|
+
var suspenseInstance = fiber.stateNode;
|
|
14411
|
+
!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;
|
|
14412
|
+
nextHydratableInstance = getNextHydratableInstanceAfterSuspenseInstance(suspenseInstance);
|
|
14413
|
+
}
|
|
14414
|
+
|
|
14111
14415
|
function popToNextHostParent(fiber) {
|
|
14112
14416
|
var parent = fiber.return;
|
|
14113
|
-
while (parent !== null && parent.tag !== HostComponent && parent.tag !== HostRoot) {
|
|
14417
|
+
while (parent !== null && parent.tag !== HostComponent && parent.tag !== HostRoot && parent.tag !== DehydratedSuspenseComponent) {
|
|
14114
14418
|
parent = parent.return;
|
|
14115
14419
|
}
|
|
14116
14420
|
hydrationParentFiber = parent;
|
|
@@ -14218,6 +14522,10 @@ function forceUnmountCurrentAndReconcile(current$$1, workInProgress, nextChildre
|
|
|
14218
14522
|
}
|
|
14219
14523
|
|
|
14220
14524
|
function updateForwardRef(current$$1, workInProgress, Component, nextProps, renderExpirationTime) {
|
|
14525
|
+
// TODO: current can be non-null here even if the component
|
|
14526
|
+
// hasn't yet mounted. This happens after the first render suspends.
|
|
14527
|
+
// We'll need to figure out if this is fine or can cause issues.
|
|
14528
|
+
|
|
14221
14529
|
{
|
|
14222
14530
|
if (workInProgress.type !== workInProgress.elementType) {
|
|
14223
14531
|
// Lazy component props can't be validated in createElement
|
|
@@ -14323,6 +14631,10 @@ function updateMemoComponent(current$$1, workInProgress, Component, nextProps, u
|
|
|
14323
14631
|
}
|
|
14324
14632
|
|
|
14325
14633
|
function updateSimpleMemoComponent(current$$1, workInProgress, Component, nextProps, updateExpirationTime, renderExpirationTime) {
|
|
14634
|
+
// TODO: current can be non-null here even if the component
|
|
14635
|
+
// hasn't yet mounted. This happens when the inner render suspends.
|
|
14636
|
+
// We'll need to figure out if this is fine or can cause issues.
|
|
14637
|
+
|
|
14326
14638
|
{
|
|
14327
14639
|
if (workInProgress.type !== workInProgress.elementType) {
|
|
14328
14640
|
// Lazy component props can't be validated in createElement
|
|
@@ -14946,6 +15258,18 @@ function updateSuspenseComponent(current$$1, workInProgress, renderExpirationTim
|
|
|
14946
15258
|
// children -- we skip over the primary children entirely.
|
|
14947
15259
|
var next = void 0;
|
|
14948
15260
|
if (current$$1 === null) {
|
|
15261
|
+
if (enableSuspenseServerRenderer) {
|
|
15262
|
+
// If we're currently hydrating, try to hydrate this boundary.
|
|
15263
|
+
// But only if this has a fallback.
|
|
15264
|
+
if (nextProps.fallback !== undefined) {
|
|
15265
|
+
tryToClaimNextHydratableInstance(workInProgress);
|
|
15266
|
+
// This could've changed the tag if this was a dehydrated suspense component.
|
|
15267
|
+
if (workInProgress.tag === DehydratedSuspenseComponent) {
|
|
15268
|
+
return updateDehydratedSuspenseComponent(null, workInProgress, renderExpirationTime);
|
|
15269
|
+
}
|
|
15270
|
+
}
|
|
15271
|
+
}
|
|
15272
|
+
|
|
14949
15273
|
// This is the initial mount. This branch is pretty simple because there's
|
|
14950
15274
|
// no previous state that needs to be preserved.
|
|
14951
15275
|
if (nextDidTimeout) {
|
|
@@ -15097,6 +15421,65 @@ function updateSuspenseComponent(current$$1, workInProgress, renderExpirationTim
|
|
|
15097
15421
|
return next;
|
|
15098
15422
|
}
|
|
15099
15423
|
|
|
15424
|
+
function updateDehydratedSuspenseComponent(current$$1, workInProgress, renderExpirationTime) {
|
|
15425
|
+
if (current$$1 === null) {
|
|
15426
|
+
// During the first pass, we'll bail out and not drill into the children.
|
|
15427
|
+
// Instead, we'll leave the content in place and try to hydrate it later.
|
|
15428
|
+
workInProgress.expirationTime = Never;
|
|
15429
|
+
return null;
|
|
15430
|
+
}
|
|
15431
|
+
// We use childExpirationTime to indicate that a child might depend on context, so if
|
|
15432
|
+
// any context has changed, we need to treat is as if the input might have changed.
|
|
15433
|
+
var hasContextChanged$$1 = current$$1.childExpirationTime >= renderExpirationTime;
|
|
15434
|
+
if (didReceiveUpdate || hasContextChanged$$1) {
|
|
15435
|
+
// This boundary has changed since the first render. This means that we are now unable to
|
|
15436
|
+
// hydrate it. We might still be able to hydrate it using an earlier expiration time but
|
|
15437
|
+
// during this render we can't. Instead, we're going to delete the whole subtree and
|
|
15438
|
+
// instead inject a new real Suspense boundary to take its place, which may render content
|
|
15439
|
+
// or fallback. The real Suspense boundary will suspend for a while so we have some time
|
|
15440
|
+
// to ensure it can produce real content, but all state and pending events will be lost.
|
|
15441
|
+
|
|
15442
|
+
// Detach from the current dehydrated boundary.
|
|
15443
|
+
current$$1.alternate = null;
|
|
15444
|
+
workInProgress.alternate = null;
|
|
15445
|
+
|
|
15446
|
+
// Insert a deletion in the effect list.
|
|
15447
|
+
var returnFiber = workInProgress.return;
|
|
15448
|
+
!(returnFiber !== null) ? invariant(false, 'Suspense boundaries are never on the root. This is probably a bug in React.') : void 0;
|
|
15449
|
+
var last = returnFiber.lastEffect;
|
|
15450
|
+
if (last !== null) {
|
|
15451
|
+
last.nextEffect = current$$1;
|
|
15452
|
+
returnFiber.lastEffect = current$$1;
|
|
15453
|
+
} else {
|
|
15454
|
+
returnFiber.firstEffect = returnFiber.lastEffect = current$$1;
|
|
15455
|
+
}
|
|
15456
|
+
current$$1.nextEffect = null;
|
|
15457
|
+
current$$1.effectTag = Deletion;
|
|
15458
|
+
|
|
15459
|
+
// Upgrade this work in progress to a real Suspense component.
|
|
15460
|
+
workInProgress.tag = SuspenseComponent;
|
|
15461
|
+
workInProgress.stateNode = null;
|
|
15462
|
+
workInProgress.memoizedState = null;
|
|
15463
|
+
// This is now an insertion.
|
|
15464
|
+
workInProgress.effectTag |= Placement;
|
|
15465
|
+
// Retry as a real Suspense component.
|
|
15466
|
+
return updateSuspenseComponent(null, workInProgress, renderExpirationTime);
|
|
15467
|
+
}
|
|
15468
|
+
if ((workInProgress.effectTag & DidCapture) === NoEffect) {
|
|
15469
|
+
// This is the first attempt.
|
|
15470
|
+
reenterHydrationStateFromDehydratedSuspenseInstance(workInProgress);
|
|
15471
|
+
var nextProps = workInProgress.pendingProps;
|
|
15472
|
+
var nextChildren = nextProps.children;
|
|
15473
|
+
workInProgress.child = mountChildFibers(workInProgress, null, nextChildren, renderExpirationTime);
|
|
15474
|
+
return workInProgress.child;
|
|
15475
|
+
} else {
|
|
15476
|
+
// Something suspended. Leave the existing children in place.
|
|
15477
|
+
// TODO: In non-concurrent mode, should we commit the nodes we have hydrated so far?
|
|
15478
|
+
workInProgress.child = null;
|
|
15479
|
+
return null;
|
|
15480
|
+
}
|
|
15481
|
+
}
|
|
15482
|
+
|
|
15100
15483
|
function updatePortalComponent(current$$1, workInProgress, renderExpirationTime) {
|
|
15101
15484
|
pushHostContainer(workInProgress, workInProgress.stateNode.containerInfo);
|
|
15102
15485
|
var nextChildren = workInProgress.pendingProps;
|
|
@@ -15308,6 +15691,16 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
|
|
|
15308
15691
|
}
|
|
15309
15692
|
break;
|
|
15310
15693
|
}
|
|
15694
|
+
case DehydratedSuspenseComponent:
|
|
15695
|
+
{
|
|
15696
|
+
if (enableSuspenseServerRenderer) {
|
|
15697
|
+
// We know that this component will suspend again because if it has
|
|
15698
|
+
// been unsuspended it has committed as a regular Suspense component.
|
|
15699
|
+
// If it needs to be retried, it should have work scheduled on it.
|
|
15700
|
+
workInProgress.effectTag |= DidCapture;
|
|
15701
|
+
break;
|
|
15702
|
+
}
|
|
15703
|
+
}
|
|
15311
15704
|
}
|
|
15312
15705
|
return bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
|
|
15313
15706
|
}
|
|
@@ -15399,9 +15792,15 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
|
|
|
15399
15792
|
var _resolvedProps4 = workInProgress.elementType === _Component3 ? _unresolvedProps4 : resolveDefaultProps(_Component3, _unresolvedProps4);
|
|
15400
15793
|
return mountIncompleteClassComponent(current$$1, workInProgress, _Component3, _resolvedProps4, renderExpirationTime);
|
|
15401
15794
|
}
|
|
15402
|
-
|
|
15403
|
-
|
|
15795
|
+
case DehydratedSuspenseComponent:
|
|
15796
|
+
{
|
|
15797
|
+
if (enableSuspenseServerRenderer) {
|
|
15798
|
+
return updateDehydratedSuspenseComponent(current$$1, workInProgress, renderExpirationTime);
|
|
15799
|
+
}
|
|
15800
|
+
break;
|
|
15801
|
+
}
|
|
15404
15802
|
}
|
|
15803
|
+
invariant(false, 'Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue.');
|
|
15405
15804
|
}
|
|
15406
15805
|
|
|
15407
15806
|
var valueCursor = createCursor(null);
|
|
@@ -15490,6 +15889,28 @@ function calculateChangedBits(context, newValue, oldValue) {
|
|
|
15490
15889
|
}
|
|
15491
15890
|
}
|
|
15492
15891
|
|
|
15892
|
+
function scheduleWorkOnParentPath(parent, renderExpirationTime) {
|
|
15893
|
+
// Update the child expiration time of all the ancestors, including
|
|
15894
|
+
// the alternates.
|
|
15895
|
+
var node = parent;
|
|
15896
|
+
while (node !== null) {
|
|
15897
|
+
var alternate = node.alternate;
|
|
15898
|
+
if (node.childExpirationTime < renderExpirationTime) {
|
|
15899
|
+
node.childExpirationTime = renderExpirationTime;
|
|
15900
|
+
if (alternate !== null && alternate.childExpirationTime < renderExpirationTime) {
|
|
15901
|
+
alternate.childExpirationTime = renderExpirationTime;
|
|
15902
|
+
}
|
|
15903
|
+
} else if (alternate !== null && alternate.childExpirationTime < renderExpirationTime) {
|
|
15904
|
+
alternate.childExpirationTime = renderExpirationTime;
|
|
15905
|
+
} else {
|
|
15906
|
+
// Neither alternate was updated, which means the rest of the
|
|
15907
|
+
// ancestor path already has sufficient priority.
|
|
15908
|
+
break;
|
|
15909
|
+
}
|
|
15910
|
+
node = node.return;
|
|
15911
|
+
}
|
|
15912
|
+
}
|
|
15913
|
+
|
|
15493
15914
|
function propagateContextChange(workInProgress, context, changedBits, renderExpirationTime) {
|
|
15494
15915
|
var fiber = workInProgress.child;
|
|
15495
15916
|
if (fiber !== null) {
|
|
@@ -15528,25 +15949,8 @@ function propagateContextChange(workInProgress, context, changedBits, renderExpi
|
|
|
15528
15949
|
if (alternate !== null && alternate.expirationTime < renderExpirationTime) {
|
|
15529
15950
|
alternate.expirationTime = renderExpirationTime;
|
|
15530
15951
|
}
|
|
15531
|
-
|
|
15532
|
-
|
|
15533
|
-
var node = fiber.return;
|
|
15534
|
-
while (node !== null) {
|
|
15535
|
-
alternate = node.alternate;
|
|
15536
|
-
if (node.childExpirationTime < renderExpirationTime) {
|
|
15537
|
-
node.childExpirationTime = renderExpirationTime;
|
|
15538
|
-
if (alternate !== null && alternate.childExpirationTime < renderExpirationTime) {
|
|
15539
|
-
alternate.childExpirationTime = renderExpirationTime;
|
|
15540
|
-
}
|
|
15541
|
-
} else if (alternate !== null && alternate.childExpirationTime < renderExpirationTime) {
|
|
15542
|
-
alternate.childExpirationTime = renderExpirationTime;
|
|
15543
|
-
} else {
|
|
15544
|
-
// Neither alternate was updated, which means the rest of the
|
|
15545
|
-
// ancestor path already has sufficient priority.
|
|
15546
|
-
break;
|
|
15547
|
-
}
|
|
15548
|
-
node = node.return;
|
|
15549
|
-
}
|
|
15952
|
+
|
|
15953
|
+
scheduleWorkOnParentPath(fiber.return, renderExpirationTime);
|
|
15550
15954
|
|
|
15551
15955
|
// Mark the expiration time on the list, too.
|
|
15552
15956
|
if (list.expirationTime < renderExpirationTime) {
|
|
@@ -15562,6 +15966,23 @@ function propagateContextChange(workInProgress, context, changedBits, renderExpi
|
|
|
15562
15966
|
} else if (fiber.tag === ContextProvider) {
|
|
15563
15967
|
// Don't scan deeper if this is a matching provider
|
|
15564
15968
|
nextFiber = fiber.type === workInProgress.type ? null : fiber.child;
|
|
15969
|
+
} else if (enableSuspenseServerRenderer && fiber.tag === DehydratedSuspenseComponent) {
|
|
15970
|
+
// If a dehydrated suspense component is in this subtree, we don't know
|
|
15971
|
+
// if it will have any context consumers in it. The best we can do is
|
|
15972
|
+
// mark it as having updates on its children.
|
|
15973
|
+
if (fiber.expirationTime < renderExpirationTime) {
|
|
15974
|
+
fiber.expirationTime = renderExpirationTime;
|
|
15975
|
+
}
|
|
15976
|
+
var _alternate = fiber.alternate;
|
|
15977
|
+
if (_alternate !== null && _alternate.expirationTime < renderExpirationTime) {
|
|
15978
|
+
_alternate.expirationTime = renderExpirationTime;
|
|
15979
|
+
}
|
|
15980
|
+
// This is intentionally passing this fiber as the parent
|
|
15981
|
+
// because we want to schedule this fiber as having work
|
|
15982
|
+
// on its children. We'll use the childExpirationTime on
|
|
15983
|
+
// this fiber to indicate that a context has changed.
|
|
15984
|
+
scheduleWorkOnParentPath(fiber, renderExpirationTime);
|
|
15985
|
+
nextFiber = fiber.sibling;
|
|
15565
15986
|
} else {
|
|
15566
15987
|
// Traverse down.
|
|
15567
15988
|
nextFiber = fiber.child;
|
|
@@ -16685,6 +17106,26 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
16685
17106
|
}
|
|
16686
17107
|
break;
|
|
16687
17108
|
}
|
|
17109
|
+
case DehydratedSuspenseComponent:
|
|
17110
|
+
{
|
|
17111
|
+
if (enableSuspenseServerRenderer) {
|
|
17112
|
+
if (current === null) {
|
|
17113
|
+
var _wasHydrated2 = popHydrationState(workInProgress);
|
|
17114
|
+
!_wasHydrated2 ? invariant(false, 'A dehydrated suspense component was completed without a hydrated node. This is probably a bug in React.') : void 0;
|
|
17115
|
+
skipPastDehydratedSuspenseInstance(workInProgress);
|
|
17116
|
+
} else if ((workInProgress.effectTag & DidCapture) === NoEffect) {
|
|
17117
|
+
// This boundary did not suspend so it's now hydrated.
|
|
17118
|
+
// To handle any future suspense cases, we're going to now upgrade it
|
|
17119
|
+
// to a Suspense component. We detach it from the existing current fiber.
|
|
17120
|
+
current.alternate = null;
|
|
17121
|
+
workInProgress.alternate = null;
|
|
17122
|
+
workInProgress.tag = SuspenseComponent;
|
|
17123
|
+
workInProgress.memoizedState = null;
|
|
17124
|
+
workInProgress.stateNode = null;
|
|
17125
|
+
}
|
|
17126
|
+
}
|
|
17127
|
+
break;
|
|
17128
|
+
}
|
|
16688
17129
|
default:
|
|
16689
17130
|
invariant(false, 'Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue.');
|
|
16690
17131
|
}
|
|
@@ -16775,7 +17216,7 @@ var didWarnAboutUndefinedSnapshotBeforeUpdate = null;
|
|
|
16775
17216
|
didWarnAboutUndefinedSnapshotBeforeUpdate = new Set();
|
|
16776
17217
|
}
|
|
16777
17218
|
|
|
16778
|
-
var PossiblyWeakSet = typeof WeakSet === 'function' ? WeakSet : Set;
|
|
17219
|
+
var PossiblyWeakSet$1 = typeof WeakSet === 'function' ? WeakSet : Set;
|
|
16779
17220
|
|
|
16780
17221
|
function logError(boundary, errorInfo) {
|
|
16781
17222
|
var source = errorInfo.source;
|
|
@@ -17088,7 +17529,7 @@ function commitLifeCycles(finishedRoot, current$$1, finishedWork, committedExpir
|
|
|
17088
17529
|
|
|
17089
17530
|
function hideOrUnhideAllChildren(finishedWork, isHidden) {
|
|
17090
17531
|
if (supportsMutation) {
|
|
17091
|
-
// We only have the top Fiber that was inserted but we need recurse down its
|
|
17532
|
+
// We only have the top Fiber that was inserted but we need to recurse down its
|
|
17092
17533
|
var node = finishedWork;
|
|
17093
17534
|
while (true) {
|
|
17094
17535
|
if (node.tag === HostComponent) {
|
|
@@ -17356,7 +17797,7 @@ function getHostSibling(fiber) {
|
|
|
17356
17797
|
}
|
|
17357
17798
|
node.sibling.return = node.return;
|
|
17358
17799
|
node = node.sibling;
|
|
17359
|
-
while (node.tag !== HostComponent && node.tag !== HostText) {
|
|
17800
|
+
while (node.tag !== HostComponent && node.tag !== HostText && node.tag !== DehydratedSuspenseComponent) {
|
|
17360
17801
|
// If it is not host node and, we might have a host node inside it.
|
|
17361
17802
|
// Try to search down until we find one.
|
|
17362
17803
|
if (node.effectTag & Placement) {
|
|
@@ -17416,7 +17857,7 @@ function commitPlacement(finishedWork) {
|
|
|
17416
17857
|
}
|
|
17417
17858
|
|
|
17418
17859
|
var before = getHostSibling(finishedWork);
|
|
17419
|
-
// We only have the top Fiber that was inserted but we need recurse down its
|
|
17860
|
+
// We only have the top Fiber that was inserted but we need to recurse down its
|
|
17420
17861
|
// children to find all the terminal nodes.
|
|
17421
17862
|
var node = finishedWork;
|
|
17422
17863
|
while (true) {
|
|
@@ -17458,7 +17899,7 @@ function commitPlacement(finishedWork) {
|
|
|
17458
17899
|
}
|
|
17459
17900
|
|
|
17460
17901
|
function unmountHostComponents(current$$1) {
|
|
17461
|
-
// We only have the top Fiber that was deleted but we need recurse down its
|
|
17902
|
+
// We only have the top Fiber that was deleted but we need to recurse down its
|
|
17462
17903
|
var node = current$$1;
|
|
17463
17904
|
|
|
17464
17905
|
// Each iteration, currentParent is populated with node's host parent if not
|
|
@@ -17503,13 +17944,20 @@ function unmountHostComponents(current$$1) {
|
|
|
17503
17944
|
removeChild(currentParent, node.stateNode);
|
|
17504
17945
|
}
|
|
17505
17946
|
// Don't visit children because we already visited them.
|
|
17947
|
+
} else if (enableSuspenseServerRenderer && node.tag === DehydratedSuspenseComponent) {
|
|
17948
|
+
// Delete the dehydrated suspense boundary and all of its content.
|
|
17949
|
+
if (currentParentIsContainer) {
|
|
17950
|
+
clearSuspenseBoundaryFromContainer(currentParent, node.stateNode);
|
|
17951
|
+
} else {
|
|
17952
|
+
clearSuspenseBoundary(currentParent, node.stateNode);
|
|
17953
|
+
}
|
|
17506
17954
|
} else if (node.tag === HostPortal) {
|
|
17507
|
-
// When we go into a portal, it becomes the parent to remove from.
|
|
17508
|
-
// We will reassign it back when we pop the portal on the way up.
|
|
17509
|
-
currentParent = node.stateNode.containerInfo;
|
|
17510
|
-
currentParentIsContainer = true;
|
|
17511
|
-
// Visit children because portals might contain host components.
|
|
17512
17955
|
if (node.child !== null) {
|
|
17956
|
+
// When we go into a portal, it becomes the parent to remove from.
|
|
17957
|
+
// We will reassign it back when we pop the portal on the way up.
|
|
17958
|
+
currentParent = node.stateNode.containerInfo;
|
|
17959
|
+
currentParentIsContainer = true;
|
|
17960
|
+
// Visit children because portals might contain host components.
|
|
17513
17961
|
node.child.return = node;
|
|
17514
17962
|
node = node.child;
|
|
17515
17963
|
continue;
|
|
@@ -17659,7 +18107,7 @@ function commitWork(current$$1, finishedWork) {
|
|
|
17659
18107
|
finishedWork.updateQueue = null;
|
|
17660
18108
|
var retryCache = finishedWork.stateNode;
|
|
17661
18109
|
if (retryCache === null) {
|
|
17662
|
-
retryCache = finishedWork.stateNode = new PossiblyWeakSet();
|
|
18110
|
+
retryCache = finishedWork.stateNode = new PossiblyWeakSet$1();
|
|
17663
18111
|
}
|
|
17664
18112
|
thenables.forEach(function (thenable) {
|
|
17665
18113
|
// Memoize using the boundary fiber to prevent redundant listeners.
|
|
@@ -17694,6 +18142,7 @@ function commitResetTextContent(current$$1) {
|
|
|
17694
18142
|
resetTextContent(current$$1.stateNode);
|
|
17695
18143
|
}
|
|
17696
18144
|
|
|
18145
|
+
var PossiblyWeakSet = typeof WeakSet === 'function' ? WeakSet : Set;
|
|
17697
18146
|
var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;
|
|
17698
18147
|
|
|
17699
18148
|
function createRootErrorUpdate(fiber, errorInfo, expirationTime) {
|
|
@@ -17752,6 +18201,34 @@ function createClassErrorUpdate(fiber, errorInfo, expirationTime) {
|
|
|
17752
18201
|
return update;
|
|
17753
18202
|
}
|
|
17754
18203
|
|
|
18204
|
+
function attachPingListener(root, renderExpirationTime, thenable) {
|
|
18205
|
+
// Attach a listener to the promise to "ping" the root and retry. But
|
|
18206
|
+
// only if one does not already exist for the current render expiration
|
|
18207
|
+
// time (which acts like a "thread ID" here).
|
|
18208
|
+
var pingCache = root.pingCache;
|
|
18209
|
+
var threadIDs = void 0;
|
|
18210
|
+
if (pingCache === null) {
|
|
18211
|
+
pingCache = root.pingCache = new PossiblyWeakMap();
|
|
18212
|
+
threadIDs = new Set();
|
|
18213
|
+
pingCache.set(thenable, threadIDs);
|
|
18214
|
+
} else {
|
|
18215
|
+
threadIDs = pingCache.get(thenable);
|
|
18216
|
+
if (threadIDs === undefined) {
|
|
18217
|
+
threadIDs = new Set();
|
|
18218
|
+
pingCache.set(thenable, threadIDs);
|
|
18219
|
+
}
|
|
18220
|
+
}
|
|
18221
|
+
if (!threadIDs.has(renderExpirationTime)) {
|
|
18222
|
+
// Memoize using the thread ID to prevent redundant listeners.
|
|
18223
|
+
threadIDs.add(renderExpirationTime);
|
|
18224
|
+
var ping = pingSuspendedRoot.bind(null, root, thenable, renderExpirationTime);
|
|
18225
|
+
if (enableSchedulerTracing) {
|
|
18226
|
+
ping = unstable_wrap(ping);
|
|
18227
|
+
}
|
|
18228
|
+
thenable.then(ping, ping);
|
|
18229
|
+
}
|
|
18230
|
+
}
|
|
18231
|
+
|
|
17755
18232
|
function throwException(root, returnFiber, sourceFiber, value, renderExpirationTime) {
|
|
17756
18233
|
// The source fiber did not complete.
|
|
17757
18234
|
sourceFiber.effectTag |= Incomplete;
|
|
@@ -17793,6 +18270,9 @@ function throwException(root, returnFiber, sourceFiber, value, renderExpirationT
|
|
|
17793
18270
|
}
|
|
17794
18271
|
}
|
|
17795
18272
|
}
|
|
18273
|
+
// If there is a DehydratedSuspenseComponent we don't have to do anything because
|
|
18274
|
+
// if something suspends inside it, we will simply leave that as dehydrated. It
|
|
18275
|
+
// will never timeout.
|
|
17796
18276
|
_workInProgress = _workInProgress.return;
|
|
17797
18277
|
} while (_workInProgress !== null);
|
|
17798
18278
|
|
|
@@ -17856,31 +18336,7 @@ function throwException(root, returnFiber, sourceFiber, value, renderExpirationT
|
|
|
17856
18336
|
// Confirmed that the boundary is in a concurrent mode tree. Continue
|
|
17857
18337
|
// with the normal suspend path.
|
|
17858
18338
|
|
|
17859
|
-
|
|
17860
|
-
// only if one does not already exist for the current render expiration
|
|
17861
|
-
// time (which acts like a "thread ID" here).
|
|
17862
|
-
var pingCache = root.pingCache;
|
|
17863
|
-
var threadIDs = void 0;
|
|
17864
|
-
if (pingCache === null) {
|
|
17865
|
-
pingCache = root.pingCache = new PossiblyWeakMap();
|
|
17866
|
-
threadIDs = new Set();
|
|
17867
|
-
pingCache.set(thenable, threadIDs);
|
|
17868
|
-
} else {
|
|
17869
|
-
threadIDs = pingCache.get(thenable);
|
|
17870
|
-
if (threadIDs === undefined) {
|
|
17871
|
-
threadIDs = new Set();
|
|
17872
|
-
pingCache.set(thenable, threadIDs);
|
|
17873
|
-
}
|
|
17874
|
-
}
|
|
17875
|
-
if (!threadIDs.has(renderExpirationTime)) {
|
|
17876
|
-
// Memoize using the thread ID to prevent redundant listeners.
|
|
17877
|
-
threadIDs.add(renderExpirationTime);
|
|
17878
|
-
var ping = pingSuspendedRoot.bind(null, root, thenable, renderExpirationTime);
|
|
17879
|
-
if (enableSchedulerTracing) {
|
|
17880
|
-
ping = unstable_wrap(ping);
|
|
17881
|
-
}
|
|
17882
|
-
thenable.then(ping, ping);
|
|
17883
|
-
}
|
|
18339
|
+
attachPingListener(root, renderExpirationTime, thenable);
|
|
17884
18340
|
|
|
17885
18341
|
var absoluteTimeoutMs = void 0;
|
|
17886
18342
|
if (earliestTimeoutMs === -1) {
|
|
@@ -17912,6 +18368,29 @@ function throwException(root, returnFiber, sourceFiber, value, renderExpirationT
|
|
|
17912
18368
|
// whole tree.
|
|
17913
18369
|
renderDidSuspend(root, absoluteTimeoutMs, renderExpirationTime);
|
|
17914
18370
|
|
|
18371
|
+
_workInProgress.effectTag |= ShouldCapture;
|
|
18372
|
+
_workInProgress.expirationTime = renderExpirationTime;
|
|
18373
|
+
return;
|
|
18374
|
+
} else if (enableSuspenseServerRenderer && _workInProgress.tag === DehydratedSuspenseComponent) {
|
|
18375
|
+
attachPingListener(root, renderExpirationTime, thenable);
|
|
18376
|
+
|
|
18377
|
+
// Since we already have a current fiber, we can eagerly add a retry listener.
|
|
18378
|
+
var retryCache = _workInProgress.memoizedState;
|
|
18379
|
+
if (retryCache === null) {
|
|
18380
|
+
retryCache = _workInProgress.memoizedState = new PossiblyWeakSet();
|
|
18381
|
+
var _current = _workInProgress.alternate;
|
|
18382
|
+
!_current ? invariant(false, 'A dehydrated suspense boundary must commit before trying to render. This is probably a bug in React.') : void 0;
|
|
18383
|
+
_current.memoizedState = retryCache;
|
|
18384
|
+
}
|
|
18385
|
+
// Memoize using the boundary fiber to prevent redundant listeners.
|
|
18386
|
+
if (!retryCache.has(thenable)) {
|
|
18387
|
+
retryCache.add(thenable);
|
|
18388
|
+
var retry = retryTimedOutBoundary.bind(null, _workInProgress, thenable);
|
|
18389
|
+
if (enableSchedulerTracing) {
|
|
18390
|
+
retry = unstable_wrap(retry);
|
|
18391
|
+
}
|
|
18392
|
+
thenable.then(retry, retry);
|
|
18393
|
+
}
|
|
17915
18394
|
_workInProgress.effectTag |= ShouldCapture;
|
|
17916
18395
|
_workInProgress.expirationTime = renderExpirationTime;
|
|
17917
18396
|
return;
|
|
@@ -17989,6 +18468,7 @@ function unwindWork(workInProgress, renderExpirationTime) {
|
|
|
17989
18468
|
}
|
|
17990
18469
|
case HostComponent:
|
|
17991
18470
|
{
|
|
18471
|
+
// TODO: popHydrationState
|
|
17992
18472
|
popHostContext(workInProgress);
|
|
17993
18473
|
return null;
|
|
17994
18474
|
}
|
|
@@ -18002,6 +18482,19 @@ function unwindWork(workInProgress, renderExpirationTime) {
|
|
|
18002
18482
|
}
|
|
18003
18483
|
return null;
|
|
18004
18484
|
}
|
|
18485
|
+
case DehydratedSuspenseComponent:
|
|
18486
|
+
{
|
|
18487
|
+
if (enableSuspenseServerRenderer) {
|
|
18488
|
+
// TODO: popHydrationState
|
|
18489
|
+
var _effectTag3 = workInProgress.effectTag;
|
|
18490
|
+
if (_effectTag3 & ShouldCapture) {
|
|
18491
|
+
workInProgress.effectTag = _effectTag3 & ~ShouldCapture | DidCapture;
|
|
18492
|
+
// Captured a suspense effect. Re-render the boundary.
|
|
18493
|
+
return workInProgress;
|
|
18494
|
+
}
|
|
18495
|
+
}
|
|
18496
|
+
return null;
|
|
18497
|
+
}
|
|
18005
18498
|
case HostPortal:
|
|
18006
18499
|
popHostContainer(workInProgress);
|
|
18007
18500
|
return null;
|
|
@@ -18099,11 +18592,6 @@ if (enableSchedulerTracing) {
|
|
|
18099
18592
|
// Used to ensure computeUniqueAsyncExpiration is monotonically decreasing.
|
|
18100
18593
|
var lastUniqueAsyncExpiration = Sync - 1;
|
|
18101
18594
|
|
|
18102
|
-
// Represents the expiration time that incoming updates should use. (If this
|
|
18103
|
-
// is NoWork, use the default strategy: async updates in async mode, sync
|
|
18104
|
-
// updates in sync mode.)
|
|
18105
|
-
var expirationContext = NoWork;
|
|
18106
|
-
|
|
18107
18595
|
var isWorking = false;
|
|
18108
18596
|
|
|
18109
18597
|
// The next work in progress fiber that we're currently working on.
|
|
@@ -18399,6 +18887,10 @@ function commitPassiveEffects(root, firstEffect) {
|
|
|
18399
18887
|
if (rootExpirationTime !== NoWork) {
|
|
18400
18888
|
requestWork(root, rootExpirationTime);
|
|
18401
18889
|
}
|
|
18890
|
+
// Flush any sync work that was scheduled by effects
|
|
18891
|
+
if (!isBatchingUpdates && !isRendering) {
|
|
18892
|
+
performSyncWork();
|
|
18893
|
+
}
|
|
18402
18894
|
}
|
|
18403
18895
|
|
|
18404
18896
|
function isAlreadyFailedLegacyErrorBoundary(instance) {
|
|
@@ -18573,7 +19065,9 @@ function commitRoot(root, finishedWork) {
|
|
|
18573
19065
|
// here because that code is still in flux.
|
|
18574
19066
|
callback = unstable_wrap(callback);
|
|
18575
19067
|
}
|
|
18576
|
-
passiveEffectCallbackHandle =
|
|
19068
|
+
passiveEffectCallbackHandle = unstable_runWithPriority(unstable_NormalPriority, function () {
|
|
19069
|
+
return schedulePassiveEffects(callback);
|
|
19070
|
+
});
|
|
18577
19071
|
passiveEffectCallback = callback;
|
|
18578
19072
|
}
|
|
18579
19073
|
|
|
@@ -19162,7 +19656,7 @@ function renderRoot(root, isYieldy) {
|
|
|
19162
19656
|
return;
|
|
19163
19657
|
} else if (
|
|
19164
19658
|
// There's no lower priority work, but we're rendering asynchronously.
|
|
19165
|
-
//
|
|
19659
|
+
// Synchronously attempt to render the same level one more time. This is
|
|
19166
19660
|
// similar to a suspend, but without a timeout because we're not waiting
|
|
19167
19661
|
// for a promise to resolve.
|
|
19168
19662
|
!root.didError && isYieldy) {
|
|
@@ -19267,49 +19761,50 @@ function computeUniqueAsyncExpiration() {
|
|
|
19267
19761
|
}
|
|
19268
19762
|
|
|
19269
19763
|
function computeExpirationForFiber(currentTime, fiber) {
|
|
19764
|
+
var priorityLevel = unstable_getCurrentPriorityLevel();
|
|
19765
|
+
|
|
19270
19766
|
var expirationTime = void 0;
|
|
19271
|
-
if (
|
|
19272
|
-
//
|
|
19273
|
-
expirationTime =
|
|
19274
|
-
} else if (isWorking) {
|
|
19275
|
-
|
|
19276
|
-
|
|
19277
|
-
// by default.
|
|
19278
|
-
expirationTime = Sync;
|
|
19279
|
-
} else {
|
|
19280
|
-
// Updates during the render phase should expire at the same time as
|
|
19281
|
-
// the work that is being rendered.
|
|
19282
|
-
expirationTime = nextRenderExpirationTime;
|
|
19283
|
-
}
|
|
19767
|
+
if ((fiber.mode & ConcurrentMode) === NoContext) {
|
|
19768
|
+
// Outside of concurrent mode, updates are always synchronous.
|
|
19769
|
+
expirationTime = Sync;
|
|
19770
|
+
} else if (isWorking && !isCommitting$1) {
|
|
19771
|
+
// During render phase, updates expire during as the current render.
|
|
19772
|
+
expirationTime = nextRenderExpirationTime;
|
|
19284
19773
|
} else {
|
|
19285
|
-
|
|
19286
|
-
|
|
19287
|
-
|
|
19288
|
-
|
|
19289
|
-
|
|
19774
|
+
switch (priorityLevel) {
|
|
19775
|
+
case unstable_ImmediatePriority:
|
|
19776
|
+
expirationTime = Sync;
|
|
19777
|
+
break;
|
|
19778
|
+
case unstable_UserBlockingPriority:
|
|
19290
19779
|
expirationTime = computeInteractiveExpiration(currentTime);
|
|
19291
|
-
|
|
19292
|
-
|
|
19780
|
+
break;
|
|
19781
|
+
case unstable_NormalPriority:
|
|
19782
|
+
// This is a normal, concurrent update
|
|
19293
19783
|
expirationTime = computeAsyncExpiration(currentTime);
|
|
19294
|
-
|
|
19295
|
-
|
|
19296
|
-
|
|
19297
|
-
|
|
19298
|
-
|
|
19299
|
-
|
|
19300
|
-
|
|
19301
|
-
// This is a sync update
|
|
19302
|
-
expirationTime = Sync;
|
|
19784
|
+
break;
|
|
19785
|
+
case unstable_LowPriority:
|
|
19786
|
+
case unstable_IdlePriority:
|
|
19787
|
+
expirationTime = Never;
|
|
19788
|
+
break;
|
|
19789
|
+
default:
|
|
19790
|
+
invariant(false, 'Unknown priority level. This error is likely caused by a bug in React. Please file an issue.');
|
|
19303
19791
|
}
|
|
19304
|
-
|
|
19305
|
-
|
|
19306
|
-
//
|
|
19307
|
-
|
|
19308
|
-
|
|
19309
|
-
if (lowestPriorityPendingInteractiveExpirationTime === NoWork || expirationTime < lowestPriorityPendingInteractiveExpirationTime) {
|
|
19310
|
-
lowestPriorityPendingInteractiveExpirationTime = expirationTime;
|
|
19792
|
+
|
|
19793
|
+
// If we're in the middle of rendering a tree, do not update at the same
|
|
19794
|
+
// expiration time that is already rendering.
|
|
19795
|
+
if (nextRoot !== null && expirationTime === nextRenderExpirationTime) {
|
|
19796
|
+
expirationTime -= 1;
|
|
19311
19797
|
}
|
|
19312
19798
|
}
|
|
19799
|
+
|
|
19800
|
+
// Keep track of the lowest pending interactive expiration time. This
|
|
19801
|
+
// allows us to synchronously flush all interactive updates
|
|
19802
|
+
// when needed.
|
|
19803
|
+
// TODO: Move this to renderer?
|
|
19804
|
+
if (priorityLevel === unstable_UserBlockingPriority && (lowestPriorityPendingInteractiveExpirationTime === NoWork || expirationTime < lowestPriorityPendingInteractiveExpirationTime)) {
|
|
19805
|
+
lowestPriorityPendingInteractiveExpirationTime = expirationTime;
|
|
19806
|
+
}
|
|
19807
|
+
|
|
19313
19808
|
return expirationTime;
|
|
19314
19809
|
}
|
|
19315
19810
|
|
|
@@ -19356,7 +19851,21 @@ function retryTimedOutBoundary(boundaryFiber, thenable) {
|
|
|
19356
19851
|
// The boundary fiber (a Suspense component) previously timed out and was
|
|
19357
19852
|
// rendered in its fallback state. One of the promises that suspended it has
|
|
19358
19853
|
// resolved, which means at least part of the tree was likely unblocked. Try
|
|
19359
|
-
var retryCache =
|
|
19854
|
+
var retryCache = void 0;
|
|
19855
|
+
if (enableSuspenseServerRenderer) {
|
|
19856
|
+
switch (boundaryFiber.tag) {
|
|
19857
|
+
case SuspenseComponent:
|
|
19858
|
+
retryCache = boundaryFiber.stateNode;
|
|
19859
|
+
break;
|
|
19860
|
+
case DehydratedSuspenseComponent:
|
|
19861
|
+
retryCache = boundaryFiber.memoizedState;
|
|
19862
|
+
break;
|
|
19863
|
+
default:
|
|
19864
|
+
invariant(false, 'Pinged unknown suspense boundary type. This is probably a bug in React.');
|
|
19865
|
+
}
|
|
19866
|
+
} else {
|
|
19867
|
+
retryCache = boundaryFiber.stateNode;
|
|
19868
|
+
}
|
|
19360
19869
|
if (retryCache !== null) {
|
|
19361
19870
|
// The thenable resolved, so we no longer need to memoize, because it will
|
|
19362
19871
|
// never be thrown again.
|
|
@@ -19455,7 +19964,7 @@ function scheduleWorkToRoot(fiber, expirationTime) {
|
|
|
19455
19964
|
function warnIfNotCurrentlyBatchingInDev(fiber) {
|
|
19456
19965
|
{
|
|
19457
19966
|
if (isRendering === false && isBatchingUpdates === false) {
|
|
19458
|
-
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));
|
|
19967
|
+
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));
|
|
19459
19968
|
}
|
|
19460
19969
|
}
|
|
19461
19970
|
}
|
|
@@ -19502,13 +20011,9 @@ function scheduleWork(fiber, expirationTime) {
|
|
|
19502
20011
|
}
|
|
19503
20012
|
|
|
19504
20013
|
function syncUpdates(fn, a, b, c, d) {
|
|
19505
|
-
|
|
19506
|
-
expirationContext = Sync;
|
|
19507
|
-
try {
|
|
20014
|
+
return unstable_runWithPriority(unstable_ImmediatePriority, function () {
|
|
19508
20015
|
return fn(a, b, c, d);
|
|
19509
|
-
}
|
|
19510
|
-
expirationContext = previousExpirationContext;
|
|
19511
|
-
}
|
|
20016
|
+
});
|
|
19512
20017
|
}
|
|
19513
20018
|
|
|
19514
20019
|
// TODO: Everything below this is written as if it has been lifted to the
|
|
@@ -19529,7 +20034,6 @@ var unhandledError = null;
|
|
|
19529
20034
|
|
|
19530
20035
|
var isBatchingUpdates = false;
|
|
19531
20036
|
var isUnbatchingUpdates = false;
|
|
19532
|
-
var isBatchingInteractiveUpdates = false;
|
|
19533
20037
|
|
|
19534
20038
|
var completedBatches = null;
|
|
19535
20039
|
|
|
@@ -20003,7 +20507,9 @@ function completeRoot(root, finishedWork, expirationTime) {
|
|
|
20003
20507
|
lastCommittedRootDuringThisBatch = root;
|
|
20004
20508
|
nestedUpdateCount = 0;
|
|
20005
20509
|
}
|
|
20006
|
-
|
|
20510
|
+
unstable_runWithPriority(unstable_ImmediatePriority, function () {
|
|
20511
|
+
commitRoot(root, finishedWork);
|
|
20512
|
+
});
|
|
20007
20513
|
}
|
|
20008
20514
|
|
|
20009
20515
|
function onUncaughtError(error) {
|
|
@@ -20061,9 +20567,6 @@ function flushSync(fn, a) {
|
|
|
20061
20567
|
}
|
|
20062
20568
|
|
|
20063
20569
|
function interactiveUpdates$1(fn, a, b) {
|
|
20064
|
-
if (isBatchingInteractiveUpdates) {
|
|
20065
|
-
return fn(a, b);
|
|
20066
|
-
}
|
|
20067
20570
|
// If there are any pending interactive updates, synchronously flush them.
|
|
20068
20571
|
// This needs to happen before we read any handlers, because the effect of
|
|
20069
20572
|
// the previous event may influence which handlers are called during
|
|
@@ -20073,14 +20576,13 @@ function interactiveUpdates$1(fn, a, b) {
|
|
|
20073
20576
|
performWork(lowestPriorityPendingInteractiveExpirationTime, false);
|
|
20074
20577
|
lowestPriorityPendingInteractiveExpirationTime = NoWork;
|
|
20075
20578
|
}
|
|
20076
|
-
var previousIsBatchingInteractiveUpdates = isBatchingInteractiveUpdates;
|
|
20077
20579
|
var previousIsBatchingUpdates = isBatchingUpdates;
|
|
20078
|
-
isBatchingInteractiveUpdates = true;
|
|
20079
20580
|
isBatchingUpdates = true;
|
|
20080
20581
|
try {
|
|
20081
|
-
return
|
|
20582
|
+
return unstable_runWithPriority(unstable_UserBlockingPriority, function () {
|
|
20583
|
+
return fn(a, b);
|
|
20584
|
+
});
|
|
20082
20585
|
} finally {
|
|
20083
|
-
isBatchingInteractiveUpdates = previousIsBatchingInteractiveUpdates;
|
|
20084
20586
|
isBatchingUpdates = previousIsBatchingUpdates;
|
|
20085
20587
|
if (!isBatchingUpdates && !isRendering) {
|
|
20086
20588
|
performSyncWork();
|
|
@@ -20343,7 +20845,7 @@ implementation) {
|
|
|
20343
20845
|
|
|
20344
20846
|
// TODO: this is special because it gets imported during build.
|
|
20345
20847
|
|
|
20346
|
-
var ReactVersion = '16.8.
|
|
20848
|
+
var ReactVersion = '16.8.4';
|
|
20347
20849
|
|
|
20348
20850
|
// This file is copy paste from ReactDOM with adjusted paths
|
|
20349
20851
|
// and a different host config import (react-reconciler/inline.fire).
|
|
@@ -20738,7 +21240,7 @@ var ReactDOM = {
|
|
|
20738
21240
|
hydrate: function (element, container, callback) {
|
|
20739
21241
|
!isValidContainer(container) ? invariant(false, 'Target container is not a DOM element.') : void 0;
|
|
20740
21242
|
{
|
|
20741
|
-
!!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
|
|
21243
|
+
!!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;
|
|
20742
21244
|
}
|
|
20743
21245
|
// TODO: throw or warn if we couldn't hydrate?
|
|
20744
21246
|
return legacyRenderSubtreeIntoContainer(null, element, container, true, callback);
|