react-test-renderer 16.10.2 → 16.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build-info.json +5 -5
- package/cjs/react-test-renderer-shallow.development.js +69 -73
- package/cjs/react-test-renderer-shallow.production.min.js +25 -25
- package/cjs/react-test-renderer.development.js +671 -639
- package/cjs/react-test-renderer.production.min.js +148 -145
- package/package.json +2 -2
- package/umd/react-test-renderer-shallow.development.js +69 -73
- package/umd/react-test-renderer-shallow.production.min.js +23 -23
- package/umd/react-test-renderer.development.js +677 -645
- package/umd/react-test-renderer.production.min.js +145 -143
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license React v16.
|
|
1
|
+
/** @license React v16.11.0
|
|
2
2
|
* react-test-renderer.development.js
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
@@ -23,16 +23,8 @@ var Scheduler$1 = require('scheduler');
|
|
|
23
23
|
var tracing = require('scheduler/tracing');
|
|
24
24
|
|
|
25
25
|
// Do not require this module directly! Use normal `invariant` calls with
|
|
26
|
-
// template literal strings. The messages will be
|
|
27
|
-
// build
|
|
28
|
-
|
|
29
|
-
// Do not require this module directly! Use normal `invariant` calls with
|
|
30
|
-
// template literal strings. The messages will be converted to ReactError during
|
|
31
|
-
// build, and in production they will be minified.
|
|
32
|
-
function ReactError(error) {
|
|
33
|
-
error.name = 'Invariant Violation';
|
|
34
|
-
return error;
|
|
35
|
-
}
|
|
26
|
+
// template literal strings. The messages will be replaced with error codes
|
|
27
|
+
// during build.
|
|
36
28
|
|
|
37
29
|
function _defineProperties(target, props) {
|
|
38
30
|
for (var i = 0; i < props.length; i++) {
|
|
@@ -444,14 +436,12 @@ var enableSuspenseServerRenderer = false;
|
|
|
444
436
|
|
|
445
437
|
|
|
446
438
|
|
|
447
|
-
|
|
448
439
|
var enableFlareAPI = false;
|
|
449
440
|
var enableFundamentalAPI = false;
|
|
450
441
|
var enableScopeAPI = false;
|
|
451
442
|
|
|
452
443
|
var warnAboutUnmockedScheduler = false;
|
|
453
444
|
var flushSuspenseFallbacksInTests = true;
|
|
454
|
-
|
|
455
445
|
var enableSuspenseCallback = false;
|
|
456
446
|
var warnAboutDefaultPropsOnFunctionComponents = false;
|
|
457
447
|
var warnAboutStringRefs = false;
|
|
@@ -526,13 +516,11 @@ function isMounted(component) {
|
|
|
526
516
|
}
|
|
527
517
|
|
|
528
518
|
function assertIsMounted(fiber) {
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
throw ReactError(Error("Unable to find node on an unmounted component."));
|
|
533
|
-
}
|
|
519
|
+
if (!(getNearestMountedFiber(fiber) === fiber)) {
|
|
520
|
+
{
|
|
521
|
+
throw Error("Unable to find node on an unmounted component.");
|
|
534
522
|
}
|
|
535
|
-
}
|
|
523
|
+
}
|
|
536
524
|
}
|
|
537
525
|
|
|
538
526
|
function findCurrentFiberUsingSlowPath(fiber) {
|
|
@@ -542,13 +530,11 @@ function findCurrentFiberUsingSlowPath(fiber) {
|
|
|
542
530
|
// If there is no alternate, then we only need to check if it is mounted.
|
|
543
531
|
var nearestMounted = getNearestMountedFiber(fiber);
|
|
544
532
|
|
|
545
|
-
(
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
throw ReactError(Error("Unable to find node on an unmounted component."));
|
|
549
|
-
}
|
|
533
|
+
if (!(nearestMounted !== null)) {
|
|
534
|
+
{
|
|
535
|
+
throw Error("Unable to find node on an unmounted component.");
|
|
550
536
|
}
|
|
551
|
-
}
|
|
537
|
+
}
|
|
552
538
|
|
|
553
539
|
if (nearestMounted !== fiber) {
|
|
554
540
|
return null;
|
|
@@ -613,13 +599,11 @@ function findCurrentFiberUsingSlowPath(fiber) {
|
|
|
613
599
|
// way this could possibly happen is if this was unmounted, if at all.
|
|
614
600
|
|
|
615
601
|
|
|
616
|
-
|
|
602
|
+
{
|
|
617
603
|
{
|
|
618
|
-
|
|
619
|
-
throw ReactError(Error("Unable to find node on an unmounted component."));
|
|
620
|
-
}
|
|
604
|
+
throw Error("Unable to find node on an unmounted component.");
|
|
621
605
|
}
|
|
622
|
-
}
|
|
606
|
+
}
|
|
623
607
|
}
|
|
624
608
|
|
|
625
609
|
if (a.return !== b.return) {
|
|
@@ -678,34 +662,28 @@ function findCurrentFiberUsingSlowPath(fiber) {
|
|
|
678
662
|
_child = _child.sibling;
|
|
679
663
|
}
|
|
680
664
|
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
throw ReactError(Error("Child was not found in either parent set. This indicates a bug in React related to the return pointer. Please file an issue."));
|
|
685
|
-
}
|
|
665
|
+
if (!didFindChild) {
|
|
666
|
+
{
|
|
667
|
+
throw Error("Child was not found in either parent set. This indicates a bug in React related to the return pointer. Please file an issue.");
|
|
686
668
|
}
|
|
687
|
-
}
|
|
669
|
+
}
|
|
688
670
|
}
|
|
689
671
|
}
|
|
690
672
|
|
|
691
|
-
(
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
throw ReactError(Error("Return fibers should always be each others' alternates. This error is likely caused by a bug in React. Please file an issue."));
|
|
695
|
-
}
|
|
673
|
+
if (!(a.alternate === b)) {
|
|
674
|
+
{
|
|
675
|
+
throw Error("Return fibers should always be each others' alternates. This error is likely caused by a bug in React. Please file an issue.");
|
|
696
676
|
}
|
|
697
|
-
}
|
|
677
|
+
}
|
|
698
678
|
} // If the root is not a host container, we're in a disconnected tree. I.e.
|
|
699
679
|
// unmounted.
|
|
700
680
|
|
|
701
681
|
|
|
702
|
-
(
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
throw ReactError(Error("Unable to find node on an unmounted component."));
|
|
706
|
-
}
|
|
682
|
+
if (!(a.tag === HostRoot)) {
|
|
683
|
+
{
|
|
684
|
+
throw Error("Unable to find node on an unmounted component.");
|
|
707
685
|
}
|
|
708
|
-
}
|
|
686
|
+
}
|
|
709
687
|
|
|
710
688
|
if (a.stateNode.current === a) {
|
|
711
689
|
// We've determined that A is the current branch.
|
|
@@ -758,13 +736,11 @@ function findCurrentHostFiber(parent) {
|
|
|
758
736
|
// can re-export everything from this module.
|
|
759
737
|
|
|
760
738
|
function shim() {
|
|
761
|
-
|
|
739
|
+
{
|
|
762
740
|
{
|
|
763
|
-
|
|
764
|
-
throw ReactError(Error("The current renderer does not support persistence. This error is likely caused by a bug in React. Please file an issue."));
|
|
765
|
-
}
|
|
741
|
+
throw Error("The current renderer does not support persistence. This error is likely caused by a bug in React. Please file an issue.");
|
|
766
742
|
}
|
|
767
|
-
}
|
|
743
|
+
}
|
|
768
744
|
} // Persistence (when unsupported)
|
|
769
745
|
|
|
770
746
|
|
|
@@ -781,13 +757,11 @@ var cloneHiddenTextInstance = shim;
|
|
|
781
757
|
// can re-export everything from this module.
|
|
782
758
|
|
|
783
759
|
function shim$1() {
|
|
784
|
-
|
|
760
|
+
{
|
|
785
761
|
{
|
|
786
|
-
|
|
787
|
-
throw ReactError(Error("The current renderer does not support hydration. This error is likely caused by a bug in React. Please file an issue."));
|
|
788
|
-
}
|
|
762
|
+
throw Error("The current renderer does not support hydration. This error is likely caused by a bug in React. Please file an issue.");
|
|
789
763
|
}
|
|
790
|
-
}
|
|
764
|
+
}
|
|
791
765
|
} // Hydration (when unsupported)
|
|
792
766
|
|
|
793
767
|
|
|
@@ -822,6 +796,7 @@ var didNotFindHydratableSuspenseInstance = shim$1;
|
|
|
822
796
|
var EVENT_COMPONENT_CONTEXT = {};
|
|
823
797
|
var NO_CONTEXT = {};
|
|
824
798
|
var UPDATE_SIGNAL = {};
|
|
799
|
+
var nodeToInstanceMap = new WeakMap();
|
|
825
800
|
|
|
826
801
|
{
|
|
827
802
|
Object.freeze(NO_CONTEXT);
|
|
@@ -832,11 +807,17 @@ function getPublicInstance(inst) {
|
|
|
832
807
|
switch (inst.tag) {
|
|
833
808
|
case 'INSTANCE':
|
|
834
809
|
var createNodeMock = inst.rootContainerInstance.createNodeMock;
|
|
835
|
-
|
|
810
|
+
var mockNode = createNodeMock({
|
|
836
811
|
type: inst.type,
|
|
837
812
|
props: inst.props
|
|
838
813
|
});
|
|
839
814
|
|
|
815
|
+
if (typeof mockNode === 'object' && mockNode !== null) {
|
|
816
|
+
nodeToInstanceMap.set(mockNode, inst);
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
return mockNode;
|
|
820
|
+
|
|
840
821
|
default:
|
|
841
822
|
return inst;
|
|
842
823
|
}
|
|
@@ -899,6 +880,7 @@ function createInstance(type, props, rootContainerInstance, hostContext, interna
|
|
|
899
880
|
props: propsToUse,
|
|
900
881
|
isHidden: false,
|
|
901
882
|
children: [],
|
|
883
|
+
internalInstanceHandle: internalInstanceHandle,
|
|
902
884
|
rootContainerInstance: rootContainerInstance,
|
|
903
885
|
tag: 'INSTANCE'
|
|
904
886
|
};
|
|
@@ -1024,6 +1006,15 @@ function unmountFundamentalComponent(fundamentalInstance) {
|
|
|
1024
1006
|
onUnmount(null, instance, props, state);
|
|
1025
1007
|
}
|
|
1026
1008
|
}
|
|
1009
|
+
function getInstanceFromNode(mockNode) {
|
|
1010
|
+
var instance = nodeToInstanceMap.get(mockNode);
|
|
1011
|
+
|
|
1012
|
+
if (instance !== undefined) {
|
|
1013
|
+
return instance.internalInstanceHandle;
|
|
1014
|
+
}
|
|
1015
|
+
|
|
1016
|
+
return null;
|
|
1017
|
+
}
|
|
1027
1018
|
|
|
1028
1019
|
var BEFORE_SLASH_RE = /^(.*)[\\\/]/;
|
|
1029
1020
|
var describeComponentFrame = function (name, source, ownerName) {
|
|
@@ -1745,13 +1736,11 @@ function pushTopLevelContextObject(fiber, context, didChange) {
|
|
|
1745
1736
|
if (disableLegacyContext) {
|
|
1746
1737
|
return;
|
|
1747
1738
|
} else {
|
|
1748
|
-
(
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
throw ReactError(Error("Unexpected context found on stack. This error is likely caused by a bug in React. Please file an issue."));
|
|
1752
|
-
}
|
|
1739
|
+
if (!(contextStackCursor.current === emptyContextObject)) {
|
|
1740
|
+
{
|
|
1741
|
+
throw Error("Unexpected context found on stack. This error is likely caused by a bug in React. Please file an issue.");
|
|
1753
1742
|
}
|
|
1754
|
-
}
|
|
1743
|
+
}
|
|
1755
1744
|
|
|
1756
1745
|
push(contextStackCursor, context, fiber);
|
|
1757
1746
|
push(didPerformWorkStackCursor, didChange, fiber);
|
|
@@ -1794,13 +1783,11 @@ function processChildContext(fiber, type, parentContext) {
|
|
|
1794
1783
|
}
|
|
1795
1784
|
|
|
1796
1785
|
for (var contextKey in childContext) {
|
|
1797
|
-
(
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
throw ReactError(Error((getComponentName(type) || 'Unknown') + ".getChildContext(): key \"" + contextKey + "\" is not defined in childContextTypes."));
|
|
1801
|
-
}
|
|
1786
|
+
if (!(contextKey in childContextTypes)) {
|
|
1787
|
+
{
|
|
1788
|
+
throw Error((getComponentName(type) || 'Unknown') + ".getChildContext(): key \"" + contextKey + "\" is not defined in childContextTypes.");
|
|
1802
1789
|
}
|
|
1803
|
-
}
|
|
1790
|
+
}
|
|
1804
1791
|
}
|
|
1805
1792
|
|
|
1806
1793
|
{
|
|
@@ -1841,13 +1828,11 @@ function invalidateContextProvider(workInProgress, type, didChange) {
|
|
|
1841
1828
|
} else {
|
|
1842
1829
|
var instance = workInProgress.stateNode;
|
|
1843
1830
|
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
throw ReactError(Error("Expected to have an instance by this point. This error is likely caused by a bug in React. Please file an issue."));
|
|
1848
|
-
}
|
|
1831
|
+
if (!instance) {
|
|
1832
|
+
{
|
|
1833
|
+
throw Error("Expected to have an instance by this point. This error is likely caused by a bug in React. Please file an issue.");
|
|
1849
1834
|
}
|
|
1850
|
-
}
|
|
1835
|
+
}
|
|
1851
1836
|
|
|
1852
1837
|
if (didChange) {
|
|
1853
1838
|
// Merge parent and own context.
|
|
@@ -1875,13 +1860,11 @@ function findCurrentUnmaskedContext(fiber) {
|
|
|
1875
1860
|
} else {
|
|
1876
1861
|
// Currently this is only used with renderSubtreeIntoContainer; not sure if it
|
|
1877
1862
|
// makes sense elsewhere
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
throw ReactError(Error("Expected subtree parent to be a mounted class component. This error is likely caused by a bug in React. Please file an issue."));
|
|
1882
|
-
}
|
|
1863
|
+
if (!(isFiberMounted(fiber) && fiber.tag === ClassComponent)) {
|
|
1864
|
+
{
|
|
1865
|
+
throw Error("Expected subtree parent to be a mounted class component. This error is likely caused by a bug in React. Please file an issue.");
|
|
1883
1866
|
}
|
|
1884
|
-
}
|
|
1867
|
+
}
|
|
1885
1868
|
|
|
1886
1869
|
var node = fiber;
|
|
1887
1870
|
|
|
@@ -1905,13 +1888,11 @@ function findCurrentUnmaskedContext(fiber) {
|
|
|
1905
1888
|
node = node.return;
|
|
1906
1889
|
} while (node !== null);
|
|
1907
1890
|
|
|
1908
|
-
|
|
1891
|
+
{
|
|
1909
1892
|
{
|
|
1910
|
-
|
|
1911
|
-
throw ReactError(Error("Found unexpected detached subtree parent. This error is likely caused by a bug in React. Please file an issue."));
|
|
1912
|
-
}
|
|
1893
|
+
throw Error("Found unexpected detached subtree parent. This error is likely caused by a bug in React. Please file an issue.");
|
|
1913
1894
|
}
|
|
1914
|
-
}
|
|
1895
|
+
}
|
|
1915
1896
|
}
|
|
1916
1897
|
}
|
|
1917
1898
|
|
|
@@ -1938,13 +1919,11 @@ if (enableSchedulerTracing) {
|
|
|
1938
1919
|
// Provide explicit error message when production+profiling bundle of e.g.
|
|
1939
1920
|
// react-dom is used with production (non-profiling) bundle of
|
|
1940
1921
|
// scheduler/tracing
|
|
1941
|
-
(
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
throw ReactError(Error("It is not supported to run the profiling version of a renderer (for example, `react-dom/profiling`) without also replacing the `scheduler/tracing` module with `scheduler/tracing-profiling`. Your bundler might have a setting for aliasing both modules. Learn more at http://fb.me/react-profiling"));
|
|
1945
|
-
}
|
|
1922
|
+
if (!(tracing.__interactionsRef != null && tracing.__interactionsRef.current != null)) {
|
|
1923
|
+
{
|
|
1924
|
+
throw Error("It is not supported to run the profiling version of a renderer (for example, `react-dom/profiling`) without also replacing the `scheduler/tracing` module with `scheduler/tracing-profiling`. Your bundler might have a setting for aliasing both modules. Learn more at http://fb.me/react-profiling");
|
|
1946
1925
|
}
|
|
1947
|
-
}
|
|
1926
|
+
}
|
|
1948
1927
|
}
|
|
1949
1928
|
|
|
1950
1929
|
var fakeCallbackNode = {}; // Except for NoPriority, these correspond to Scheduler priorities. We use
|
|
@@ -1993,13 +1972,11 @@ function getCurrentPriorityLevel() {
|
|
|
1993
1972
|
return IdlePriority;
|
|
1994
1973
|
|
|
1995
1974
|
default:
|
|
1996
|
-
|
|
1975
|
+
{
|
|
1997
1976
|
{
|
|
1998
|
-
|
|
1999
|
-
throw ReactError(Error("Unknown priority level."));
|
|
2000
|
-
}
|
|
1977
|
+
throw Error("Unknown priority level.");
|
|
2001
1978
|
}
|
|
2002
|
-
}
|
|
1979
|
+
}
|
|
2003
1980
|
|
|
2004
1981
|
}
|
|
2005
1982
|
}
|
|
@@ -2022,13 +1999,11 @@ function reactPriorityToSchedulerPriority(reactPriorityLevel) {
|
|
|
2022
1999
|
return Scheduler_IdlePriority;
|
|
2023
2000
|
|
|
2024
2001
|
default:
|
|
2025
|
-
|
|
2002
|
+
{
|
|
2026
2003
|
{
|
|
2027
|
-
|
|
2028
|
-
throw ReactError(Error("Unknown priority level."));
|
|
2029
|
-
}
|
|
2004
|
+
throw Error("Unknown priority level.");
|
|
2030
2005
|
}
|
|
2031
|
-
}
|
|
2006
|
+
}
|
|
2032
2007
|
|
|
2033
2008
|
}
|
|
2034
2009
|
}
|
|
@@ -2129,7 +2104,7 @@ var NoWork = 0; // TODO: Think of a better name for Never. The key difference wi
|
|
|
2129
2104
|
var Never = 1; // Idle is slightly higher priority than Never. It must completely finish in
|
|
2130
2105
|
// order to be consistent.
|
|
2131
2106
|
|
|
2132
|
-
var Idle = 2;
|
|
2107
|
+
var Idle = 2; // Continuous Hydration is a moving priority. It is slightly higher than Idle
|
|
2133
2108
|
var Sync = MAX_SIGNED_31_BIT_INT;
|
|
2134
2109
|
var Batched = Sync - 1;
|
|
2135
2110
|
var UNIT_SIZE = 10;
|
|
@@ -2178,6 +2153,7 @@ var HIGH_PRIORITY_BATCH_SIZE = 100;
|
|
|
2178
2153
|
function computeInteractiveExpiration(currentTime) {
|
|
2179
2154
|
return computeExpirationBucket(currentTime, HIGH_PRIORITY_EXPIRATION, HIGH_PRIORITY_BATCH_SIZE);
|
|
2180
2155
|
}
|
|
2156
|
+
|
|
2181
2157
|
function inferPriorityFromExpirationTime(currentTime, expirationTime) {
|
|
2182
2158
|
if (expirationTime === Sync) {
|
|
2183
2159
|
return ImmediatePriority;
|
|
@@ -2725,7 +2701,9 @@ var scheduleRoot = function (root, element) {
|
|
|
2725
2701
|
}
|
|
2726
2702
|
|
|
2727
2703
|
flushPassiveEffects();
|
|
2728
|
-
|
|
2704
|
+
syncUpdates(function () {
|
|
2705
|
+
updateContainer(element, root, null, null);
|
|
2706
|
+
});
|
|
2729
2707
|
}
|
|
2730
2708
|
};
|
|
2731
2709
|
|
|
@@ -3127,13 +3105,11 @@ function propagateContextChange(workInProgress, context, changedBits, renderExpi
|
|
|
3127
3105
|
// mark it as having updates.
|
|
3128
3106
|
var parentSuspense = fiber.return;
|
|
3129
3107
|
|
|
3130
|
-
(
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
throw ReactError(Error("We just came from a parent so we must have had a parent. This is a bug in React."));
|
|
3134
|
-
}
|
|
3108
|
+
if (!(parentSuspense !== null)) {
|
|
3109
|
+
{
|
|
3110
|
+
throw Error("We just came from a parent so we must have had a parent. This is a bug in React.");
|
|
3135
3111
|
}
|
|
3136
|
-
}
|
|
3112
|
+
}
|
|
3137
3113
|
|
|
3138
3114
|
if (parentSuspense.expirationTime < renderExpirationTime) {
|
|
3139
3115
|
parentSuspense.expirationTime = renderExpirationTime;
|
|
@@ -3234,13 +3210,11 @@ function readContext(context, observedBits) {
|
|
|
3234
3210
|
};
|
|
3235
3211
|
|
|
3236
3212
|
if (lastContextDependency === null) {
|
|
3237
|
-
(
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
throw ReactError(Error("Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo()."));
|
|
3241
|
-
}
|
|
3213
|
+
if (!(currentlyRenderingFiber !== null)) {
|
|
3214
|
+
{
|
|
3215
|
+
throw Error("Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo().");
|
|
3242
3216
|
}
|
|
3243
|
-
}
|
|
3217
|
+
} // This is the first dependency for this component. Create a new list.
|
|
3244
3218
|
|
|
3245
3219
|
|
|
3246
3220
|
lastContextDependency = contextItem;
|
|
@@ -3745,13 +3719,11 @@ function processUpdateQueue(workInProgress, queue, props, instance, renderExpira
|
|
|
3745
3719
|
}
|
|
3746
3720
|
|
|
3747
3721
|
function callCallback(callback, context) {
|
|
3748
|
-
(function
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
throw ReactError(Error("Invalid argument passed as callback. Expected a function. Instead received: " + callback));
|
|
3752
|
-
}
|
|
3722
|
+
if (!(typeof callback === 'function')) {
|
|
3723
|
+
{
|
|
3724
|
+
throw Error("Invalid argument passed as callback. Expected a function. Instead received: " + callback);
|
|
3753
3725
|
}
|
|
3754
|
-
}
|
|
3726
|
+
}
|
|
3755
3727
|
|
|
3756
3728
|
callback.call(context);
|
|
3757
3729
|
}
|
|
@@ -3862,13 +3834,11 @@ var didWarnAboutInvalidateContextType;
|
|
|
3862
3834
|
Object.defineProperty(fakeInternalInstance, '_processChildContext', {
|
|
3863
3835
|
enumerable: false,
|
|
3864
3836
|
value: function () {
|
|
3865
|
-
|
|
3837
|
+
{
|
|
3866
3838
|
{
|
|
3867
|
-
|
|
3868
|
-
throw ReactError(Error("_processChildContext is not available in React 16+. This likely means you have multiple copies of React and are attempting to nest a React 15 tree inside a React 16 tree using unstable_renderSubtreeIntoContainer, which isn't supported. Try to make sure you have only one copy of React (and ideally, switch to ReactDOM.createPortal)."));
|
|
3869
|
-
}
|
|
3839
|
+
throw Error("_processChildContext is not available in React 16+. This likely means you have multiple copies of React and are attempting to nest a React 15 tree inside a React 16 tree using unstable_renderSubtreeIntoContainer, which isn't supported. Try to make sure you have only one copy of React (and ideally, switch to ReactDOM.createPortal).");
|
|
3870
3840
|
}
|
|
3871
|
-
}
|
|
3841
|
+
}
|
|
3872
3842
|
}
|
|
3873
3843
|
});
|
|
3874
3844
|
Object.freeze(fakeInternalInstance);
|
|
@@ -3905,7 +3875,7 @@ var classComponentUpdater = {
|
|
|
3905
3875
|
isMounted: isMounted,
|
|
3906
3876
|
enqueueSetState: function (inst, payload, callback) {
|
|
3907
3877
|
var fiber = get(inst);
|
|
3908
|
-
var currentTime =
|
|
3878
|
+
var currentTime = requestCurrentTimeForUpdate();
|
|
3909
3879
|
var suspenseConfig = requestCurrentSuspenseConfig();
|
|
3910
3880
|
var expirationTime = computeExpirationForFiber(currentTime, fiber, suspenseConfig);
|
|
3911
3881
|
var update = createUpdate(expirationTime, suspenseConfig);
|
|
@@ -3924,7 +3894,7 @@ var classComponentUpdater = {
|
|
|
3924
3894
|
},
|
|
3925
3895
|
enqueueReplaceState: function (inst, payload, callback) {
|
|
3926
3896
|
var fiber = get(inst);
|
|
3927
|
-
var currentTime =
|
|
3897
|
+
var currentTime = requestCurrentTimeForUpdate();
|
|
3928
3898
|
var suspenseConfig = requestCurrentSuspenseConfig();
|
|
3929
3899
|
var expirationTime = computeExpirationForFiber(currentTime, fiber, suspenseConfig);
|
|
3930
3900
|
var update = createUpdate(expirationTime, suspenseConfig);
|
|
@@ -3944,7 +3914,7 @@ var classComponentUpdater = {
|
|
|
3944
3914
|
},
|
|
3945
3915
|
enqueueForceUpdate: function (inst, callback) {
|
|
3946
3916
|
var fiber = get(inst);
|
|
3947
|
-
var currentTime =
|
|
3917
|
+
var currentTime = requestCurrentTimeForUpdate();
|
|
3948
3918
|
var suspenseConfig = requestCurrentSuspenseConfig();
|
|
3949
3919
|
var expirationTime = computeExpirationForFiber(currentTime, fiber, suspenseConfig);
|
|
3950
3920
|
var update = createUpdate(expirationTime, suspenseConfig);
|
|
@@ -4559,13 +4529,11 @@ var warnForMissingKey = function (child) {};
|
|
|
4559
4529
|
return;
|
|
4560
4530
|
}
|
|
4561
4531
|
|
|
4562
|
-
(
|
|
4563
|
-
|
|
4564
|
-
|
|
4565
|
-
throw ReactError(Error("React Component in warnForMissingKey should have a _store. This error is likely caused by a bug in React. Please file an issue."));
|
|
4566
|
-
}
|
|
4532
|
+
if (!(typeof child._store === 'object')) {
|
|
4533
|
+
{
|
|
4534
|
+
throw Error("React Component in warnForMissingKey should have a _store. This error is likely caused by a bug in React. Please file an issue.");
|
|
4567
4535
|
}
|
|
4568
|
-
}
|
|
4536
|
+
}
|
|
4569
4537
|
|
|
4570
4538
|
child._store.validated = true;
|
|
4571
4539
|
var currentComponentErrorInfo = 'Each child in a list should have a unique ' + '"key" prop. See https://fb.me/react-warning-keys for ' + 'more information.' + getCurrentFiberStackInDev();
|
|
@@ -4610,24 +4578,20 @@ function coerceRef(returnFiber, current$$1, element) {
|
|
|
4610
4578
|
if (owner) {
|
|
4611
4579
|
var ownerFiber = owner;
|
|
4612
4580
|
|
|
4613
|
-
(
|
|
4614
|
-
|
|
4615
|
-
|
|
4616
|
-
throw ReactError(Error("Function components cannot have refs. Did you mean to use React.forwardRef()?"));
|
|
4617
|
-
}
|
|
4581
|
+
if (!(ownerFiber.tag === ClassComponent)) {
|
|
4582
|
+
{
|
|
4583
|
+
throw Error("Function components cannot have refs. Did you mean to use React.forwardRef()?");
|
|
4618
4584
|
}
|
|
4619
|
-
}
|
|
4585
|
+
}
|
|
4620
4586
|
|
|
4621
4587
|
inst = ownerFiber.stateNode;
|
|
4622
4588
|
}
|
|
4623
4589
|
|
|
4624
|
-
|
|
4625
|
-
|
|
4626
|
-
|
|
4627
|
-
throw ReactError(Error("Missing owner for string ref " + mixedRef + ". This error is likely caused by a bug in React. Please file an issue."));
|
|
4628
|
-
}
|
|
4590
|
+
if (!inst) {
|
|
4591
|
+
{
|
|
4592
|
+
throw Error("Missing owner for string ref " + mixedRef + ". This error is likely caused by a bug in React. Please file an issue.");
|
|
4629
4593
|
}
|
|
4630
|
-
}
|
|
4594
|
+
}
|
|
4631
4595
|
|
|
4632
4596
|
var stringRef = '' + mixedRef; // Check if previous string ref matches new string ref
|
|
4633
4597
|
|
|
@@ -4653,21 +4617,17 @@ function coerceRef(returnFiber, current$$1, element) {
|
|
|
4653
4617
|
ref._stringRef = stringRef;
|
|
4654
4618
|
return ref;
|
|
4655
4619
|
} else {
|
|
4656
|
-
(
|
|
4657
|
-
|
|
4658
|
-
|
|
4659
|
-
throw ReactError(Error("Expected ref to be a function, a string, an object returned by React.createRef(), or null."));
|
|
4660
|
-
}
|
|
4620
|
+
if (!(typeof mixedRef === 'string')) {
|
|
4621
|
+
{
|
|
4622
|
+
throw Error("Expected ref to be a function, a string, an object returned by React.createRef(), or null.");
|
|
4661
4623
|
}
|
|
4662
|
-
}
|
|
4624
|
+
}
|
|
4663
4625
|
|
|
4664
|
-
|
|
4665
|
-
|
|
4666
|
-
|
|
4667
|
-
throw ReactError(Error("Element ref was specified as a string (" + mixedRef + ") but no owner was set. This could happen for one of the following reasons:\n1. You may be adding a ref to a function component\n2. You may be adding a ref to a component that was not created inside a component's render method\n3. You have multiple copies of React loaded\nSee https://fb.me/react-refs-must-have-owner for more information."));
|
|
4668
|
-
}
|
|
4626
|
+
if (!element._owner) {
|
|
4627
|
+
{
|
|
4628
|
+
throw Error("Element ref was specified as a string (" + mixedRef + ") but no owner was set. This could happen for one of the following reasons:\n1. You may be adding a ref to a function component\n2. You may be adding a ref to a component that was not created inside a component's render method\n3. You have multiple copies of React loaded\nSee https://fb.me/react-refs-must-have-owner for more information.");
|
|
4669
4629
|
}
|
|
4670
|
-
}
|
|
4630
|
+
}
|
|
4671
4631
|
}
|
|
4672
4632
|
}
|
|
4673
4633
|
|
|
@@ -4682,13 +4642,11 @@ function throwOnInvalidObjectType(returnFiber, newChild) {
|
|
|
4682
4642
|
addendum = ' If you meant to render a collection of children, use an array ' + 'instead.' + getCurrentFiberStackInDev();
|
|
4683
4643
|
}
|
|
4684
4644
|
|
|
4685
|
-
|
|
4645
|
+
{
|
|
4686
4646
|
{
|
|
4687
|
-
{
|
|
4688
|
-
throw ReactError(Error("Objects are not valid as a React child (found: " + (Object.prototype.toString.call(newChild) === '[object Object]' ? 'object with keys {' + Object.keys(newChild).join(', ') + '}' : newChild) + ")." + addendum));
|
|
4689
|
-
}
|
|
4647
|
+
throw Error("Objects are not valid as a React child (found: " + (Object.prototype.toString.call(newChild) === '[object Object]' ? 'object with keys {' + Object.keys(newChild).join(', ') + '}' : newChild) + ")." + addendum);
|
|
4690
4648
|
}
|
|
4691
|
-
}
|
|
4649
|
+
}
|
|
4692
4650
|
}
|
|
4693
4651
|
}
|
|
4694
4652
|
|
|
@@ -5236,13 +5194,11 @@ function ChildReconciler(shouldTrackSideEffects) {
|
|
|
5236
5194
|
// but using the iterator instead.
|
|
5237
5195
|
var iteratorFn = getIteratorFn(newChildrenIterable);
|
|
5238
5196
|
|
|
5239
|
-
(function
|
|
5240
|
-
|
|
5241
|
-
|
|
5242
|
-
throw ReactError(Error("An object is not an iterable. This error is likely caused by a bug in React. Please file an issue."));
|
|
5243
|
-
}
|
|
5197
|
+
if (!(typeof iteratorFn === 'function')) {
|
|
5198
|
+
{
|
|
5199
|
+
throw Error("An object is not an iterable. This error is likely caused by a bug in React. Please file an issue.");
|
|
5244
5200
|
}
|
|
5245
|
-
}
|
|
5201
|
+
}
|
|
5246
5202
|
|
|
5247
5203
|
{
|
|
5248
5204
|
// We don't support rendering Generators because it's a mutation.
|
|
@@ -5277,13 +5233,11 @@ function ChildReconciler(shouldTrackSideEffects) {
|
|
|
5277
5233
|
|
|
5278
5234
|
var newChildren = iteratorFn.call(newChildrenIterable);
|
|
5279
5235
|
|
|
5280
|
-
(
|
|
5281
|
-
|
|
5282
|
-
|
|
5283
|
-
throw ReactError(Error("An iterable object provided no iterator."));
|
|
5284
|
-
}
|
|
5236
|
+
if (!(newChildren != null)) {
|
|
5237
|
+
{
|
|
5238
|
+
throw Error("An iterable object provided no iterator.");
|
|
5285
5239
|
}
|
|
5286
|
-
}
|
|
5240
|
+
}
|
|
5287
5241
|
|
|
5288
5242
|
var resultingFirstChild = null;
|
|
5289
5243
|
var previousNewFiber = null;
|
|
@@ -5581,13 +5535,11 @@ function ChildReconciler(shouldTrackSideEffects) {
|
|
|
5581
5535
|
{
|
|
5582
5536
|
var Component = returnFiber.type;
|
|
5583
5537
|
|
|
5584
|
-
|
|
5538
|
+
{
|
|
5585
5539
|
{
|
|
5586
|
-
|
|
5587
|
-
throw ReactError(Error((Component.displayName || Component.name || 'Component') + "(...): Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null."));
|
|
5588
|
-
}
|
|
5540
|
+
throw Error((Component.displayName || Component.name || 'Component') + "(...): Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null.");
|
|
5589
5541
|
}
|
|
5590
|
-
}
|
|
5542
|
+
}
|
|
5591
5543
|
}
|
|
5592
5544
|
}
|
|
5593
5545
|
} // Remaining cases are all treated as empty.
|
|
@@ -5602,13 +5554,11 @@ function ChildReconciler(shouldTrackSideEffects) {
|
|
|
5602
5554
|
var reconcileChildFibers = ChildReconciler(true);
|
|
5603
5555
|
var mountChildFibers = ChildReconciler(false);
|
|
5604
5556
|
function cloneChildFibers(current$$1, workInProgress) {
|
|
5605
|
-
(
|
|
5606
|
-
|
|
5607
|
-
|
|
5608
|
-
throw ReactError(Error("Resuming work not yet implemented."));
|
|
5609
|
-
}
|
|
5557
|
+
if (!(current$$1 === null || workInProgress.child === current$$1.child)) {
|
|
5558
|
+
{
|
|
5559
|
+
throw Error("Resuming work not yet implemented.");
|
|
5610
5560
|
}
|
|
5611
|
-
}
|
|
5561
|
+
}
|
|
5612
5562
|
|
|
5613
5563
|
if (workInProgress.child === null) {
|
|
5614
5564
|
return;
|
|
@@ -5643,13 +5593,11 @@ var contextFiberStackCursor = createCursor(NO_CONTEXT$1);
|
|
|
5643
5593
|
var rootInstanceStackCursor = createCursor(NO_CONTEXT$1);
|
|
5644
5594
|
|
|
5645
5595
|
function requiredContext(c) {
|
|
5646
|
-
(
|
|
5647
|
-
|
|
5648
|
-
|
|
5649
|
-
throw ReactError(Error("Expected host context to exist. This error is likely caused by a bug in React. Please file an issue."));
|
|
5650
|
-
}
|
|
5596
|
+
if (!(c !== NO_CONTEXT$1)) {
|
|
5597
|
+
{
|
|
5598
|
+
throw Error("Expected host context to exist. This error is likely caused by a bug in React. Please file an issue.");
|
|
5651
5599
|
}
|
|
5652
|
-
}
|
|
5600
|
+
}
|
|
5653
5601
|
|
|
5654
5602
|
return c;
|
|
5655
5603
|
}
|
|
@@ -5886,13 +5834,11 @@ function updateEventListener(listener, fiber, visistedResponders, respondersMap,
|
|
|
5886
5834
|
props = listener.props;
|
|
5887
5835
|
}
|
|
5888
5836
|
|
|
5889
|
-
(
|
|
5890
|
-
|
|
5891
|
-
|
|
5892
|
-
throw ReactError(Error("An invalid value was used as an event listener. Expect one or many event listeners created via React.unstable_useResponder()."));
|
|
5893
|
-
}
|
|
5837
|
+
if (!(responder && responder.$$typeof === REACT_RESPONDER_TYPE)) {
|
|
5838
|
+
{
|
|
5839
|
+
throw Error("An invalid value was used as an event listener. Expect one or many event listeners created via React.unstable_useResponder().");
|
|
5894
5840
|
}
|
|
5895
|
-
}
|
|
5841
|
+
}
|
|
5896
5842
|
|
|
5897
5843
|
var listenerProps = props;
|
|
5898
5844
|
|
|
@@ -6005,6 +5951,7 @@ var UnmountPassive =
|
|
|
6005
5951
|
128;
|
|
6006
5952
|
|
|
6007
5953
|
var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher;
|
|
5954
|
+
var ReactCurrentBatchConfig$1 = ReactSharedInternals.ReactCurrentBatchConfig;
|
|
6008
5955
|
var didWarnAboutMismatchedHooksForComponent;
|
|
6009
5956
|
|
|
6010
5957
|
{
|
|
@@ -6122,13 +6069,11 @@ function warnOnHookMismatchInDev(currentHookName) {
|
|
|
6122
6069
|
}
|
|
6123
6070
|
|
|
6124
6071
|
function throwInvalidHookError() {
|
|
6125
|
-
|
|
6072
|
+
{
|
|
6126
6073
|
{
|
|
6127
|
-
|
|
6128
|
-
throw ReactError(Error("Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem."));
|
|
6129
|
-
}
|
|
6074
|
+
throw Error("Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem.");
|
|
6130
6075
|
}
|
|
6131
|
-
}
|
|
6076
|
+
}
|
|
6132
6077
|
}
|
|
6133
6078
|
|
|
6134
6079
|
function areHookInputsEqual(nextDeps, prevDeps) {
|
|
@@ -6278,13 +6223,11 @@ function renderWithHooks(current, workInProgress, Component, props, refOrContext
|
|
|
6278
6223
|
// renderPhaseUpdates = null;
|
|
6279
6224
|
// numberOfReRenders = 0;
|
|
6280
6225
|
|
|
6281
|
-
|
|
6282
|
-
|
|
6283
|
-
|
|
6284
|
-
throw ReactError(Error("Rendered fewer hooks than expected. This may be caused by an accidental early return statement."));
|
|
6285
|
-
}
|
|
6226
|
+
if (!!didRenderTooFewHooks) {
|
|
6227
|
+
{
|
|
6228
|
+
throw Error("Rendered fewer hooks than expected. This may be caused by an accidental early return statement.");
|
|
6286
6229
|
}
|
|
6287
|
-
}
|
|
6230
|
+
}
|
|
6288
6231
|
|
|
6289
6232
|
return children;
|
|
6290
6233
|
}
|
|
@@ -6359,13 +6302,11 @@ function updateWorkInProgressHook() {
|
|
|
6359
6302
|
nextCurrentHook = currentHook !== null ? currentHook.next : null;
|
|
6360
6303
|
} else {
|
|
6361
6304
|
// Clone from the current hook.
|
|
6362
|
-
(
|
|
6363
|
-
|
|
6364
|
-
|
|
6365
|
-
throw ReactError(Error("Rendered more hooks than during the previous render."));
|
|
6366
|
-
}
|
|
6305
|
+
if (!(nextCurrentHook !== null)) {
|
|
6306
|
+
{
|
|
6307
|
+
throw Error("Rendered more hooks than during the previous render.");
|
|
6367
6308
|
}
|
|
6368
|
-
}
|
|
6309
|
+
}
|
|
6369
6310
|
|
|
6370
6311
|
currentHook = nextCurrentHook;
|
|
6371
6312
|
var newHook = {
|
|
@@ -6426,13 +6367,11 @@ function updateReducer(reducer, initialArg, init) {
|
|
|
6426
6367
|
var hook = updateWorkInProgressHook();
|
|
6427
6368
|
var queue = hook.queue;
|
|
6428
6369
|
|
|
6429
|
-
(
|
|
6430
|
-
|
|
6431
|
-
|
|
6432
|
-
throw ReactError(Error("Should have a queue. This is likely a bug in React. Please file an issue."));
|
|
6433
|
-
}
|
|
6370
|
+
if (!(queue !== null)) {
|
|
6371
|
+
{
|
|
6372
|
+
throw Error("Should have a queue. This is likely a bug in React. Please file an issue.");
|
|
6434
6373
|
}
|
|
6435
|
-
}
|
|
6374
|
+
}
|
|
6436
6375
|
|
|
6437
6376
|
queue.lastRenderedReducer = reducer;
|
|
6438
6377
|
|
|
@@ -6813,14 +6752,96 @@ function updateMemo(nextCreate, deps) {
|
|
|
6813
6752
|
return nextValue;
|
|
6814
6753
|
}
|
|
6815
6754
|
|
|
6816
|
-
function
|
|
6817
|
-
|
|
6818
|
-
|
|
6819
|
-
|
|
6820
|
-
|
|
6755
|
+
function mountDeferredValue(value, config) {
|
|
6756
|
+
var _mountState = mountState(value),
|
|
6757
|
+
prevValue = _mountState[0],
|
|
6758
|
+
setValue = _mountState[1];
|
|
6759
|
+
|
|
6760
|
+
mountEffect(function () {
|
|
6761
|
+
Scheduler$1.unstable_next(function () {
|
|
6762
|
+
var previousConfig = ReactCurrentBatchConfig$1.suspense;
|
|
6763
|
+
ReactCurrentBatchConfig$1.suspense = config === undefined ? null : config;
|
|
6764
|
+
|
|
6765
|
+
try {
|
|
6766
|
+
setValue(value);
|
|
6767
|
+
} finally {
|
|
6768
|
+
ReactCurrentBatchConfig$1.suspense = previousConfig;
|
|
6769
|
+
}
|
|
6770
|
+
});
|
|
6771
|
+
}, [value, config]);
|
|
6772
|
+
return prevValue;
|
|
6773
|
+
}
|
|
6774
|
+
|
|
6775
|
+
function updateDeferredValue(value, config) {
|
|
6776
|
+
var _updateState = updateState(value),
|
|
6777
|
+
prevValue = _updateState[0],
|
|
6778
|
+
setValue = _updateState[1];
|
|
6779
|
+
|
|
6780
|
+
updateEffect(function () {
|
|
6781
|
+
Scheduler$1.unstable_next(function () {
|
|
6782
|
+
var previousConfig = ReactCurrentBatchConfig$1.suspense;
|
|
6783
|
+
ReactCurrentBatchConfig$1.suspense = config === undefined ? null : config;
|
|
6784
|
+
|
|
6785
|
+
try {
|
|
6786
|
+
setValue(value);
|
|
6787
|
+
} finally {
|
|
6788
|
+
ReactCurrentBatchConfig$1.suspense = previousConfig;
|
|
6789
|
+
}
|
|
6790
|
+
});
|
|
6791
|
+
}, [value, config]);
|
|
6792
|
+
return prevValue;
|
|
6793
|
+
}
|
|
6794
|
+
|
|
6795
|
+
function mountTransition(config) {
|
|
6796
|
+
var _mountState2 = mountState(false),
|
|
6797
|
+
isPending = _mountState2[0],
|
|
6798
|
+
setPending = _mountState2[1];
|
|
6799
|
+
|
|
6800
|
+
var startTransition = mountCallback(function (callback) {
|
|
6801
|
+
setPending(true);
|
|
6802
|
+
Scheduler$1.unstable_next(function () {
|
|
6803
|
+
var previousConfig = ReactCurrentBatchConfig$1.suspense;
|
|
6804
|
+
ReactCurrentBatchConfig$1.suspense = config === undefined ? null : config;
|
|
6805
|
+
|
|
6806
|
+
try {
|
|
6807
|
+
setPending(false);
|
|
6808
|
+
callback();
|
|
6809
|
+
} finally {
|
|
6810
|
+
ReactCurrentBatchConfig$1.suspense = previousConfig;
|
|
6821
6811
|
}
|
|
6812
|
+
});
|
|
6813
|
+
}, [config, isPending]);
|
|
6814
|
+
return [startTransition, isPending];
|
|
6815
|
+
}
|
|
6816
|
+
|
|
6817
|
+
function updateTransition(config) {
|
|
6818
|
+
var _updateState2 = updateState(false),
|
|
6819
|
+
isPending = _updateState2[0],
|
|
6820
|
+
setPending = _updateState2[1];
|
|
6821
|
+
|
|
6822
|
+
var startTransition = updateCallback(function (callback) {
|
|
6823
|
+
setPending(true);
|
|
6824
|
+
Scheduler$1.unstable_next(function () {
|
|
6825
|
+
var previousConfig = ReactCurrentBatchConfig$1.suspense;
|
|
6826
|
+
ReactCurrentBatchConfig$1.suspense = config === undefined ? null : config;
|
|
6827
|
+
|
|
6828
|
+
try {
|
|
6829
|
+
setPending(false);
|
|
6830
|
+
callback();
|
|
6831
|
+
} finally {
|
|
6832
|
+
ReactCurrentBatchConfig$1.suspense = previousConfig;
|
|
6833
|
+
}
|
|
6834
|
+
});
|
|
6835
|
+
}, [config, isPending]);
|
|
6836
|
+
return [startTransition, isPending];
|
|
6837
|
+
}
|
|
6838
|
+
|
|
6839
|
+
function dispatchAction(fiber, queue, action) {
|
|
6840
|
+
if (!(numberOfReRenders < RE_RENDER_LIMIT)) {
|
|
6841
|
+
{
|
|
6842
|
+
throw Error("Too many re-renders. React limits the number of renders to prevent an infinite loop.");
|
|
6822
6843
|
}
|
|
6823
|
-
}
|
|
6844
|
+
}
|
|
6824
6845
|
|
|
6825
6846
|
{
|
|
6826
6847
|
!(typeof arguments[3] !== 'function') ? warning$1(false, "State updates from the useState() and useReducer() Hooks don't support the " + 'second callback argument. To execute a side effect after ' + 'rendering, declare it in the component body with useEffect().') : void 0;
|
|
@@ -6865,7 +6886,7 @@ function dispatchAction(fiber, queue, action) {
|
|
|
6865
6886
|
lastRenderPhaseUpdate.next = update;
|
|
6866
6887
|
}
|
|
6867
6888
|
} else {
|
|
6868
|
-
var currentTime =
|
|
6889
|
+
var currentTime = requestCurrentTimeForUpdate();
|
|
6869
6890
|
var suspenseConfig = requestCurrentSuspenseConfig();
|
|
6870
6891
|
var expirationTime = computeExpirationForFiber(currentTime, fiber, suspenseConfig);
|
|
6871
6892
|
var _update2 = {
|
|
@@ -6964,7 +6985,9 @@ var ContextOnlyDispatcher = {
|
|
|
6964
6985
|
useRef: throwInvalidHookError,
|
|
6965
6986
|
useState: throwInvalidHookError,
|
|
6966
6987
|
useDebugValue: throwInvalidHookError,
|
|
6967
|
-
useResponder: throwInvalidHookError
|
|
6988
|
+
useResponder: throwInvalidHookError,
|
|
6989
|
+
useDeferredValue: throwInvalidHookError,
|
|
6990
|
+
useTransition: throwInvalidHookError
|
|
6968
6991
|
};
|
|
6969
6992
|
var HooksDispatcherOnMountInDEV = null;
|
|
6970
6993
|
var HooksDispatcherOnMountWithHookTypesInDEV = null;
|
|
@@ -7065,6 +7088,16 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
|
7065
7088
|
currentHookNameInDev = 'useResponder';
|
|
7066
7089
|
mountHookTypesDev();
|
|
7067
7090
|
return createResponderListener(responder, props);
|
|
7091
|
+
},
|
|
7092
|
+
useDeferredValue: function (value, config) {
|
|
7093
|
+
currentHookNameInDev = 'useDeferredValue';
|
|
7094
|
+
mountHookTypesDev();
|
|
7095
|
+
return mountDeferredValue(value, config);
|
|
7096
|
+
},
|
|
7097
|
+
useTransition: function (config) {
|
|
7098
|
+
currentHookNameInDev = 'useTransition';
|
|
7099
|
+
mountHookTypesDev();
|
|
7100
|
+
return mountTransition(config);
|
|
7068
7101
|
}
|
|
7069
7102
|
};
|
|
7070
7103
|
HooksDispatcherOnMountWithHookTypesInDEV = {
|
|
@@ -7146,6 +7179,16 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
|
7146
7179
|
currentHookNameInDev = 'useResponder';
|
|
7147
7180
|
updateHookTypesDev();
|
|
7148
7181
|
return createResponderListener(responder, props);
|
|
7182
|
+
},
|
|
7183
|
+
useDeferredValue: function (value, config) {
|
|
7184
|
+
currentHookNameInDev = 'useDeferredValue';
|
|
7185
|
+
updateHookTypesDev();
|
|
7186
|
+
return mountDeferredValue(value, config);
|
|
7187
|
+
},
|
|
7188
|
+
useTransition: function (config) {
|
|
7189
|
+
currentHookNameInDev = 'useTransition';
|
|
7190
|
+
updateHookTypesDev();
|
|
7191
|
+
return mountTransition(config);
|
|
7149
7192
|
}
|
|
7150
7193
|
};
|
|
7151
7194
|
HooksDispatcherOnUpdateInDEV = {
|
|
@@ -7227,6 +7270,16 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
|
7227
7270
|
currentHookNameInDev = 'useResponder';
|
|
7228
7271
|
updateHookTypesDev();
|
|
7229
7272
|
return createResponderListener(responder, props);
|
|
7273
|
+
},
|
|
7274
|
+
useDeferredValue: function (value, config) {
|
|
7275
|
+
currentHookNameInDev = 'useDeferredValue';
|
|
7276
|
+
updateHookTypesDev();
|
|
7277
|
+
return updateDeferredValue(value, config);
|
|
7278
|
+
},
|
|
7279
|
+
useTransition: function (config) {
|
|
7280
|
+
currentHookNameInDev = 'useTransition';
|
|
7281
|
+
updateHookTypesDev();
|
|
7282
|
+
return updateTransition(config);
|
|
7230
7283
|
}
|
|
7231
7284
|
};
|
|
7232
7285
|
InvalidNestedHooksDispatcherOnMountInDEV = {
|
|
@@ -7320,6 +7373,18 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
|
7320
7373
|
warnInvalidHookAccess();
|
|
7321
7374
|
mountHookTypesDev();
|
|
7322
7375
|
return createResponderListener(responder, props);
|
|
7376
|
+
},
|
|
7377
|
+
useDeferredValue: function (value, config) {
|
|
7378
|
+
currentHookNameInDev = 'useDeferredValue';
|
|
7379
|
+
warnInvalidHookAccess();
|
|
7380
|
+
mountHookTypesDev();
|
|
7381
|
+
return mountDeferredValue(value, config);
|
|
7382
|
+
},
|
|
7383
|
+
useTransition: function (config) {
|
|
7384
|
+
currentHookNameInDev = 'useTransition';
|
|
7385
|
+
warnInvalidHookAccess();
|
|
7386
|
+
mountHookTypesDev();
|
|
7387
|
+
return mountTransition(config);
|
|
7323
7388
|
}
|
|
7324
7389
|
};
|
|
7325
7390
|
InvalidNestedHooksDispatcherOnUpdateInDEV = {
|
|
@@ -7413,6 +7478,18 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
|
7413
7478
|
warnInvalidHookAccess();
|
|
7414
7479
|
updateHookTypesDev();
|
|
7415
7480
|
return createResponderListener(responder, props);
|
|
7481
|
+
},
|
|
7482
|
+
useDeferredValue: function (value, config) {
|
|
7483
|
+
currentHookNameInDev = 'useDeferredValue';
|
|
7484
|
+
warnInvalidHookAccess();
|
|
7485
|
+
updateHookTypesDev();
|
|
7486
|
+
return updateDeferredValue(value, config);
|
|
7487
|
+
},
|
|
7488
|
+
useTransition: function (config) {
|
|
7489
|
+
currentHookNameInDev = 'useTransition';
|
|
7490
|
+
warnInvalidHookAccess();
|
|
7491
|
+
updateHookTypesDev();
|
|
7492
|
+
return updateTransition(config);
|
|
7416
7493
|
}
|
|
7417
7494
|
};
|
|
7418
7495
|
}
|
|
@@ -7701,13 +7778,11 @@ function tryToClaimNextHydratableInstance(fiber) {
|
|
|
7701
7778
|
|
|
7702
7779
|
function prepareToHydrateHostInstance(fiber, rootContainerInstance, hostContext) {
|
|
7703
7780
|
if (!supportsHydration) {
|
|
7704
|
-
|
|
7781
|
+
{
|
|
7705
7782
|
{
|
|
7706
|
-
|
|
7707
|
-
throw ReactError(Error("Expected prepareToHydrateHostInstance() to never be called. This error is likely caused by a bug in React. Please file an issue."));
|
|
7708
|
-
}
|
|
7783
|
+
throw Error("Expected prepareToHydrateHostInstance() to never be called. This error is likely caused by a bug in React. Please file an issue.");
|
|
7709
7784
|
}
|
|
7710
|
-
}
|
|
7785
|
+
}
|
|
7711
7786
|
}
|
|
7712
7787
|
|
|
7713
7788
|
var instance = fiber.stateNode;
|
|
@@ -7725,13 +7800,11 @@ function prepareToHydrateHostInstance(fiber, rootContainerInstance, hostContext)
|
|
|
7725
7800
|
|
|
7726
7801
|
function prepareToHydrateHostTextInstance(fiber) {
|
|
7727
7802
|
if (!supportsHydration) {
|
|
7728
|
-
|
|
7803
|
+
{
|
|
7729
7804
|
{
|
|
7730
|
-
|
|
7731
|
-
throw ReactError(Error("Expected prepareToHydrateHostTextInstance() to never be called. This error is likely caused by a bug in React. Please file an issue."));
|
|
7732
|
-
}
|
|
7805
|
+
throw Error("Expected prepareToHydrateHostTextInstance() to never be called. This error is likely caused by a bug in React. Please file an issue.");
|
|
7733
7806
|
}
|
|
7734
|
-
}
|
|
7807
|
+
}
|
|
7735
7808
|
}
|
|
7736
7809
|
|
|
7737
7810
|
var textInstance = fiber.stateNode;
|
|
@@ -7771,46 +7844,41 @@ function prepareToHydrateHostTextInstance(fiber) {
|
|
|
7771
7844
|
|
|
7772
7845
|
function prepareToHydrateHostSuspenseInstance(fiber) {
|
|
7773
7846
|
if (!supportsHydration) {
|
|
7774
|
-
|
|
7847
|
+
{
|
|
7775
7848
|
{
|
|
7776
|
-
|
|
7777
|
-
throw ReactError(Error("Expected prepareToHydrateHostSuspenseInstance() to never be called. This error is likely caused by a bug in React. Please file an issue."));
|
|
7778
|
-
}
|
|
7849
|
+
throw Error("Expected prepareToHydrateHostSuspenseInstance() to never be called. This error is likely caused by a bug in React. Please file an issue.");
|
|
7779
7850
|
}
|
|
7780
|
-
}
|
|
7851
|
+
}
|
|
7781
7852
|
}
|
|
7782
7853
|
|
|
7783
7854
|
var suspenseState = fiber.memoizedState;
|
|
7784
7855
|
var suspenseInstance = suspenseState !== null ? suspenseState.dehydrated : null;
|
|
7785
7856
|
|
|
7786
|
-
|
|
7787
|
-
|
|
7788
|
-
|
|
7789
|
-
throw ReactError(Error("Expected to have a hydrated suspense instance. This error is likely caused by a bug in React. Please file an issue."));
|
|
7790
|
-
}
|
|
7857
|
+
if (!suspenseInstance) {
|
|
7858
|
+
{
|
|
7859
|
+
throw Error("Expected to have a hydrated suspense instance. This error is likely caused by a bug in React. Please file an issue.");
|
|
7791
7860
|
}
|
|
7792
|
-
}
|
|
7861
|
+
}
|
|
7793
7862
|
|
|
7794
7863
|
hydrateSuspenseInstance(suspenseInstance, fiber);
|
|
7795
7864
|
}
|
|
7796
7865
|
|
|
7797
7866
|
function skipPastDehydratedSuspenseInstance(fiber) {
|
|
7798
7867
|
if (!supportsHydration) {
|
|
7799
|
-
|
|
7868
|
+
{
|
|
7800
7869
|
{
|
|
7801
|
-
|
|
7802
|
-
throw ReactError(Error("Expected skipPastDehydratedSuspenseInstance() to never be called. This error is likely caused by a bug in React. Please file an issue."));
|
|
7803
|
-
}
|
|
7870
|
+
throw Error("Expected skipPastDehydratedSuspenseInstance() to never be called. This error is likely caused by a bug in React. Please file an issue.");
|
|
7804
7871
|
}
|
|
7805
|
-
}
|
|
7872
|
+
}
|
|
7806
7873
|
}
|
|
7807
7874
|
|
|
7808
7875
|
var suspenseState = fiber.memoizedState;
|
|
7809
7876
|
var suspenseInstance = suspenseState !== null ? suspenseState.dehydrated : null;
|
|
7810
7877
|
|
|
7811
|
-
if (suspenseInstance
|
|
7812
|
-
|
|
7813
|
-
|
|
7878
|
+
if (!suspenseInstance) {
|
|
7879
|
+
{
|
|
7880
|
+
throw Error("Expected to have a hydrated suspense instance. This error is likely caused by a bug in React. Please file an issue.");
|
|
7881
|
+
}
|
|
7814
7882
|
}
|
|
7815
7883
|
|
|
7816
7884
|
return getNextHydratableInstanceAfterSuspenseInstance(suspenseInstance);
|
|
@@ -8346,13 +8414,11 @@ function updateHostRoot(current$$1, workInProgress, renderExpirationTime) {
|
|
|
8346
8414
|
pushHostRootContext(workInProgress);
|
|
8347
8415
|
var updateQueue = workInProgress.updateQueue;
|
|
8348
8416
|
|
|
8349
|
-
(
|
|
8350
|
-
|
|
8351
|
-
|
|
8352
|
-
throw ReactError(Error("If the root does not have an updateQueue, we should have already bailed out. This error is likely caused by a bug in React. Please file an issue."));
|
|
8353
|
-
}
|
|
8417
|
+
if (!(updateQueue !== null)) {
|
|
8418
|
+
{
|
|
8419
|
+
throw Error("If the root does not have an updateQueue, we should have already bailed out. This error is likely caused by a bug in React. Please file an issue.");
|
|
8354
8420
|
}
|
|
8355
|
-
}
|
|
8421
|
+
}
|
|
8356
8422
|
|
|
8357
8423
|
var nextProps = workInProgress.pendingProps;
|
|
8358
8424
|
var prevState = workInProgress.memoizedState;
|
|
@@ -8539,13 +8605,11 @@ function mountLazyComponent(_current, workInProgress, elementType, updateExpirat
|
|
|
8539
8605
|
// implementation detail.
|
|
8540
8606
|
|
|
8541
8607
|
|
|
8542
|
-
|
|
8608
|
+
{
|
|
8543
8609
|
{
|
|
8544
|
-
|
|
8545
|
-
throw ReactError(Error("Element type is invalid. Received a promise that resolves to: " + Component + ". Lazy element type must resolve to a class or function." + hint));
|
|
8546
|
-
}
|
|
8610
|
+
throw Error("Element type is invalid. Received a promise that resolves to: " + Component + ". Lazy element type must resolve to a class or function." + hint);
|
|
8547
8611
|
}
|
|
8548
|
-
}
|
|
8612
|
+
}
|
|
8549
8613
|
}
|
|
8550
8614
|
}
|
|
8551
8615
|
|
|
@@ -8748,7 +8812,7 @@ function validateFunctionComponentInDev(workInProgress, Component) {
|
|
|
8748
8812
|
|
|
8749
8813
|
var SUSPENDED_MARKER = {
|
|
8750
8814
|
dehydrated: null,
|
|
8751
|
-
retryTime:
|
|
8815
|
+
retryTime: NoWork
|
|
8752
8816
|
};
|
|
8753
8817
|
|
|
8754
8818
|
function shouldRemainOnFallback(suspenseContext, current$$1, workInProgress) {
|
|
@@ -8824,12 +8888,12 @@ function updateSuspenseComponent(current$$1, workInProgress, renderExpirationTim
|
|
|
8824
8888
|
|
|
8825
8889
|
|
|
8826
8890
|
if (current$$1 === null) {
|
|
8827
|
-
|
|
8828
|
-
|
|
8829
|
-
|
|
8830
|
-
|
|
8831
|
-
tryToClaimNextHydratableInstance(workInProgress); // This could've been a dehydrated suspense component.
|
|
8891
|
+
// If we're currently hydrating, try to hydrate this boundary.
|
|
8892
|
+
// But only if this has a fallback.
|
|
8893
|
+
if (nextProps.fallback !== undefined) {
|
|
8894
|
+
tryToClaimNextHydratableInstance(workInProgress); // This could've been a dehydrated suspense component.
|
|
8832
8895
|
|
|
8896
|
+
if (enableSuspenseServerRenderer) {
|
|
8833
8897
|
var suspenseState = workInProgress.memoizedState;
|
|
8834
8898
|
|
|
8835
8899
|
if (suspenseState !== null) {
|
|
@@ -9131,7 +9195,7 @@ function mountDehydratedSuspenseComponent(workInProgress, suspenseInstance, rend
|
|
|
9131
9195
|
// Instead, we'll leave the content in place and try to hydrate it later.
|
|
9132
9196
|
if ((workInProgress.mode & BatchedMode) === NoMode) {
|
|
9133
9197
|
{
|
|
9134
|
-
warning$1(false, 'Cannot hydrate Suspense in legacy mode. Switch from ' + 'ReactDOM.hydrate(element, container) to ' + 'ReactDOM.
|
|
9198
|
+
warning$1(false, 'Cannot hydrate Suspense in legacy mode. Switch from ' + 'ReactDOM.hydrate(element, container) to ' + 'ReactDOM.createSyncRoot(container, { hydrate: true })' + '.render(element) or remove the Suspense components from ' + 'the server rendered components.');
|
|
9135
9199
|
}
|
|
9136
9200
|
|
|
9137
9201
|
workInProgress.expirationTime = Sync;
|
|
@@ -9146,7 +9210,7 @@ function mountDehydratedSuspenseComponent(workInProgress, suspenseInstance, rend
|
|
|
9146
9210
|
// a protocol to transfer that time, we'll just estimate it by using the current
|
|
9147
9211
|
// time. This will mean that Suspense timeouts are slightly shifted to later than
|
|
9148
9212
|
// they should be.
|
|
9149
|
-
var serverDisplayTime =
|
|
9213
|
+
var serverDisplayTime = requestCurrentTimeForUpdate(); // Schedule a normal pri update to render this content.
|
|
9150
9214
|
|
|
9151
9215
|
var newExpirationTime = computeAsyncExpiration(serverDisplayTime);
|
|
9152
9216
|
|
|
@@ -9255,6 +9319,20 @@ function updateDehydratedSuspenseComponent(current$$1, workInProgress, suspenseI
|
|
|
9255
9319
|
}
|
|
9256
9320
|
}
|
|
9257
9321
|
|
|
9322
|
+
function scheduleWorkOnFiber(fiber, renderExpirationTime) {
|
|
9323
|
+
if (fiber.expirationTime < renderExpirationTime) {
|
|
9324
|
+
fiber.expirationTime = renderExpirationTime;
|
|
9325
|
+
}
|
|
9326
|
+
|
|
9327
|
+
var alternate = fiber.alternate;
|
|
9328
|
+
|
|
9329
|
+
if (alternate !== null && alternate.expirationTime < renderExpirationTime) {
|
|
9330
|
+
alternate.expirationTime = renderExpirationTime;
|
|
9331
|
+
}
|
|
9332
|
+
|
|
9333
|
+
scheduleWorkOnParentPath(fiber.return, renderExpirationTime);
|
|
9334
|
+
}
|
|
9335
|
+
|
|
9258
9336
|
function propagateSuspenseContextChange(workInProgress, firstChild, renderExpirationTime) {
|
|
9259
9337
|
// Mark any Suspense boundaries with fallbacks as having work to do.
|
|
9260
9338
|
// If they were previously forced into fallbacks, they may now be able
|
|
@@ -9266,18 +9344,15 @@ function propagateSuspenseContextChange(workInProgress, firstChild, renderExpira
|
|
|
9266
9344
|
var state = node.memoizedState;
|
|
9267
9345
|
|
|
9268
9346
|
if (state !== null) {
|
|
9269
|
-
|
|
9270
|
-
|
|
9271
|
-
|
|
9272
|
-
|
|
9273
|
-
|
|
9274
|
-
|
|
9275
|
-
|
|
9276
|
-
|
|
9277
|
-
|
|
9278
|
-
|
|
9279
|
-
scheduleWorkOnParentPath(node.return, renderExpirationTime);
|
|
9280
|
-
}
|
|
9347
|
+
scheduleWorkOnFiber(node, renderExpirationTime);
|
|
9348
|
+
}
|
|
9349
|
+
} else if (node.tag === SuspenseListComponent) {
|
|
9350
|
+
// If the tail is hidden there might not be an Suspense boundaries
|
|
9351
|
+
// to schedule work on. In this case we have to schedule it on the
|
|
9352
|
+
// list itself.
|
|
9353
|
+
// We don't have to traverse to the children of the list since
|
|
9354
|
+
// the list will propagate the change when it rerenders.
|
|
9355
|
+
scheduleWorkOnFiber(node, renderExpirationTime);
|
|
9281
9356
|
} else if (node.child !== null) {
|
|
9282
9357
|
node.child.return = node;
|
|
9283
9358
|
node = node.child;
|
|
@@ -9422,7 +9497,7 @@ function validateSuspenseListChildren(children, revealOrder) {
|
|
|
9422
9497
|
}
|
|
9423
9498
|
}
|
|
9424
9499
|
|
|
9425
|
-
function initSuspenseListRenderState(workInProgress, isBackwards, tail, lastContentRow, tailMode) {
|
|
9500
|
+
function initSuspenseListRenderState(workInProgress, isBackwards, tail, lastContentRow, tailMode, lastEffectBeforeRendering) {
|
|
9426
9501
|
var renderState = workInProgress.memoizedState;
|
|
9427
9502
|
|
|
9428
9503
|
if (renderState === null) {
|
|
@@ -9432,7 +9507,8 @@ function initSuspenseListRenderState(workInProgress, isBackwards, tail, lastCont
|
|
|
9432
9507
|
last: lastContentRow,
|
|
9433
9508
|
tail: tail,
|
|
9434
9509
|
tailExpiration: 0,
|
|
9435
|
-
tailMode: tailMode
|
|
9510
|
+
tailMode: tailMode,
|
|
9511
|
+
lastEffect: lastEffectBeforeRendering
|
|
9436
9512
|
};
|
|
9437
9513
|
} else {
|
|
9438
9514
|
// We can reuse the existing object from previous renders.
|
|
@@ -9442,6 +9518,7 @@ function initSuspenseListRenderState(workInProgress, isBackwards, tail, lastCont
|
|
|
9442
9518
|
renderState.tail = tail;
|
|
9443
9519
|
renderState.tailExpiration = 0;
|
|
9444
9520
|
renderState.tailMode = tailMode;
|
|
9521
|
+
renderState.lastEffect = lastEffectBeforeRendering;
|
|
9445
9522
|
}
|
|
9446
9523
|
} // This can end up rendering this component multiple passes.
|
|
9447
9524
|
// The first pass splits the children fibers into two sets. A head and tail.
|
|
@@ -9506,7 +9583,7 @@ function updateSuspenseListComponent(current$$1, workInProgress, renderExpiratio
|
|
|
9506
9583
|
}
|
|
9507
9584
|
|
|
9508
9585
|
initSuspenseListRenderState(workInProgress, false, // isBackwards
|
|
9509
|
-
tail, lastContentRow, tailMode);
|
|
9586
|
+
tail, lastContentRow, tailMode, workInProgress.lastEffect);
|
|
9510
9587
|
break;
|
|
9511
9588
|
}
|
|
9512
9589
|
|
|
@@ -9538,7 +9615,7 @@ function updateSuspenseListComponent(current$$1, workInProgress, renderExpiratio
|
|
|
9538
9615
|
|
|
9539
9616
|
initSuspenseListRenderState(workInProgress, true, // isBackwards
|
|
9540
9617
|
_tail, null, // last
|
|
9541
|
-
tailMode);
|
|
9618
|
+
tailMode, workInProgress.lastEffect);
|
|
9542
9619
|
break;
|
|
9543
9620
|
}
|
|
9544
9621
|
|
|
@@ -9547,7 +9624,7 @@ function updateSuspenseListComponent(current$$1, workInProgress, renderExpiratio
|
|
|
9547
9624
|
initSuspenseListRenderState(workInProgress, false, // isBackwards
|
|
9548
9625
|
null, // tail
|
|
9549
9626
|
null, // last
|
|
9550
|
-
undefined);
|
|
9627
|
+
undefined, workInProgress.lastEffect);
|
|
9551
9628
|
break;
|
|
9552
9629
|
}
|
|
9553
9630
|
|
|
@@ -10100,13 +10177,11 @@ function beginWork$1(current$$1, workInProgress, renderExpirationTime) {
|
|
|
10100
10177
|
}
|
|
10101
10178
|
}
|
|
10102
10179
|
|
|
10103
|
-
|
|
10180
|
+
{
|
|
10104
10181
|
{
|
|
10105
|
-
|
|
10106
|
-
throw ReactError(Error("Unknown unit of work tag (" + workInProgress.tag + "). This error is likely caused by a bug in React. Please file an issue."));
|
|
10107
|
-
}
|
|
10182
|
+
throw Error("Unknown unit of work tag (" + workInProgress.tag + "). This error is likely caused by a bug in React. Please file an issue.");
|
|
10108
10183
|
}
|
|
10109
|
-
}
|
|
10184
|
+
}
|
|
10110
10185
|
}
|
|
10111
10186
|
|
|
10112
10187
|
function createFundamentalStateInstance(currentFiber, props, impl, state) {
|
|
@@ -10151,6 +10226,31 @@ function collectScopedNodes(node, fn, scopedNodes) {
|
|
|
10151
10226
|
}
|
|
10152
10227
|
}
|
|
10153
10228
|
|
|
10229
|
+
function collectFirstScopedNode(node, fn) {
|
|
10230
|
+
if (enableScopeAPI) {
|
|
10231
|
+
if (node.tag === HostComponent) {
|
|
10232
|
+
var _type2 = node.type,
|
|
10233
|
+
memoizedProps = node.memoizedProps;
|
|
10234
|
+
|
|
10235
|
+
if (fn(_type2, memoizedProps) === true) {
|
|
10236
|
+
return getPublicInstance(node.stateNode);
|
|
10237
|
+
}
|
|
10238
|
+
}
|
|
10239
|
+
|
|
10240
|
+
var child = node.child;
|
|
10241
|
+
|
|
10242
|
+
if (isFiberSuspenseAndTimedOut(node)) {
|
|
10243
|
+
child = getSuspenseFallbackChild(node);
|
|
10244
|
+
}
|
|
10245
|
+
|
|
10246
|
+
if (child !== null) {
|
|
10247
|
+
return collectFirstScopedNodeFromChildren(child, fn);
|
|
10248
|
+
}
|
|
10249
|
+
}
|
|
10250
|
+
|
|
10251
|
+
return null;
|
|
10252
|
+
}
|
|
10253
|
+
|
|
10154
10254
|
function collectScopedNodesFromChildren(startingChild, fn, scopedNodes) {
|
|
10155
10255
|
var child = startingChild;
|
|
10156
10256
|
|
|
@@ -10160,6 +10260,22 @@ function collectScopedNodesFromChildren(startingChild, fn, scopedNodes) {
|
|
|
10160
10260
|
}
|
|
10161
10261
|
}
|
|
10162
10262
|
|
|
10263
|
+
function collectFirstScopedNodeFromChildren(startingChild, fn) {
|
|
10264
|
+
var child = startingChild;
|
|
10265
|
+
|
|
10266
|
+
while (child !== null) {
|
|
10267
|
+
var scopedNode = collectFirstScopedNode(child, fn);
|
|
10268
|
+
|
|
10269
|
+
if (scopedNode !== null) {
|
|
10270
|
+
return scopedNode;
|
|
10271
|
+
}
|
|
10272
|
+
|
|
10273
|
+
child = child.sibling;
|
|
10274
|
+
}
|
|
10275
|
+
|
|
10276
|
+
return null;
|
|
10277
|
+
}
|
|
10278
|
+
|
|
10163
10279
|
function collectNearestScopeMethods(node, scope, childrenScopes) {
|
|
10164
10280
|
if (isValidScopeNode(node, scope)) {
|
|
10165
10281
|
childrenScopes.push(node.stateNode.methods);
|
|
@@ -10186,11 +10302,10 @@ function collectNearestChildScopeMethods(startingChild, scope, childrenScopes) {
|
|
|
10186
10302
|
}
|
|
10187
10303
|
|
|
10188
10304
|
function isValidScopeNode(node, scope) {
|
|
10189
|
-
return node.tag === ScopeComponent && node.type === scope;
|
|
10305
|
+
return node.tag === ScopeComponent && node.type === scope && node.stateNode !== null;
|
|
10190
10306
|
}
|
|
10191
10307
|
|
|
10192
10308
|
function createScopeMethods(scope, instance) {
|
|
10193
|
-
var fn = scope.fn;
|
|
10194
10309
|
return {
|
|
10195
10310
|
getChildren: function () {
|
|
10196
10311
|
var currentFiber = instance.fiber;
|
|
@@ -10242,7 +10357,7 @@ function createScopeMethods(scope, instance) {
|
|
|
10242
10357
|
var currentFiber = instance.fiber;
|
|
10243
10358
|
return currentFiber.memoizedProps;
|
|
10244
10359
|
},
|
|
10245
|
-
|
|
10360
|
+
queryAllNodes: function (fn) {
|
|
10246
10361
|
var currentFiber = instance.fiber;
|
|
10247
10362
|
var child = currentFiber.child;
|
|
10248
10363
|
var scopedNodes = [];
|
|
@@ -10252,6 +10367,29 @@ function createScopeMethods(scope, instance) {
|
|
|
10252
10367
|
}
|
|
10253
10368
|
|
|
10254
10369
|
return scopedNodes.length === 0 ? null : scopedNodes;
|
|
10370
|
+
},
|
|
10371
|
+
queryFirstNode: function (fn) {
|
|
10372
|
+
var currentFiber = instance.fiber;
|
|
10373
|
+
var child = currentFiber.child;
|
|
10374
|
+
|
|
10375
|
+
if (child !== null) {
|
|
10376
|
+
return collectFirstScopedNodeFromChildren(child, fn);
|
|
10377
|
+
}
|
|
10378
|
+
|
|
10379
|
+
return null;
|
|
10380
|
+
},
|
|
10381
|
+
containsNode: function (node) {
|
|
10382
|
+
var fiber = getInstanceFromNode(node);
|
|
10383
|
+
|
|
10384
|
+
while (fiber !== null) {
|
|
10385
|
+
if (fiber.tag === ScopeComponent && fiber.type === scope && fiber.stateNode === instance) {
|
|
10386
|
+
return true;
|
|
10387
|
+
}
|
|
10388
|
+
|
|
10389
|
+
fiber = fiber.return;
|
|
10390
|
+
}
|
|
10391
|
+
|
|
10392
|
+
return false;
|
|
10255
10393
|
}
|
|
10256
10394
|
};
|
|
10257
10395
|
}
|
|
@@ -10786,13 +10924,11 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
10786
10924
|
}
|
|
10787
10925
|
} else {
|
|
10788
10926
|
if (!newProps) {
|
|
10789
|
-
(
|
|
10790
|
-
|
|
10791
|
-
|
|
10792
|
-
throw ReactError(Error("We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue."));
|
|
10793
|
-
}
|
|
10927
|
+
if (!(workInProgress.stateNode !== null)) {
|
|
10928
|
+
{
|
|
10929
|
+
throw Error("We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue.");
|
|
10794
10930
|
}
|
|
10795
|
-
}
|
|
10931
|
+
} // This can happen when we abort work.
|
|
10796
10932
|
|
|
10797
10933
|
|
|
10798
10934
|
break;
|
|
@@ -10863,13 +10999,11 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
10863
10999
|
updateHostText$1(current, workInProgress, oldText, newText);
|
|
10864
11000
|
} else {
|
|
10865
11001
|
if (typeof newText !== 'string') {
|
|
10866
|
-
(
|
|
10867
|
-
|
|
10868
|
-
|
|
10869
|
-
throw ReactError(Error("We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue."));
|
|
10870
|
-
}
|
|
11002
|
+
if (!(workInProgress.stateNode !== null)) {
|
|
11003
|
+
{
|
|
11004
|
+
throw Error("We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue.");
|
|
10871
11005
|
}
|
|
10872
|
-
}
|
|
11006
|
+
} // This can happen when we abort work.
|
|
10873
11007
|
|
|
10874
11008
|
}
|
|
10875
11009
|
|
|
@@ -10904,13 +11038,11 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
10904
11038
|
if (current === null) {
|
|
10905
11039
|
var _wasHydrated3 = popHydrationState(workInProgress);
|
|
10906
11040
|
|
|
10907
|
-
|
|
10908
|
-
|
|
10909
|
-
|
|
10910
|
-
throw ReactError(Error("A dehydrated suspense component was completed without a hydrated node. This is probably a bug in React."));
|
|
10911
|
-
}
|
|
11041
|
+
if (!_wasHydrated3) {
|
|
11042
|
+
{
|
|
11043
|
+
throw Error("A dehydrated suspense component was completed without a hydrated node. This is probably a bug in React.");
|
|
10912
11044
|
}
|
|
10913
|
-
}
|
|
11045
|
+
}
|
|
10914
11046
|
|
|
10915
11047
|
prepareToHydrateHostSuspenseInstance(workInProgress);
|
|
10916
11048
|
|
|
@@ -10953,10 +11085,9 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
10953
11085
|
var prevDidTimeout = false;
|
|
10954
11086
|
|
|
10955
11087
|
if (current === null) {
|
|
10956
|
-
|
|
10957
|
-
|
|
10958
|
-
|
|
10959
|
-
popHydrationState(workInProgress);
|
|
11088
|
+
if (workInProgress.memoizedProps.fallback !== undefined) {
|
|
11089
|
+
popHydrationState(workInProgress);
|
|
11090
|
+
}
|
|
10960
11091
|
} else {
|
|
10961
11092
|
var prevState = current.memoizedState;
|
|
10962
11093
|
prevDidTimeout = prevState !== null;
|
|
@@ -11141,7 +11272,11 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
11141
11272
|
// Reset the effect list before doing the second pass since that's now invalid.
|
|
11142
11273
|
|
|
11143
11274
|
|
|
11144
|
-
|
|
11275
|
+
if (renderState.lastEffect === null) {
|
|
11276
|
+
workInProgress.firstEffect = null;
|
|
11277
|
+
}
|
|
11278
|
+
|
|
11279
|
+
workInProgress.lastEffect = renderState.lastEffect; // Reset the child fibers to their original state.
|
|
11145
11280
|
|
|
11146
11281
|
resetChildFibers(workInProgress, renderExpirationTime); // Set up the Suspense Context to force suspense and immediately
|
|
11147
11282
|
// rerender the children.
|
|
@@ -11164,21 +11299,22 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
11164
11299
|
|
|
11165
11300
|
if (_suspended !== null) {
|
|
11166
11301
|
workInProgress.effectTag |= DidCapture;
|
|
11167
|
-
didSuspendAlready = true;
|
|
11302
|
+
didSuspendAlready = true; // Ensure we transfer the update queue to the parent so that it doesn't
|
|
11303
|
+
// get lost if this row ends up dropped during a second pass.
|
|
11304
|
+
|
|
11305
|
+
var _newThennables = _suspended.updateQueue;
|
|
11306
|
+
|
|
11307
|
+
if (_newThennables !== null) {
|
|
11308
|
+
workInProgress.updateQueue = _newThennables;
|
|
11309
|
+
workInProgress.effectTag |= Update;
|
|
11310
|
+
}
|
|
11311
|
+
|
|
11168
11312
|
cutOffTailIfNeeded(renderState, true); // This might have been modified.
|
|
11169
11313
|
|
|
11170
11314
|
if (renderState.tail === null && renderState.tailMode === 'hidden') {
|
|
11171
11315
|
// We need to delete the row we just rendered.
|
|
11172
|
-
//
|
|
11173
|
-
var _newThennables = _suspended.updateQueue;
|
|
11174
|
-
|
|
11175
|
-
if (_newThennables !== null) {
|
|
11176
|
-
workInProgress.updateQueue = _newThennables;
|
|
11177
|
-
workInProgress.effectTag |= Update;
|
|
11178
|
-
} // Reset the effect list to what it w as before we rendered this
|
|
11316
|
+
// Reset the effect list to what it w as before we rendered this
|
|
11179
11317
|
// child. The nested children have already appended themselves.
|
|
11180
|
-
|
|
11181
|
-
|
|
11182
11318
|
var lastEffect = workInProgress.lastEffect = renderState.lastEffect; // Remove any effects that were appended after this point.
|
|
11183
11319
|
|
|
11184
11320
|
if (lastEffect !== null) {
|
|
@@ -11365,13 +11501,11 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
11365
11501
|
}
|
|
11366
11502
|
|
|
11367
11503
|
default:
|
|
11368
|
-
|
|
11504
|
+
{
|
|
11369
11505
|
{
|
|
11370
|
-
|
|
11371
|
-
throw ReactError(Error("Unknown unit of work tag (" + workInProgress.tag + "). This error is likely caused by a bug in React. Please file an issue."));
|
|
11372
|
-
}
|
|
11506
|
+
throw Error("Unknown unit of work tag (" + workInProgress.tag + "). This error is likely caused by a bug in React. Please file an issue.");
|
|
11373
11507
|
}
|
|
11374
|
-
}
|
|
11508
|
+
}
|
|
11375
11509
|
|
|
11376
11510
|
}
|
|
11377
11511
|
|
|
@@ -11404,13 +11538,11 @@ function unwindWork(workInProgress, renderExpirationTime) {
|
|
|
11404
11538
|
popTopLevelContextObject(workInProgress);
|
|
11405
11539
|
var _effectTag = workInProgress.effectTag;
|
|
11406
11540
|
|
|
11407
|
-
(
|
|
11408
|
-
|
|
11409
|
-
|
|
11410
|
-
throw ReactError(Error("The root failed to unmount after an error. This is likely a bug in React. Please file an issue."));
|
|
11411
|
-
}
|
|
11541
|
+
if (!((_effectTag & DidCapture) === NoEffect)) {
|
|
11542
|
+
{
|
|
11543
|
+
throw Error("The root failed to unmount after an error. This is likely a bug in React. Please file an issue.");
|
|
11412
11544
|
}
|
|
11413
|
-
}
|
|
11545
|
+
}
|
|
11414
11546
|
|
|
11415
11547
|
workInProgress.effectTag = _effectTag & ~ShouldCapture | DidCapture;
|
|
11416
11548
|
return workInProgress;
|
|
@@ -11431,13 +11563,11 @@ function unwindWork(workInProgress, renderExpirationTime) {
|
|
|
11431
11563
|
var suspenseState = workInProgress.memoizedState;
|
|
11432
11564
|
|
|
11433
11565
|
if (suspenseState !== null && suspenseState.dehydrated !== null) {
|
|
11434
|
-
(
|
|
11435
|
-
|
|
11436
|
-
|
|
11437
|
-
throw ReactError(Error("Threw in newly mounted dehydrated component. This is likely a bug in React. Please file an issue."));
|
|
11438
|
-
}
|
|
11566
|
+
if (!(workInProgress.alternate !== null)) {
|
|
11567
|
+
{
|
|
11568
|
+
throw Error("Threw in newly mounted dehydrated component. This is likely a bug in React. Please file an issue.");
|
|
11439
11569
|
}
|
|
11440
|
-
}
|
|
11570
|
+
}
|
|
11441
11571
|
|
|
11442
11572
|
resetHydrationState();
|
|
11443
11573
|
}
|
|
@@ -11571,13 +11701,11 @@ var invokeGuardedCallbackImpl = function (name, func, context, a, b, c, d, e, f)
|
|
|
11571
11701
|
// when we call document.createEvent(). However this can cause confusing
|
|
11572
11702
|
// errors: https://github.com/facebookincubator/create-react-app/issues/3482
|
|
11573
11703
|
// So we preemptively throw with a better message instead.
|
|
11574
|
-
(
|
|
11575
|
-
|
|
11576
|
-
|
|
11577
|
-
throw ReactError(Error("The `document` global was defined when React was initialized, but is not defined anymore. This can happen in a test environment if a component schedules an update from an asynchronous callback, but the test has already finished running. To solve this, you can either unmount the component at the end of your test (and ensure that any asynchronous operations get canceled in `componentWillUnmount`), or you can change the test itself to be asynchronous."));
|
|
11578
|
-
}
|
|
11704
|
+
if (!(typeof document !== 'undefined')) {
|
|
11705
|
+
{
|
|
11706
|
+
throw Error("The `document` global was defined when React was initialized, but is not defined anymore. This can happen in a test environment if a component schedules an update from an asynchronous callback, but the test has already finished running. To solve this, you can either unmount the component at the end of your test (and ensure that any asynchronous operations get canceled in `componentWillUnmount`), or you can change the test itself to be asynchronous.");
|
|
11579
11707
|
}
|
|
11580
|
-
}
|
|
11708
|
+
}
|
|
11581
11709
|
|
|
11582
11710
|
var evt = document.createEvent('Event'); // Keeps track of whether the user-provided callback threw an error. We
|
|
11583
11711
|
// set this to true at the beginning, then set it to false right after
|
|
@@ -11745,13 +11873,11 @@ function clearCaughtError() {
|
|
|
11745
11873
|
caughtError = null;
|
|
11746
11874
|
return error;
|
|
11747
11875
|
} else {
|
|
11748
|
-
|
|
11876
|
+
{
|
|
11749
11877
|
{
|
|
11750
|
-
|
|
11751
|
-
throw ReactError(Error("clearCaughtError was called but no error was captured. This error is likely caused by a bug in React. Please file an issue."));
|
|
11752
|
-
}
|
|
11878
|
+
throw Error("clearCaughtError was called but no error was captured. This error is likely caused by a bug in React. Please file an issue.");
|
|
11753
11879
|
}
|
|
11754
|
-
}
|
|
11880
|
+
}
|
|
11755
11881
|
}
|
|
11756
11882
|
}
|
|
11757
11883
|
|
|
@@ -11971,13 +12097,11 @@ function commitBeforeMutationLifeCycles(current$$1, finishedWork) {
|
|
|
11971
12097
|
|
|
11972
12098
|
default:
|
|
11973
12099
|
{
|
|
11974
|
-
|
|
12100
|
+
{
|
|
11975
12101
|
{
|
|
11976
|
-
|
|
11977
|
-
throw ReactError(Error("This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue."));
|
|
11978
|
-
}
|
|
12102
|
+
throw Error("This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue.");
|
|
11979
12103
|
}
|
|
11980
|
-
}
|
|
12104
|
+
}
|
|
11981
12105
|
}
|
|
11982
12106
|
}
|
|
11983
12107
|
}
|
|
@@ -12199,13 +12323,11 @@ function commitLifeCycles(finishedRoot, current$$1, finishedWork, committedExpir
|
|
|
12199
12323
|
|
|
12200
12324
|
default:
|
|
12201
12325
|
{
|
|
12202
|
-
|
|
12326
|
+
{
|
|
12203
12327
|
{
|
|
12204
|
-
|
|
12205
|
-
throw ReactError(Error("This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue."));
|
|
12206
|
-
}
|
|
12328
|
+
throw Error("This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue.");
|
|
12207
12329
|
}
|
|
12208
|
-
}
|
|
12330
|
+
}
|
|
12209
12331
|
}
|
|
12210
12332
|
}
|
|
12211
12333
|
}
|
|
@@ -12550,13 +12672,11 @@ function commitContainer(finishedWork) {
|
|
|
12550
12672
|
|
|
12551
12673
|
default:
|
|
12552
12674
|
{
|
|
12553
|
-
|
|
12675
|
+
{
|
|
12554
12676
|
{
|
|
12555
|
-
|
|
12556
|
-
throw ReactError(Error("This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue."));
|
|
12557
|
-
}
|
|
12677
|
+
throw Error("This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue.");
|
|
12558
12678
|
}
|
|
12559
|
-
}
|
|
12679
|
+
}
|
|
12560
12680
|
}
|
|
12561
12681
|
}
|
|
12562
12682
|
}
|
|
@@ -12572,13 +12692,11 @@ function getHostParentFiber(fiber) {
|
|
|
12572
12692
|
parent = parent.return;
|
|
12573
12693
|
}
|
|
12574
12694
|
|
|
12575
|
-
|
|
12695
|
+
{
|
|
12576
12696
|
{
|
|
12577
|
-
|
|
12578
|
-
throw ReactError(Error("Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue."));
|
|
12579
|
-
}
|
|
12697
|
+
throw Error("Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue.");
|
|
12580
12698
|
}
|
|
12581
|
-
}
|
|
12699
|
+
}
|
|
12582
12700
|
}
|
|
12583
12701
|
|
|
12584
12702
|
function isHostParent(fiber) {
|
|
@@ -12670,13 +12788,11 @@ function commitPlacement(finishedWork) {
|
|
|
12670
12788
|
// eslint-disable-next-line-no-fallthrough
|
|
12671
12789
|
|
|
12672
12790
|
default:
|
|
12673
|
-
|
|
12791
|
+
{
|
|
12674
12792
|
{
|
|
12675
|
-
|
|
12676
|
-
throw ReactError(Error("Invalid host parent fiber. This error is likely caused by a bug in React. Please file an issue."));
|
|
12677
|
-
}
|
|
12793
|
+
throw Error("Invalid host parent fiber. This error is likely caused by a bug in React. Please file an issue.");
|
|
12678
12794
|
}
|
|
12679
|
-
}
|
|
12795
|
+
}
|
|
12680
12796
|
|
|
12681
12797
|
}
|
|
12682
12798
|
|
|
@@ -12751,13 +12867,11 @@ function unmountHostComponents(finishedRoot, current$$1, renderPriorityLevel) {
|
|
|
12751
12867
|
var parent = node.return;
|
|
12752
12868
|
|
|
12753
12869
|
findParent: while (true) {
|
|
12754
|
-
(
|
|
12755
|
-
|
|
12756
|
-
|
|
12757
|
-
throw ReactError(Error("Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue."));
|
|
12758
|
-
}
|
|
12870
|
+
if (!(parent !== null)) {
|
|
12871
|
+
{
|
|
12872
|
+
throw Error("Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue.");
|
|
12759
12873
|
}
|
|
12760
|
-
}
|
|
12874
|
+
}
|
|
12761
12875
|
|
|
12762
12876
|
var parentStateNode = parent.stateNode;
|
|
12763
12877
|
|
|
@@ -12991,13 +13105,11 @@ function commitWork(current$$1, finishedWork) {
|
|
|
12991
13105
|
|
|
12992
13106
|
case HostText:
|
|
12993
13107
|
{
|
|
12994
|
-
(
|
|
12995
|
-
|
|
12996
|
-
|
|
12997
|
-
throw ReactError(Error("This should have a text node initialized. This error is likely caused by a bug in React. Please file an issue."));
|
|
12998
|
-
}
|
|
13108
|
+
if (!(finishedWork.stateNode !== null)) {
|
|
13109
|
+
{
|
|
13110
|
+
throw Error("This should have a text node initialized. This error is likely caused by a bug in React. Please file an issue.");
|
|
12999
13111
|
}
|
|
13000
|
-
}
|
|
13112
|
+
}
|
|
13001
13113
|
|
|
13002
13114
|
var textInstance = finishedWork.stateNode;
|
|
13003
13115
|
var newText = finishedWork.memoizedProps; // For hydration we reuse the update path but we treat the oldProps
|
|
@@ -13082,13 +13194,11 @@ function commitWork(current$$1, finishedWork) {
|
|
|
13082
13194
|
|
|
13083
13195
|
default:
|
|
13084
13196
|
{
|
|
13085
|
-
|
|
13197
|
+
{
|
|
13086
13198
|
{
|
|
13087
|
-
|
|
13088
|
-
throw ReactError(Error("This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue."));
|
|
13089
|
-
}
|
|
13199
|
+
throw Error("This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue.");
|
|
13090
13200
|
}
|
|
13091
|
-
}
|
|
13201
|
+
}
|
|
13092
13202
|
}
|
|
13093
13203
|
}
|
|
13094
13204
|
}
|
|
@@ -13509,7 +13619,6 @@ var RootErrored = 2;
|
|
|
13509
13619
|
var RootSuspended = 3;
|
|
13510
13620
|
var RootSuspendedWithDelay = 4;
|
|
13511
13621
|
var RootCompleted = 5;
|
|
13512
|
-
var RootLocked = 6;
|
|
13513
13622
|
// Describes where we are in the React execution stack
|
|
13514
13623
|
var executionContext = NoContext; // The root we're working on
|
|
13515
13624
|
|
|
@@ -13569,7 +13678,7 @@ var spawnedWorkDuringRender = null; // Expiration times are computed by adding t
|
|
|
13569
13678
|
// receive the same expiration time. Otherwise we get tearing.
|
|
13570
13679
|
|
|
13571
13680
|
var currentEventTime = NoWork;
|
|
13572
|
-
function
|
|
13681
|
+
function requestCurrentTimeForUpdate() {
|
|
13573
13682
|
if ((executionContext & (RenderContext | CommitContext)) !== NoContext) {
|
|
13574
13683
|
// We're inside React, so it's fine to read the actual time.
|
|
13575
13684
|
return msToExpirationTime(now());
|
|
@@ -13585,6 +13694,9 @@ function requestCurrentTime() {
|
|
|
13585
13694
|
currentEventTime = msToExpirationTime(now());
|
|
13586
13695
|
return currentEventTime;
|
|
13587
13696
|
}
|
|
13697
|
+
function getCurrentTime() {
|
|
13698
|
+
return msToExpirationTime(now());
|
|
13699
|
+
}
|
|
13588
13700
|
function computeExpirationForFiber(currentTime, fiber, suspenseConfig) {
|
|
13589
13701
|
var mode = fiber.mode;
|
|
13590
13702
|
|
|
@@ -13633,13 +13745,11 @@ function computeExpirationForFiber(currentTime, fiber, suspenseConfig) {
|
|
|
13633
13745
|
break;
|
|
13634
13746
|
|
|
13635
13747
|
default:
|
|
13636
|
-
|
|
13748
|
+
{
|
|
13637
13749
|
{
|
|
13638
|
-
|
|
13639
|
-
throw ReactError(Error("Expected a valid priority level"));
|
|
13640
|
-
}
|
|
13750
|
+
throw Error("Expected a valid priority level");
|
|
13641
13751
|
}
|
|
13642
|
-
}
|
|
13752
|
+
}
|
|
13643
13753
|
|
|
13644
13754
|
}
|
|
13645
13755
|
} // If we're in the middle of rendering a tree, do not update at the same
|
|
@@ -13656,7 +13766,6 @@ function computeExpirationForFiber(currentTime, fiber, suspenseConfig) {
|
|
|
13656
13766
|
|
|
13657
13767
|
return expirationTime;
|
|
13658
13768
|
}
|
|
13659
|
-
|
|
13660
13769
|
function scheduleUpdateOnFiber(fiber, expirationTime) {
|
|
13661
13770
|
checkForNestedUpdates();
|
|
13662
13771
|
warnAboutInvalidUpdatesOnClassComponentsInDEV(fiber);
|
|
@@ -13853,7 +13962,7 @@ function ensureRootIsScheduled(root) {
|
|
|
13853
13962
|
// time as an argument.
|
|
13854
13963
|
|
|
13855
13964
|
|
|
13856
|
-
var currentTime =
|
|
13965
|
+
var currentTime = requestCurrentTimeForUpdate();
|
|
13857
13966
|
var priorityLevel = inferPriorityFromExpirationTime(currentTime, expirationTime); // If there's an existing render task, confirm it has the correct priority and
|
|
13858
13967
|
// expiration time. Otherwise, we'll cancel it and schedule a new one.
|
|
13859
13968
|
|
|
@@ -13904,7 +14013,7 @@ function performConcurrentWorkOnRoot(root, didTimeout) {
|
|
|
13904
14013
|
if (didTimeout) {
|
|
13905
14014
|
// The render task took too long to complete. Mark the current time as
|
|
13906
14015
|
// expired to synchronously render all expired work in a single batch.
|
|
13907
|
-
var currentTime =
|
|
14016
|
+
var currentTime = requestCurrentTimeForUpdate();
|
|
13908
14017
|
markRootExpiredAtTime(root, currentTime); // This will schedule a synchronous callback.
|
|
13909
14018
|
|
|
13910
14019
|
ensureRootIsScheduled(root);
|
|
@@ -13918,13 +14027,11 @@ function performConcurrentWorkOnRoot(root, didTimeout) {
|
|
|
13918
14027
|
if (expirationTime !== NoWork) {
|
|
13919
14028
|
var originalCallbackNode = root.callbackNode;
|
|
13920
14029
|
|
|
13921
|
-
(
|
|
13922
|
-
|
|
13923
|
-
|
|
13924
|
-
throw ReactError(Error("Should not already be working."));
|
|
13925
|
-
}
|
|
14030
|
+
if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) {
|
|
14031
|
+
{
|
|
14032
|
+
throw Error("Should not already be working.");
|
|
13926
14033
|
}
|
|
13927
|
-
}
|
|
14034
|
+
}
|
|
13928
14035
|
|
|
13929
14036
|
flushPassiveEffects(); // If the root or expiration time have changed, throw out the existing stack
|
|
13930
14037
|
// and prepare a fresh one. Otherwise we'll continue where we left off.
|
|
@@ -13978,7 +14085,6 @@ function performConcurrentWorkOnRoot(root, didTimeout) {
|
|
|
13978
14085
|
stopFinishedWorkLoopTimer();
|
|
13979
14086
|
var finishedWork = root.finishedWork = root.current.alternate;
|
|
13980
14087
|
root.finishedExpirationTime = expirationTime;
|
|
13981
|
-
resolveLocksOnRoot(root, expirationTime);
|
|
13982
14088
|
finishConcurrentRender(root, finishedWork, workInProgressRootExitStatus, expirationTime);
|
|
13983
14089
|
}
|
|
13984
14090
|
|
|
@@ -14003,13 +14109,11 @@ function finishConcurrentRender(root, finishedWork, exitStatus, expirationTime)
|
|
|
14003
14109
|
case RootIncomplete:
|
|
14004
14110
|
case RootFatalErrored:
|
|
14005
14111
|
{
|
|
14006
|
-
|
|
14112
|
+
{
|
|
14007
14113
|
{
|
|
14008
|
-
|
|
14009
|
-
throw ReactError(Error("Root did not complete. This is a bug in React."));
|
|
14010
|
-
}
|
|
14114
|
+
throw Error("Root did not complete. This is a bug in React.");
|
|
14011
14115
|
}
|
|
14012
|
-
}
|
|
14116
|
+
}
|
|
14013
14117
|
}
|
|
14014
14118
|
// Flow knows about invariant, so it complains if I add a break
|
|
14015
14119
|
// statement, but eslint doesn't know about invariant, so it complains
|
|
@@ -14017,18 +14121,16 @@ function finishConcurrentRender(root, finishedWork, exitStatus, expirationTime)
|
|
|
14017
14121
|
|
|
14018
14122
|
case RootErrored:
|
|
14019
14123
|
{
|
|
14020
|
-
|
|
14021
|
-
|
|
14022
|
-
|
|
14023
|
-
|
|
14024
|
-
|
|
14025
|
-
|
|
14026
|
-
|
|
14027
|
-
|
|
14028
|
-
|
|
14124
|
+
// If this was an async render, the error may have happened due to
|
|
14125
|
+
// a mutation in a concurrent event. Try rendering one more time,
|
|
14126
|
+
// synchronously, to see if the error goes away. If there are
|
|
14127
|
+
// lower priority updates, let's include those, too, in case they
|
|
14128
|
+
// fix the inconsistency. Render at Idle to include all updates.
|
|
14129
|
+
// If it was Idle or Never or some not-yet-invented time, render
|
|
14130
|
+
// at that time.
|
|
14131
|
+
markRootExpiredAtTime(root, expirationTime > Idle ? Idle : expirationTime); // We assume that this second render pass will be synchronous
|
|
14132
|
+
// and therefore not hit this path again.
|
|
14029
14133
|
|
|
14030
|
-
|
|
14031
|
-
commitRoot(root);
|
|
14032
14134
|
break;
|
|
14033
14135
|
}
|
|
14034
14136
|
|
|
@@ -14212,24 +14314,13 @@ function finishConcurrentRender(root, finishedWork, exitStatus, expirationTime)
|
|
|
14212
14314
|
break;
|
|
14213
14315
|
}
|
|
14214
14316
|
|
|
14215
|
-
case RootLocked:
|
|
14216
|
-
{
|
|
14217
|
-
// This root has a lock that prevents it from committing. Exit. If
|
|
14218
|
-
// we begin work on the root again, without any intervening updates,
|
|
14219
|
-
// it will finish without doing additional work.
|
|
14220
|
-
markRootSuspendedAtTime(root, expirationTime);
|
|
14221
|
-
break;
|
|
14222
|
-
}
|
|
14223
|
-
|
|
14224
14317
|
default:
|
|
14225
14318
|
{
|
|
14226
|
-
|
|
14319
|
+
{
|
|
14227
14320
|
{
|
|
14228
|
-
|
|
14229
|
-
throw ReactError(Error("Unknown root exit status."));
|
|
14230
|
-
}
|
|
14321
|
+
throw Error("Unknown root exit status.");
|
|
14231
14322
|
}
|
|
14232
|
-
}
|
|
14323
|
+
}
|
|
14233
14324
|
}
|
|
14234
14325
|
}
|
|
14235
14326
|
} // This is the entry point for synchronous tasks that don't go
|
|
@@ -14247,13 +14338,11 @@ function performSyncWorkOnRoot(root) {
|
|
|
14247
14338
|
// batch.commit() API.
|
|
14248
14339
|
commitRoot(root);
|
|
14249
14340
|
} else {
|
|
14250
|
-
(
|
|
14251
|
-
|
|
14252
|
-
|
|
14253
|
-
throw ReactError(Error("Should not already be working."));
|
|
14254
|
-
}
|
|
14341
|
+
if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) {
|
|
14342
|
+
{
|
|
14343
|
+
throw Error("Should not already be working.");
|
|
14255
14344
|
}
|
|
14256
|
-
}
|
|
14345
|
+
}
|
|
14257
14346
|
|
|
14258
14347
|
flushPassiveEffects(); // If the root or expiration time have changed, throw out the existing stack
|
|
14259
14348
|
// and prepare a fresh one. Otherwise we'll continue where we left off.
|
|
@@ -14300,21 +14389,17 @@ function performSyncWorkOnRoot(root) {
|
|
|
14300
14389
|
|
|
14301
14390
|
if (workInProgress !== null) {
|
|
14302
14391
|
// This is a sync render, so we should have finished the whole tree.
|
|
14303
|
-
|
|
14392
|
+
{
|
|
14304
14393
|
{
|
|
14305
|
-
|
|
14306
|
-
throw ReactError(Error("Cannot commit an incomplete root. This error is likely caused by a bug in React. Please file an issue."));
|
|
14307
|
-
}
|
|
14394
|
+
throw Error("Cannot commit an incomplete root. This error is likely caused by a bug in React. Please file an issue.");
|
|
14308
14395
|
}
|
|
14309
|
-
}
|
|
14396
|
+
}
|
|
14310
14397
|
} else {
|
|
14311
14398
|
// We now have a consistent tree. Because this is a sync render, we
|
|
14312
|
-
// will commit it even if something suspended.
|
|
14313
|
-
// if the root is locked (using the unstable_createBatch API).
|
|
14399
|
+
// will commit it even if something suspended.
|
|
14314
14400
|
stopFinishedWorkLoopTimer();
|
|
14315
14401
|
root.finishedWork = root.current.alternate;
|
|
14316
14402
|
root.finishedExpirationTime = expirationTime;
|
|
14317
|
-
resolveLocksOnRoot(root, expirationTime);
|
|
14318
14403
|
finishSyncRender(root, workInProgressRootExitStatus, expirationTime);
|
|
14319
14404
|
} // Before exiting, make sure there's a callback scheduled for the next
|
|
14320
14405
|
// pending level.
|
|
@@ -14328,44 +14413,25 @@ function performSyncWorkOnRoot(root) {
|
|
|
14328
14413
|
}
|
|
14329
14414
|
|
|
14330
14415
|
function finishSyncRender(root, exitStatus, expirationTime) {
|
|
14331
|
-
|
|
14332
|
-
|
|
14333
|
-
// begin work on the root again, without any intervening updates, it
|
|
14334
|
-
// will finish without doing additional work.
|
|
14335
|
-
markRootSuspendedAtTime(root, expirationTime);
|
|
14336
|
-
} else {
|
|
14337
|
-
// Set this to null to indicate there's no in-progress render.
|
|
14338
|
-
workInProgressRoot = null;
|
|
14416
|
+
// Set this to null to indicate there's no in-progress render.
|
|
14417
|
+
workInProgressRoot = null;
|
|
14339
14418
|
|
|
14340
|
-
|
|
14341
|
-
|
|
14342
|
-
|
|
14343
|
-
}
|
|
14419
|
+
{
|
|
14420
|
+
if (exitStatus === RootSuspended || exitStatus === RootSuspendedWithDelay) {
|
|
14421
|
+
flushSuspensePriorityWarningInDEV();
|
|
14344
14422
|
}
|
|
14345
|
-
|
|
14346
|
-
commitRoot(root);
|
|
14347
14423
|
}
|
|
14348
|
-
}
|
|
14349
|
-
|
|
14350
14424
|
|
|
14425
|
+
commitRoot(root);
|
|
14426
|
+
}
|
|
14351
14427
|
|
|
14352
14428
|
|
|
14353
|
-
function resolveLocksOnRoot(root, expirationTime) {
|
|
14354
|
-
var firstBatch = root.firstBatch;
|
|
14355
14429
|
|
|
14356
|
-
if (firstBatch !== null && firstBatch._defer && firstBatch._expirationTime >= expirationTime) {
|
|
14357
|
-
scheduleCallback(NormalPriority, function () {
|
|
14358
|
-
firstBatch._onComplete();
|
|
14359
14430
|
|
|
14360
|
-
|
|
14361
|
-
|
|
14362
|
-
workInProgressRootExitStatus = RootLocked;
|
|
14363
|
-
}
|
|
14431
|
+
function syncUpdates(fn, a, b, c) {
|
|
14432
|
+
return runWithPriority(ImmediatePriority, fn.bind(null, a, b, c));
|
|
14364
14433
|
}
|
|
14365
14434
|
|
|
14366
|
-
|
|
14367
|
-
|
|
14368
|
-
|
|
14369
14435
|
function batchedUpdates(fn, a) {
|
|
14370
14436
|
var prevExecutionContext = executionContext;
|
|
14371
14437
|
executionContext |= BatchedContext;
|
|
@@ -14386,13 +14452,11 @@ function batchedUpdates(fn, a) {
|
|
|
14386
14452
|
|
|
14387
14453
|
function flushSync(fn, a) {
|
|
14388
14454
|
if ((executionContext & (RenderContext | CommitContext)) !== NoContext) {
|
|
14389
|
-
|
|
14455
|
+
{
|
|
14390
14456
|
{
|
|
14391
|
-
|
|
14392
|
-
throw ReactError(Error("flushSync was called from inside a lifecycle method. It cannot be called when React is already rendering."));
|
|
14393
|
-
}
|
|
14457
|
+
throw Error("flushSync was called from inside a lifecycle method. It cannot be called when React is already rendering.");
|
|
14394
14458
|
}
|
|
14395
|
-
}
|
|
14459
|
+
}
|
|
14396
14460
|
}
|
|
14397
14461
|
|
|
14398
14462
|
var prevExecutionContext = executionContext;
|
|
@@ -14459,6 +14523,7 @@ function handleError(root, thrownValue) {
|
|
|
14459
14523
|
// Reset module-level state that was set during the render phase.
|
|
14460
14524
|
resetContextDependencies();
|
|
14461
14525
|
resetHooks();
|
|
14526
|
+
resetCurrentFiber();
|
|
14462
14527
|
|
|
14463
14528
|
if (workInProgress === null || workInProgress.return === null) {
|
|
14464
14529
|
// Expected to be working on a non-root fiber. This is a fatal error
|
|
@@ -14858,13 +14923,11 @@ function commitRootImpl(root, renderPriorityLevel) {
|
|
|
14858
14923
|
flushPassiveEffects();
|
|
14859
14924
|
flushRenderPhaseStrictModeWarningsInDEV();
|
|
14860
14925
|
|
|
14861
|
-
(
|
|
14862
|
-
|
|
14863
|
-
|
|
14864
|
-
throw ReactError(Error("Should not already be working."));
|
|
14865
|
-
}
|
|
14926
|
+
if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) {
|
|
14927
|
+
{
|
|
14928
|
+
throw Error("Should not already be working.");
|
|
14866
14929
|
}
|
|
14867
|
-
}
|
|
14930
|
+
}
|
|
14868
14931
|
|
|
14869
14932
|
var finishedWork = root.finishedWork;
|
|
14870
14933
|
var expirationTime = root.finishedExpirationTime;
|
|
@@ -14876,13 +14939,11 @@ function commitRootImpl(root, renderPriorityLevel) {
|
|
|
14876
14939
|
root.finishedWork = null;
|
|
14877
14940
|
root.finishedExpirationTime = NoWork;
|
|
14878
14941
|
|
|
14879
|
-
(
|
|
14880
|
-
|
|
14881
|
-
|
|
14882
|
-
throw ReactError(Error("Cannot commit the same tree as before. This error is likely caused by a bug in React. Please file an issue."));
|
|
14883
|
-
}
|
|
14942
|
+
if (!(finishedWork !== root.current)) {
|
|
14943
|
+
{
|
|
14944
|
+
throw Error("Cannot commit the same tree as before. This error is likely caused by a bug in React. Please file an issue.");
|
|
14884
14945
|
}
|
|
14885
|
-
}
|
|
14946
|
+
} // commitRoot never returns a continuation; it always finishes synchronously.
|
|
14886
14947
|
// So we can clear these now to allow a new callback to be scheduled.
|
|
14887
14948
|
|
|
14888
14949
|
|
|
@@ -14946,13 +15007,11 @@ function commitRootImpl(root, renderPriorityLevel) {
|
|
|
14946
15007
|
invokeGuardedCallback(null, commitBeforeMutationEffects, null);
|
|
14947
15008
|
|
|
14948
15009
|
if (hasCaughtError()) {
|
|
14949
|
-
(
|
|
14950
|
-
|
|
14951
|
-
|
|
14952
|
-
throw ReactError(Error("Should be working on an effect."));
|
|
14953
|
-
}
|
|
15010
|
+
if (!(nextEffect !== null)) {
|
|
15011
|
+
{
|
|
15012
|
+
throw Error("Should be working on an effect.");
|
|
14954
15013
|
}
|
|
14955
|
-
}
|
|
15014
|
+
}
|
|
14956
15015
|
|
|
14957
15016
|
var error = clearCaughtError();
|
|
14958
15017
|
captureCommitPhaseError(nextEffect, error);
|
|
@@ -14978,13 +15037,11 @@ function commitRootImpl(root, renderPriorityLevel) {
|
|
|
14978
15037
|
invokeGuardedCallback(null, commitMutationEffects, null, root, renderPriorityLevel);
|
|
14979
15038
|
|
|
14980
15039
|
if (hasCaughtError()) {
|
|
14981
|
-
(
|
|
14982
|
-
|
|
14983
|
-
|
|
14984
|
-
throw ReactError(Error("Should be working on an effect."));
|
|
14985
|
-
}
|
|
15040
|
+
if (!(nextEffect !== null)) {
|
|
15041
|
+
{
|
|
15042
|
+
throw Error("Should be working on an effect.");
|
|
14986
15043
|
}
|
|
14987
|
-
}
|
|
15044
|
+
}
|
|
14988
15045
|
|
|
14989
15046
|
var _error = clearCaughtError();
|
|
14990
15047
|
|
|
@@ -15012,13 +15069,11 @@ function commitRootImpl(root, renderPriorityLevel) {
|
|
|
15012
15069
|
invokeGuardedCallback(null, commitLayoutEffects, null, root, expirationTime);
|
|
15013
15070
|
|
|
15014
15071
|
if (hasCaughtError()) {
|
|
15015
|
-
(
|
|
15016
|
-
|
|
15017
|
-
|
|
15018
|
-
throw ReactError(Error("Should be working on an effect."));
|
|
15019
|
-
}
|
|
15072
|
+
if (!(nextEffect !== null)) {
|
|
15073
|
+
{
|
|
15074
|
+
throw Error("Should be working on an effect.");
|
|
15020
15075
|
}
|
|
15021
|
-
}
|
|
15076
|
+
}
|
|
15022
15077
|
|
|
15023
15078
|
var _error2 = clearCaughtError();
|
|
15024
15079
|
|
|
@@ -15304,13 +15359,11 @@ function flushPassiveEffectsImpl() {
|
|
|
15304
15359
|
rootWithPendingPassiveEffects = null;
|
|
15305
15360
|
pendingPassiveEffectsExpirationTime = NoWork;
|
|
15306
15361
|
|
|
15307
|
-
(
|
|
15308
|
-
|
|
15309
|
-
|
|
15310
|
-
throw ReactError(Error("Cannot flush passive effects while already rendering."));
|
|
15311
|
-
}
|
|
15362
|
+
if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) {
|
|
15363
|
+
{
|
|
15364
|
+
throw Error("Cannot flush passive effects while already rendering.");
|
|
15312
15365
|
}
|
|
15313
|
-
}
|
|
15366
|
+
}
|
|
15314
15367
|
|
|
15315
15368
|
var prevExecutionContext = executionContext;
|
|
15316
15369
|
executionContext |= CommitContext;
|
|
@@ -15326,13 +15379,11 @@ function flushPassiveEffectsImpl() {
|
|
|
15326
15379
|
invokeGuardedCallback(null, commitPassiveHookEffects, null, effect);
|
|
15327
15380
|
|
|
15328
15381
|
if (hasCaughtError()) {
|
|
15329
|
-
(
|
|
15330
|
-
|
|
15331
|
-
|
|
15332
|
-
throw ReactError(Error("Should be working on an effect."));
|
|
15333
|
-
}
|
|
15382
|
+
if (!(effect !== null)) {
|
|
15383
|
+
{
|
|
15384
|
+
throw Error("Should be working on an effect.");
|
|
15334
15385
|
}
|
|
15335
|
-
}
|
|
15386
|
+
}
|
|
15336
15387
|
|
|
15337
15388
|
var error = clearCaughtError();
|
|
15338
15389
|
captureCommitPhaseError(effect, error);
|
|
@@ -15493,10 +15544,10 @@ function retryTimedOutBoundary(boundaryFiber, retryTime) {
|
|
|
15493
15544
|
// previously was rendered in its fallback state. One of the promises that
|
|
15494
15545
|
// suspended it has resolved, which means at least part of the tree was
|
|
15495
15546
|
// likely unblocked. Try rendering again, at a new expiration time.
|
|
15496
|
-
if (retryTime ===
|
|
15547
|
+
if (retryTime === NoWork) {
|
|
15497
15548
|
var suspenseConfig = null; // Retries don't carry over the already committed update.
|
|
15498
15549
|
|
|
15499
|
-
var currentTime =
|
|
15550
|
+
var currentTime = requestCurrentTimeForUpdate();
|
|
15500
15551
|
retryTime = computeExpirationForFiber(currentTime, boundaryFiber, suspenseConfig);
|
|
15501
15552
|
} // TODO: Special case idle priority?
|
|
15502
15553
|
|
|
@@ -15511,7 +15562,7 @@ function retryTimedOutBoundary(boundaryFiber, retryTime) {
|
|
|
15511
15562
|
|
|
15512
15563
|
function retryDehydratedSuspenseBoundary(boundaryFiber) {
|
|
15513
15564
|
var suspenseState = boundaryFiber.memoizedState;
|
|
15514
|
-
var retryTime =
|
|
15565
|
+
var retryTime = NoWork;
|
|
15515
15566
|
|
|
15516
15567
|
if (suspenseState !== null) {
|
|
15517
15568
|
retryTime = suspenseState.retryTime;
|
|
@@ -15520,7 +15571,7 @@ function retryDehydratedSuspenseBoundary(boundaryFiber) {
|
|
|
15520
15571
|
retryTimedOutBoundary(boundaryFiber, retryTime);
|
|
15521
15572
|
}
|
|
15522
15573
|
function resolveRetryThenable(boundaryFiber, thenable) {
|
|
15523
|
-
var retryTime =
|
|
15574
|
+
var retryTime = NoWork; // Default
|
|
15524
15575
|
|
|
15525
15576
|
var retryCache;
|
|
15526
15577
|
|
|
@@ -15541,13 +15592,11 @@ function resolveRetryThenable(boundaryFiber, thenable) {
|
|
|
15541
15592
|
break;
|
|
15542
15593
|
|
|
15543
15594
|
default:
|
|
15544
|
-
|
|
15595
|
+
{
|
|
15545
15596
|
{
|
|
15546
|
-
|
|
15547
|
-
throw ReactError(Error("Pinged unknown suspense boundary type. This is probably a bug in React."));
|
|
15548
|
-
}
|
|
15597
|
+
throw Error("Pinged unknown suspense boundary type. This is probably a bug in React.");
|
|
15549
15598
|
}
|
|
15550
|
-
}
|
|
15599
|
+
}
|
|
15551
15600
|
|
|
15552
15601
|
}
|
|
15553
15602
|
} else {
|
|
@@ -15604,13 +15653,11 @@ function checkForNestedUpdates() {
|
|
|
15604
15653
|
nestedUpdateCount = 0;
|
|
15605
15654
|
rootWithNestedUpdates = null;
|
|
15606
15655
|
|
|
15607
|
-
|
|
15656
|
+
{
|
|
15608
15657
|
{
|
|
15609
|
-
|
|
15610
|
-
throw ReactError(Error("Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops."));
|
|
15611
|
-
}
|
|
15658
|
+
throw Error("Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops.");
|
|
15612
15659
|
}
|
|
15613
|
-
}
|
|
15660
|
+
}
|
|
15614
15661
|
}
|
|
15615
15662
|
|
|
15616
15663
|
{
|
|
@@ -15698,12 +15745,14 @@ if (true && replayFailedUnitOfWorkWithInvokeGuardedCallback) {
|
|
|
15698
15745
|
if (originalError !== null && typeof originalError === 'object' && typeof originalError.then === 'function') {
|
|
15699
15746
|
// Don't replay promises. Treat everything else like an error.
|
|
15700
15747
|
throw originalError;
|
|
15701
|
-
} // Keep this code in sync with
|
|
15748
|
+
} // Keep this code in sync with handleError; any changes here must have
|
|
15702
15749
|
// corresponding changes there.
|
|
15703
15750
|
|
|
15704
15751
|
|
|
15705
15752
|
resetContextDependencies();
|
|
15706
|
-
resetHooks(); //
|
|
15753
|
+
resetHooks(); // Don't reset current debug fiber, since we're about to work on the
|
|
15754
|
+
// same fiber again.
|
|
15755
|
+
// Unwind the failed stack frame
|
|
15707
15756
|
|
|
15708
15757
|
unwindInterruptedWork(unitOfWork); // Restore the original properties of the fiber.
|
|
15709
15758
|
|
|
@@ -15902,7 +15951,7 @@ function flushSuspensePriorityWarningInDEV() {
|
|
|
15902
15951
|
componentsThatTriggeredHighPriSuspend = null;
|
|
15903
15952
|
|
|
15904
15953
|
if (componentNames.length > 0) {
|
|
15905
|
-
warningWithoutStack$1(false, '%s triggered a user-blocking update that suspended.' + '\n\n' + 'The fix is to split the update into multiple parts: a user-blocking ' + 'update to provide immediate feedback, and another update that ' + 'triggers the bulk of the changes.' + '\n\n' + 'Refer to the documentation for
|
|
15954
|
+
warningWithoutStack$1(false, '%s triggered a user-blocking update that suspended.' + '\n\n' + 'The fix is to split the update into multiple parts: a user-blocking ' + 'update to provide immediate feedback, and another update that ' + 'triggers the bulk of the changes.' + '\n\n' + 'Refer to the documentation for useTransition to learn how ' + 'to implement this pattern.', // TODO: Add link to React docs with more information, once it exists
|
|
15906
15955
|
componentNames.sort().join(', '));
|
|
15907
15956
|
}
|
|
15908
15957
|
}
|
|
@@ -15989,10 +16038,10 @@ function startWorkOnPendingInteractions(root, expirationTime) {
|
|
|
15989
16038
|
});
|
|
15990
16039
|
}
|
|
15991
16040
|
}); // Store the current set of interactions on the FiberRoot for a few reasons:
|
|
15992
|
-
// We can re-use it in hot functions like
|
|
15993
|
-
// recalculate it. We will also use it in commitWork() to
|
|
15994
|
-
// onRender() hooks. This also provides DevTools with a
|
|
15995
|
-
// the onCommitRoot() hook is called.
|
|
16041
|
+
// We can re-use it in hot functions like performConcurrentWorkOnRoot()
|
|
16042
|
+
// without having to recalculate it. We will also use it in commitWork() to
|
|
16043
|
+
// pass to any Profiler onRender() hooks. This also provides DevTools with a
|
|
16044
|
+
// way to access it when the onCommitRoot() hook is called.
|
|
15996
16045
|
|
|
15997
16046
|
root.memoizedInteractions = interactions;
|
|
15998
16047
|
|
|
@@ -16100,7 +16149,7 @@ function injectInternals(internals) {
|
|
|
16100
16149
|
var didError = (root.current.effectTag & DidCapture) === DidCapture;
|
|
16101
16150
|
|
|
16102
16151
|
if (enableProfilerTimer) {
|
|
16103
|
-
var currentTime =
|
|
16152
|
+
var currentTime = getCurrentTime();
|
|
16104
16153
|
var priorityLevel = inferPriorityFromExpirationTime(currentTime, expirationTime);
|
|
16105
16154
|
hook.onCommitFiberRoot(rendererID, root, priorityLevel, didError);
|
|
16106
16155
|
} else {
|
|
@@ -16562,13 +16611,11 @@ key, pendingProps, owner, mode, expirationTime) {
|
|
|
16562
16611
|
}
|
|
16563
16612
|
}
|
|
16564
16613
|
|
|
16565
|
-
|
|
16614
|
+
{
|
|
16566
16615
|
{
|
|
16567
|
-
|
|
16568
|
-
throw ReactError(Error("Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: " + (type == null ? type : typeof type) + "." + info));
|
|
16569
|
-
}
|
|
16616
|
+
throw Error("Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: " + (type == null ? type : typeof type) + "." + info);
|
|
16570
16617
|
}
|
|
16571
|
-
}
|
|
16618
|
+
}
|
|
16572
16619
|
}
|
|
16573
16620
|
}
|
|
16574
16621
|
}
|
|
@@ -16752,7 +16799,6 @@ function FiberRootNode(containerInfo, tag, hydrate) {
|
|
|
16752
16799
|
this.context = null;
|
|
16753
16800
|
this.pendingContext = null;
|
|
16754
16801
|
this.hydrate = hydrate;
|
|
16755
|
-
this.firstBatch = null;
|
|
16756
16802
|
this.callbackNode = null;
|
|
16757
16803
|
this.callbackPriority = NoPriority;
|
|
16758
16804
|
this.firstPendingTime = NoWork;
|
|
@@ -16906,35 +16952,23 @@ function getContextForSubtree(parentComponent) {
|
|
|
16906
16952
|
return parentContext;
|
|
16907
16953
|
}
|
|
16908
16954
|
|
|
16909
|
-
function
|
|
16955
|
+
function createContainer(containerInfo, tag, hydrate, hydrationCallbacks) {
|
|
16956
|
+
return createFiberRoot(containerInfo, tag, hydrate, hydrationCallbacks);
|
|
16957
|
+
}
|
|
16958
|
+
function updateContainer(element, container, parentComponent, callback) {
|
|
16959
|
+
var current$$1 = container.current;
|
|
16960
|
+
var currentTime = requestCurrentTimeForUpdate();
|
|
16961
|
+
|
|
16910
16962
|
{
|
|
16911
|
-
|
|
16912
|
-
|
|
16913
|
-
|
|
16963
|
+
// $FlowExpectedError - jest isn't a global, and isn't recognized outside of tests
|
|
16964
|
+
if ('undefined' !== typeof jest) {
|
|
16965
|
+
warnIfUnmockedScheduler(current$$1);
|
|
16966
|
+
warnIfNotScopedWithMatchingAct(current$$1);
|
|
16914
16967
|
}
|
|
16915
16968
|
}
|
|
16916
16969
|
|
|
16917
|
-
var
|
|
16918
|
-
|
|
16919
|
-
|
|
16920
|
-
update.payload = {
|
|
16921
|
-
element: element
|
|
16922
|
-
};
|
|
16923
|
-
callback = callback === undefined ? null : callback;
|
|
16924
|
-
|
|
16925
|
-
if (callback !== null) {
|
|
16926
|
-
!(typeof callback === 'function') ? warningWithoutStack$1(false, 'render(...): Expected the last optional `callback` argument to be a ' + 'function. Instead received: %s.', callback) : void 0;
|
|
16927
|
-
update.callback = callback;
|
|
16928
|
-
}
|
|
16929
|
-
|
|
16930
|
-
enqueueUpdate(current$$1, update);
|
|
16931
|
-
scheduleWork(current$$1, expirationTime);
|
|
16932
|
-
return expirationTime;
|
|
16933
|
-
}
|
|
16934
|
-
|
|
16935
|
-
function updateContainerAtExpirationTime(element, container, parentComponent, expirationTime, suspenseConfig, callback) {
|
|
16936
|
-
// TODO: If this is a nested container, this won't be the root.
|
|
16937
|
-
var current$$1 = container.current;
|
|
16970
|
+
var suspenseConfig = requestCurrentSuspenseConfig();
|
|
16971
|
+
var expirationTime = computeExpirationForFiber(currentTime, current$$1, suspenseConfig);
|
|
16938
16972
|
|
|
16939
16973
|
{
|
|
16940
16974
|
if (ReactFiberInstrumentation_1.debugTool) {
|
|
@@ -16956,27 +16990,29 @@ function updateContainerAtExpirationTime(element, container, parentComponent, ex
|
|
|
16956
16990
|
container.pendingContext = context;
|
|
16957
16991
|
}
|
|
16958
16992
|
|
|
16959
|
-
return scheduleRootUpdate(current$$1, element, expirationTime, suspenseConfig, callback);
|
|
16960
|
-
}
|
|
16961
|
-
|
|
16962
|
-
function createContainer(containerInfo, tag, hydrate, hydrationCallbacks) {
|
|
16963
|
-
return createFiberRoot(containerInfo, tag, hydrate, hydrationCallbacks);
|
|
16964
|
-
}
|
|
16965
|
-
function updateContainer(element, container, parentComponent, callback) {
|
|
16966
|
-
var current$$1 = container.current;
|
|
16967
|
-
var currentTime = requestCurrentTime();
|
|
16968
|
-
|
|
16969
16993
|
{
|
|
16970
|
-
|
|
16971
|
-
|
|
16972
|
-
|
|
16973
|
-
warnIfNotScopedWithMatchingAct(current$$1);
|
|
16994
|
+
if (phase === 'render' && current !== null && !didWarnAboutNestedUpdates) {
|
|
16995
|
+
didWarnAboutNestedUpdates = true;
|
|
16996
|
+
warningWithoutStack$1(false, 'Render methods should be a pure function of props and state; ' + 'triggering nested component updates from render is not allowed. ' + 'If necessary, trigger nested updates in componentDidUpdate.\n\n' + 'Check the render method of %s.', getComponentName(current.type) || 'Unknown');
|
|
16974
16997
|
}
|
|
16975
16998
|
}
|
|
16976
16999
|
|
|
16977
|
-
var
|
|
16978
|
-
|
|
16979
|
-
|
|
17000
|
+
var update = createUpdate(expirationTime, suspenseConfig); // Caution: React DevTools currently depends on this property
|
|
17001
|
+
// being called "element".
|
|
17002
|
+
|
|
17003
|
+
update.payload = {
|
|
17004
|
+
element: element
|
|
17005
|
+
};
|
|
17006
|
+
callback = callback === undefined ? null : callback;
|
|
17007
|
+
|
|
17008
|
+
if (callback !== null) {
|
|
17009
|
+
!(typeof callback === 'function') ? warningWithoutStack$1(false, 'render(...): Expected the last optional `callback` argument to be a ' + 'function. Instead received: %s.', callback) : void 0;
|
|
17010
|
+
update.callback = callback;
|
|
17011
|
+
}
|
|
17012
|
+
|
|
17013
|
+
enqueueUpdate(current$$1, update);
|
|
17014
|
+
scheduleWork(current$$1, expirationTime);
|
|
17015
|
+
return expirationTime;
|
|
16980
17016
|
}
|
|
16981
17017
|
function getPublicRootInstance(container) {
|
|
16982
17018
|
var containerFiber = container.current;
|
|
@@ -16996,6 +17032,10 @@ function getPublicRootInstance(container) {
|
|
|
16996
17032
|
|
|
16997
17033
|
|
|
16998
17034
|
|
|
17035
|
+
|
|
17036
|
+
|
|
17037
|
+
|
|
17038
|
+
|
|
16999
17039
|
var shouldSuspendImpl = function (fiber) {
|
|
17000
17040
|
return false;
|
|
17001
17041
|
};
|
|
@@ -17113,7 +17153,7 @@ function injectIntoDevTools(devToolsConfig) {
|
|
|
17113
17153
|
|
|
17114
17154
|
// TODO: this is special because it gets imported during build.
|
|
17115
17155
|
|
|
17116
|
-
var ReactVersion = '16.
|
|
17156
|
+
var ReactVersion = '16.11.0';
|
|
17117
17157
|
|
|
17118
17158
|
var didWarnAboutMessageChannel = false;
|
|
17119
17159
|
var enqueueTask;
|
|
@@ -17467,13 +17507,11 @@ function toTree(node) {
|
|
|
17467
17507
|
return childrenToTree(node.child);
|
|
17468
17508
|
|
|
17469
17509
|
default:
|
|
17470
|
-
|
|
17510
|
+
{
|
|
17471
17511
|
{
|
|
17472
|
-
|
|
17473
|
-
throw ReactError(Error("toTree() does not yet know how to handle nodes with tag=" + node.tag));
|
|
17474
|
-
}
|
|
17512
|
+
throw Error("toTree() does not yet know how to handle nodes with tag=" + node.tag);
|
|
17475
17513
|
}
|
|
17476
|
-
}
|
|
17514
|
+
}
|
|
17477
17515
|
|
|
17478
17516
|
}
|
|
17479
17517
|
}
|
|
@@ -17534,25 +17572,21 @@ function () {
|
|
|
17534
17572
|
// Throws if this component has been unmounted.
|
|
17535
17573
|
var fiber = findCurrentFiberUsingSlowPath(this._fiber);
|
|
17536
17574
|
|
|
17537
|
-
(
|
|
17538
|
-
|
|
17539
|
-
|
|
17540
|
-
throw ReactError(Error("Can't read from currently-mounting component. This error is likely caused by a bug in React. Please file an issue."));
|
|
17541
|
-
}
|
|
17575
|
+
if (!(fiber !== null)) {
|
|
17576
|
+
{
|
|
17577
|
+
throw Error("Can't read from currently-mounting component. This error is likely caused by a bug in React. Please file an issue.");
|
|
17542
17578
|
}
|
|
17543
|
-
}
|
|
17579
|
+
}
|
|
17544
17580
|
|
|
17545
17581
|
return fiber;
|
|
17546
17582
|
};
|
|
17547
17583
|
|
|
17548
17584
|
function ReactTestInstance(fiber) {
|
|
17549
|
-
|
|
17550
|
-
|
|
17551
|
-
|
|
17552
|
-
throw ReactError(Error("Unexpected object passed to ReactTestInstance constructor (tag: " + fiber.tag + "). This is probably a bug in React."));
|
|
17553
|
-
}
|
|
17585
|
+
if (!validWrapperTypes.has(fiber.tag)) {
|
|
17586
|
+
{
|
|
17587
|
+
throw Error("Unexpected object passed to ReactTestInstance constructor (tag: " + fiber.tag + "). This is probably a bug in React.");
|
|
17554
17588
|
}
|
|
17555
|
-
}
|
|
17589
|
+
}
|
|
17556
17590
|
|
|
17557
17591
|
this._fiber = fiber;
|
|
17558
17592
|
}
|
|
@@ -17711,13 +17745,11 @@ var ReactTestRendererFiber = {
|
|
|
17711
17745
|
};
|
|
17712
17746
|
var root = createContainer(container, isConcurrent ? ConcurrentRoot : LegacyRoot, false, null);
|
|
17713
17747
|
|
|
17714
|
-
(
|
|
17715
|
-
|
|
17716
|
-
|
|
17717
|
-
throw ReactError(Error("something went wrong"));
|
|
17718
|
-
}
|
|
17748
|
+
if (!(root != null)) {
|
|
17749
|
+
{
|
|
17750
|
+
throw Error("something went wrong");
|
|
17719
17751
|
}
|
|
17720
|
-
}
|
|
17752
|
+
}
|
|
17721
17753
|
|
|
17722
17754
|
updateContainer(element, root, null, null);
|
|
17723
17755
|
var entry = {
|