react-dom 16.8.1 → 16.8.2
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 +6 -6
- package/cjs/react-dom-server.browser.development.js +55 -34
- package/cjs/react-dom-server.browser.production.min.js +3 -3
- package/cjs/react-dom-server.node.development.js +55 -34
- package/cjs/react-dom-server.node.production.min.js +3 -3
- 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 +464 -139
- package/cjs/react-dom-unstable-fire.production.min.js +252 -251
- package/cjs/react-dom-unstable-fire.profiling.min.js +175 -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 +464 -139
- package/cjs/react-dom.production.min.js +252 -251
- package/cjs/react-dom.profiling.min.js +175 -173
- package/package.json +2 -2
- package/umd/react-dom-server.browser.development.js +55 -34
- package/umd/react-dom-server.browser.production.min.js +20 -20
- 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 +472 -139
- 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 +472 -139
- 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.2
|
|
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;
|
|
@@ -2901,12 +2902,15 @@ var capitalize = function (token) {
|
|
|
2901
2902
|
attributeName, 'http://www.w3.org/XML/1998/namespace');
|
|
2902
2903
|
});
|
|
2903
2904
|
|
|
2904
|
-
//
|
|
2905
|
-
//
|
|
2906
|
-
//
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
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
|
+
);
|
|
2910
2914
|
|
|
2911
2915
|
/**
|
|
2912
2916
|
* Get the value for a property on a node. Only used in DEV for SSR validation.
|
|
@@ -3250,7 +3254,7 @@ var enableProfilerTimer = true;
|
|
|
3250
3254
|
var enableSchedulerTracing = true;
|
|
3251
3255
|
|
|
3252
3256
|
// Only used in www builds.
|
|
3253
|
-
// TODO: true? Here it might just be false.
|
|
3257
|
+
var enableSuspenseServerRenderer = false; // TODO: true? Here it might just be false.
|
|
3254
3258
|
|
|
3255
3259
|
// Only used in www builds.
|
|
3256
3260
|
|
|
@@ -8710,8 +8714,16 @@ var unstable_now = _ReactInternals$Sched.unstable_now;
|
|
|
8710
8714
|
var unstable_scheduleCallback = _ReactInternals$Sched.unstable_scheduleCallback;
|
|
8711
8715
|
var unstable_shouldYield = _ReactInternals$Sched.unstable_shouldYield;
|
|
8712
8716
|
var unstable_getFirstCallbackNode = _ReactInternals$Sched.unstable_getFirstCallbackNode;
|
|
8717
|
+
var unstable_runWithPriority = _ReactInternals$Sched.unstable_runWithPriority;
|
|
8718
|
+
var unstable_next = _ReactInternals$Sched.unstable_next;
|
|
8713
8719
|
var unstable_continueExecution = _ReactInternals$Sched.unstable_continueExecution;
|
|
8714
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;
|
|
8715
8727
|
|
|
8716
8728
|
// Renderers that don't support persistence
|
|
8717
8729
|
// can re-export everything from this module.
|
|
@@ -8736,6 +8748,9 @@ var SUPPRESS_HYDRATION_WARNING = void 0;
|
|
|
8736
8748
|
SUPPRESS_HYDRATION_WARNING = 'suppressHydrationWarning';
|
|
8737
8749
|
}
|
|
8738
8750
|
|
|
8751
|
+
var SUSPENSE_START_DATA = '$';
|
|
8752
|
+
var SUSPENSE_END_DATA = '/$';
|
|
8753
|
+
|
|
8739
8754
|
var STYLE = 'style';
|
|
8740
8755
|
|
|
8741
8756
|
var eventsEnabled = null;
|
|
@@ -8964,6 +8979,43 @@ function removeChildFromContainer(container, child) {
|
|
|
8964
8979
|
}
|
|
8965
8980
|
}
|
|
8966
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
|
+
|
|
8967
9019
|
function hideInstance(instance) {
|
|
8968
9020
|
// TODO: Does this work for all element types? What about MathML? Should we
|
|
8969
9021
|
// pass host context to this method?
|
|
@@ -9009,10 +9061,19 @@ function canHydrateTextInstance(instance, text) {
|
|
|
9009
9061
|
return instance;
|
|
9010
9062
|
}
|
|
9011
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
|
+
|
|
9012
9073
|
function getNextHydratableSibling(instance) {
|
|
9013
9074
|
var node = instance.nextSibling;
|
|
9014
9075
|
// Skip non-hydratable nodes.
|
|
9015
|
-
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)) {
|
|
9016
9077
|
node = node.nextSibling;
|
|
9017
9078
|
}
|
|
9018
9079
|
return node;
|
|
@@ -9021,7 +9082,7 @@ function getNextHydratableSibling(instance) {
|
|
|
9021
9082
|
function getFirstHydratableChild(parentInstance) {
|
|
9022
9083
|
var next = parentInstance.firstChild;
|
|
9023
9084
|
// Skip non-hydratable nodes.
|
|
9024
|
-
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)) {
|
|
9025
9086
|
next = next.nextSibling;
|
|
9026
9087
|
}
|
|
9027
9088
|
return next;
|
|
@@ -9045,6 +9106,31 @@ function hydrateTextInstance(textInstance, text, internalInstanceHandle) {
|
|
|
9045
9106
|
return diffHydratedText(textInstance, text);
|
|
9046
9107
|
}
|
|
9047
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
|
+
|
|
9048
9134
|
function didNotMatchHydratedContainerTextInstance(parentContainer, textInstance, text) {
|
|
9049
9135
|
{
|
|
9050
9136
|
warnForUnmatchedText(textInstance, text);
|
|
@@ -9061,6 +9147,8 @@ function didNotHydrateContainerInstance(parentContainer, instance) {
|
|
|
9061
9147
|
{
|
|
9062
9148
|
if (instance.nodeType === ELEMENT_NODE) {
|
|
9063
9149
|
warnForDeletedHydratableElement(parentContainer, instance);
|
|
9150
|
+
} else if (instance.nodeType === COMMENT_NODE) {
|
|
9151
|
+
// TODO: warnForDeletedHydratableSuspenseBoundary
|
|
9064
9152
|
} else {
|
|
9065
9153
|
warnForDeletedHydratableText(parentContainer, instance);
|
|
9066
9154
|
}
|
|
@@ -9071,6 +9159,8 @@ function didNotHydrateInstance(parentType, parentProps, parentInstance, instance
|
|
|
9071
9159
|
if (true && parentProps[SUPPRESS_HYDRATION_WARNING] !== true) {
|
|
9072
9160
|
if (instance.nodeType === ELEMENT_NODE) {
|
|
9073
9161
|
warnForDeletedHydratableElement(parentInstance, instance);
|
|
9162
|
+
} else if (instance.nodeType === COMMENT_NODE) {
|
|
9163
|
+
// TODO: warnForDeletedHydratableSuspenseBoundary
|
|
9074
9164
|
} else {
|
|
9075
9165
|
warnForDeletedHydratableText(parentInstance, instance);
|
|
9076
9166
|
}
|
|
@@ -9089,6 +9179,8 @@ function didNotFindHydratableContainerTextInstance(parentContainer, text) {
|
|
|
9089
9179
|
}
|
|
9090
9180
|
}
|
|
9091
9181
|
|
|
9182
|
+
|
|
9183
|
+
|
|
9092
9184
|
function didNotFindHydratableInstance(parentType, parentProps, parentInstance, type, props) {
|
|
9093
9185
|
if (true && parentProps[SUPPRESS_HYDRATION_WARNING] !== true) {
|
|
9094
9186
|
warnForInsertedHydratedElement(parentInstance, type, props);
|
|
@@ -9101,6 +9193,12 @@ function didNotFindHydratableTextInstance(parentType, parentProps, parentInstanc
|
|
|
9101
9193
|
}
|
|
9102
9194
|
}
|
|
9103
9195
|
|
|
9196
|
+
function didNotFindHydratableSuspenseInstance(parentType, parentProps, parentInstance) {
|
|
9197
|
+
if (true && parentProps[SUPPRESS_HYDRATION_WARNING] !== true) {
|
|
9198
|
+
// TODO: warnForInsertedHydratedSuspense(parentInstance);
|
|
9199
|
+
}
|
|
9200
|
+
}
|
|
9201
|
+
|
|
9104
9202
|
// This is just to get the setup running.
|
|
9105
9203
|
// TODO: real implementation.
|
|
9106
9204
|
// console.log('Hello from Fire host config.');
|
|
@@ -9360,7 +9458,7 @@ function stopFailedWorkTimer(fiber) {
|
|
|
9360
9458
|
return;
|
|
9361
9459
|
}
|
|
9362
9460
|
fiber._debugIsCurrentlyTiming = false;
|
|
9363
|
-
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';
|
|
9364
9462
|
endFiberMark(fiber, null, warning);
|
|
9365
9463
|
}
|
|
9366
9464
|
}
|
|
@@ -12180,7 +12278,7 @@ function ChildReconciler(shouldTrackSideEffects) {
|
|
|
12180
12278
|
}
|
|
12181
12279
|
|
|
12182
12280
|
function reconcileChildrenArray(returnFiber, currentFirstChild, newChildren, expirationTime) {
|
|
12183
|
-
// This algorithm can't optimize by searching from
|
|
12281
|
+
// This algorithm can't optimize by searching from both ends since we
|
|
12184
12282
|
// don't have backpointers on fibers. I'm trying to see how far we can get
|
|
12185
12283
|
// with that model. If it ends up not being worth the tradeoffs, we can
|
|
12186
12284
|
// add it later.
|
|
@@ -12994,9 +13092,6 @@ function mountWorkInProgressHook() {
|
|
|
12994
13092
|
|
|
12995
13093
|
{
|
|
12996
13094
|
hook._debugType = currentHookNameInDev;
|
|
12997
|
-
if (currentlyRenderingFiber$1 !== null && currentlyRenderingFiber$1.alternate !== null) {
|
|
12998
|
-
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));
|
|
12999
|
-
}
|
|
13000
13095
|
}
|
|
13001
13096
|
if (workInProgressHook === null) {
|
|
13002
13097
|
// This is the first hook in the list
|
|
@@ -13359,7 +13454,7 @@ function mountImperativeHandle(ref, create, deps) {
|
|
|
13359
13454
|
}
|
|
13360
13455
|
|
|
13361
13456
|
// TODO: If deps are provided, should we skip comparing the ref itself?
|
|
13362
|
-
var effectDeps = deps !== null && deps !== undefined ? deps.concat([ref]) :
|
|
13457
|
+
var effectDeps = deps !== null && deps !== undefined ? deps.concat([ref]) : null;
|
|
13363
13458
|
|
|
13364
13459
|
return mountEffectImpl(Update, UnmountMutation | MountLayout, imperativeHandleEffect.bind(null, create, ref), effectDeps);
|
|
13365
13460
|
}
|
|
@@ -13370,7 +13465,7 @@ function updateImperativeHandle(ref, create, deps) {
|
|
|
13370
13465
|
}
|
|
13371
13466
|
|
|
13372
13467
|
// TODO: If deps are provided, should we skip comparing the ref itself?
|
|
13373
|
-
var effectDeps = deps !== null && deps !== undefined ? deps.concat([ref]) :
|
|
13468
|
+
var effectDeps = deps !== null && deps !== undefined ? deps.concat([ref]) : null;
|
|
13374
13469
|
|
|
13375
13470
|
return updateEffectImpl(Update, UnmountMutation | MountLayout, imperativeHandleEffect.bind(null, create, ref), effectDeps);
|
|
13376
13471
|
}
|
|
@@ -13437,7 +13532,7 @@ function updateMemo(nextCreate, deps) {
|
|
|
13437
13532
|
var shouldWarnForUnbatchedSetState = false;
|
|
13438
13533
|
|
|
13439
13534
|
{
|
|
13440
|
-
// jest
|
|
13535
|
+
// jest isn't a 'global', it's just exposed to tests via a wrapped function
|
|
13441
13536
|
// further, this isn't a test file, so flow doesn't recognize the symbol. So...
|
|
13442
13537
|
// $FlowExpectedError - because requirements don't give a damn about your type sigs.
|
|
13443
13538
|
if ('undefined' !== typeof jest) {
|
|
@@ -13927,6 +14022,18 @@ function enterHydrationState(fiber) {
|
|
|
13927
14022
|
return true;
|
|
13928
14023
|
}
|
|
13929
14024
|
|
|
14025
|
+
function reenterHydrationStateFromDehydratedSuspenseInstance(fiber) {
|
|
14026
|
+
if (!supportsHydration) {
|
|
14027
|
+
return false;
|
|
14028
|
+
}
|
|
14029
|
+
|
|
14030
|
+
var suspenseInstance = fiber.stateNode;
|
|
14031
|
+
nextHydratableInstance = getNextHydratableSibling(suspenseInstance);
|
|
14032
|
+
popToNextHostParent(fiber);
|
|
14033
|
+
isHydrating = true;
|
|
14034
|
+
return true;
|
|
14035
|
+
}
|
|
14036
|
+
|
|
13930
14037
|
function deleteHydratableInstance(returnFiber, instance) {
|
|
13931
14038
|
{
|
|
13932
14039
|
switch (returnFiber.tag) {
|
|
@@ -13973,6 +14080,9 @@ function insertNonHydratedInstance(returnFiber, fiber) {
|
|
|
13973
14080
|
case HostText:
|
|
13974
14081
|
var text = fiber.pendingProps;
|
|
13975
14082
|
didNotFindHydratableContainerTextInstance(parentContainer, text);
|
|
14083
|
+
break;
|
|
14084
|
+
case SuspenseComponent:
|
|
14085
|
+
|
|
13976
14086
|
break;
|
|
13977
14087
|
}
|
|
13978
14088
|
break;
|
|
@@ -13992,6 +14102,9 @@ function insertNonHydratedInstance(returnFiber, fiber) {
|
|
|
13992
14102
|
var _text = fiber.pendingProps;
|
|
13993
14103
|
didNotFindHydratableTextInstance(parentType, parentProps, parentInstance, _text);
|
|
13994
14104
|
break;
|
|
14105
|
+
case SuspenseComponent:
|
|
14106
|
+
didNotFindHydratableSuspenseInstance(parentType, parentProps, parentInstance);
|
|
14107
|
+
break;
|
|
13995
14108
|
}
|
|
13996
14109
|
break;
|
|
13997
14110
|
}
|
|
@@ -14024,6 +14137,19 @@ function tryHydrate(fiber, nextInstance) {
|
|
|
14024
14137
|
}
|
|
14025
14138
|
return false;
|
|
14026
14139
|
}
|
|
14140
|
+
case SuspenseComponent:
|
|
14141
|
+
{
|
|
14142
|
+
if (enableSuspenseServerRenderer) {
|
|
14143
|
+
var suspenseInstance = canHydrateSuspenseInstance(nextInstance);
|
|
14144
|
+
if (suspenseInstance !== null) {
|
|
14145
|
+
// Downgrade the tag to a dehydrated component until we've hydrated it.
|
|
14146
|
+
fiber.tag = DehydratedSuspenseComponent;
|
|
14147
|
+
fiber.stateNode = suspenseInstance;
|
|
14148
|
+
return true;
|
|
14149
|
+
}
|
|
14150
|
+
}
|
|
14151
|
+
return false;
|
|
14152
|
+
}
|
|
14027
14153
|
default:
|
|
14028
14154
|
return false;
|
|
14029
14155
|
}
|
|
@@ -14117,9 +14243,18 @@ function prepareToHydrateHostTextInstance(fiber) {
|
|
|
14117
14243
|
return shouldUpdate;
|
|
14118
14244
|
}
|
|
14119
14245
|
|
|
14246
|
+
function skipPastDehydratedSuspenseInstance(fiber) {
|
|
14247
|
+
if (!supportsHydration) {
|
|
14248
|
+
invariant(false, 'Expected skipPastDehydratedSuspenseInstance() to never be called. This error is likely caused by a bug in React. Please file an issue.');
|
|
14249
|
+
}
|
|
14250
|
+
var suspenseInstance = fiber.stateNode;
|
|
14251
|
+
!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;
|
|
14252
|
+
nextHydratableInstance = getNextHydratableInstanceAfterSuspenseInstance(suspenseInstance);
|
|
14253
|
+
}
|
|
14254
|
+
|
|
14120
14255
|
function popToNextHostParent(fiber) {
|
|
14121
14256
|
var parent = fiber.return;
|
|
14122
|
-
while (parent !== null && parent.tag !== HostComponent && parent.tag !== HostRoot) {
|
|
14257
|
+
while (parent !== null && parent.tag !== HostComponent && parent.tag !== HostRoot && parent.tag !== DehydratedSuspenseComponent) {
|
|
14123
14258
|
parent = parent.return;
|
|
14124
14259
|
}
|
|
14125
14260
|
hydrationParentFiber = parent;
|
|
@@ -14227,6 +14362,10 @@ function forceUnmountCurrentAndReconcile(current$$1, workInProgress, nextChildre
|
|
|
14227
14362
|
}
|
|
14228
14363
|
|
|
14229
14364
|
function updateForwardRef(current$$1, workInProgress, Component, nextProps, renderExpirationTime) {
|
|
14365
|
+
// TODO: current can be non-null here even if the component
|
|
14366
|
+
// hasn't yet mounted. This happens after the first render suspends.
|
|
14367
|
+
// We'll need to figure out if this is fine or can cause issues.
|
|
14368
|
+
|
|
14230
14369
|
{
|
|
14231
14370
|
if (workInProgress.type !== workInProgress.elementType) {
|
|
14232
14371
|
// Lazy component props can't be validated in createElement
|
|
@@ -14332,6 +14471,10 @@ function updateMemoComponent(current$$1, workInProgress, Component, nextProps, u
|
|
|
14332
14471
|
}
|
|
14333
14472
|
|
|
14334
14473
|
function updateSimpleMemoComponent(current$$1, workInProgress, Component, nextProps, updateExpirationTime, renderExpirationTime) {
|
|
14474
|
+
// TODO: current can be non-null here even if the component
|
|
14475
|
+
// hasn't yet mounted. This happens when the inner render suspends.
|
|
14476
|
+
// We'll need to figure out if this is fine or can cause issues.
|
|
14477
|
+
|
|
14335
14478
|
{
|
|
14336
14479
|
if (workInProgress.type !== workInProgress.elementType) {
|
|
14337
14480
|
// Lazy component props can't be validated in createElement
|
|
@@ -14955,6 +15098,18 @@ function updateSuspenseComponent(current$$1, workInProgress, renderExpirationTim
|
|
|
14955
15098
|
// children -- we skip over the primary children entirely.
|
|
14956
15099
|
var next = void 0;
|
|
14957
15100
|
if (current$$1 === null) {
|
|
15101
|
+
if (enableSuspenseServerRenderer) {
|
|
15102
|
+
// If we're currently hydrating, try to hydrate this boundary.
|
|
15103
|
+
// But only if this has a fallback.
|
|
15104
|
+
if (nextProps.fallback !== undefined) {
|
|
15105
|
+
tryToClaimNextHydratableInstance(workInProgress);
|
|
15106
|
+
// This could've changed the tag if this was a dehydrated suspense component.
|
|
15107
|
+
if (workInProgress.tag === DehydratedSuspenseComponent) {
|
|
15108
|
+
return updateDehydratedSuspenseComponent(null, workInProgress, renderExpirationTime);
|
|
15109
|
+
}
|
|
15110
|
+
}
|
|
15111
|
+
}
|
|
15112
|
+
|
|
14958
15113
|
// This is the initial mount. This branch is pretty simple because there's
|
|
14959
15114
|
// no previous state that needs to be preserved.
|
|
14960
15115
|
if (nextDidTimeout) {
|
|
@@ -15106,6 +15261,65 @@ function updateSuspenseComponent(current$$1, workInProgress, renderExpirationTim
|
|
|
15106
15261
|
return next;
|
|
15107
15262
|
}
|
|
15108
15263
|
|
|
15264
|
+
function updateDehydratedSuspenseComponent(current$$1, workInProgress, renderExpirationTime) {
|
|
15265
|
+
if (current$$1 === null) {
|
|
15266
|
+
// During the first pass, we'll bail out and not drill into the children.
|
|
15267
|
+
// Instead, we'll leave the content in place and try to hydrate it later.
|
|
15268
|
+
workInProgress.expirationTime = Never;
|
|
15269
|
+
return null;
|
|
15270
|
+
}
|
|
15271
|
+
// We use childExpirationTime to indicate that a child might depend on context, so if
|
|
15272
|
+
// any context has changed, we need to treat is as if the input might have changed.
|
|
15273
|
+
var hasContextChanged$$1 = current$$1.childExpirationTime >= renderExpirationTime;
|
|
15274
|
+
if (didReceiveUpdate || hasContextChanged$$1) {
|
|
15275
|
+
// This boundary has changed since the first render. This means that we are now unable to
|
|
15276
|
+
// hydrate it. We might still be able to hydrate it using an earlier expiration time but
|
|
15277
|
+
// during this render we can't. Instead, we're going to delete the whole subtree and
|
|
15278
|
+
// instead inject a new real Suspense boundary to take its place, which may render content
|
|
15279
|
+
// or fallback. The real Suspense boundary will suspend for a while so we have some time
|
|
15280
|
+
// to ensure it can produce real content, but all state and pending events will be lost.
|
|
15281
|
+
|
|
15282
|
+
// Detach from the current dehydrated boundary.
|
|
15283
|
+
current$$1.alternate = null;
|
|
15284
|
+
workInProgress.alternate = null;
|
|
15285
|
+
|
|
15286
|
+
// Insert a deletion in the effect list.
|
|
15287
|
+
var returnFiber = workInProgress.return;
|
|
15288
|
+
!(returnFiber !== null) ? invariant(false, 'Suspense boundaries are never on the root. This is probably a bug in React.') : void 0;
|
|
15289
|
+
var last = returnFiber.lastEffect;
|
|
15290
|
+
if (last !== null) {
|
|
15291
|
+
last.nextEffect = current$$1;
|
|
15292
|
+
returnFiber.lastEffect = current$$1;
|
|
15293
|
+
} else {
|
|
15294
|
+
returnFiber.firstEffect = returnFiber.lastEffect = current$$1;
|
|
15295
|
+
}
|
|
15296
|
+
current$$1.nextEffect = null;
|
|
15297
|
+
current$$1.effectTag = Deletion;
|
|
15298
|
+
|
|
15299
|
+
// Upgrade this work in progress to a real Suspense component.
|
|
15300
|
+
workInProgress.tag = SuspenseComponent;
|
|
15301
|
+
workInProgress.stateNode = null;
|
|
15302
|
+
workInProgress.memoizedState = null;
|
|
15303
|
+
// This is now an insertion.
|
|
15304
|
+
workInProgress.effectTag |= Placement;
|
|
15305
|
+
// Retry as a real Suspense component.
|
|
15306
|
+
return updateSuspenseComponent(null, workInProgress, renderExpirationTime);
|
|
15307
|
+
}
|
|
15308
|
+
if ((workInProgress.effectTag & DidCapture) === NoEffect) {
|
|
15309
|
+
// This is the first attempt.
|
|
15310
|
+
reenterHydrationStateFromDehydratedSuspenseInstance(workInProgress);
|
|
15311
|
+
var nextProps = workInProgress.pendingProps;
|
|
15312
|
+
var nextChildren = nextProps.children;
|
|
15313
|
+
workInProgress.child = mountChildFibers(workInProgress, null, nextChildren, renderExpirationTime);
|
|
15314
|
+
return workInProgress.child;
|
|
15315
|
+
} else {
|
|
15316
|
+
// Something suspended. Leave the existing children in place.
|
|
15317
|
+
// TODO: In non-concurrent mode, should we commit the nodes we have hydrated so far?
|
|
15318
|
+
workInProgress.child = null;
|
|
15319
|
+
return null;
|
|
15320
|
+
}
|
|
15321
|
+
}
|
|
15322
|
+
|
|
15109
15323
|
function updatePortalComponent(current$$1, workInProgress, renderExpirationTime) {
|
|
15110
15324
|
pushHostContainer(workInProgress, workInProgress.stateNode.containerInfo);
|
|
15111
15325
|
var nextChildren = workInProgress.pendingProps;
|
|
@@ -15317,6 +15531,16 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
|
|
|
15317
15531
|
}
|
|
15318
15532
|
break;
|
|
15319
15533
|
}
|
|
15534
|
+
case DehydratedSuspenseComponent:
|
|
15535
|
+
{
|
|
15536
|
+
if (enableSuspenseServerRenderer) {
|
|
15537
|
+
// We know that this component will suspend again because if it has
|
|
15538
|
+
// been unsuspended it has committed as a regular Suspense component.
|
|
15539
|
+
// If it needs to be retried, it should have work scheduled on it.
|
|
15540
|
+
workInProgress.effectTag |= DidCapture;
|
|
15541
|
+
break;
|
|
15542
|
+
}
|
|
15543
|
+
}
|
|
15320
15544
|
}
|
|
15321
15545
|
return bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
|
|
15322
15546
|
}
|
|
@@ -15408,9 +15632,15 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
|
|
|
15408
15632
|
var _resolvedProps4 = workInProgress.elementType === _Component3 ? _unresolvedProps4 : resolveDefaultProps(_Component3, _unresolvedProps4);
|
|
15409
15633
|
return mountIncompleteClassComponent(current$$1, workInProgress, _Component3, _resolvedProps4, renderExpirationTime);
|
|
15410
15634
|
}
|
|
15411
|
-
|
|
15412
|
-
|
|
15635
|
+
case DehydratedSuspenseComponent:
|
|
15636
|
+
{
|
|
15637
|
+
if (enableSuspenseServerRenderer) {
|
|
15638
|
+
return updateDehydratedSuspenseComponent(current$$1, workInProgress, renderExpirationTime);
|
|
15639
|
+
}
|
|
15640
|
+
break;
|
|
15641
|
+
}
|
|
15413
15642
|
}
|
|
15643
|
+
invariant(false, 'Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue.');
|
|
15414
15644
|
}
|
|
15415
15645
|
|
|
15416
15646
|
var valueCursor = createCursor(null);
|
|
@@ -15499,6 +15729,28 @@ function calculateChangedBits(context, newValue, oldValue) {
|
|
|
15499
15729
|
}
|
|
15500
15730
|
}
|
|
15501
15731
|
|
|
15732
|
+
function scheduleWorkOnParentPath(parent, renderExpirationTime) {
|
|
15733
|
+
// Update the child expiration time of all the ancestors, including
|
|
15734
|
+
// the alternates.
|
|
15735
|
+
var node = parent;
|
|
15736
|
+
while (node !== null) {
|
|
15737
|
+
var alternate = node.alternate;
|
|
15738
|
+
if (node.childExpirationTime < renderExpirationTime) {
|
|
15739
|
+
node.childExpirationTime = renderExpirationTime;
|
|
15740
|
+
if (alternate !== null && alternate.childExpirationTime < renderExpirationTime) {
|
|
15741
|
+
alternate.childExpirationTime = renderExpirationTime;
|
|
15742
|
+
}
|
|
15743
|
+
} else if (alternate !== null && alternate.childExpirationTime < renderExpirationTime) {
|
|
15744
|
+
alternate.childExpirationTime = renderExpirationTime;
|
|
15745
|
+
} else {
|
|
15746
|
+
// Neither alternate was updated, which means the rest of the
|
|
15747
|
+
// ancestor path already has sufficient priority.
|
|
15748
|
+
break;
|
|
15749
|
+
}
|
|
15750
|
+
node = node.return;
|
|
15751
|
+
}
|
|
15752
|
+
}
|
|
15753
|
+
|
|
15502
15754
|
function propagateContextChange(workInProgress, context, changedBits, renderExpirationTime) {
|
|
15503
15755
|
var fiber = workInProgress.child;
|
|
15504
15756
|
if (fiber !== null) {
|
|
@@ -15537,25 +15789,8 @@ function propagateContextChange(workInProgress, context, changedBits, renderExpi
|
|
|
15537
15789
|
if (alternate !== null && alternate.expirationTime < renderExpirationTime) {
|
|
15538
15790
|
alternate.expirationTime = renderExpirationTime;
|
|
15539
15791
|
}
|
|
15540
|
-
|
|
15541
|
-
|
|
15542
|
-
var node = fiber.return;
|
|
15543
|
-
while (node !== null) {
|
|
15544
|
-
alternate = node.alternate;
|
|
15545
|
-
if (node.childExpirationTime < renderExpirationTime) {
|
|
15546
|
-
node.childExpirationTime = renderExpirationTime;
|
|
15547
|
-
if (alternate !== null && alternate.childExpirationTime < renderExpirationTime) {
|
|
15548
|
-
alternate.childExpirationTime = renderExpirationTime;
|
|
15549
|
-
}
|
|
15550
|
-
} else if (alternate !== null && alternate.childExpirationTime < renderExpirationTime) {
|
|
15551
|
-
alternate.childExpirationTime = renderExpirationTime;
|
|
15552
|
-
} else {
|
|
15553
|
-
// Neither alternate was updated, which means the rest of the
|
|
15554
|
-
// ancestor path already has sufficient priority.
|
|
15555
|
-
break;
|
|
15556
|
-
}
|
|
15557
|
-
node = node.return;
|
|
15558
|
-
}
|
|
15792
|
+
|
|
15793
|
+
scheduleWorkOnParentPath(fiber.return, renderExpirationTime);
|
|
15559
15794
|
|
|
15560
15795
|
// Mark the expiration time on the list, too.
|
|
15561
15796
|
if (list.expirationTime < renderExpirationTime) {
|
|
@@ -15571,6 +15806,23 @@ function propagateContextChange(workInProgress, context, changedBits, renderExpi
|
|
|
15571
15806
|
} else if (fiber.tag === ContextProvider) {
|
|
15572
15807
|
// Don't scan deeper if this is a matching provider
|
|
15573
15808
|
nextFiber = fiber.type === workInProgress.type ? null : fiber.child;
|
|
15809
|
+
} else if (enableSuspenseServerRenderer && fiber.tag === DehydratedSuspenseComponent) {
|
|
15810
|
+
// If a dehydrated suspense component is in this subtree, we don't know
|
|
15811
|
+
// if it will have any context consumers in it. The best we can do is
|
|
15812
|
+
// mark it as having updates on its children.
|
|
15813
|
+
if (fiber.expirationTime < renderExpirationTime) {
|
|
15814
|
+
fiber.expirationTime = renderExpirationTime;
|
|
15815
|
+
}
|
|
15816
|
+
var _alternate = fiber.alternate;
|
|
15817
|
+
if (_alternate !== null && _alternate.expirationTime < renderExpirationTime) {
|
|
15818
|
+
_alternate.expirationTime = renderExpirationTime;
|
|
15819
|
+
}
|
|
15820
|
+
// This is intentionally passing this fiber as the parent
|
|
15821
|
+
// because we want to schedule this fiber as having work
|
|
15822
|
+
// on its children. We'll use the childExpirationTime on
|
|
15823
|
+
// this fiber to indicate that a context has changed.
|
|
15824
|
+
scheduleWorkOnParentPath(fiber, renderExpirationTime);
|
|
15825
|
+
nextFiber = fiber.sibling;
|
|
15574
15826
|
} else {
|
|
15575
15827
|
// Traverse down.
|
|
15576
15828
|
nextFiber = fiber.child;
|
|
@@ -16694,6 +16946,26 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
16694
16946
|
}
|
|
16695
16947
|
break;
|
|
16696
16948
|
}
|
|
16949
|
+
case DehydratedSuspenseComponent:
|
|
16950
|
+
{
|
|
16951
|
+
if (enableSuspenseServerRenderer) {
|
|
16952
|
+
if (current === null) {
|
|
16953
|
+
var _wasHydrated2 = popHydrationState(workInProgress);
|
|
16954
|
+
!_wasHydrated2 ? invariant(false, 'A dehydrated suspense component was completed without a hydrated node. This is probably a bug in React.') : void 0;
|
|
16955
|
+
skipPastDehydratedSuspenseInstance(workInProgress);
|
|
16956
|
+
} else if ((workInProgress.effectTag & DidCapture) === NoEffect) {
|
|
16957
|
+
// This boundary did not suspend so it's now hydrated.
|
|
16958
|
+
// To handle any future suspense cases, we're going to now upgrade it
|
|
16959
|
+
// to a Suspense component. We detach it from the existing current fiber.
|
|
16960
|
+
current.alternate = null;
|
|
16961
|
+
workInProgress.alternate = null;
|
|
16962
|
+
workInProgress.tag = SuspenseComponent;
|
|
16963
|
+
workInProgress.memoizedState = null;
|
|
16964
|
+
workInProgress.stateNode = null;
|
|
16965
|
+
}
|
|
16966
|
+
}
|
|
16967
|
+
break;
|
|
16968
|
+
}
|
|
16697
16969
|
default:
|
|
16698
16970
|
invariant(false, 'Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue.');
|
|
16699
16971
|
}
|
|
@@ -16784,7 +17056,7 @@ var didWarnAboutUndefinedSnapshotBeforeUpdate = null;
|
|
|
16784
17056
|
didWarnAboutUndefinedSnapshotBeforeUpdate = new Set();
|
|
16785
17057
|
}
|
|
16786
17058
|
|
|
16787
|
-
var PossiblyWeakSet = typeof WeakSet === 'function' ? WeakSet : Set;
|
|
17059
|
+
var PossiblyWeakSet$1 = typeof WeakSet === 'function' ? WeakSet : Set;
|
|
16788
17060
|
|
|
16789
17061
|
function logError(boundary, errorInfo) {
|
|
16790
17062
|
var source = errorInfo.source;
|
|
@@ -17097,7 +17369,7 @@ function commitLifeCycles(finishedRoot, current$$1, finishedWork, committedExpir
|
|
|
17097
17369
|
|
|
17098
17370
|
function hideOrUnhideAllChildren(finishedWork, isHidden) {
|
|
17099
17371
|
if (supportsMutation) {
|
|
17100
|
-
// We only have the top Fiber that was inserted but we need recurse down its
|
|
17372
|
+
// We only have the top Fiber that was inserted but we need to recurse down its
|
|
17101
17373
|
var node = finishedWork;
|
|
17102
17374
|
while (true) {
|
|
17103
17375
|
if (node.tag === HostComponent) {
|
|
@@ -17365,7 +17637,7 @@ function getHostSibling(fiber) {
|
|
|
17365
17637
|
}
|
|
17366
17638
|
node.sibling.return = node.return;
|
|
17367
17639
|
node = node.sibling;
|
|
17368
|
-
while (node.tag !== HostComponent && node.tag !== HostText) {
|
|
17640
|
+
while (node.tag !== HostComponent && node.tag !== HostText && node.tag !== DehydratedSuspenseComponent) {
|
|
17369
17641
|
// If it is not host node and, we might have a host node inside it.
|
|
17370
17642
|
// Try to search down until we find one.
|
|
17371
17643
|
if (node.effectTag & Placement) {
|
|
@@ -17425,7 +17697,7 @@ function commitPlacement(finishedWork) {
|
|
|
17425
17697
|
}
|
|
17426
17698
|
|
|
17427
17699
|
var before = getHostSibling(finishedWork);
|
|
17428
|
-
// We only have the top Fiber that was inserted but we need recurse down its
|
|
17700
|
+
// We only have the top Fiber that was inserted but we need to recurse down its
|
|
17429
17701
|
// children to find all the terminal nodes.
|
|
17430
17702
|
var node = finishedWork;
|
|
17431
17703
|
while (true) {
|
|
@@ -17467,7 +17739,7 @@ function commitPlacement(finishedWork) {
|
|
|
17467
17739
|
}
|
|
17468
17740
|
|
|
17469
17741
|
function unmountHostComponents(current$$1) {
|
|
17470
|
-
// We only have the top Fiber that was deleted but we need recurse down its
|
|
17742
|
+
// We only have the top Fiber that was deleted but we need to recurse down its
|
|
17471
17743
|
var node = current$$1;
|
|
17472
17744
|
|
|
17473
17745
|
// Each iteration, currentParent is populated with node's host parent if not
|
|
@@ -17512,13 +17784,20 @@ function unmountHostComponents(current$$1) {
|
|
|
17512
17784
|
removeChild(currentParent, node.stateNode);
|
|
17513
17785
|
}
|
|
17514
17786
|
// Don't visit children because we already visited them.
|
|
17787
|
+
} else if (enableSuspenseServerRenderer && node.tag === DehydratedSuspenseComponent) {
|
|
17788
|
+
// Delete the dehydrated suspense boundary and all of its content.
|
|
17789
|
+
if (currentParentIsContainer) {
|
|
17790
|
+
clearSuspenseBoundaryFromContainer(currentParent, node.stateNode);
|
|
17791
|
+
} else {
|
|
17792
|
+
clearSuspenseBoundary(currentParent, node.stateNode);
|
|
17793
|
+
}
|
|
17515
17794
|
} else if (node.tag === HostPortal) {
|
|
17516
|
-
// When we go into a portal, it becomes the parent to remove from.
|
|
17517
|
-
// We will reassign it back when we pop the portal on the way up.
|
|
17518
|
-
currentParent = node.stateNode.containerInfo;
|
|
17519
|
-
currentParentIsContainer = true;
|
|
17520
|
-
// Visit children because portals might contain host components.
|
|
17521
17795
|
if (node.child !== null) {
|
|
17796
|
+
// When we go into a portal, it becomes the parent to remove from.
|
|
17797
|
+
// We will reassign it back when we pop the portal on the way up.
|
|
17798
|
+
currentParent = node.stateNode.containerInfo;
|
|
17799
|
+
currentParentIsContainer = true;
|
|
17800
|
+
// Visit children because portals might contain host components.
|
|
17522
17801
|
node.child.return = node;
|
|
17523
17802
|
node = node.child;
|
|
17524
17803
|
continue;
|
|
@@ -17668,7 +17947,7 @@ function commitWork(current$$1, finishedWork) {
|
|
|
17668
17947
|
finishedWork.updateQueue = null;
|
|
17669
17948
|
var retryCache = finishedWork.stateNode;
|
|
17670
17949
|
if (retryCache === null) {
|
|
17671
|
-
retryCache = finishedWork.stateNode = new PossiblyWeakSet();
|
|
17950
|
+
retryCache = finishedWork.stateNode = new PossiblyWeakSet$1();
|
|
17672
17951
|
}
|
|
17673
17952
|
thenables.forEach(function (thenable) {
|
|
17674
17953
|
// Memoize using the boundary fiber to prevent redundant listeners.
|
|
@@ -17703,6 +17982,7 @@ function commitResetTextContent(current$$1) {
|
|
|
17703
17982
|
resetTextContent(current$$1.stateNode);
|
|
17704
17983
|
}
|
|
17705
17984
|
|
|
17985
|
+
var PossiblyWeakSet = typeof WeakSet === 'function' ? WeakSet : Set;
|
|
17706
17986
|
var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;
|
|
17707
17987
|
|
|
17708
17988
|
function createRootErrorUpdate(fiber, errorInfo, expirationTime) {
|
|
@@ -17761,6 +18041,34 @@ function createClassErrorUpdate(fiber, errorInfo, expirationTime) {
|
|
|
17761
18041
|
return update;
|
|
17762
18042
|
}
|
|
17763
18043
|
|
|
18044
|
+
function attachPingListener(root, renderExpirationTime, thenable) {
|
|
18045
|
+
// Attach a listener to the promise to "ping" the root and retry. But
|
|
18046
|
+
// only if one does not already exist for the current render expiration
|
|
18047
|
+
// time (which acts like a "thread ID" here).
|
|
18048
|
+
var pingCache = root.pingCache;
|
|
18049
|
+
var threadIDs = void 0;
|
|
18050
|
+
if (pingCache === null) {
|
|
18051
|
+
pingCache = root.pingCache = new PossiblyWeakMap();
|
|
18052
|
+
threadIDs = new Set();
|
|
18053
|
+
pingCache.set(thenable, threadIDs);
|
|
18054
|
+
} else {
|
|
18055
|
+
threadIDs = pingCache.get(thenable);
|
|
18056
|
+
if (threadIDs === undefined) {
|
|
18057
|
+
threadIDs = new Set();
|
|
18058
|
+
pingCache.set(thenable, threadIDs);
|
|
18059
|
+
}
|
|
18060
|
+
}
|
|
18061
|
+
if (!threadIDs.has(renderExpirationTime)) {
|
|
18062
|
+
// Memoize using the thread ID to prevent redundant listeners.
|
|
18063
|
+
threadIDs.add(renderExpirationTime);
|
|
18064
|
+
var ping = pingSuspendedRoot.bind(null, root, thenable, renderExpirationTime);
|
|
18065
|
+
if (enableSchedulerTracing) {
|
|
18066
|
+
ping = unstable_wrap(ping);
|
|
18067
|
+
}
|
|
18068
|
+
thenable.then(ping, ping);
|
|
18069
|
+
}
|
|
18070
|
+
}
|
|
18071
|
+
|
|
17764
18072
|
function throwException(root, returnFiber, sourceFiber, value, renderExpirationTime) {
|
|
17765
18073
|
// The source fiber did not complete.
|
|
17766
18074
|
sourceFiber.effectTag |= Incomplete;
|
|
@@ -17802,6 +18110,9 @@ function throwException(root, returnFiber, sourceFiber, value, renderExpirationT
|
|
|
17802
18110
|
}
|
|
17803
18111
|
}
|
|
17804
18112
|
}
|
|
18113
|
+
// If there is a DehydratedSuspenseComponent we don't have to do anything because
|
|
18114
|
+
// if something suspends inside it, we will simply leave that as dehydrated. It
|
|
18115
|
+
// will never timeout.
|
|
17805
18116
|
_workInProgress = _workInProgress.return;
|
|
17806
18117
|
} while (_workInProgress !== null);
|
|
17807
18118
|
|
|
@@ -17865,31 +18176,7 @@ function throwException(root, returnFiber, sourceFiber, value, renderExpirationT
|
|
|
17865
18176
|
// Confirmed that the boundary is in a concurrent mode tree. Continue
|
|
17866
18177
|
// with the normal suspend path.
|
|
17867
18178
|
|
|
17868
|
-
|
|
17869
|
-
// only if one does not already exist for the current render expiration
|
|
17870
|
-
// time (which acts like a "thread ID" here).
|
|
17871
|
-
var pingCache = root.pingCache;
|
|
17872
|
-
var threadIDs = void 0;
|
|
17873
|
-
if (pingCache === null) {
|
|
17874
|
-
pingCache = root.pingCache = new PossiblyWeakMap();
|
|
17875
|
-
threadIDs = new Set();
|
|
17876
|
-
pingCache.set(thenable, threadIDs);
|
|
17877
|
-
} else {
|
|
17878
|
-
threadIDs = pingCache.get(thenable);
|
|
17879
|
-
if (threadIDs === undefined) {
|
|
17880
|
-
threadIDs = new Set();
|
|
17881
|
-
pingCache.set(thenable, threadIDs);
|
|
17882
|
-
}
|
|
17883
|
-
}
|
|
17884
|
-
if (!threadIDs.has(renderExpirationTime)) {
|
|
17885
|
-
// Memoize using the thread ID to prevent redundant listeners.
|
|
17886
|
-
threadIDs.add(renderExpirationTime);
|
|
17887
|
-
var ping = pingSuspendedRoot.bind(null, root, thenable, renderExpirationTime);
|
|
17888
|
-
if (enableSchedulerTracing) {
|
|
17889
|
-
ping = unstable_wrap(ping);
|
|
17890
|
-
}
|
|
17891
|
-
thenable.then(ping, ping);
|
|
17892
|
-
}
|
|
18179
|
+
attachPingListener(root, renderExpirationTime, thenable);
|
|
17893
18180
|
|
|
17894
18181
|
var absoluteTimeoutMs = void 0;
|
|
17895
18182
|
if (earliestTimeoutMs === -1) {
|
|
@@ -17921,6 +18208,29 @@ function throwException(root, returnFiber, sourceFiber, value, renderExpirationT
|
|
|
17921
18208
|
// whole tree.
|
|
17922
18209
|
renderDidSuspend(root, absoluteTimeoutMs, renderExpirationTime);
|
|
17923
18210
|
|
|
18211
|
+
_workInProgress.effectTag |= ShouldCapture;
|
|
18212
|
+
_workInProgress.expirationTime = renderExpirationTime;
|
|
18213
|
+
return;
|
|
18214
|
+
} else if (enableSuspenseServerRenderer && _workInProgress.tag === DehydratedSuspenseComponent) {
|
|
18215
|
+
attachPingListener(root, renderExpirationTime, thenable);
|
|
18216
|
+
|
|
18217
|
+
// Since we already have a current fiber, we can eagerly add a retry listener.
|
|
18218
|
+
var retryCache = _workInProgress.memoizedState;
|
|
18219
|
+
if (retryCache === null) {
|
|
18220
|
+
retryCache = _workInProgress.memoizedState = new PossiblyWeakSet();
|
|
18221
|
+
var _current = _workInProgress.alternate;
|
|
18222
|
+
!_current ? invariant(false, 'A dehydrated suspense boundary must commit before trying to render. This is probably a bug in React.') : void 0;
|
|
18223
|
+
_current.memoizedState = retryCache;
|
|
18224
|
+
}
|
|
18225
|
+
// Memoize using the boundary fiber to prevent redundant listeners.
|
|
18226
|
+
if (!retryCache.has(thenable)) {
|
|
18227
|
+
retryCache.add(thenable);
|
|
18228
|
+
var retry = retryTimedOutBoundary.bind(null, _workInProgress, thenable);
|
|
18229
|
+
if (enableSchedulerTracing) {
|
|
18230
|
+
retry = unstable_wrap(retry);
|
|
18231
|
+
}
|
|
18232
|
+
thenable.then(retry, retry);
|
|
18233
|
+
}
|
|
17924
18234
|
_workInProgress.effectTag |= ShouldCapture;
|
|
17925
18235
|
_workInProgress.expirationTime = renderExpirationTime;
|
|
17926
18236
|
return;
|
|
@@ -17998,6 +18308,7 @@ function unwindWork(workInProgress, renderExpirationTime) {
|
|
|
17998
18308
|
}
|
|
17999
18309
|
case HostComponent:
|
|
18000
18310
|
{
|
|
18311
|
+
// TODO: popHydrationState
|
|
18001
18312
|
popHostContext(workInProgress);
|
|
18002
18313
|
return null;
|
|
18003
18314
|
}
|
|
@@ -18011,6 +18322,19 @@ function unwindWork(workInProgress, renderExpirationTime) {
|
|
|
18011
18322
|
}
|
|
18012
18323
|
return null;
|
|
18013
18324
|
}
|
|
18325
|
+
case DehydratedSuspenseComponent:
|
|
18326
|
+
{
|
|
18327
|
+
if (enableSuspenseServerRenderer) {
|
|
18328
|
+
// TODO: popHydrationState
|
|
18329
|
+
var _effectTag3 = workInProgress.effectTag;
|
|
18330
|
+
if (_effectTag3 & ShouldCapture) {
|
|
18331
|
+
workInProgress.effectTag = _effectTag3 & ~ShouldCapture | DidCapture;
|
|
18332
|
+
// Captured a suspense effect. Re-render the boundary.
|
|
18333
|
+
return workInProgress;
|
|
18334
|
+
}
|
|
18335
|
+
}
|
|
18336
|
+
return null;
|
|
18337
|
+
}
|
|
18014
18338
|
case HostPortal:
|
|
18015
18339
|
popHostContainer(workInProgress);
|
|
18016
18340
|
return null;
|
|
@@ -18108,11 +18432,6 @@ if (enableSchedulerTracing) {
|
|
|
18108
18432
|
// Used to ensure computeUniqueAsyncExpiration is monotonically decreasing.
|
|
18109
18433
|
var lastUniqueAsyncExpiration = Sync - 1;
|
|
18110
18434
|
|
|
18111
|
-
// Represents the expiration time that incoming updates should use. (If this
|
|
18112
|
-
// is NoWork, use the default strategy: async updates in async mode, sync
|
|
18113
|
-
// updates in sync mode.)
|
|
18114
|
-
var expirationContext = NoWork;
|
|
18115
|
-
|
|
18116
18435
|
var isWorking = false;
|
|
18117
18436
|
|
|
18118
18437
|
// The next work in progress fiber that we're currently working on.
|
|
@@ -18408,6 +18727,10 @@ function commitPassiveEffects(root, firstEffect) {
|
|
|
18408
18727
|
if (rootExpirationTime !== NoWork) {
|
|
18409
18728
|
requestWork(root, rootExpirationTime);
|
|
18410
18729
|
}
|
|
18730
|
+
// Flush any sync work that was scheduled by effects
|
|
18731
|
+
if (!isBatchingUpdates && !isRendering) {
|
|
18732
|
+
performSyncWork();
|
|
18733
|
+
}
|
|
18411
18734
|
}
|
|
18412
18735
|
|
|
18413
18736
|
function isAlreadyFailedLegacyErrorBoundary(instance) {
|
|
@@ -18582,7 +18905,9 @@ function commitRoot(root, finishedWork) {
|
|
|
18582
18905
|
// here because that code is still in flux.
|
|
18583
18906
|
callback = unstable_wrap(callback);
|
|
18584
18907
|
}
|
|
18585
|
-
passiveEffectCallbackHandle =
|
|
18908
|
+
passiveEffectCallbackHandle = unstable_runWithPriority(unstable_NormalPriority, function () {
|
|
18909
|
+
return schedulePassiveEffects(callback);
|
|
18910
|
+
});
|
|
18586
18911
|
passiveEffectCallback = callback;
|
|
18587
18912
|
}
|
|
18588
18913
|
|
|
@@ -19171,7 +19496,7 @@ function renderRoot(root, isYieldy) {
|
|
|
19171
19496
|
return;
|
|
19172
19497
|
} else if (
|
|
19173
19498
|
// There's no lower priority work, but we're rendering asynchronously.
|
|
19174
|
-
//
|
|
19499
|
+
// Synchronously attempt to render the same level one more time. This is
|
|
19175
19500
|
// similar to a suspend, but without a timeout because we're not waiting
|
|
19176
19501
|
// for a promise to resolve.
|
|
19177
19502
|
!root.didError && isYieldy) {
|
|
@@ -19276,49 +19601,50 @@ function computeUniqueAsyncExpiration() {
|
|
|
19276
19601
|
}
|
|
19277
19602
|
|
|
19278
19603
|
function computeExpirationForFiber(currentTime, fiber) {
|
|
19604
|
+
var priorityLevel = unstable_getCurrentPriorityLevel();
|
|
19605
|
+
|
|
19279
19606
|
var expirationTime = void 0;
|
|
19280
|
-
if (
|
|
19281
|
-
//
|
|
19282
|
-
expirationTime =
|
|
19283
|
-
} else if (isWorking) {
|
|
19284
|
-
|
|
19285
|
-
|
|
19286
|
-
// by default.
|
|
19287
|
-
expirationTime = Sync;
|
|
19288
|
-
} else {
|
|
19289
|
-
// Updates during the render phase should expire at the same time as
|
|
19290
|
-
// the work that is being rendered.
|
|
19291
|
-
expirationTime = nextRenderExpirationTime;
|
|
19292
|
-
}
|
|
19607
|
+
if ((fiber.mode & ConcurrentMode) === NoContext) {
|
|
19608
|
+
// Outside of concurrent mode, updates are always synchronous.
|
|
19609
|
+
expirationTime = Sync;
|
|
19610
|
+
} else if (isWorking && !isCommitting$1) {
|
|
19611
|
+
// During render phase, updates expire during as the current render.
|
|
19612
|
+
expirationTime = nextRenderExpirationTime;
|
|
19293
19613
|
} else {
|
|
19294
|
-
|
|
19295
|
-
|
|
19296
|
-
|
|
19297
|
-
|
|
19298
|
-
|
|
19614
|
+
switch (priorityLevel) {
|
|
19615
|
+
case unstable_ImmediatePriority:
|
|
19616
|
+
expirationTime = Sync;
|
|
19617
|
+
break;
|
|
19618
|
+
case unstable_UserBlockingPriority:
|
|
19299
19619
|
expirationTime = computeInteractiveExpiration(currentTime);
|
|
19300
|
-
|
|
19301
|
-
|
|
19620
|
+
break;
|
|
19621
|
+
case unstable_NormalPriority:
|
|
19622
|
+
// This is a normal, concurrent update
|
|
19302
19623
|
expirationTime = computeAsyncExpiration(currentTime);
|
|
19303
|
-
|
|
19304
|
-
|
|
19305
|
-
|
|
19306
|
-
|
|
19307
|
-
|
|
19308
|
-
|
|
19309
|
-
|
|
19310
|
-
// This is a sync update
|
|
19311
|
-
expirationTime = Sync;
|
|
19624
|
+
break;
|
|
19625
|
+
case unstable_LowPriority:
|
|
19626
|
+
case unstable_IdlePriority:
|
|
19627
|
+
expirationTime = Never;
|
|
19628
|
+
break;
|
|
19629
|
+
default:
|
|
19630
|
+
invariant(false, 'Unknown priority level. This error is likely caused by a bug in React. Please file an issue.');
|
|
19312
19631
|
}
|
|
19313
|
-
|
|
19314
|
-
|
|
19315
|
-
//
|
|
19316
|
-
|
|
19317
|
-
|
|
19318
|
-
if (lowestPriorityPendingInteractiveExpirationTime === NoWork || expirationTime < lowestPriorityPendingInteractiveExpirationTime) {
|
|
19319
|
-
lowestPriorityPendingInteractiveExpirationTime = expirationTime;
|
|
19632
|
+
|
|
19633
|
+
// If we're in the middle of rendering a tree, do not update at the same
|
|
19634
|
+
// expiration time that is already rendering.
|
|
19635
|
+
if (nextRoot !== null && expirationTime === nextRenderExpirationTime) {
|
|
19636
|
+
expirationTime -= 1;
|
|
19320
19637
|
}
|
|
19321
19638
|
}
|
|
19639
|
+
|
|
19640
|
+
// Keep track of the lowest pending interactive expiration time. This
|
|
19641
|
+
// allows us to synchronously flush all interactive updates
|
|
19642
|
+
// when needed.
|
|
19643
|
+
// TODO: Move this to renderer?
|
|
19644
|
+
if (priorityLevel === unstable_UserBlockingPriority && (lowestPriorityPendingInteractiveExpirationTime === NoWork || expirationTime < lowestPriorityPendingInteractiveExpirationTime)) {
|
|
19645
|
+
lowestPriorityPendingInteractiveExpirationTime = expirationTime;
|
|
19646
|
+
}
|
|
19647
|
+
|
|
19322
19648
|
return expirationTime;
|
|
19323
19649
|
}
|
|
19324
19650
|
|
|
@@ -19365,7 +19691,21 @@ function retryTimedOutBoundary(boundaryFiber, thenable) {
|
|
|
19365
19691
|
// The boundary fiber (a Suspense component) previously timed out and was
|
|
19366
19692
|
// rendered in its fallback state. One of the promises that suspended it has
|
|
19367
19693
|
// resolved, which means at least part of the tree was likely unblocked. Try
|
|
19368
|
-
var retryCache =
|
|
19694
|
+
var retryCache = void 0;
|
|
19695
|
+
if (enableSuspenseServerRenderer) {
|
|
19696
|
+
switch (boundaryFiber.tag) {
|
|
19697
|
+
case SuspenseComponent:
|
|
19698
|
+
retryCache = boundaryFiber.stateNode;
|
|
19699
|
+
break;
|
|
19700
|
+
case DehydratedSuspenseComponent:
|
|
19701
|
+
retryCache = boundaryFiber.memoizedState;
|
|
19702
|
+
break;
|
|
19703
|
+
default:
|
|
19704
|
+
invariant(false, 'Pinged unknown suspense boundary type. This is probably a bug in React.');
|
|
19705
|
+
}
|
|
19706
|
+
} else {
|
|
19707
|
+
retryCache = boundaryFiber.stateNode;
|
|
19708
|
+
}
|
|
19369
19709
|
if (retryCache !== null) {
|
|
19370
19710
|
// The thenable resolved, so we no longer need to memoize, because it will
|
|
19371
19711
|
// never be thrown again.
|
|
@@ -19464,7 +19804,7 @@ function scheduleWorkToRoot(fiber, expirationTime) {
|
|
|
19464
19804
|
function warnIfNotCurrentlyBatchingInDev(fiber) {
|
|
19465
19805
|
{
|
|
19466
19806
|
if (isRendering === false && isBatchingUpdates === false) {
|
|
19467
|
-
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));
|
|
19807
|
+
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));
|
|
19468
19808
|
}
|
|
19469
19809
|
}
|
|
19470
19810
|
}
|
|
@@ -19511,13 +19851,9 @@ function scheduleWork(fiber, expirationTime) {
|
|
|
19511
19851
|
}
|
|
19512
19852
|
|
|
19513
19853
|
function syncUpdates(fn, a, b, c, d) {
|
|
19514
|
-
|
|
19515
|
-
expirationContext = Sync;
|
|
19516
|
-
try {
|
|
19854
|
+
return unstable_runWithPriority(unstable_ImmediatePriority, function () {
|
|
19517
19855
|
return fn(a, b, c, d);
|
|
19518
|
-
}
|
|
19519
|
-
expirationContext = previousExpirationContext;
|
|
19520
|
-
}
|
|
19856
|
+
});
|
|
19521
19857
|
}
|
|
19522
19858
|
|
|
19523
19859
|
// TODO: Everything below this is written as if it has been lifted to the
|
|
@@ -19538,7 +19874,6 @@ var unhandledError = null;
|
|
|
19538
19874
|
|
|
19539
19875
|
var isBatchingUpdates = false;
|
|
19540
19876
|
var isUnbatchingUpdates = false;
|
|
19541
|
-
var isBatchingInteractiveUpdates = false;
|
|
19542
19877
|
|
|
19543
19878
|
var completedBatches = null;
|
|
19544
19879
|
|
|
@@ -20012,7 +20347,9 @@ function completeRoot(root, finishedWork, expirationTime) {
|
|
|
20012
20347
|
lastCommittedRootDuringThisBatch = root;
|
|
20013
20348
|
nestedUpdateCount = 0;
|
|
20014
20349
|
}
|
|
20015
|
-
|
|
20350
|
+
unstable_runWithPriority(unstable_ImmediatePriority, function () {
|
|
20351
|
+
commitRoot(root, finishedWork);
|
|
20352
|
+
});
|
|
20016
20353
|
}
|
|
20017
20354
|
|
|
20018
20355
|
function onUncaughtError(error) {
|
|
@@ -20070,9 +20407,6 @@ function flushSync(fn, a) {
|
|
|
20070
20407
|
}
|
|
20071
20408
|
|
|
20072
20409
|
function interactiveUpdates$1(fn, a, b) {
|
|
20073
|
-
if (isBatchingInteractiveUpdates) {
|
|
20074
|
-
return fn(a, b);
|
|
20075
|
-
}
|
|
20076
20410
|
// If there are any pending interactive updates, synchronously flush them.
|
|
20077
20411
|
// This needs to happen before we read any handlers, because the effect of
|
|
20078
20412
|
// the previous event may influence which handlers are called during
|
|
@@ -20082,14 +20416,13 @@ function interactiveUpdates$1(fn, a, b) {
|
|
|
20082
20416
|
performWork(lowestPriorityPendingInteractiveExpirationTime, false);
|
|
20083
20417
|
lowestPriorityPendingInteractiveExpirationTime = NoWork;
|
|
20084
20418
|
}
|
|
20085
|
-
var previousIsBatchingInteractiveUpdates = isBatchingInteractiveUpdates;
|
|
20086
20419
|
var previousIsBatchingUpdates = isBatchingUpdates;
|
|
20087
|
-
isBatchingInteractiveUpdates = true;
|
|
20088
20420
|
isBatchingUpdates = true;
|
|
20089
20421
|
try {
|
|
20090
|
-
return
|
|
20422
|
+
return unstable_runWithPriority(unstable_UserBlockingPriority, function () {
|
|
20423
|
+
return fn(a, b);
|
|
20424
|
+
});
|
|
20091
20425
|
} finally {
|
|
20092
|
-
isBatchingInteractiveUpdates = previousIsBatchingInteractiveUpdates;
|
|
20093
20426
|
isBatchingUpdates = previousIsBatchingUpdates;
|
|
20094
20427
|
if (!isBatchingUpdates && !isRendering) {
|
|
20095
20428
|
performSyncWork();
|
|
@@ -20352,7 +20685,7 @@ implementation) {
|
|
|
20352
20685
|
|
|
20353
20686
|
// TODO: this is special because it gets imported during build.
|
|
20354
20687
|
|
|
20355
|
-
var ReactVersion = '16.8.
|
|
20688
|
+
var ReactVersion = '16.8.2';
|
|
20356
20689
|
|
|
20357
20690
|
// This file is copy paste from ReactDOM with adjusted paths
|
|
20358
20691
|
// and a different host config import (react-reconciler/inline.fire).
|
|
@@ -20747,7 +21080,7 @@ var ReactDOM = {
|
|
|
20747
21080
|
hydrate: function (element, container, callback) {
|
|
20748
21081
|
!isValidContainer(container) ? invariant(false, 'Target container is not a DOM element.') : void 0;
|
|
20749
21082
|
{
|
|
20750
|
-
!!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
|
|
21083
|
+
!!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;
|
|
20751
21084
|
}
|
|
20752
21085
|
// TODO: throw or warn if we couldn't hydrate?
|
|
20753
21086
|
return legacyRenderSubtreeIntoContainer(null, element, container, true, callback);
|