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.
|
|
@@ -85,7 +85,7 @@ var invokeGuardedCallbackImpl = function (name, func, context, a, b, c, d, e, f)
|
|
|
85
85
|
// invokeGuardedCallback uses a try-catch, all user exceptions are treated
|
|
86
86
|
// like caught exceptions, and the DevTools won't pause unless the developer
|
|
87
87
|
// takes the extra step of enabling pause on caught exceptions. This is
|
|
88
|
-
//
|
|
88
|
+
// unintuitive, though, because even though React has caught the error, from
|
|
89
89
|
// the developer's perspective, the error is uncaught.
|
|
90
90
|
//
|
|
91
91
|
// To preserve the expected "Pause on exceptions" behavior, we don't use a
|
|
@@ -842,6 +842,7 @@ var MemoComponent = 14;
|
|
|
842
842
|
var SimpleMemoComponent = 15;
|
|
843
843
|
var LazyComponent = 16;
|
|
844
844
|
var IncompleteClassComponent = 17;
|
|
845
|
+
var DehydratedSuspenseComponent = 18;
|
|
845
846
|
|
|
846
847
|
var randomKey = Math.random().toString(36).slice(2);
|
|
847
848
|
var internalInstanceKey = '__reactInternalInstance$' + randomKey;
|
|
@@ -2903,12 +2904,15 @@ var capitalize = function (token) {
|
|
|
2903
2904
|
attributeName, 'http://www.w3.org/XML/1998/namespace');
|
|
2904
2905
|
});
|
|
2905
2906
|
|
|
2906
|
-
//
|
|
2907
|
-
//
|
|
2908
|
-
//
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2907
|
+
// These attribute exists both in HTML and SVG.
|
|
2908
|
+
// The attribute name is case-sensitive in SVG so we can't just use
|
|
2909
|
+
// the React name like we do for attributes that exist only in HTML.
|
|
2910
|
+
['tabIndex', 'crossOrigin'].forEach(function (attributeName) {
|
|
2911
|
+
properties[attributeName] = new PropertyInfoRecord(attributeName, STRING, false, // mustUseProperty
|
|
2912
|
+
attributeName.toLowerCase(), // attributeName
|
|
2913
|
+
null);
|
|
2914
|
+
} // attributeNamespace
|
|
2915
|
+
);
|
|
2912
2916
|
|
|
2913
2917
|
/**
|
|
2914
2918
|
* Get the value for a property on a node. Only used in DEV for SSR validation.
|
|
@@ -3147,7 +3151,7 @@ var enableProfilerTimer = true;
|
|
|
3147
3151
|
var enableSchedulerTracing = true;
|
|
3148
3152
|
|
|
3149
3153
|
// Only used in www builds.
|
|
3150
|
-
// TODO: true? Here it might just be false.
|
|
3154
|
+
var enableSuspenseServerRenderer = false; // TODO: true? Here it might just be false.
|
|
3151
3155
|
|
|
3152
3156
|
// Only used in www builds.
|
|
3153
3157
|
|
|
@@ -8622,6 +8626,9 @@ var SUPPRESS_HYDRATION_WARNING = void 0;
|
|
|
8622
8626
|
SUPPRESS_HYDRATION_WARNING = 'suppressHydrationWarning';
|
|
8623
8627
|
}
|
|
8624
8628
|
|
|
8629
|
+
var SUSPENSE_START_DATA = '$';
|
|
8630
|
+
var SUSPENSE_END_DATA = '/$';
|
|
8631
|
+
|
|
8625
8632
|
var STYLE = 'style';
|
|
8626
8633
|
|
|
8627
8634
|
var eventsEnabled = null;
|
|
@@ -8850,6 +8857,43 @@ function removeChildFromContainer(container, child) {
|
|
|
8850
8857
|
}
|
|
8851
8858
|
}
|
|
8852
8859
|
|
|
8860
|
+
function clearSuspenseBoundary(parentInstance, suspenseInstance) {
|
|
8861
|
+
var node = suspenseInstance;
|
|
8862
|
+
// Delete all nodes within this suspense boundary.
|
|
8863
|
+
// There might be nested nodes so we need to keep track of how
|
|
8864
|
+
// deep we are and only break out when we're back on top.
|
|
8865
|
+
var depth = 0;
|
|
8866
|
+
do {
|
|
8867
|
+
var nextNode = node.nextSibling;
|
|
8868
|
+
parentInstance.removeChild(node);
|
|
8869
|
+
if (nextNode && nextNode.nodeType === COMMENT_NODE) {
|
|
8870
|
+
var data = nextNode.data;
|
|
8871
|
+
if (data === SUSPENSE_END_DATA) {
|
|
8872
|
+
if (depth === 0) {
|
|
8873
|
+
parentInstance.removeChild(nextNode);
|
|
8874
|
+
return;
|
|
8875
|
+
} else {
|
|
8876
|
+
depth--;
|
|
8877
|
+
}
|
|
8878
|
+
} else if (data === SUSPENSE_START_DATA) {
|
|
8879
|
+
depth++;
|
|
8880
|
+
}
|
|
8881
|
+
}
|
|
8882
|
+
node = nextNode;
|
|
8883
|
+
} while (node);
|
|
8884
|
+
// TODO: Warn, we didn't find the end comment boundary.
|
|
8885
|
+
}
|
|
8886
|
+
|
|
8887
|
+
function clearSuspenseBoundaryFromContainer(container, suspenseInstance) {
|
|
8888
|
+
if (container.nodeType === COMMENT_NODE) {
|
|
8889
|
+
clearSuspenseBoundary(container.parentNode, suspenseInstance);
|
|
8890
|
+
} else if (container.nodeType === ELEMENT_NODE) {
|
|
8891
|
+
clearSuspenseBoundary(container, suspenseInstance);
|
|
8892
|
+
} else {
|
|
8893
|
+
// Document nodes should never contain suspense boundaries.
|
|
8894
|
+
}
|
|
8895
|
+
}
|
|
8896
|
+
|
|
8853
8897
|
function hideInstance(instance) {
|
|
8854
8898
|
// TODO: Does this work for all element types? What about MathML? Should we
|
|
8855
8899
|
// pass host context to this method?
|
|
@@ -8895,10 +8939,19 @@ function canHydrateTextInstance(instance, text) {
|
|
|
8895
8939
|
return instance;
|
|
8896
8940
|
}
|
|
8897
8941
|
|
|
8942
|
+
function canHydrateSuspenseInstance(instance) {
|
|
8943
|
+
if (instance.nodeType !== COMMENT_NODE) {
|
|
8944
|
+
// Empty strings are not parsed by HTML so there won't be a correct match here.
|
|
8945
|
+
return null;
|
|
8946
|
+
}
|
|
8947
|
+
// This has now been refined to a suspense node.
|
|
8948
|
+
return instance;
|
|
8949
|
+
}
|
|
8950
|
+
|
|
8898
8951
|
function getNextHydratableSibling(instance) {
|
|
8899
8952
|
var node = instance.nextSibling;
|
|
8900
8953
|
// Skip non-hydratable nodes.
|
|
8901
|
-
while (node && node.nodeType !== ELEMENT_NODE && node.nodeType !== TEXT_NODE) {
|
|
8954
|
+
while (node && node.nodeType !== ELEMENT_NODE && node.nodeType !== TEXT_NODE && (!enableSuspenseServerRenderer || node.nodeType !== COMMENT_NODE || node.data !== SUSPENSE_START_DATA)) {
|
|
8902
8955
|
node = node.nextSibling;
|
|
8903
8956
|
}
|
|
8904
8957
|
return node;
|
|
@@ -8907,7 +8960,7 @@ function getNextHydratableSibling(instance) {
|
|
|
8907
8960
|
function getFirstHydratableChild(parentInstance) {
|
|
8908
8961
|
var next = parentInstance.firstChild;
|
|
8909
8962
|
// Skip non-hydratable nodes.
|
|
8910
|
-
while (next && next.nodeType !== ELEMENT_NODE && next.nodeType !== TEXT_NODE) {
|
|
8963
|
+
while (next && next.nodeType !== ELEMENT_NODE && next.nodeType !== TEXT_NODE && (!enableSuspenseServerRenderer || next.nodeType !== COMMENT_NODE || next.data !== SUSPENSE_START_DATA)) {
|
|
8911
8964
|
next = next.nextSibling;
|
|
8912
8965
|
}
|
|
8913
8966
|
return next;
|
|
@@ -8931,6 +8984,31 @@ function hydrateTextInstance(textInstance, text, internalInstanceHandle) {
|
|
|
8931
8984
|
return diffHydratedText(textInstance, text);
|
|
8932
8985
|
}
|
|
8933
8986
|
|
|
8987
|
+
function getNextHydratableInstanceAfterSuspenseInstance(suspenseInstance) {
|
|
8988
|
+
var node = suspenseInstance.nextSibling;
|
|
8989
|
+
// Skip past all nodes within this suspense boundary.
|
|
8990
|
+
// There might be nested nodes so we need to keep track of how
|
|
8991
|
+
// deep we are and only break out when we're back on top.
|
|
8992
|
+
var depth = 0;
|
|
8993
|
+
while (node) {
|
|
8994
|
+
if (node.nodeType === COMMENT_NODE) {
|
|
8995
|
+
var data = node.data;
|
|
8996
|
+
if (data === SUSPENSE_END_DATA) {
|
|
8997
|
+
if (depth === 0) {
|
|
8998
|
+
return getNextHydratableSibling(node);
|
|
8999
|
+
} else {
|
|
9000
|
+
depth--;
|
|
9001
|
+
}
|
|
9002
|
+
} else if (data === SUSPENSE_START_DATA) {
|
|
9003
|
+
depth++;
|
|
9004
|
+
}
|
|
9005
|
+
}
|
|
9006
|
+
node = node.nextSibling;
|
|
9007
|
+
}
|
|
9008
|
+
// TODO: Warn, we didn't find the end comment boundary.
|
|
9009
|
+
return null;
|
|
9010
|
+
}
|
|
9011
|
+
|
|
8934
9012
|
function didNotMatchHydratedContainerTextInstance(parentContainer, textInstance, text) {
|
|
8935
9013
|
{
|
|
8936
9014
|
warnForUnmatchedText(textInstance, text);
|
|
@@ -8947,6 +9025,8 @@ function didNotHydrateContainerInstance(parentContainer, instance) {
|
|
|
8947
9025
|
{
|
|
8948
9026
|
if (instance.nodeType === ELEMENT_NODE) {
|
|
8949
9027
|
warnForDeletedHydratableElement(parentContainer, instance);
|
|
9028
|
+
} else if (instance.nodeType === COMMENT_NODE) {
|
|
9029
|
+
// TODO: warnForDeletedHydratableSuspenseBoundary
|
|
8950
9030
|
} else {
|
|
8951
9031
|
warnForDeletedHydratableText(parentContainer, instance);
|
|
8952
9032
|
}
|
|
@@ -8957,6 +9037,8 @@ function didNotHydrateInstance(parentType, parentProps, parentInstance, instance
|
|
|
8957
9037
|
if (true && parentProps[SUPPRESS_HYDRATION_WARNING] !== true) {
|
|
8958
9038
|
if (instance.nodeType === ELEMENT_NODE) {
|
|
8959
9039
|
warnForDeletedHydratableElement(parentInstance, instance);
|
|
9040
|
+
} else if (instance.nodeType === COMMENT_NODE) {
|
|
9041
|
+
// TODO: warnForDeletedHydratableSuspenseBoundary
|
|
8960
9042
|
} else {
|
|
8961
9043
|
warnForDeletedHydratableText(parentInstance, instance);
|
|
8962
9044
|
}
|
|
@@ -8975,6 +9057,8 @@ function didNotFindHydratableContainerTextInstance(parentContainer, text) {
|
|
|
8975
9057
|
}
|
|
8976
9058
|
}
|
|
8977
9059
|
|
|
9060
|
+
|
|
9061
|
+
|
|
8978
9062
|
function didNotFindHydratableInstance(parentType, parentProps, parentInstance, type, props) {
|
|
8979
9063
|
if (true && parentProps[SUPPRESS_HYDRATION_WARNING] !== true) {
|
|
8980
9064
|
warnForInsertedHydratedElement(parentInstance, type, props);
|
|
@@ -8987,6 +9071,12 @@ function didNotFindHydratableTextInstance(parentType, parentProps, parentInstanc
|
|
|
8987
9071
|
}
|
|
8988
9072
|
}
|
|
8989
9073
|
|
|
9074
|
+
function didNotFindHydratableSuspenseInstance(parentType, parentProps, parentInstance) {
|
|
9075
|
+
if (true && parentProps[SUPPRESS_HYDRATION_WARNING] !== true) {
|
|
9076
|
+
// TODO: warnForInsertedHydratedSuspense(parentInstance);
|
|
9077
|
+
}
|
|
9078
|
+
}
|
|
9079
|
+
|
|
8990
9080
|
// This is just to get the setup running.
|
|
8991
9081
|
// TODO: real implementation.
|
|
8992
9082
|
// console.log('Hello from Fire host config.');
|
|
@@ -9246,7 +9336,7 @@ function stopFailedWorkTimer(fiber) {
|
|
|
9246
9336
|
return;
|
|
9247
9337
|
}
|
|
9248
9338
|
fiber._debugIsCurrentlyTiming = false;
|
|
9249
|
-
var warning = fiber.tag === SuspenseComponent ? 'Rendering was suspended' : 'An error was thrown inside this error boundary';
|
|
9339
|
+
var warning = fiber.tag === SuspenseComponent || fiber.tag === DehydratedSuspenseComponent ? 'Rendering was suspended' : 'An error was thrown inside this error boundary';
|
|
9250
9340
|
endFiberMark(fiber, null, warning);
|
|
9251
9341
|
}
|
|
9252
9342
|
}
|
|
@@ -12053,7 +12143,7 @@ function ChildReconciler(shouldTrackSideEffects) {
|
|
|
12053
12143
|
}
|
|
12054
12144
|
|
|
12055
12145
|
function reconcileChildrenArray(returnFiber, currentFirstChild, newChildren, expirationTime) {
|
|
12056
|
-
// This algorithm can't optimize by searching from
|
|
12146
|
+
// This algorithm can't optimize by searching from both ends since we
|
|
12057
12147
|
// don't have backpointers on fibers. I'm trying to see how far we can get
|
|
12058
12148
|
// with that model. If it ends up not being worth the tradeoffs, we can
|
|
12059
12149
|
// add it later.
|
|
@@ -12867,9 +12957,6 @@ function mountWorkInProgressHook() {
|
|
|
12867
12957
|
|
|
12868
12958
|
{
|
|
12869
12959
|
hook._debugType = currentHookNameInDev;
|
|
12870
|
-
if (currentlyRenderingFiber$1 !== null && currentlyRenderingFiber$1.alternate !== null) {
|
|
12871
|
-
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));
|
|
12872
|
-
}
|
|
12873
12960
|
}
|
|
12874
12961
|
if (workInProgressHook === null) {
|
|
12875
12962
|
// This is the first hook in the list
|
|
@@ -13232,7 +13319,7 @@ function mountImperativeHandle(ref, create, deps) {
|
|
|
13232
13319
|
}
|
|
13233
13320
|
|
|
13234
13321
|
// TODO: If deps are provided, should we skip comparing the ref itself?
|
|
13235
|
-
var effectDeps = deps !== null && deps !== undefined ? deps.concat([ref]) :
|
|
13322
|
+
var effectDeps = deps !== null && deps !== undefined ? deps.concat([ref]) : null;
|
|
13236
13323
|
|
|
13237
13324
|
return mountEffectImpl(Update, UnmountMutation | MountLayout, imperativeHandleEffect.bind(null, create, ref), effectDeps);
|
|
13238
13325
|
}
|
|
@@ -13243,7 +13330,7 @@ function updateImperativeHandle(ref, create, deps) {
|
|
|
13243
13330
|
}
|
|
13244
13331
|
|
|
13245
13332
|
// TODO: If deps are provided, should we skip comparing the ref itself?
|
|
13246
|
-
var effectDeps = deps !== null && deps !== undefined ? deps.concat([ref]) :
|
|
13333
|
+
var effectDeps = deps !== null && deps !== undefined ? deps.concat([ref]) : null;
|
|
13247
13334
|
|
|
13248
13335
|
return updateEffectImpl(Update, UnmountMutation | MountLayout, imperativeHandleEffect.bind(null, create, ref), effectDeps);
|
|
13249
13336
|
}
|
|
@@ -13310,7 +13397,7 @@ function updateMemo(nextCreate, deps) {
|
|
|
13310
13397
|
var shouldWarnForUnbatchedSetState = false;
|
|
13311
13398
|
|
|
13312
13399
|
{
|
|
13313
|
-
// jest
|
|
13400
|
+
// jest isn't a 'global', it's just exposed to tests via a wrapped function
|
|
13314
13401
|
// further, this isn't a test file, so flow doesn't recognize the symbol. So...
|
|
13315
13402
|
// $FlowExpectedError - because requirements don't give a damn about your type sigs.
|
|
13316
13403
|
if ('undefined' !== typeof jest) {
|
|
@@ -13800,6 +13887,18 @@ function enterHydrationState(fiber) {
|
|
|
13800
13887
|
return true;
|
|
13801
13888
|
}
|
|
13802
13889
|
|
|
13890
|
+
function reenterHydrationStateFromDehydratedSuspenseInstance(fiber) {
|
|
13891
|
+
if (!supportsHydration) {
|
|
13892
|
+
return false;
|
|
13893
|
+
}
|
|
13894
|
+
|
|
13895
|
+
var suspenseInstance = fiber.stateNode;
|
|
13896
|
+
nextHydratableInstance = getNextHydratableSibling(suspenseInstance);
|
|
13897
|
+
popToNextHostParent(fiber);
|
|
13898
|
+
isHydrating = true;
|
|
13899
|
+
return true;
|
|
13900
|
+
}
|
|
13901
|
+
|
|
13803
13902
|
function deleteHydratableInstance(returnFiber, instance) {
|
|
13804
13903
|
{
|
|
13805
13904
|
switch (returnFiber.tag) {
|
|
@@ -13846,6 +13945,9 @@ function insertNonHydratedInstance(returnFiber, fiber) {
|
|
|
13846
13945
|
case HostText:
|
|
13847
13946
|
var text = fiber.pendingProps;
|
|
13848
13947
|
didNotFindHydratableContainerTextInstance(parentContainer, text);
|
|
13948
|
+
break;
|
|
13949
|
+
case SuspenseComponent:
|
|
13950
|
+
|
|
13849
13951
|
break;
|
|
13850
13952
|
}
|
|
13851
13953
|
break;
|
|
@@ -13865,6 +13967,9 @@ function insertNonHydratedInstance(returnFiber, fiber) {
|
|
|
13865
13967
|
var _text = fiber.pendingProps;
|
|
13866
13968
|
didNotFindHydratableTextInstance(parentType, parentProps, parentInstance, _text);
|
|
13867
13969
|
break;
|
|
13970
|
+
case SuspenseComponent:
|
|
13971
|
+
didNotFindHydratableSuspenseInstance(parentType, parentProps, parentInstance);
|
|
13972
|
+
break;
|
|
13868
13973
|
}
|
|
13869
13974
|
break;
|
|
13870
13975
|
}
|
|
@@ -13897,6 +14002,19 @@ function tryHydrate(fiber, nextInstance) {
|
|
|
13897
14002
|
}
|
|
13898
14003
|
return false;
|
|
13899
14004
|
}
|
|
14005
|
+
case SuspenseComponent:
|
|
14006
|
+
{
|
|
14007
|
+
if (enableSuspenseServerRenderer) {
|
|
14008
|
+
var suspenseInstance = canHydrateSuspenseInstance(nextInstance);
|
|
14009
|
+
if (suspenseInstance !== null) {
|
|
14010
|
+
// Downgrade the tag to a dehydrated component until we've hydrated it.
|
|
14011
|
+
fiber.tag = DehydratedSuspenseComponent;
|
|
14012
|
+
fiber.stateNode = suspenseInstance;
|
|
14013
|
+
return true;
|
|
14014
|
+
}
|
|
14015
|
+
}
|
|
14016
|
+
return false;
|
|
14017
|
+
}
|
|
13900
14018
|
default:
|
|
13901
14019
|
return false;
|
|
13902
14020
|
}
|
|
@@ -13990,9 +14108,18 @@ function prepareToHydrateHostTextInstance(fiber) {
|
|
|
13990
14108
|
return shouldUpdate;
|
|
13991
14109
|
}
|
|
13992
14110
|
|
|
14111
|
+
function skipPastDehydratedSuspenseInstance(fiber) {
|
|
14112
|
+
if (!supportsHydration) {
|
|
14113
|
+
invariant(false, 'Expected skipPastDehydratedSuspenseInstance() to never be called. This error is likely caused by a bug in React. Please file an issue.');
|
|
14114
|
+
}
|
|
14115
|
+
var suspenseInstance = fiber.stateNode;
|
|
14116
|
+
!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;
|
|
14117
|
+
nextHydratableInstance = getNextHydratableInstanceAfterSuspenseInstance(suspenseInstance);
|
|
14118
|
+
}
|
|
14119
|
+
|
|
13993
14120
|
function popToNextHostParent(fiber) {
|
|
13994
14121
|
var parent = fiber.return;
|
|
13995
|
-
while (parent !== null && parent.tag !== HostComponent && parent.tag !== HostRoot) {
|
|
14122
|
+
while (parent !== null && parent.tag !== HostComponent && parent.tag !== HostRoot && parent.tag !== DehydratedSuspenseComponent) {
|
|
13996
14123
|
parent = parent.return;
|
|
13997
14124
|
}
|
|
13998
14125
|
hydrationParentFiber = parent;
|
|
@@ -14100,6 +14227,10 @@ function forceUnmountCurrentAndReconcile(current$$1, workInProgress, nextChildre
|
|
|
14100
14227
|
}
|
|
14101
14228
|
|
|
14102
14229
|
function updateForwardRef(current$$1, workInProgress, Component, nextProps, renderExpirationTime) {
|
|
14230
|
+
// TODO: current can be non-null here even if the component
|
|
14231
|
+
// hasn't yet mounted. This happens after the first render suspends.
|
|
14232
|
+
// We'll need to figure out if this is fine or can cause issues.
|
|
14233
|
+
|
|
14103
14234
|
{
|
|
14104
14235
|
if (workInProgress.type !== workInProgress.elementType) {
|
|
14105
14236
|
// Lazy component props can't be validated in createElement
|
|
@@ -14205,6 +14336,10 @@ function updateMemoComponent(current$$1, workInProgress, Component, nextProps, u
|
|
|
14205
14336
|
}
|
|
14206
14337
|
|
|
14207
14338
|
function updateSimpleMemoComponent(current$$1, workInProgress, Component, nextProps, updateExpirationTime, renderExpirationTime) {
|
|
14339
|
+
// TODO: current can be non-null here even if the component
|
|
14340
|
+
// hasn't yet mounted. This happens when the inner render suspends.
|
|
14341
|
+
// We'll need to figure out if this is fine or can cause issues.
|
|
14342
|
+
|
|
14208
14343
|
{
|
|
14209
14344
|
if (workInProgress.type !== workInProgress.elementType) {
|
|
14210
14345
|
// Lazy component props can't be validated in createElement
|
|
@@ -14828,6 +14963,18 @@ function updateSuspenseComponent(current$$1, workInProgress, renderExpirationTim
|
|
|
14828
14963
|
// children -- we skip over the primary children entirely.
|
|
14829
14964
|
var next = void 0;
|
|
14830
14965
|
if (current$$1 === null) {
|
|
14966
|
+
if (enableSuspenseServerRenderer) {
|
|
14967
|
+
// If we're currently hydrating, try to hydrate this boundary.
|
|
14968
|
+
// But only if this has a fallback.
|
|
14969
|
+
if (nextProps.fallback !== undefined) {
|
|
14970
|
+
tryToClaimNextHydratableInstance(workInProgress);
|
|
14971
|
+
// This could've changed the tag if this was a dehydrated suspense component.
|
|
14972
|
+
if (workInProgress.tag === DehydratedSuspenseComponent) {
|
|
14973
|
+
return updateDehydratedSuspenseComponent(null, workInProgress, renderExpirationTime);
|
|
14974
|
+
}
|
|
14975
|
+
}
|
|
14976
|
+
}
|
|
14977
|
+
|
|
14831
14978
|
// This is the initial mount. This branch is pretty simple because there's
|
|
14832
14979
|
// no previous state that needs to be preserved.
|
|
14833
14980
|
if (nextDidTimeout) {
|
|
@@ -14979,6 +15126,65 @@ function updateSuspenseComponent(current$$1, workInProgress, renderExpirationTim
|
|
|
14979
15126
|
return next;
|
|
14980
15127
|
}
|
|
14981
15128
|
|
|
15129
|
+
function updateDehydratedSuspenseComponent(current$$1, workInProgress, renderExpirationTime) {
|
|
15130
|
+
if (current$$1 === null) {
|
|
15131
|
+
// During the first pass, we'll bail out and not drill into the children.
|
|
15132
|
+
// Instead, we'll leave the content in place and try to hydrate it later.
|
|
15133
|
+
workInProgress.expirationTime = Never;
|
|
15134
|
+
return null;
|
|
15135
|
+
}
|
|
15136
|
+
// We use childExpirationTime to indicate that a child might depend on context, so if
|
|
15137
|
+
// any context has changed, we need to treat is as if the input might have changed.
|
|
15138
|
+
var hasContextChanged$$1 = current$$1.childExpirationTime >= renderExpirationTime;
|
|
15139
|
+
if (didReceiveUpdate || hasContextChanged$$1) {
|
|
15140
|
+
// This boundary has changed since the first render. This means that we are now unable to
|
|
15141
|
+
// hydrate it. We might still be able to hydrate it using an earlier expiration time but
|
|
15142
|
+
// during this render we can't. Instead, we're going to delete the whole subtree and
|
|
15143
|
+
// instead inject a new real Suspense boundary to take its place, which may render content
|
|
15144
|
+
// or fallback. The real Suspense boundary will suspend for a while so we have some time
|
|
15145
|
+
// to ensure it can produce real content, but all state and pending events will be lost.
|
|
15146
|
+
|
|
15147
|
+
// Detach from the current dehydrated boundary.
|
|
15148
|
+
current$$1.alternate = null;
|
|
15149
|
+
workInProgress.alternate = null;
|
|
15150
|
+
|
|
15151
|
+
// Insert a deletion in the effect list.
|
|
15152
|
+
var returnFiber = workInProgress.return;
|
|
15153
|
+
!(returnFiber !== null) ? invariant(false, 'Suspense boundaries are never on the root. This is probably a bug in React.') : void 0;
|
|
15154
|
+
var last = returnFiber.lastEffect;
|
|
15155
|
+
if (last !== null) {
|
|
15156
|
+
last.nextEffect = current$$1;
|
|
15157
|
+
returnFiber.lastEffect = current$$1;
|
|
15158
|
+
} else {
|
|
15159
|
+
returnFiber.firstEffect = returnFiber.lastEffect = current$$1;
|
|
15160
|
+
}
|
|
15161
|
+
current$$1.nextEffect = null;
|
|
15162
|
+
current$$1.effectTag = Deletion;
|
|
15163
|
+
|
|
15164
|
+
// Upgrade this work in progress to a real Suspense component.
|
|
15165
|
+
workInProgress.tag = SuspenseComponent;
|
|
15166
|
+
workInProgress.stateNode = null;
|
|
15167
|
+
workInProgress.memoizedState = null;
|
|
15168
|
+
// This is now an insertion.
|
|
15169
|
+
workInProgress.effectTag |= Placement;
|
|
15170
|
+
// Retry as a real Suspense component.
|
|
15171
|
+
return updateSuspenseComponent(null, workInProgress, renderExpirationTime);
|
|
15172
|
+
}
|
|
15173
|
+
if ((workInProgress.effectTag & DidCapture) === NoEffect) {
|
|
15174
|
+
// This is the first attempt.
|
|
15175
|
+
reenterHydrationStateFromDehydratedSuspenseInstance(workInProgress);
|
|
15176
|
+
var nextProps = workInProgress.pendingProps;
|
|
15177
|
+
var nextChildren = nextProps.children;
|
|
15178
|
+
workInProgress.child = mountChildFibers(workInProgress, null, nextChildren, renderExpirationTime);
|
|
15179
|
+
return workInProgress.child;
|
|
15180
|
+
} else {
|
|
15181
|
+
// Something suspended. Leave the existing children in place.
|
|
15182
|
+
// TODO: In non-concurrent mode, should we commit the nodes we have hydrated so far?
|
|
15183
|
+
workInProgress.child = null;
|
|
15184
|
+
return null;
|
|
15185
|
+
}
|
|
15186
|
+
}
|
|
15187
|
+
|
|
14982
15188
|
function updatePortalComponent(current$$1, workInProgress, renderExpirationTime) {
|
|
14983
15189
|
pushHostContainer(workInProgress, workInProgress.stateNode.containerInfo);
|
|
14984
15190
|
var nextChildren = workInProgress.pendingProps;
|
|
@@ -15190,6 +15396,16 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
|
|
|
15190
15396
|
}
|
|
15191
15397
|
break;
|
|
15192
15398
|
}
|
|
15399
|
+
case DehydratedSuspenseComponent:
|
|
15400
|
+
{
|
|
15401
|
+
if (enableSuspenseServerRenderer) {
|
|
15402
|
+
// We know that this component will suspend again because if it has
|
|
15403
|
+
// been unsuspended it has committed as a regular Suspense component.
|
|
15404
|
+
// If it needs to be retried, it should have work scheduled on it.
|
|
15405
|
+
workInProgress.effectTag |= DidCapture;
|
|
15406
|
+
break;
|
|
15407
|
+
}
|
|
15408
|
+
}
|
|
15193
15409
|
}
|
|
15194
15410
|
return bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
|
|
15195
15411
|
}
|
|
@@ -15281,9 +15497,15 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
|
|
|
15281
15497
|
var _resolvedProps4 = workInProgress.elementType === _Component3 ? _unresolvedProps4 : resolveDefaultProps(_Component3, _unresolvedProps4);
|
|
15282
15498
|
return mountIncompleteClassComponent(current$$1, workInProgress, _Component3, _resolvedProps4, renderExpirationTime);
|
|
15283
15499
|
}
|
|
15284
|
-
|
|
15285
|
-
|
|
15500
|
+
case DehydratedSuspenseComponent:
|
|
15501
|
+
{
|
|
15502
|
+
if (enableSuspenseServerRenderer) {
|
|
15503
|
+
return updateDehydratedSuspenseComponent(current$$1, workInProgress, renderExpirationTime);
|
|
15504
|
+
}
|
|
15505
|
+
break;
|
|
15506
|
+
}
|
|
15286
15507
|
}
|
|
15508
|
+
invariant(false, 'Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue.');
|
|
15287
15509
|
}
|
|
15288
15510
|
|
|
15289
15511
|
var valueCursor = createCursor(null);
|
|
@@ -15372,6 +15594,28 @@ function calculateChangedBits(context, newValue, oldValue) {
|
|
|
15372
15594
|
}
|
|
15373
15595
|
}
|
|
15374
15596
|
|
|
15597
|
+
function scheduleWorkOnParentPath(parent, renderExpirationTime) {
|
|
15598
|
+
// Update the child expiration time of all the ancestors, including
|
|
15599
|
+
// the alternates.
|
|
15600
|
+
var node = parent;
|
|
15601
|
+
while (node !== null) {
|
|
15602
|
+
var alternate = node.alternate;
|
|
15603
|
+
if (node.childExpirationTime < renderExpirationTime) {
|
|
15604
|
+
node.childExpirationTime = renderExpirationTime;
|
|
15605
|
+
if (alternate !== null && alternate.childExpirationTime < renderExpirationTime) {
|
|
15606
|
+
alternate.childExpirationTime = renderExpirationTime;
|
|
15607
|
+
}
|
|
15608
|
+
} else if (alternate !== null && alternate.childExpirationTime < renderExpirationTime) {
|
|
15609
|
+
alternate.childExpirationTime = renderExpirationTime;
|
|
15610
|
+
} else {
|
|
15611
|
+
// Neither alternate was updated, which means the rest of the
|
|
15612
|
+
// ancestor path already has sufficient priority.
|
|
15613
|
+
break;
|
|
15614
|
+
}
|
|
15615
|
+
node = node.return;
|
|
15616
|
+
}
|
|
15617
|
+
}
|
|
15618
|
+
|
|
15375
15619
|
function propagateContextChange(workInProgress, context, changedBits, renderExpirationTime) {
|
|
15376
15620
|
var fiber = workInProgress.child;
|
|
15377
15621
|
if (fiber !== null) {
|
|
@@ -15410,25 +15654,8 @@ function propagateContextChange(workInProgress, context, changedBits, renderExpi
|
|
|
15410
15654
|
if (alternate !== null && alternate.expirationTime < renderExpirationTime) {
|
|
15411
15655
|
alternate.expirationTime = renderExpirationTime;
|
|
15412
15656
|
}
|
|
15413
|
-
|
|
15414
|
-
|
|
15415
|
-
var node = fiber.return;
|
|
15416
|
-
while (node !== null) {
|
|
15417
|
-
alternate = node.alternate;
|
|
15418
|
-
if (node.childExpirationTime < renderExpirationTime) {
|
|
15419
|
-
node.childExpirationTime = renderExpirationTime;
|
|
15420
|
-
if (alternate !== null && alternate.childExpirationTime < renderExpirationTime) {
|
|
15421
|
-
alternate.childExpirationTime = renderExpirationTime;
|
|
15422
|
-
}
|
|
15423
|
-
} else if (alternate !== null && alternate.childExpirationTime < renderExpirationTime) {
|
|
15424
|
-
alternate.childExpirationTime = renderExpirationTime;
|
|
15425
|
-
} else {
|
|
15426
|
-
// Neither alternate was updated, which means the rest of the
|
|
15427
|
-
// ancestor path already has sufficient priority.
|
|
15428
|
-
break;
|
|
15429
|
-
}
|
|
15430
|
-
node = node.return;
|
|
15431
|
-
}
|
|
15657
|
+
|
|
15658
|
+
scheduleWorkOnParentPath(fiber.return, renderExpirationTime);
|
|
15432
15659
|
|
|
15433
15660
|
// Mark the expiration time on the list, too.
|
|
15434
15661
|
if (list.expirationTime < renderExpirationTime) {
|
|
@@ -15444,6 +15671,23 @@ function propagateContextChange(workInProgress, context, changedBits, renderExpi
|
|
|
15444
15671
|
} else if (fiber.tag === ContextProvider) {
|
|
15445
15672
|
// Don't scan deeper if this is a matching provider
|
|
15446
15673
|
nextFiber = fiber.type === workInProgress.type ? null : fiber.child;
|
|
15674
|
+
} else if (enableSuspenseServerRenderer && fiber.tag === DehydratedSuspenseComponent) {
|
|
15675
|
+
// If a dehydrated suspense component is in this subtree, we don't know
|
|
15676
|
+
// if it will have any context consumers in it. The best we can do is
|
|
15677
|
+
// mark it as having updates on its children.
|
|
15678
|
+
if (fiber.expirationTime < renderExpirationTime) {
|
|
15679
|
+
fiber.expirationTime = renderExpirationTime;
|
|
15680
|
+
}
|
|
15681
|
+
var _alternate = fiber.alternate;
|
|
15682
|
+
if (_alternate !== null && _alternate.expirationTime < renderExpirationTime) {
|
|
15683
|
+
_alternate.expirationTime = renderExpirationTime;
|
|
15684
|
+
}
|
|
15685
|
+
// This is intentionally passing this fiber as the parent
|
|
15686
|
+
// because we want to schedule this fiber as having work
|
|
15687
|
+
// on its children. We'll use the childExpirationTime on
|
|
15688
|
+
// this fiber to indicate that a context has changed.
|
|
15689
|
+
scheduleWorkOnParentPath(fiber, renderExpirationTime);
|
|
15690
|
+
nextFiber = fiber.sibling;
|
|
15447
15691
|
} else {
|
|
15448
15692
|
// Traverse down.
|
|
15449
15693
|
nextFiber = fiber.child;
|
|
@@ -16567,6 +16811,26 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
16567
16811
|
}
|
|
16568
16812
|
break;
|
|
16569
16813
|
}
|
|
16814
|
+
case DehydratedSuspenseComponent:
|
|
16815
|
+
{
|
|
16816
|
+
if (enableSuspenseServerRenderer) {
|
|
16817
|
+
if (current === null) {
|
|
16818
|
+
var _wasHydrated2 = popHydrationState(workInProgress);
|
|
16819
|
+
!_wasHydrated2 ? invariant(false, 'A dehydrated suspense component was completed without a hydrated node. This is probably a bug in React.') : void 0;
|
|
16820
|
+
skipPastDehydratedSuspenseInstance(workInProgress);
|
|
16821
|
+
} else if ((workInProgress.effectTag & DidCapture) === NoEffect) {
|
|
16822
|
+
// This boundary did not suspend so it's now hydrated.
|
|
16823
|
+
// To handle any future suspense cases, we're going to now upgrade it
|
|
16824
|
+
// to a Suspense component. We detach it from the existing current fiber.
|
|
16825
|
+
current.alternate = null;
|
|
16826
|
+
workInProgress.alternate = null;
|
|
16827
|
+
workInProgress.tag = SuspenseComponent;
|
|
16828
|
+
workInProgress.memoizedState = null;
|
|
16829
|
+
workInProgress.stateNode = null;
|
|
16830
|
+
}
|
|
16831
|
+
}
|
|
16832
|
+
break;
|
|
16833
|
+
}
|
|
16570
16834
|
default:
|
|
16571
16835
|
invariant(false, 'Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue.');
|
|
16572
16836
|
}
|
|
@@ -16657,7 +16921,7 @@ var didWarnAboutUndefinedSnapshotBeforeUpdate = null;
|
|
|
16657
16921
|
didWarnAboutUndefinedSnapshotBeforeUpdate = new Set();
|
|
16658
16922
|
}
|
|
16659
16923
|
|
|
16660
|
-
var PossiblyWeakSet = typeof WeakSet === 'function' ? WeakSet : Set;
|
|
16924
|
+
var PossiblyWeakSet$1 = typeof WeakSet === 'function' ? WeakSet : Set;
|
|
16661
16925
|
|
|
16662
16926
|
function logError(boundary, errorInfo) {
|
|
16663
16927
|
var source = errorInfo.source;
|
|
@@ -16970,7 +17234,7 @@ function commitLifeCycles(finishedRoot, current$$1, finishedWork, committedExpir
|
|
|
16970
17234
|
|
|
16971
17235
|
function hideOrUnhideAllChildren(finishedWork, isHidden) {
|
|
16972
17236
|
if (supportsMutation) {
|
|
16973
|
-
// We only have the top Fiber that was inserted but we need recurse down its
|
|
17237
|
+
// We only have the top Fiber that was inserted but we need to recurse down its
|
|
16974
17238
|
var node = finishedWork;
|
|
16975
17239
|
while (true) {
|
|
16976
17240
|
if (node.tag === HostComponent) {
|
|
@@ -17238,7 +17502,7 @@ function getHostSibling(fiber) {
|
|
|
17238
17502
|
}
|
|
17239
17503
|
node.sibling.return = node.return;
|
|
17240
17504
|
node = node.sibling;
|
|
17241
|
-
while (node.tag !== HostComponent && node.tag !== HostText) {
|
|
17505
|
+
while (node.tag !== HostComponent && node.tag !== HostText && node.tag !== DehydratedSuspenseComponent) {
|
|
17242
17506
|
// If it is not host node and, we might have a host node inside it.
|
|
17243
17507
|
// Try to search down until we find one.
|
|
17244
17508
|
if (node.effectTag & Placement) {
|
|
@@ -17298,7 +17562,7 @@ function commitPlacement(finishedWork) {
|
|
|
17298
17562
|
}
|
|
17299
17563
|
|
|
17300
17564
|
var before = getHostSibling(finishedWork);
|
|
17301
|
-
// We only have the top Fiber that was inserted but we need recurse down its
|
|
17565
|
+
// We only have the top Fiber that was inserted but we need to recurse down its
|
|
17302
17566
|
// children to find all the terminal nodes.
|
|
17303
17567
|
var node = finishedWork;
|
|
17304
17568
|
while (true) {
|
|
@@ -17340,7 +17604,7 @@ function commitPlacement(finishedWork) {
|
|
|
17340
17604
|
}
|
|
17341
17605
|
|
|
17342
17606
|
function unmountHostComponents(current$$1) {
|
|
17343
|
-
// We only have the top Fiber that was deleted but we need recurse down its
|
|
17607
|
+
// We only have the top Fiber that was deleted but we need to recurse down its
|
|
17344
17608
|
var node = current$$1;
|
|
17345
17609
|
|
|
17346
17610
|
// Each iteration, currentParent is populated with node's host parent if not
|
|
@@ -17385,13 +17649,20 @@ function unmountHostComponents(current$$1) {
|
|
|
17385
17649
|
removeChild(currentParent, node.stateNode);
|
|
17386
17650
|
}
|
|
17387
17651
|
// Don't visit children because we already visited them.
|
|
17652
|
+
} else if (enableSuspenseServerRenderer && node.tag === DehydratedSuspenseComponent) {
|
|
17653
|
+
// Delete the dehydrated suspense boundary and all of its content.
|
|
17654
|
+
if (currentParentIsContainer) {
|
|
17655
|
+
clearSuspenseBoundaryFromContainer(currentParent, node.stateNode);
|
|
17656
|
+
} else {
|
|
17657
|
+
clearSuspenseBoundary(currentParent, node.stateNode);
|
|
17658
|
+
}
|
|
17388
17659
|
} else if (node.tag === HostPortal) {
|
|
17389
|
-
// When we go into a portal, it becomes the parent to remove from.
|
|
17390
|
-
// We will reassign it back when we pop the portal on the way up.
|
|
17391
|
-
currentParent = node.stateNode.containerInfo;
|
|
17392
|
-
currentParentIsContainer = true;
|
|
17393
|
-
// Visit children because portals might contain host components.
|
|
17394
17660
|
if (node.child !== null) {
|
|
17661
|
+
// When we go into a portal, it becomes the parent to remove from.
|
|
17662
|
+
// We will reassign it back when we pop the portal on the way up.
|
|
17663
|
+
currentParent = node.stateNode.containerInfo;
|
|
17664
|
+
currentParentIsContainer = true;
|
|
17665
|
+
// Visit children because portals might contain host components.
|
|
17395
17666
|
node.child.return = node;
|
|
17396
17667
|
node = node.child;
|
|
17397
17668
|
continue;
|
|
@@ -17541,7 +17812,7 @@ function commitWork(current$$1, finishedWork) {
|
|
|
17541
17812
|
finishedWork.updateQueue = null;
|
|
17542
17813
|
var retryCache = finishedWork.stateNode;
|
|
17543
17814
|
if (retryCache === null) {
|
|
17544
|
-
retryCache = finishedWork.stateNode = new PossiblyWeakSet();
|
|
17815
|
+
retryCache = finishedWork.stateNode = new PossiblyWeakSet$1();
|
|
17545
17816
|
}
|
|
17546
17817
|
thenables.forEach(function (thenable) {
|
|
17547
17818
|
// Memoize using the boundary fiber to prevent redundant listeners.
|
|
@@ -17576,6 +17847,7 @@ function commitResetTextContent(current$$1) {
|
|
|
17576
17847
|
resetTextContent(current$$1.stateNode);
|
|
17577
17848
|
}
|
|
17578
17849
|
|
|
17850
|
+
var PossiblyWeakSet = typeof WeakSet === 'function' ? WeakSet : Set;
|
|
17579
17851
|
var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;
|
|
17580
17852
|
|
|
17581
17853
|
function createRootErrorUpdate(fiber, errorInfo, expirationTime) {
|
|
@@ -17634,6 +17906,34 @@ function createClassErrorUpdate(fiber, errorInfo, expirationTime) {
|
|
|
17634
17906
|
return update;
|
|
17635
17907
|
}
|
|
17636
17908
|
|
|
17909
|
+
function attachPingListener(root, renderExpirationTime, thenable) {
|
|
17910
|
+
// Attach a listener to the promise to "ping" the root and retry. But
|
|
17911
|
+
// only if one does not already exist for the current render expiration
|
|
17912
|
+
// time (which acts like a "thread ID" here).
|
|
17913
|
+
var pingCache = root.pingCache;
|
|
17914
|
+
var threadIDs = void 0;
|
|
17915
|
+
if (pingCache === null) {
|
|
17916
|
+
pingCache = root.pingCache = new PossiblyWeakMap();
|
|
17917
|
+
threadIDs = new Set();
|
|
17918
|
+
pingCache.set(thenable, threadIDs);
|
|
17919
|
+
} else {
|
|
17920
|
+
threadIDs = pingCache.get(thenable);
|
|
17921
|
+
if (threadIDs === undefined) {
|
|
17922
|
+
threadIDs = new Set();
|
|
17923
|
+
pingCache.set(thenable, threadIDs);
|
|
17924
|
+
}
|
|
17925
|
+
}
|
|
17926
|
+
if (!threadIDs.has(renderExpirationTime)) {
|
|
17927
|
+
// Memoize using the thread ID to prevent redundant listeners.
|
|
17928
|
+
threadIDs.add(renderExpirationTime);
|
|
17929
|
+
var ping = pingSuspendedRoot.bind(null, root, thenable, renderExpirationTime);
|
|
17930
|
+
if (enableSchedulerTracing) {
|
|
17931
|
+
ping = tracing.unstable_wrap(ping);
|
|
17932
|
+
}
|
|
17933
|
+
thenable.then(ping, ping);
|
|
17934
|
+
}
|
|
17935
|
+
}
|
|
17936
|
+
|
|
17637
17937
|
function throwException(root, returnFiber, sourceFiber, value, renderExpirationTime) {
|
|
17638
17938
|
// The source fiber did not complete.
|
|
17639
17939
|
sourceFiber.effectTag |= Incomplete;
|
|
@@ -17675,6 +17975,9 @@ function throwException(root, returnFiber, sourceFiber, value, renderExpirationT
|
|
|
17675
17975
|
}
|
|
17676
17976
|
}
|
|
17677
17977
|
}
|
|
17978
|
+
// If there is a DehydratedSuspenseComponent we don't have to do anything because
|
|
17979
|
+
// if something suspends inside it, we will simply leave that as dehydrated. It
|
|
17980
|
+
// will never timeout.
|
|
17678
17981
|
_workInProgress = _workInProgress.return;
|
|
17679
17982
|
} while (_workInProgress !== null);
|
|
17680
17983
|
|
|
@@ -17738,31 +18041,7 @@ function throwException(root, returnFiber, sourceFiber, value, renderExpirationT
|
|
|
17738
18041
|
// Confirmed that the boundary is in a concurrent mode tree. Continue
|
|
17739
18042
|
// with the normal suspend path.
|
|
17740
18043
|
|
|
17741
|
-
|
|
17742
|
-
// only if one does not already exist for the current render expiration
|
|
17743
|
-
// time (which acts like a "thread ID" here).
|
|
17744
|
-
var pingCache = root.pingCache;
|
|
17745
|
-
var threadIDs = void 0;
|
|
17746
|
-
if (pingCache === null) {
|
|
17747
|
-
pingCache = root.pingCache = new PossiblyWeakMap();
|
|
17748
|
-
threadIDs = new Set();
|
|
17749
|
-
pingCache.set(thenable, threadIDs);
|
|
17750
|
-
} else {
|
|
17751
|
-
threadIDs = pingCache.get(thenable);
|
|
17752
|
-
if (threadIDs === undefined) {
|
|
17753
|
-
threadIDs = new Set();
|
|
17754
|
-
pingCache.set(thenable, threadIDs);
|
|
17755
|
-
}
|
|
17756
|
-
}
|
|
17757
|
-
if (!threadIDs.has(renderExpirationTime)) {
|
|
17758
|
-
// Memoize using the thread ID to prevent redundant listeners.
|
|
17759
|
-
threadIDs.add(renderExpirationTime);
|
|
17760
|
-
var ping = pingSuspendedRoot.bind(null, root, thenable, renderExpirationTime);
|
|
17761
|
-
if (enableSchedulerTracing) {
|
|
17762
|
-
ping = tracing.unstable_wrap(ping);
|
|
17763
|
-
}
|
|
17764
|
-
thenable.then(ping, ping);
|
|
17765
|
-
}
|
|
18044
|
+
attachPingListener(root, renderExpirationTime, thenable);
|
|
17766
18045
|
|
|
17767
18046
|
var absoluteTimeoutMs = void 0;
|
|
17768
18047
|
if (earliestTimeoutMs === -1) {
|
|
@@ -17794,6 +18073,29 @@ function throwException(root, returnFiber, sourceFiber, value, renderExpirationT
|
|
|
17794
18073
|
// whole tree.
|
|
17795
18074
|
renderDidSuspend(root, absoluteTimeoutMs, renderExpirationTime);
|
|
17796
18075
|
|
|
18076
|
+
_workInProgress.effectTag |= ShouldCapture;
|
|
18077
|
+
_workInProgress.expirationTime = renderExpirationTime;
|
|
18078
|
+
return;
|
|
18079
|
+
} else if (enableSuspenseServerRenderer && _workInProgress.tag === DehydratedSuspenseComponent) {
|
|
18080
|
+
attachPingListener(root, renderExpirationTime, thenable);
|
|
18081
|
+
|
|
18082
|
+
// Since we already have a current fiber, we can eagerly add a retry listener.
|
|
18083
|
+
var retryCache = _workInProgress.memoizedState;
|
|
18084
|
+
if (retryCache === null) {
|
|
18085
|
+
retryCache = _workInProgress.memoizedState = new PossiblyWeakSet();
|
|
18086
|
+
var _current = _workInProgress.alternate;
|
|
18087
|
+
!_current ? invariant(false, 'A dehydrated suspense boundary must commit before trying to render. This is probably a bug in React.') : void 0;
|
|
18088
|
+
_current.memoizedState = retryCache;
|
|
18089
|
+
}
|
|
18090
|
+
// Memoize using the boundary fiber to prevent redundant listeners.
|
|
18091
|
+
if (!retryCache.has(thenable)) {
|
|
18092
|
+
retryCache.add(thenable);
|
|
18093
|
+
var retry = retryTimedOutBoundary.bind(null, _workInProgress, thenable);
|
|
18094
|
+
if (enableSchedulerTracing) {
|
|
18095
|
+
retry = tracing.unstable_wrap(retry);
|
|
18096
|
+
}
|
|
18097
|
+
thenable.then(retry, retry);
|
|
18098
|
+
}
|
|
17797
18099
|
_workInProgress.effectTag |= ShouldCapture;
|
|
17798
18100
|
_workInProgress.expirationTime = renderExpirationTime;
|
|
17799
18101
|
return;
|
|
@@ -17871,6 +18173,7 @@ function unwindWork(workInProgress, renderExpirationTime) {
|
|
|
17871
18173
|
}
|
|
17872
18174
|
case HostComponent:
|
|
17873
18175
|
{
|
|
18176
|
+
// TODO: popHydrationState
|
|
17874
18177
|
popHostContext(workInProgress);
|
|
17875
18178
|
return null;
|
|
17876
18179
|
}
|
|
@@ -17884,6 +18187,19 @@ function unwindWork(workInProgress, renderExpirationTime) {
|
|
|
17884
18187
|
}
|
|
17885
18188
|
return null;
|
|
17886
18189
|
}
|
|
18190
|
+
case DehydratedSuspenseComponent:
|
|
18191
|
+
{
|
|
18192
|
+
if (enableSuspenseServerRenderer) {
|
|
18193
|
+
// TODO: popHydrationState
|
|
18194
|
+
var _effectTag3 = workInProgress.effectTag;
|
|
18195
|
+
if (_effectTag3 & ShouldCapture) {
|
|
18196
|
+
workInProgress.effectTag = _effectTag3 & ~ShouldCapture | DidCapture;
|
|
18197
|
+
// Captured a suspense effect. Re-render the boundary.
|
|
18198
|
+
return workInProgress;
|
|
18199
|
+
}
|
|
18200
|
+
}
|
|
18201
|
+
return null;
|
|
18202
|
+
}
|
|
17887
18203
|
case HostPortal:
|
|
17888
18204
|
popHostContainer(workInProgress);
|
|
17889
18205
|
return null;
|
|
@@ -17981,11 +18297,6 @@ if (enableSchedulerTracing) {
|
|
|
17981
18297
|
// Used to ensure computeUniqueAsyncExpiration is monotonically decreasing.
|
|
17982
18298
|
var lastUniqueAsyncExpiration = Sync - 1;
|
|
17983
18299
|
|
|
17984
|
-
// Represents the expiration time that incoming updates should use. (If this
|
|
17985
|
-
// is NoWork, use the default strategy: async updates in async mode, sync
|
|
17986
|
-
// updates in sync mode.)
|
|
17987
|
-
var expirationContext = NoWork;
|
|
17988
|
-
|
|
17989
18300
|
var isWorking = false;
|
|
17990
18301
|
|
|
17991
18302
|
// The next work in progress fiber that we're currently working on.
|
|
@@ -18281,6 +18592,10 @@ function commitPassiveEffects(root, firstEffect) {
|
|
|
18281
18592
|
if (rootExpirationTime !== NoWork) {
|
|
18282
18593
|
requestWork(root, rootExpirationTime);
|
|
18283
18594
|
}
|
|
18595
|
+
// Flush any sync work that was scheduled by effects
|
|
18596
|
+
if (!isBatchingUpdates && !isRendering) {
|
|
18597
|
+
performSyncWork();
|
|
18598
|
+
}
|
|
18284
18599
|
}
|
|
18285
18600
|
|
|
18286
18601
|
function isAlreadyFailedLegacyErrorBoundary(instance) {
|
|
@@ -18455,7 +18770,9 @@ function commitRoot(root, finishedWork) {
|
|
|
18455
18770
|
// here because that code is still in flux.
|
|
18456
18771
|
callback = tracing.unstable_wrap(callback);
|
|
18457
18772
|
}
|
|
18458
|
-
passiveEffectCallbackHandle =
|
|
18773
|
+
passiveEffectCallbackHandle = scheduler.unstable_runWithPriority(scheduler.unstable_NormalPriority, function () {
|
|
18774
|
+
return schedulePassiveEffects(callback);
|
|
18775
|
+
});
|
|
18459
18776
|
passiveEffectCallback = callback;
|
|
18460
18777
|
}
|
|
18461
18778
|
|
|
@@ -19044,7 +19361,7 @@ function renderRoot(root, isYieldy) {
|
|
|
19044
19361
|
return;
|
|
19045
19362
|
} else if (
|
|
19046
19363
|
// There's no lower priority work, but we're rendering asynchronously.
|
|
19047
|
-
//
|
|
19364
|
+
// Synchronously attempt to render the same level one more time. This is
|
|
19048
19365
|
// similar to a suspend, but without a timeout because we're not waiting
|
|
19049
19366
|
// for a promise to resolve.
|
|
19050
19367
|
!root.didError && isYieldy) {
|
|
@@ -19149,49 +19466,50 @@ function computeUniqueAsyncExpiration() {
|
|
|
19149
19466
|
}
|
|
19150
19467
|
|
|
19151
19468
|
function computeExpirationForFiber(currentTime, fiber) {
|
|
19469
|
+
var priorityLevel = scheduler.unstable_getCurrentPriorityLevel();
|
|
19470
|
+
|
|
19152
19471
|
var expirationTime = void 0;
|
|
19153
|
-
if (
|
|
19154
|
-
//
|
|
19155
|
-
expirationTime =
|
|
19156
|
-
} else if (isWorking) {
|
|
19157
|
-
|
|
19158
|
-
|
|
19159
|
-
// by default.
|
|
19160
|
-
expirationTime = Sync;
|
|
19161
|
-
} else {
|
|
19162
|
-
// Updates during the render phase should expire at the same time as
|
|
19163
|
-
// the work that is being rendered.
|
|
19164
|
-
expirationTime = nextRenderExpirationTime;
|
|
19165
|
-
}
|
|
19472
|
+
if ((fiber.mode & ConcurrentMode) === NoContext) {
|
|
19473
|
+
// Outside of concurrent mode, updates are always synchronous.
|
|
19474
|
+
expirationTime = Sync;
|
|
19475
|
+
} else if (isWorking && !isCommitting$1) {
|
|
19476
|
+
// During render phase, updates expire during as the current render.
|
|
19477
|
+
expirationTime = nextRenderExpirationTime;
|
|
19166
19478
|
} else {
|
|
19167
|
-
|
|
19168
|
-
|
|
19169
|
-
|
|
19170
|
-
|
|
19171
|
-
|
|
19479
|
+
switch (priorityLevel) {
|
|
19480
|
+
case scheduler.unstable_ImmediatePriority:
|
|
19481
|
+
expirationTime = Sync;
|
|
19482
|
+
break;
|
|
19483
|
+
case scheduler.unstable_UserBlockingPriority:
|
|
19172
19484
|
expirationTime = computeInteractiveExpiration(currentTime);
|
|
19173
|
-
|
|
19174
|
-
|
|
19485
|
+
break;
|
|
19486
|
+
case scheduler.unstable_NormalPriority:
|
|
19487
|
+
// This is a normal, concurrent update
|
|
19175
19488
|
expirationTime = computeAsyncExpiration(currentTime);
|
|
19176
|
-
|
|
19177
|
-
|
|
19178
|
-
|
|
19179
|
-
|
|
19180
|
-
|
|
19181
|
-
|
|
19182
|
-
|
|
19183
|
-
// This is a sync update
|
|
19184
|
-
expirationTime = Sync;
|
|
19489
|
+
break;
|
|
19490
|
+
case scheduler.unstable_LowPriority:
|
|
19491
|
+
case scheduler.unstable_IdlePriority:
|
|
19492
|
+
expirationTime = Never;
|
|
19493
|
+
break;
|
|
19494
|
+
default:
|
|
19495
|
+
invariant(false, 'Unknown priority level. This error is likely caused by a bug in React. Please file an issue.');
|
|
19185
19496
|
}
|
|
19186
|
-
|
|
19187
|
-
|
|
19188
|
-
//
|
|
19189
|
-
|
|
19190
|
-
|
|
19191
|
-
if (lowestPriorityPendingInteractiveExpirationTime === NoWork || expirationTime < lowestPriorityPendingInteractiveExpirationTime) {
|
|
19192
|
-
lowestPriorityPendingInteractiveExpirationTime = expirationTime;
|
|
19497
|
+
|
|
19498
|
+
// If we're in the middle of rendering a tree, do not update at the same
|
|
19499
|
+
// expiration time that is already rendering.
|
|
19500
|
+
if (nextRoot !== null && expirationTime === nextRenderExpirationTime) {
|
|
19501
|
+
expirationTime -= 1;
|
|
19193
19502
|
}
|
|
19194
19503
|
}
|
|
19504
|
+
|
|
19505
|
+
// Keep track of the lowest pending interactive expiration time. This
|
|
19506
|
+
// allows us to synchronously flush all interactive updates
|
|
19507
|
+
// when needed.
|
|
19508
|
+
// TODO: Move this to renderer?
|
|
19509
|
+
if (priorityLevel === scheduler.unstable_UserBlockingPriority && (lowestPriorityPendingInteractiveExpirationTime === NoWork || expirationTime < lowestPriorityPendingInteractiveExpirationTime)) {
|
|
19510
|
+
lowestPriorityPendingInteractiveExpirationTime = expirationTime;
|
|
19511
|
+
}
|
|
19512
|
+
|
|
19195
19513
|
return expirationTime;
|
|
19196
19514
|
}
|
|
19197
19515
|
|
|
@@ -19238,7 +19556,21 @@ function retryTimedOutBoundary(boundaryFiber, thenable) {
|
|
|
19238
19556
|
// The boundary fiber (a Suspense component) previously timed out and was
|
|
19239
19557
|
// rendered in its fallback state. One of the promises that suspended it has
|
|
19240
19558
|
// resolved, which means at least part of the tree was likely unblocked. Try
|
|
19241
|
-
var retryCache =
|
|
19559
|
+
var retryCache = void 0;
|
|
19560
|
+
if (enableSuspenseServerRenderer) {
|
|
19561
|
+
switch (boundaryFiber.tag) {
|
|
19562
|
+
case SuspenseComponent:
|
|
19563
|
+
retryCache = boundaryFiber.stateNode;
|
|
19564
|
+
break;
|
|
19565
|
+
case DehydratedSuspenseComponent:
|
|
19566
|
+
retryCache = boundaryFiber.memoizedState;
|
|
19567
|
+
break;
|
|
19568
|
+
default:
|
|
19569
|
+
invariant(false, 'Pinged unknown suspense boundary type. This is probably a bug in React.');
|
|
19570
|
+
}
|
|
19571
|
+
} else {
|
|
19572
|
+
retryCache = boundaryFiber.stateNode;
|
|
19573
|
+
}
|
|
19242
19574
|
if (retryCache !== null) {
|
|
19243
19575
|
// The thenable resolved, so we no longer need to memoize, because it will
|
|
19244
19576
|
// never be thrown again.
|
|
@@ -19337,7 +19669,7 @@ function scheduleWorkToRoot(fiber, expirationTime) {
|
|
|
19337
19669
|
function warnIfNotCurrentlyBatchingInDev(fiber) {
|
|
19338
19670
|
{
|
|
19339
19671
|
if (isRendering === false && isBatchingUpdates === false) {
|
|
19340
|
-
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));
|
|
19672
|
+
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));
|
|
19341
19673
|
}
|
|
19342
19674
|
}
|
|
19343
19675
|
}
|
|
@@ -19384,13 +19716,9 @@ function scheduleWork(fiber, expirationTime) {
|
|
|
19384
19716
|
}
|
|
19385
19717
|
|
|
19386
19718
|
function syncUpdates(fn, a, b, c, d) {
|
|
19387
|
-
|
|
19388
|
-
expirationContext = Sync;
|
|
19389
|
-
try {
|
|
19719
|
+
return scheduler.unstable_runWithPriority(scheduler.unstable_ImmediatePriority, function () {
|
|
19390
19720
|
return fn(a, b, c, d);
|
|
19391
|
-
}
|
|
19392
|
-
expirationContext = previousExpirationContext;
|
|
19393
|
-
}
|
|
19721
|
+
});
|
|
19394
19722
|
}
|
|
19395
19723
|
|
|
19396
19724
|
// TODO: Everything below this is written as if it has been lifted to the
|
|
@@ -19411,7 +19739,6 @@ var unhandledError = null;
|
|
|
19411
19739
|
|
|
19412
19740
|
var isBatchingUpdates = false;
|
|
19413
19741
|
var isUnbatchingUpdates = false;
|
|
19414
|
-
var isBatchingInteractiveUpdates = false;
|
|
19415
19742
|
|
|
19416
19743
|
var completedBatches = null;
|
|
19417
19744
|
|
|
@@ -19885,7 +20212,9 @@ function completeRoot(root, finishedWork, expirationTime) {
|
|
|
19885
20212
|
lastCommittedRootDuringThisBatch = root;
|
|
19886
20213
|
nestedUpdateCount = 0;
|
|
19887
20214
|
}
|
|
19888
|
-
|
|
20215
|
+
scheduler.unstable_runWithPriority(scheduler.unstable_ImmediatePriority, function () {
|
|
20216
|
+
commitRoot(root, finishedWork);
|
|
20217
|
+
});
|
|
19889
20218
|
}
|
|
19890
20219
|
|
|
19891
20220
|
function onUncaughtError(error) {
|
|
@@ -19943,9 +20272,6 @@ function flushSync(fn, a) {
|
|
|
19943
20272
|
}
|
|
19944
20273
|
|
|
19945
20274
|
function interactiveUpdates$1(fn, a, b) {
|
|
19946
|
-
if (isBatchingInteractiveUpdates) {
|
|
19947
|
-
return fn(a, b);
|
|
19948
|
-
}
|
|
19949
20275
|
// If there are any pending interactive updates, synchronously flush them.
|
|
19950
20276
|
// This needs to happen before we read any handlers, because the effect of
|
|
19951
20277
|
// the previous event may influence which handlers are called during
|
|
@@ -19955,14 +20281,13 @@ function interactiveUpdates$1(fn, a, b) {
|
|
|
19955
20281
|
performWork(lowestPriorityPendingInteractiveExpirationTime, false);
|
|
19956
20282
|
lowestPriorityPendingInteractiveExpirationTime = NoWork;
|
|
19957
20283
|
}
|
|
19958
|
-
var previousIsBatchingInteractiveUpdates = isBatchingInteractiveUpdates;
|
|
19959
20284
|
var previousIsBatchingUpdates = isBatchingUpdates;
|
|
19960
|
-
isBatchingInteractiveUpdates = true;
|
|
19961
20285
|
isBatchingUpdates = true;
|
|
19962
20286
|
try {
|
|
19963
|
-
return
|
|
20287
|
+
return scheduler.unstable_runWithPriority(scheduler.unstable_UserBlockingPriority, function () {
|
|
20288
|
+
return fn(a, b);
|
|
20289
|
+
});
|
|
19964
20290
|
} finally {
|
|
19965
|
-
isBatchingInteractiveUpdates = previousIsBatchingInteractiveUpdates;
|
|
19966
20291
|
isBatchingUpdates = previousIsBatchingUpdates;
|
|
19967
20292
|
if (!isBatchingUpdates && !isRendering) {
|
|
19968
20293
|
performSyncWork();
|
|
@@ -20225,7 +20550,7 @@ implementation) {
|
|
|
20225
20550
|
|
|
20226
20551
|
// TODO: this is special because it gets imported during build.
|
|
20227
20552
|
|
|
20228
|
-
var ReactVersion = '16.8.
|
|
20553
|
+
var ReactVersion = '16.8.2';
|
|
20229
20554
|
|
|
20230
20555
|
// This file is copy paste from ReactDOM with adjusted paths
|
|
20231
20556
|
// and a different host config import (react-reconciler/inline.fire).
|
|
@@ -20620,7 +20945,7 @@ var ReactDOM = {
|
|
|
20620
20945
|
hydrate: function (element, container, callback) {
|
|
20621
20946
|
!isValidContainer(container) ? invariant(false, 'Target container is not a DOM element.') : void 0;
|
|
20622
20947
|
{
|
|
20623
|
-
!!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
|
|
20948
|
+
!!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;
|
|
20624
20949
|
}
|
|
20625
20950
|
// TODO: throw or warn if we couldn't hydrate?
|
|
20626
20951
|
return legacyRenderSubtreeIntoContainer(null, element, container, true, callback);
|