react-test-renderer 16.10.0 → 16.12.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 +4 -4
- package/cjs/react-test-renderer-shallow.development.js +73 -77
- package/cjs/react-test-renderer-shallow.production.min.js +25 -25
- package/cjs/react-test-renderer.development.js +739 -687
- package/cjs/react-test-renderer.production.min.js +148 -145
- package/package.json +2 -2
- package/umd/react-test-renderer-shallow.development.js +75 -79
- package/umd/react-test-renderer-shallow.production.min.js +24 -24
- package/umd/react-test-renderer.development.js +743 -691
- package/umd/react-test-renderer.production.min.js +145 -143
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license React v16.
|
|
1
|
+
/** @license React v16.12.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++) {
|
|
@@ -430,7 +422,6 @@ var ShouldCapture =
|
|
|
430
422
|
/* */
|
|
431
423
|
4096;
|
|
432
424
|
|
|
433
|
-
var debugRenderPhaseSideEffects = false;
|
|
434
425
|
var debugRenderPhaseSideEffectsForStrictMode = false;
|
|
435
426
|
var enableUserTimingAPI = true;
|
|
436
427
|
var warnAboutDeprecatedLifecycles = true;
|
|
@@ -444,19 +435,18 @@ var enableSuspenseServerRenderer = false;
|
|
|
444
435
|
|
|
445
436
|
|
|
446
437
|
|
|
447
|
-
|
|
448
438
|
var enableFlareAPI = false;
|
|
449
439
|
var enableFundamentalAPI = false;
|
|
450
440
|
var enableScopeAPI = false;
|
|
451
441
|
|
|
452
442
|
var warnAboutUnmockedScheduler = false;
|
|
453
443
|
var flushSuspenseFallbacksInTests = true;
|
|
454
|
-
|
|
455
444
|
var enableSuspenseCallback = false;
|
|
456
445
|
var warnAboutDefaultPropsOnFunctionComponents = false;
|
|
457
446
|
var warnAboutStringRefs = false;
|
|
458
447
|
var disableLegacyContext = false;
|
|
459
448
|
var disableSchedulerTimeoutBasedOnReactExpirationTime = false;
|
|
449
|
+
|
|
460
450
|
// Only used in www builds.
|
|
461
451
|
|
|
462
452
|
// Flow magic to verify the exports of this file match the original version.
|
|
@@ -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,18 +1888,16 @@ 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
|
|
|
1918
1899
|
var LegacyRoot = 0;
|
|
1919
|
-
var
|
|
1900
|
+
var BlockingRoot = 1;
|
|
1920
1901
|
var ConcurrentRoot = 2;
|
|
1921
1902
|
|
|
1922
1903
|
// Intentionally not named imports because Rollup would use dynamic dispatch for
|
|
@@ -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
|
}
|
|
@@ -2106,10 +2081,10 @@ function flushSyncCallbackQueueImpl() {
|
|
|
2106
2081
|
}
|
|
2107
2082
|
|
|
2108
2083
|
var NoMode = 0;
|
|
2109
|
-
var StrictMode = 1; // TODO: Remove
|
|
2084
|
+
var StrictMode = 1; // TODO: Remove BlockingMode and ConcurrentMode by reading from the root
|
|
2110
2085
|
// tag instead
|
|
2111
2086
|
|
|
2112
|
-
var
|
|
2087
|
+
var BlockingMode = 2;
|
|
2113
2088
|
var ConcurrentMode = 4;
|
|
2114
2089
|
var ProfileMode = 8;
|
|
2115
2090
|
|
|
@@ -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;
|
|
@@ -3527,7 +3501,7 @@ function getStateFromUpdate(workInProgress, queue, update, prevState, nextProps,
|
|
|
3527
3501
|
{
|
|
3528
3502
|
enterDisallowedContextReadInDEV();
|
|
3529
3503
|
|
|
3530
|
-
if (
|
|
3504
|
+
if (debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
|
|
3531
3505
|
payload.call(instance, prevState, nextProps);
|
|
3532
3506
|
}
|
|
3533
3507
|
}
|
|
@@ -3561,7 +3535,7 @@ function getStateFromUpdate(workInProgress, queue, update, prevState, nextProps,
|
|
|
3561
3535
|
{
|
|
3562
3536
|
enterDisallowedContextReadInDEV();
|
|
3563
3537
|
|
|
3564
|
-
if (
|
|
3538
|
+
if (debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
|
|
3565
3539
|
_payload.call(instance, prevState, nextProps);
|
|
3566
3540
|
}
|
|
3567
3541
|
}
|
|
@@ -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);
|
|
@@ -3878,7 +3848,7 @@ function applyDerivedStateFromProps(workInProgress, ctor, getDerivedStateFromPro
|
|
|
3878
3848
|
var prevState = workInProgress.memoizedState;
|
|
3879
3849
|
|
|
3880
3850
|
{
|
|
3881
|
-
if (
|
|
3851
|
+
if (debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
|
|
3882
3852
|
// Invoke the function an extra time to help detect side-effects.
|
|
3883
3853
|
getDerivedStateFromProps(nextProps, prevState);
|
|
3884
3854
|
}
|
|
@@ -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);
|
|
@@ -4125,7 +4095,7 @@ function constructClassInstance(workInProgress, ctor, props, renderExpirationTim
|
|
|
4125
4095
|
|
|
4126
4096
|
|
|
4127
4097
|
{
|
|
4128
|
-
if (
|
|
4098
|
+
if (debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
|
|
4129
4099
|
new ctor(props, context); // eslint-disable-line no-new
|
|
4130
4100
|
}
|
|
4131
4101
|
}
|
|
@@ -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;
|
|
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;
|
|
6821
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,50 +7844,42 @@ 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
|
-
|
|
7812
|
-
|
|
7813
|
-
|
|
7814
|
-
throw ReactError(Error("Expected to have a hydrated suspense instance. This error is likely caused by a bug in React. Please file an issue."));
|
|
7815
|
-
}
|
|
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.");
|
|
7816
7881
|
}
|
|
7817
|
-
}
|
|
7882
|
+
}
|
|
7818
7883
|
|
|
7819
7884
|
return getNextHydratableInstanceAfterSuspenseInstance(suspenseInstance);
|
|
7820
7885
|
}
|
|
@@ -7973,7 +8038,7 @@ function updateForwardRef(current$$1, workInProgress, Component, nextProps, rend
|
|
|
7973
8038
|
setCurrentPhase('render');
|
|
7974
8039
|
nextChildren = renderWithHooks(current$$1, workInProgress, render, nextProps, ref, renderExpirationTime);
|
|
7975
8040
|
|
|
7976
|
-
if (
|
|
8041
|
+
if (debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
|
|
7977
8042
|
// Only double-render components with Hooks
|
|
7978
8043
|
if (workInProgress.memoizedState !== null) {
|
|
7979
8044
|
nextChildren = renderWithHooks(current$$1, workInProgress, render, nextProps, ref, renderExpirationTime);
|
|
@@ -8177,7 +8242,7 @@ function updateFunctionComponent(current$$1, workInProgress, Component, nextProp
|
|
|
8177
8242
|
setCurrentPhase('render');
|
|
8178
8243
|
nextChildren = renderWithHooks(current$$1, workInProgress, Component, nextProps, context, renderExpirationTime);
|
|
8179
8244
|
|
|
8180
|
-
if (
|
|
8245
|
+
if (debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
|
|
8181
8246
|
// Only double-render components with Hooks
|
|
8182
8247
|
if (workInProgress.memoizedState !== null) {
|
|
8183
8248
|
nextChildren = renderWithHooks(current$$1, workInProgress, Component, nextProps, context, renderExpirationTime);
|
|
@@ -8300,7 +8365,7 @@ function finishClassComponent(current$$1, workInProgress, Component, shouldUpdat
|
|
|
8300
8365
|
setCurrentPhase('render');
|
|
8301
8366
|
nextChildren = instance.render();
|
|
8302
8367
|
|
|
8303
|
-
if (
|
|
8368
|
+
if (debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
|
|
8304
8369
|
instance.render();
|
|
8305
8370
|
}
|
|
8306
8371
|
|
|
@@ -8349,13 +8414,11 @@ function updateHostRoot(current$$1, workInProgress, renderExpirationTime) {
|
|
|
8349
8414
|
pushHostRootContext(workInProgress);
|
|
8350
8415
|
var updateQueue = workInProgress.updateQueue;
|
|
8351
8416
|
|
|
8352
|
-
(
|
|
8353
|
-
|
|
8354
|
-
|
|
8355
|
-
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."));
|
|
8356
|
-
}
|
|
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.");
|
|
8357
8420
|
}
|
|
8358
|
-
}
|
|
8421
|
+
}
|
|
8359
8422
|
|
|
8360
8423
|
var nextProps = workInProgress.pendingProps;
|
|
8361
8424
|
var prevState = workInProgress.memoizedState;
|
|
@@ -8542,13 +8605,11 @@ function mountLazyComponent(_current, workInProgress, elementType, updateExpirat
|
|
|
8542
8605
|
// implementation detail.
|
|
8543
8606
|
|
|
8544
8607
|
|
|
8545
|
-
|
|
8608
|
+
{
|
|
8546
8609
|
{
|
|
8547
|
-
|
|
8548
|
-
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));
|
|
8549
|
-
}
|
|
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);
|
|
8550
8611
|
}
|
|
8551
|
-
}
|
|
8612
|
+
}
|
|
8552
8613
|
}
|
|
8553
8614
|
}
|
|
8554
8615
|
|
|
@@ -8677,7 +8738,7 @@ function mountIndeterminateComponent(_current, workInProgress, Component, render
|
|
|
8677
8738
|
warningWithoutStack$1(false, '%s uses the legacy contextTypes API which is no longer supported. ' + 'Use React.createContext() with React.useContext() instead.', getComponentName(Component) || 'Unknown');
|
|
8678
8739
|
}
|
|
8679
8740
|
|
|
8680
|
-
if (
|
|
8741
|
+
if (debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
|
|
8681
8742
|
// Only double-render components with Hooks
|
|
8682
8743
|
if (workInProgress.memoizedState !== null) {
|
|
8683
8744
|
value = renderWithHooks(null, workInProgress, Component, props, context, renderExpirationTime);
|
|
@@ -8751,7 +8812,7 @@ function validateFunctionComponentInDev(workInProgress, Component) {
|
|
|
8751
8812
|
|
|
8752
8813
|
var SUSPENDED_MARKER = {
|
|
8753
8814
|
dehydrated: null,
|
|
8754
|
-
retryTime:
|
|
8815
|
+
retryTime: NoWork
|
|
8755
8816
|
};
|
|
8756
8817
|
|
|
8757
8818
|
function shouldRemainOnFallback(suspenseContext, current$$1, workInProgress) {
|
|
@@ -8827,12 +8888,12 @@ function updateSuspenseComponent(current$$1, workInProgress, renderExpirationTim
|
|
|
8827
8888
|
|
|
8828
8889
|
|
|
8829
8890
|
if (current$$1 === null) {
|
|
8830
|
-
|
|
8831
|
-
|
|
8832
|
-
|
|
8833
|
-
|
|
8834
|
-
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.
|
|
8835
8895
|
|
|
8896
|
+
if (enableSuspenseServerRenderer) {
|
|
8836
8897
|
var suspenseState = workInProgress.memoizedState;
|
|
8837
8898
|
|
|
8838
8899
|
if (suspenseState !== null) {
|
|
@@ -8853,8 +8914,8 @@ function updateSuspenseComponent(current$$1, workInProgress, renderExpirationTim
|
|
|
8853
8914
|
var primaryChildFragment = createFiberFromFragment(null, mode, NoWork, null);
|
|
8854
8915
|
primaryChildFragment.return = workInProgress;
|
|
8855
8916
|
|
|
8856
|
-
if ((workInProgress.mode &
|
|
8857
|
-
// Outside of
|
|
8917
|
+
if ((workInProgress.mode & BlockingMode) === NoMode) {
|
|
8918
|
+
// Outside of blocking mode, we commit the effects from the
|
|
8858
8919
|
// partially completed, timed-out tree, too.
|
|
8859
8920
|
var progressedState = workInProgress.memoizedState;
|
|
8860
8921
|
var progressedPrimaryChild = progressedState !== null ? workInProgress.child.child : workInProgress.child;
|
|
@@ -8917,8 +8978,8 @@ function updateSuspenseComponent(current$$1, workInProgress, renderExpirationTim
|
|
|
8917
8978
|
|
|
8918
8979
|
_primaryChildFragment.child = null;
|
|
8919
8980
|
|
|
8920
|
-
if ((workInProgress.mode &
|
|
8921
|
-
// Outside of
|
|
8981
|
+
if ((workInProgress.mode & BlockingMode) === NoMode) {
|
|
8982
|
+
// Outside of blocking mode, we commit the effects from the
|
|
8922
8983
|
// partially completed, timed-out tree, too.
|
|
8923
8984
|
var _progressedChild = _primaryChildFragment.child = workInProgress.child;
|
|
8924
8985
|
|
|
@@ -8977,8 +9038,8 @@ function updateSuspenseComponent(current$$1, workInProgress, renderExpirationTim
|
|
|
8977
9038
|
|
|
8978
9039
|
_primaryChildFragment2.return = workInProgress;
|
|
8979
9040
|
|
|
8980
|
-
if ((workInProgress.mode &
|
|
8981
|
-
// Outside of
|
|
9041
|
+
if ((workInProgress.mode & BlockingMode) === NoMode) {
|
|
9042
|
+
// Outside of blocking mode, we commit the effects from the
|
|
8982
9043
|
// partially completed, timed-out tree, too.
|
|
8983
9044
|
var _progressedState = workInProgress.memoizedState;
|
|
8984
9045
|
|
|
@@ -9062,8 +9123,8 @@ function updateSuspenseComponent(current$$1, workInProgress, renderExpirationTim
|
|
|
9062
9123
|
// primaryChildFragment.effectTag |= Placement;
|
|
9063
9124
|
|
|
9064
9125
|
|
|
9065
|
-
if ((workInProgress.mode &
|
|
9066
|
-
// Outside of
|
|
9126
|
+
if ((workInProgress.mode & BlockingMode) === NoMode) {
|
|
9127
|
+
// Outside of blocking mode, we commit the effects from the
|
|
9067
9128
|
// partially completed, timed-out tree, too.
|
|
9068
9129
|
var _progressedState2 = workInProgress.memoizedState;
|
|
9069
9130
|
|
|
@@ -9132,9 +9193,9 @@ function retrySuspenseComponentWithoutHydrating(current$$1, workInProgress, rend
|
|
|
9132
9193
|
function mountDehydratedSuspenseComponent(workInProgress, suspenseInstance, renderExpirationTime) {
|
|
9133
9194
|
// During the first pass, we'll bail out and not drill into the children.
|
|
9134
9195
|
// Instead, we'll leave the content in place and try to hydrate it later.
|
|
9135
|
-
if ((workInProgress.mode &
|
|
9196
|
+
if ((workInProgress.mode & BlockingMode) === NoMode) {
|
|
9136
9197
|
{
|
|
9137
|
-
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.createBlockingRoot(container, { hydrate: true })' + '.render(element) or remove the Suspense components from ' + 'the server rendered components.');
|
|
9138
9199
|
}
|
|
9139
9200
|
|
|
9140
9201
|
workInProgress.expirationTime = Sync;
|
|
@@ -9149,7 +9210,7 @@ function mountDehydratedSuspenseComponent(workInProgress, suspenseInstance, rend
|
|
|
9149
9210
|
// a protocol to transfer that time, we'll just estimate it by using the current
|
|
9150
9211
|
// time. This will mean that Suspense timeouts are slightly shifted to later than
|
|
9151
9212
|
// they should be.
|
|
9152
|
-
var serverDisplayTime =
|
|
9213
|
+
var serverDisplayTime = requestCurrentTimeForUpdate(); // Schedule a normal pri update to render this content.
|
|
9153
9214
|
|
|
9154
9215
|
var newExpirationTime = computeAsyncExpiration(serverDisplayTime);
|
|
9155
9216
|
|
|
@@ -9176,7 +9237,7 @@ function updateDehydratedSuspenseComponent(current$$1, workInProgress, suspenseI
|
|
|
9176
9237
|
// but after we've already committed once.
|
|
9177
9238
|
warnIfHydrating();
|
|
9178
9239
|
|
|
9179
|
-
if ((workInProgress.mode &
|
|
9240
|
+
if ((workInProgress.mode & BlockingMode) === NoMode) {
|
|
9180
9241
|
return retrySuspenseComponentWithoutHydrating(current$$1, workInProgress, renderExpirationTime);
|
|
9181
9242
|
}
|
|
9182
9243
|
|
|
@@ -9258,6 +9319,20 @@ function updateDehydratedSuspenseComponent(current$$1, workInProgress, suspenseI
|
|
|
9258
9319
|
}
|
|
9259
9320
|
}
|
|
9260
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
|
+
|
|
9261
9336
|
function propagateSuspenseContextChange(workInProgress, firstChild, renderExpirationTime) {
|
|
9262
9337
|
// Mark any Suspense boundaries with fallbacks as having work to do.
|
|
9263
9338
|
// If they were previously forced into fallbacks, they may now be able
|
|
@@ -9269,18 +9344,15 @@ function propagateSuspenseContextChange(workInProgress, firstChild, renderExpira
|
|
|
9269
9344
|
var state = node.memoizedState;
|
|
9270
9345
|
|
|
9271
9346
|
if (state !== null) {
|
|
9272
|
-
|
|
9273
|
-
|
|
9274
|
-
|
|
9275
|
-
|
|
9276
|
-
|
|
9277
|
-
|
|
9278
|
-
|
|
9279
|
-
|
|
9280
|
-
|
|
9281
|
-
|
|
9282
|
-
scheduleWorkOnParentPath(node.return, renderExpirationTime);
|
|
9283
|
-
}
|
|
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);
|
|
9284
9356
|
} else if (node.child !== null) {
|
|
9285
9357
|
node.child.return = node;
|
|
9286
9358
|
node = node.child;
|
|
@@ -9425,7 +9497,7 @@ function validateSuspenseListChildren(children, revealOrder) {
|
|
|
9425
9497
|
}
|
|
9426
9498
|
}
|
|
9427
9499
|
|
|
9428
|
-
function initSuspenseListRenderState(workInProgress, isBackwards, tail, lastContentRow, tailMode) {
|
|
9500
|
+
function initSuspenseListRenderState(workInProgress, isBackwards, tail, lastContentRow, tailMode, lastEffectBeforeRendering) {
|
|
9429
9501
|
var renderState = workInProgress.memoizedState;
|
|
9430
9502
|
|
|
9431
9503
|
if (renderState === null) {
|
|
@@ -9435,7 +9507,8 @@ function initSuspenseListRenderState(workInProgress, isBackwards, tail, lastCont
|
|
|
9435
9507
|
last: lastContentRow,
|
|
9436
9508
|
tail: tail,
|
|
9437
9509
|
tailExpiration: 0,
|
|
9438
|
-
tailMode: tailMode
|
|
9510
|
+
tailMode: tailMode,
|
|
9511
|
+
lastEffect: lastEffectBeforeRendering
|
|
9439
9512
|
};
|
|
9440
9513
|
} else {
|
|
9441
9514
|
// We can reuse the existing object from previous renders.
|
|
@@ -9445,6 +9518,7 @@ function initSuspenseListRenderState(workInProgress, isBackwards, tail, lastCont
|
|
|
9445
9518
|
renderState.tail = tail;
|
|
9446
9519
|
renderState.tailExpiration = 0;
|
|
9447
9520
|
renderState.tailMode = tailMode;
|
|
9521
|
+
renderState.lastEffect = lastEffectBeforeRendering;
|
|
9448
9522
|
}
|
|
9449
9523
|
} // This can end up rendering this component multiple passes.
|
|
9450
9524
|
// The first pass splits the children fibers into two sets. A head and tail.
|
|
@@ -9485,8 +9559,8 @@ function updateSuspenseListComponent(current$$1, workInProgress, renderExpiratio
|
|
|
9485
9559
|
|
|
9486
9560
|
pushSuspenseContext(workInProgress, suspenseContext);
|
|
9487
9561
|
|
|
9488
|
-
if ((workInProgress.mode &
|
|
9489
|
-
// Outside of
|
|
9562
|
+
if ((workInProgress.mode & BlockingMode) === NoMode) {
|
|
9563
|
+
// Outside of blocking mode, SuspenseList doesn't work so we just
|
|
9490
9564
|
// use make it a noop by treating it as the default revealOrder.
|
|
9491
9565
|
workInProgress.memoizedState = null;
|
|
9492
9566
|
} else {
|
|
@@ -9509,7 +9583,7 @@ function updateSuspenseListComponent(current$$1, workInProgress, renderExpiratio
|
|
|
9509
9583
|
}
|
|
9510
9584
|
|
|
9511
9585
|
initSuspenseListRenderState(workInProgress, false, // isBackwards
|
|
9512
|
-
tail, lastContentRow, tailMode);
|
|
9586
|
+
tail, lastContentRow, tailMode, workInProgress.lastEffect);
|
|
9513
9587
|
break;
|
|
9514
9588
|
}
|
|
9515
9589
|
|
|
@@ -9541,7 +9615,7 @@ function updateSuspenseListComponent(current$$1, workInProgress, renderExpiratio
|
|
|
9541
9615
|
|
|
9542
9616
|
initSuspenseListRenderState(workInProgress, true, // isBackwards
|
|
9543
9617
|
_tail, null, // last
|
|
9544
|
-
tailMode);
|
|
9618
|
+
tailMode, workInProgress.lastEffect);
|
|
9545
9619
|
break;
|
|
9546
9620
|
}
|
|
9547
9621
|
|
|
@@ -9550,7 +9624,7 @@ function updateSuspenseListComponent(current$$1, workInProgress, renderExpiratio
|
|
|
9550
9624
|
initSuspenseListRenderState(workInProgress, false, // isBackwards
|
|
9551
9625
|
null, // tail
|
|
9552
9626
|
null, // last
|
|
9553
|
-
undefined);
|
|
9627
|
+
undefined, workInProgress.lastEffect);
|
|
9554
9628
|
break;
|
|
9555
9629
|
}
|
|
9556
9630
|
|
|
@@ -9858,7 +9932,12 @@ function beginWork$1(current$$1, workInProgress, renderExpirationTime) {
|
|
|
9858
9932
|
|
|
9859
9933
|
case Profiler:
|
|
9860
9934
|
if (enableProfilerTimer) {
|
|
9861
|
-
|
|
9935
|
+
// Profiler should only call onRender when one of its descendants actually rendered.
|
|
9936
|
+
var hasChildWork = workInProgress.childExpirationTime >= renderExpirationTime;
|
|
9937
|
+
|
|
9938
|
+
if (hasChildWork) {
|
|
9939
|
+
workInProgress.effectTag |= Update;
|
|
9940
|
+
}
|
|
9862
9941
|
}
|
|
9863
9942
|
|
|
9864
9943
|
break;
|
|
@@ -9914,10 +9993,11 @@ function beginWork$1(current$$1, workInProgress, renderExpirationTime) {
|
|
|
9914
9993
|
case SuspenseListComponent:
|
|
9915
9994
|
{
|
|
9916
9995
|
var didSuspendBefore = (current$$1.effectTag & DidCapture) !== NoEffect;
|
|
9917
|
-
|
|
9996
|
+
|
|
9997
|
+
var _hasChildWork = workInProgress.childExpirationTime >= renderExpirationTime;
|
|
9918
9998
|
|
|
9919
9999
|
if (didSuspendBefore) {
|
|
9920
|
-
if (
|
|
10000
|
+
if (_hasChildWork) {
|
|
9921
10001
|
// If something was in fallback state last time, and we have all the
|
|
9922
10002
|
// same children then we're still in progressive loading state.
|
|
9923
10003
|
// Something might get unblocked by state updates or retries in the
|
|
@@ -9946,7 +10026,7 @@ function beginWork$1(current$$1, workInProgress, renderExpirationTime) {
|
|
|
9946
10026
|
|
|
9947
10027
|
pushSuspenseContext(workInProgress, suspenseStackCursor.current);
|
|
9948
10028
|
|
|
9949
|
-
if (
|
|
10029
|
+
if (_hasChildWork) {
|
|
9950
10030
|
break;
|
|
9951
10031
|
} else {
|
|
9952
10032
|
// If none of the children had any work, that means that none of
|
|
@@ -10103,13 +10183,11 @@ function beginWork$1(current$$1, workInProgress, renderExpirationTime) {
|
|
|
10103
10183
|
}
|
|
10104
10184
|
}
|
|
10105
10185
|
|
|
10106
|
-
|
|
10186
|
+
{
|
|
10107
10187
|
{
|
|
10108
|
-
|
|
10109
|
-
throw ReactError(Error("Unknown unit of work tag (" + workInProgress.tag + "). This error is likely caused by a bug in React. Please file an issue."));
|
|
10110
|
-
}
|
|
10188
|
+
throw Error("Unknown unit of work tag (" + workInProgress.tag + "). This error is likely caused by a bug in React. Please file an issue.");
|
|
10111
10189
|
}
|
|
10112
|
-
}
|
|
10190
|
+
}
|
|
10113
10191
|
}
|
|
10114
10192
|
|
|
10115
10193
|
function createFundamentalStateInstance(currentFiber, props, impl, state) {
|
|
@@ -10131,14 +10209,19 @@ function getSuspenseFallbackChild(fiber) {
|
|
|
10131
10209
|
return fiber.child.sibling.child;
|
|
10132
10210
|
}
|
|
10133
10211
|
|
|
10212
|
+
var emptyObject$1 = {};
|
|
10213
|
+
|
|
10134
10214
|
function collectScopedNodes(node, fn, scopedNodes) {
|
|
10135
10215
|
if (enableScopeAPI) {
|
|
10136
10216
|
if (node.tag === HostComponent) {
|
|
10137
10217
|
var _type = node.type,
|
|
10138
|
-
memoizedProps = node.memoizedProps
|
|
10218
|
+
memoizedProps = node.memoizedProps,
|
|
10219
|
+
stateNode = node.stateNode;
|
|
10220
|
+
|
|
10221
|
+
var _instance = getPublicInstance(stateNode);
|
|
10139
10222
|
|
|
10140
|
-
if (fn(_type, memoizedProps) === true) {
|
|
10141
|
-
scopedNodes.push(
|
|
10223
|
+
if (_instance !== null && fn(_type, memoizedProps || emptyObject$1, _instance) === true) {
|
|
10224
|
+
scopedNodes.push(_instance);
|
|
10142
10225
|
}
|
|
10143
10226
|
}
|
|
10144
10227
|
|
|
@@ -10154,6 +10237,34 @@ function collectScopedNodes(node, fn, scopedNodes) {
|
|
|
10154
10237
|
}
|
|
10155
10238
|
}
|
|
10156
10239
|
|
|
10240
|
+
function collectFirstScopedNode(node, fn) {
|
|
10241
|
+
if (enableScopeAPI) {
|
|
10242
|
+
if (node.tag === HostComponent) {
|
|
10243
|
+
var _type2 = node.type,
|
|
10244
|
+
memoizedProps = node.memoizedProps,
|
|
10245
|
+
stateNode = node.stateNode;
|
|
10246
|
+
|
|
10247
|
+
var _instance2 = getPublicInstance(stateNode);
|
|
10248
|
+
|
|
10249
|
+
if (_instance2 !== null && fn(_type2, memoizedProps, _instance2) === true) {
|
|
10250
|
+
return _instance2;
|
|
10251
|
+
}
|
|
10252
|
+
}
|
|
10253
|
+
|
|
10254
|
+
var child = node.child;
|
|
10255
|
+
|
|
10256
|
+
if (isFiberSuspenseAndTimedOut(node)) {
|
|
10257
|
+
child = getSuspenseFallbackChild(node);
|
|
10258
|
+
}
|
|
10259
|
+
|
|
10260
|
+
if (child !== null) {
|
|
10261
|
+
return collectFirstScopedNodeFromChildren(child, fn);
|
|
10262
|
+
}
|
|
10263
|
+
}
|
|
10264
|
+
|
|
10265
|
+
return null;
|
|
10266
|
+
}
|
|
10267
|
+
|
|
10157
10268
|
function collectScopedNodesFromChildren(startingChild, fn, scopedNodes) {
|
|
10158
10269
|
var child = startingChild;
|
|
10159
10270
|
|
|
@@ -10163,6 +10274,22 @@ function collectScopedNodesFromChildren(startingChild, fn, scopedNodes) {
|
|
|
10163
10274
|
}
|
|
10164
10275
|
}
|
|
10165
10276
|
|
|
10277
|
+
function collectFirstScopedNodeFromChildren(startingChild, fn) {
|
|
10278
|
+
var child = startingChild;
|
|
10279
|
+
|
|
10280
|
+
while (child !== null) {
|
|
10281
|
+
var scopedNode = collectFirstScopedNode(child, fn);
|
|
10282
|
+
|
|
10283
|
+
if (scopedNode !== null) {
|
|
10284
|
+
return scopedNode;
|
|
10285
|
+
}
|
|
10286
|
+
|
|
10287
|
+
child = child.sibling;
|
|
10288
|
+
}
|
|
10289
|
+
|
|
10290
|
+
return null;
|
|
10291
|
+
}
|
|
10292
|
+
|
|
10166
10293
|
function collectNearestScopeMethods(node, scope, childrenScopes) {
|
|
10167
10294
|
if (isValidScopeNode(node, scope)) {
|
|
10168
10295
|
childrenScopes.push(node.stateNode.methods);
|
|
@@ -10189,11 +10316,10 @@ function collectNearestChildScopeMethods(startingChild, scope, childrenScopes) {
|
|
|
10189
10316
|
}
|
|
10190
10317
|
|
|
10191
10318
|
function isValidScopeNode(node, scope) {
|
|
10192
|
-
return node.tag === ScopeComponent && node.type === scope;
|
|
10319
|
+
return node.tag === ScopeComponent && node.type === scope && node.stateNode !== null;
|
|
10193
10320
|
}
|
|
10194
10321
|
|
|
10195
10322
|
function createScopeMethods(scope, instance) {
|
|
10196
|
-
var fn = scope.fn;
|
|
10197
10323
|
return {
|
|
10198
10324
|
getChildren: function () {
|
|
10199
10325
|
var currentFiber = instance.fiber;
|
|
@@ -10245,7 +10371,7 @@ function createScopeMethods(scope, instance) {
|
|
|
10245
10371
|
var currentFiber = instance.fiber;
|
|
10246
10372
|
return currentFiber.memoizedProps;
|
|
10247
10373
|
},
|
|
10248
|
-
|
|
10374
|
+
queryAllNodes: function (fn) {
|
|
10249
10375
|
var currentFiber = instance.fiber;
|
|
10250
10376
|
var child = currentFiber.child;
|
|
10251
10377
|
var scopedNodes = [];
|
|
@@ -10255,6 +10381,29 @@ function createScopeMethods(scope, instance) {
|
|
|
10255
10381
|
}
|
|
10256
10382
|
|
|
10257
10383
|
return scopedNodes.length === 0 ? null : scopedNodes;
|
|
10384
|
+
},
|
|
10385
|
+
queryFirstNode: function (fn) {
|
|
10386
|
+
var currentFiber = instance.fiber;
|
|
10387
|
+
var child = currentFiber.child;
|
|
10388
|
+
|
|
10389
|
+
if (child !== null) {
|
|
10390
|
+
return collectFirstScopedNodeFromChildren(child, fn);
|
|
10391
|
+
}
|
|
10392
|
+
|
|
10393
|
+
return null;
|
|
10394
|
+
},
|
|
10395
|
+
containsNode: function (node) {
|
|
10396
|
+
var fiber = getInstanceFromNode(node);
|
|
10397
|
+
|
|
10398
|
+
while (fiber !== null) {
|
|
10399
|
+
if (fiber.tag === ScopeComponent && fiber.type === scope && fiber.stateNode === instance) {
|
|
10400
|
+
return true;
|
|
10401
|
+
}
|
|
10402
|
+
|
|
10403
|
+
fiber = fiber.return;
|
|
10404
|
+
}
|
|
10405
|
+
|
|
10406
|
+
return false;
|
|
10258
10407
|
}
|
|
10259
10408
|
};
|
|
10260
10409
|
}
|
|
@@ -10789,13 +10938,11 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
10789
10938
|
}
|
|
10790
10939
|
} else {
|
|
10791
10940
|
if (!newProps) {
|
|
10792
|
-
(
|
|
10793
|
-
|
|
10794
|
-
|
|
10795
|
-
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."));
|
|
10796
|
-
}
|
|
10941
|
+
if (!(workInProgress.stateNode !== null)) {
|
|
10942
|
+
{
|
|
10943
|
+
throw Error("We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue.");
|
|
10797
10944
|
}
|
|
10798
|
-
}
|
|
10945
|
+
} // This can happen when we abort work.
|
|
10799
10946
|
|
|
10800
10947
|
|
|
10801
10948
|
break;
|
|
@@ -10866,13 +11013,11 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
10866
11013
|
updateHostText$1(current, workInProgress, oldText, newText);
|
|
10867
11014
|
} else {
|
|
10868
11015
|
if (typeof newText !== 'string') {
|
|
10869
|
-
(
|
|
10870
|
-
|
|
10871
|
-
|
|
10872
|
-
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."));
|
|
10873
|
-
}
|
|
11016
|
+
if (!(workInProgress.stateNode !== null)) {
|
|
11017
|
+
{
|
|
11018
|
+
throw Error("We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue.");
|
|
10874
11019
|
}
|
|
10875
|
-
}
|
|
11020
|
+
} // This can happen when we abort work.
|
|
10876
11021
|
|
|
10877
11022
|
}
|
|
10878
11023
|
|
|
@@ -10907,13 +11052,11 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
10907
11052
|
if (current === null) {
|
|
10908
11053
|
var _wasHydrated3 = popHydrationState(workInProgress);
|
|
10909
11054
|
|
|
10910
|
-
|
|
10911
|
-
|
|
10912
|
-
|
|
10913
|
-
throw ReactError(Error("A dehydrated suspense component was completed without a hydrated node. This is probably a bug in React."));
|
|
10914
|
-
}
|
|
11055
|
+
if (!_wasHydrated3) {
|
|
11056
|
+
{
|
|
11057
|
+
throw Error("A dehydrated suspense component was completed without a hydrated node. This is probably a bug in React.");
|
|
10915
11058
|
}
|
|
10916
|
-
}
|
|
11059
|
+
}
|
|
10917
11060
|
|
|
10918
11061
|
prepareToHydrateHostSuspenseInstance(workInProgress);
|
|
10919
11062
|
|
|
@@ -10956,10 +11099,9 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
10956
11099
|
var prevDidTimeout = false;
|
|
10957
11100
|
|
|
10958
11101
|
if (current === null) {
|
|
10959
|
-
|
|
10960
|
-
|
|
10961
|
-
|
|
10962
|
-
popHydrationState(workInProgress);
|
|
11102
|
+
if (workInProgress.memoizedProps.fallback !== undefined) {
|
|
11103
|
+
popHydrationState(workInProgress);
|
|
11104
|
+
}
|
|
10963
11105
|
} else {
|
|
10964
11106
|
var prevState = current.memoizedState;
|
|
10965
11107
|
prevDidTimeout = prevState !== null;
|
|
@@ -10989,12 +11131,12 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
10989
11131
|
}
|
|
10990
11132
|
|
|
10991
11133
|
if (nextDidTimeout && !prevDidTimeout) {
|
|
10992
|
-
// If this subtreee is running in
|
|
11134
|
+
// If this subtreee is running in blocking mode we can suspend,
|
|
10993
11135
|
// otherwise we won't suspend.
|
|
10994
11136
|
// TODO: This will still suspend a synchronous tree if anything
|
|
10995
11137
|
// in the concurrent tree already suspended during this render.
|
|
10996
11138
|
// This is a known bug.
|
|
10997
|
-
if ((workInProgress.mode &
|
|
11139
|
+
if ((workInProgress.mode & BlockingMode) !== NoMode) {
|
|
10998
11140
|
// TODO: Move this back to throwException because this is too late
|
|
10999
11141
|
// if this is a large tree which is common for initial loads. We
|
|
11000
11142
|
// don't know if we should restart a render or not until we get
|
|
@@ -11144,7 +11286,11 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
11144
11286
|
// Reset the effect list before doing the second pass since that's now invalid.
|
|
11145
11287
|
|
|
11146
11288
|
|
|
11147
|
-
|
|
11289
|
+
if (renderState.lastEffect === null) {
|
|
11290
|
+
workInProgress.firstEffect = null;
|
|
11291
|
+
}
|
|
11292
|
+
|
|
11293
|
+
workInProgress.lastEffect = renderState.lastEffect; // Reset the child fibers to their original state.
|
|
11148
11294
|
|
|
11149
11295
|
resetChildFibers(workInProgress, renderExpirationTime); // Set up the Suspense Context to force suspense and immediately
|
|
11150
11296
|
// rerender the children.
|
|
@@ -11167,21 +11313,22 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
11167
11313
|
|
|
11168
11314
|
if (_suspended !== null) {
|
|
11169
11315
|
workInProgress.effectTag |= DidCapture;
|
|
11170
|
-
didSuspendAlready = true;
|
|
11171
|
-
|
|
11316
|
+
didSuspendAlready = true; // Ensure we transfer the update queue to the parent so that it doesn't
|
|
11317
|
+
// get lost if this row ends up dropped during a second pass.
|
|
11172
11318
|
|
|
11173
|
-
|
|
11174
|
-
// We need to delete the row we just rendered.
|
|
11175
|
-
// Ensure we transfer the update queue to the parent.
|
|
11176
|
-
var _newThennables = _suspended.updateQueue;
|
|
11319
|
+
var _newThennables = _suspended.updateQueue;
|
|
11177
11320
|
|
|
11178
|
-
|
|
11179
|
-
|
|
11180
|
-
|
|
11181
|
-
|
|
11182
|
-
// child. The nested children have already appended themselves.
|
|
11321
|
+
if (_newThennables !== null) {
|
|
11322
|
+
workInProgress.updateQueue = _newThennables;
|
|
11323
|
+
workInProgress.effectTag |= Update;
|
|
11324
|
+
}
|
|
11183
11325
|
|
|
11326
|
+
cutOffTailIfNeeded(renderState, true); // This might have been modified.
|
|
11184
11327
|
|
|
11328
|
+
if (renderState.tail === null && renderState.tailMode === 'hidden' && !renderedTail.alternate) {
|
|
11329
|
+
// We need to delete the row we just rendered.
|
|
11330
|
+
// Reset the effect list to what it was before we rendered this
|
|
11331
|
+
// child. The nested children have already appended themselves.
|
|
11185
11332
|
var lastEffect = workInProgress.lastEffect = renderState.lastEffect; // Remove any effects that were appended after this point.
|
|
11186
11333
|
|
|
11187
11334
|
if (lastEffect !== null) {
|
|
@@ -11368,13 +11515,11 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
11368
11515
|
}
|
|
11369
11516
|
|
|
11370
11517
|
default:
|
|
11371
|
-
|
|
11518
|
+
{
|
|
11372
11519
|
{
|
|
11373
|
-
|
|
11374
|
-
throw ReactError(Error("Unknown unit of work tag (" + workInProgress.tag + "). This error is likely caused by a bug in React. Please file an issue."));
|
|
11375
|
-
}
|
|
11520
|
+
throw Error("Unknown unit of work tag (" + workInProgress.tag + "). This error is likely caused by a bug in React. Please file an issue.");
|
|
11376
11521
|
}
|
|
11377
|
-
}
|
|
11522
|
+
}
|
|
11378
11523
|
|
|
11379
11524
|
}
|
|
11380
11525
|
|
|
@@ -11407,13 +11552,11 @@ function unwindWork(workInProgress, renderExpirationTime) {
|
|
|
11407
11552
|
popTopLevelContextObject(workInProgress);
|
|
11408
11553
|
var _effectTag = workInProgress.effectTag;
|
|
11409
11554
|
|
|
11410
|
-
(
|
|
11411
|
-
|
|
11412
|
-
|
|
11413
|
-
throw ReactError(Error("The root failed to unmount after an error. This is likely a bug in React. Please file an issue."));
|
|
11414
|
-
}
|
|
11555
|
+
if (!((_effectTag & DidCapture) === NoEffect)) {
|
|
11556
|
+
{
|
|
11557
|
+
throw Error("The root failed to unmount after an error. This is likely a bug in React. Please file an issue.");
|
|
11415
11558
|
}
|
|
11416
|
-
}
|
|
11559
|
+
}
|
|
11417
11560
|
|
|
11418
11561
|
workInProgress.effectTag = _effectTag & ~ShouldCapture | DidCapture;
|
|
11419
11562
|
return workInProgress;
|
|
@@ -11434,13 +11577,11 @@ function unwindWork(workInProgress, renderExpirationTime) {
|
|
|
11434
11577
|
var suspenseState = workInProgress.memoizedState;
|
|
11435
11578
|
|
|
11436
11579
|
if (suspenseState !== null && suspenseState.dehydrated !== null) {
|
|
11437
|
-
(
|
|
11438
|
-
|
|
11439
|
-
|
|
11440
|
-
throw ReactError(Error("Threw in newly mounted dehydrated component. This is likely a bug in React. Please file an issue."));
|
|
11441
|
-
}
|
|
11580
|
+
if (!(workInProgress.alternate !== null)) {
|
|
11581
|
+
{
|
|
11582
|
+
throw Error("Threw in newly mounted dehydrated component. This is likely a bug in React. Please file an issue.");
|
|
11442
11583
|
}
|
|
11443
|
-
}
|
|
11584
|
+
}
|
|
11444
11585
|
|
|
11445
11586
|
resetHydrationState();
|
|
11446
11587
|
}
|
|
@@ -11574,13 +11715,11 @@ var invokeGuardedCallbackImpl = function (name, func, context, a, b, c, d, e, f)
|
|
|
11574
11715
|
// when we call document.createEvent(). However this can cause confusing
|
|
11575
11716
|
// errors: https://github.com/facebookincubator/create-react-app/issues/3482
|
|
11576
11717
|
// So we preemptively throw with a better message instead.
|
|
11577
|
-
(
|
|
11578
|
-
|
|
11579
|
-
|
|
11580
|
-
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."));
|
|
11581
|
-
}
|
|
11718
|
+
if (!(typeof document !== 'undefined')) {
|
|
11719
|
+
{
|
|
11720
|
+
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.");
|
|
11582
11721
|
}
|
|
11583
|
-
}
|
|
11722
|
+
}
|
|
11584
11723
|
|
|
11585
11724
|
var evt = document.createEvent('Event'); // Keeps track of whether the user-provided callback threw an error. We
|
|
11586
11725
|
// set this to true at the beginning, then set it to false right after
|
|
@@ -11748,13 +11887,11 @@ function clearCaughtError() {
|
|
|
11748
11887
|
caughtError = null;
|
|
11749
11888
|
return error;
|
|
11750
11889
|
} else {
|
|
11751
|
-
|
|
11890
|
+
{
|
|
11752
11891
|
{
|
|
11753
|
-
|
|
11754
|
-
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."));
|
|
11755
|
-
}
|
|
11892
|
+
throw Error("clearCaughtError was called but no error was captured. This error is likely caused by a bug in React. Please file an issue.");
|
|
11756
11893
|
}
|
|
11757
|
-
}
|
|
11894
|
+
}
|
|
11758
11895
|
}
|
|
11759
11896
|
}
|
|
11760
11897
|
|
|
@@ -11974,13 +12111,11 @@ function commitBeforeMutationLifeCycles(current$$1, finishedWork) {
|
|
|
11974
12111
|
|
|
11975
12112
|
default:
|
|
11976
12113
|
{
|
|
11977
|
-
|
|
12114
|
+
{
|
|
11978
12115
|
{
|
|
11979
|
-
|
|
11980
|
-
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."));
|
|
11981
|
-
}
|
|
12116
|
+
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.");
|
|
11982
12117
|
}
|
|
11983
|
-
}
|
|
12118
|
+
}
|
|
11984
12119
|
}
|
|
11985
12120
|
}
|
|
11986
12121
|
}
|
|
@@ -12202,13 +12337,11 @@ function commitLifeCycles(finishedRoot, current$$1, finishedWork, committedExpir
|
|
|
12202
12337
|
|
|
12203
12338
|
default:
|
|
12204
12339
|
{
|
|
12205
|
-
|
|
12340
|
+
{
|
|
12206
12341
|
{
|
|
12207
|
-
|
|
12208
|
-
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."));
|
|
12209
|
-
}
|
|
12342
|
+
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.");
|
|
12210
12343
|
}
|
|
12211
|
-
}
|
|
12344
|
+
}
|
|
12212
12345
|
}
|
|
12213
12346
|
}
|
|
12214
12347
|
}
|
|
@@ -12553,13 +12686,11 @@ function commitContainer(finishedWork) {
|
|
|
12553
12686
|
|
|
12554
12687
|
default:
|
|
12555
12688
|
{
|
|
12556
|
-
|
|
12689
|
+
{
|
|
12557
12690
|
{
|
|
12558
|
-
|
|
12559
|
-
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."));
|
|
12560
|
-
}
|
|
12691
|
+
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.");
|
|
12561
12692
|
}
|
|
12562
|
-
}
|
|
12693
|
+
}
|
|
12563
12694
|
}
|
|
12564
12695
|
}
|
|
12565
12696
|
}
|
|
@@ -12575,13 +12706,11 @@ function getHostParentFiber(fiber) {
|
|
|
12575
12706
|
parent = parent.return;
|
|
12576
12707
|
}
|
|
12577
12708
|
|
|
12578
|
-
|
|
12709
|
+
{
|
|
12579
12710
|
{
|
|
12580
|
-
|
|
12581
|
-
throw ReactError(Error("Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue."));
|
|
12582
|
-
}
|
|
12711
|
+
throw Error("Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue.");
|
|
12583
12712
|
}
|
|
12584
|
-
}
|
|
12713
|
+
}
|
|
12585
12714
|
}
|
|
12586
12715
|
|
|
12587
12716
|
function isHostParent(fiber) {
|
|
@@ -12673,13 +12802,11 @@ function commitPlacement(finishedWork) {
|
|
|
12673
12802
|
// eslint-disable-next-line-no-fallthrough
|
|
12674
12803
|
|
|
12675
12804
|
default:
|
|
12676
|
-
|
|
12805
|
+
{
|
|
12677
12806
|
{
|
|
12678
|
-
|
|
12679
|
-
throw ReactError(Error("Invalid host parent fiber. This error is likely caused by a bug in React. Please file an issue."));
|
|
12680
|
-
}
|
|
12807
|
+
throw Error("Invalid host parent fiber. This error is likely caused by a bug in React. Please file an issue.");
|
|
12681
12808
|
}
|
|
12682
|
-
}
|
|
12809
|
+
}
|
|
12683
12810
|
|
|
12684
12811
|
}
|
|
12685
12812
|
|
|
@@ -12754,13 +12881,11 @@ function unmountHostComponents(finishedRoot, current$$1, renderPriorityLevel) {
|
|
|
12754
12881
|
var parent = node.return;
|
|
12755
12882
|
|
|
12756
12883
|
findParent: while (true) {
|
|
12757
|
-
(
|
|
12758
|
-
|
|
12759
|
-
|
|
12760
|
-
throw ReactError(Error("Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue."));
|
|
12761
|
-
}
|
|
12884
|
+
if (!(parent !== null)) {
|
|
12885
|
+
{
|
|
12886
|
+
throw Error("Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue.");
|
|
12762
12887
|
}
|
|
12763
|
-
}
|
|
12888
|
+
}
|
|
12764
12889
|
|
|
12765
12890
|
var parentStateNode = parent.stateNode;
|
|
12766
12891
|
|
|
@@ -12994,13 +13119,11 @@ function commitWork(current$$1, finishedWork) {
|
|
|
12994
13119
|
|
|
12995
13120
|
case HostText:
|
|
12996
13121
|
{
|
|
12997
|
-
(
|
|
12998
|
-
|
|
12999
|
-
|
|
13000
|
-
throw ReactError(Error("This should have a text node initialized. This error is likely caused by a bug in React. Please file an issue."));
|
|
13001
|
-
}
|
|
13122
|
+
if (!(finishedWork.stateNode !== null)) {
|
|
13123
|
+
{
|
|
13124
|
+
throw Error("This should have a text node initialized. This error is likely caused by a bug in React. Please file an issue.");
|
|
13002
13125
|
}
|
|
13003
|
-
}
|
|
13126
|
+
}
|
|
13004
13127
|
|
|
13005
13128
|
var textInstance = finishedWork.stateNode;
|
|
13006
13129
|
var newText = finishedWork.memoizedProps; // For hydration we reuse the update path but we treat the oldProps
|
|
@@ -13085,13 +13208,11 @@ function commitWork(current$$1, finishedWork) {
|
|
|
13085
13208
|
|
|
13086
13209
|
default:
|
|
13087
13210
|
{
|
|
13088
|
-
|
|
13211
|
+
{
|
|
13089
13212
|
{
|
|
13090
|
-
|
|
13091
|
-
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."));
|
|
13092
|
-
}
|
|
13213
|
+
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.");
|
|
13093
13214
|
}
|
|
13094
|
-
}
|
|
13215
|
+
}
|
|
13095
13216
|
}
|
|
13096
13217
|
}
|
|
13097
13218
|
}
|
|
@@ -13339,17 +13460,17 @@ function throwException(root, returnFiber, sourceFiber, value, renderExpirationT
|
|
|
13339
13460
|
_workInProgress.updateQueue = updateQueue;
|
|
13340
13461
|
} else {
|
|
13341
13462
|
thenables.add(thenable);
|
|
13342
|
-
} // If the boundary is outside of
|
|
13463
|
+
} // If the boundary is outside of blocking mode, we should *not*
|
|
13343
13464
|
// suspend the commit. Pretend as if the suspended component rendered
|
|
13344
13465
|
// null and keep rendering. In the commit phase, we'll schedule a
|
|
13345
13466
|
// subsequent synchronous update to re-render the Suspense.
|
|
13346
13467
|
//
|
|
13347
13468
|
// Note: It doesn't matter whether the component that suspended was
|
|
13348
|
-
// inside a
|
|
13469
|
+
// inside a blocking mode tree. If the Suspense is outside of it, we
|
|
13349
13470
|
// should *not* suspend the commit.
|
|
13350
13471
|
|
|
13351
13472
|
|
|
13352
|
-
if ((_workInProgress.mode &
|
|
13473
|
+
if ((_workInProgress.mode & BlockingMode) === NoMode) {
|
|
13353
13474
|
_workInProgress.effectTag |= DidCapture; // We're going to commit this fiber even though it didn't complete.
|
|
13354
13475
|
// But we shouldn't call any lifecycle methods or callbacks. Remove
|
|
13355
13476
|
// all lifecycle effect tags.
|
|
@@ -13512,7 +13633,6 @@ var RootErrored = 2;
|
|
|
13512
13633
|
var RootSuspended = 3;
|
|
13513
13634
|
var RootSuspendedWithDelay = 4;
|
|
13514
13635
|
var RootCompleted = 5;
|
|
13515
|
-
var RootLocked = 6;
|
|
13516
13636
|
// Describes where we are in the React execution stack
|
|
13517
13637
|
var executionContext = NoContext; // The root we're working on
|
|
13518
13638
|
|
|
@@ -13572,7 +13692,7 @@ var spawnedWorkDuringRender = null; // Expiration times are computed by adding t
|
|
|
13572
13692
|
// receive the same expiration time. Otherwise we get tearing.
|
|
13573
13693
|
|
|
13574
13694
|
var currentEventTime = NoWork;
|
|
13575
|
-
function
|
|
13695
|
+
function requestCurrentTimeForUpdate() {
|
|
13576
13696
|
if ((executionContext & (RenderContext | CommitContext)) !== NoContext) {
|
|
13577
13697
|
// We're inside React, so it's fine to read the actual time.
|
|
13578
13698
|
return msToExpirationTime(now());
|
|
@@ -13588,10 +13708,13 @@ function requestCurrentTime() {
|
|
|
13588
13708
|
currentEventTime = msToExpirationTime(now());
|
|
13589
13709
|
return currentEventTime;
|
|
13590
13710
|
}
|
|
13711
|
+
function getCurrentTime() {
|
|
13712
|
+
return msToExpirationTime(now());
|
|
13713
|
+
}
|
|
13591
13714
|
function computeExpirationForFiber(currentTime, fiber, suspenseConfig) {
|
|
13592
13715
|
var mode = fiber.mode;
|
|
13593
13716
|
|
|
13594
|
-
if ((mode &
|
|
13717
|
+
if ((mode & BlockingMode) === NoMode) {
|
|
13595
13718
|
return Sync;
|
|
13596
13719
|
}
|
|
13597
13720
|
|
|
@@ -13636,13 +13759,11 @@ function computeExpirationForFiber(currentTime, fiber, suspenseConfig) {
|
|
|
13636
13759
|
break;
|
|
13637
13760
|
|
|
13638
13761
|
default:
|
|
13639
|
-
|
|
13762
|
+
{
|
|
13640
13763
|
{
|
|
13641
|
-
|
|
13642
|
-
throw ReactError(Error("Expected a valid priority level"));
|
|
13643
|
-
}
|
|
13764
|
+
throw Error("Expected a valid priority level");
|
|
13644
13765
|
}
|
|
13645
|
-
}
|
|
13766
|
+
}
|
|
13646
13767
|
|
|
13647
13768
|
}
|
|
13648
13769
|
} // If we're in the middle of rendering a tree, do not update at the same
|
|
@@ -13659,7 +13780,6 @@ function computeExpirationForFiber(currentTime, fiber, suspenseConfig) {
|
|
|
13659
13780
|
|
|
13660
13781
|
return expirationTime;
|
|
13661
13782
|
}
|
|
13662
|
-
|
|
13663
13783
|
function scheduleUpdateOnFiber(fiber, expirationTime) {
|
|
13664
13784
|
checkForNestedUpdates();
|
|
13665
13785
|
warnAboutInvalidUpdatesOnClassComponentsInDEV(fiber);
|
|
@@ -13695,7 +13815,7 @@ function scheduleUpdateOnFiber(fiber, expirationTime) {
|
|
|
13695
13815
|
// a batch. This is intentionally inside scheduleUpdateOnFiber instead of
|
|
13696
13816
|
// scheduleCallbackForFiber to preserve the ability to schedule a callback
|
|
13697
13817
|
// without immediately flushing it. We only do this for user-initiated
|
|
13698
|
-
// updates, to preserve historical behavior of
|
|
13818
|
+
// updates, to preserve historical behavior of legacy mode.
|
|
13699
13819
|
flushSyncCallbackQueue();
|
|
13700
13820
|
}
|
|
13701
13821
|
}
|
|
@@ -13856,7 +13976,7 @@ function ensureRootIsScheduled(root) {
|
|
|
13856
13976
|
// time as an argument.
|
|
13857
13977
|
|
|
13858
13978
|
|
|
13859
|
-
var currentTime =
|
|
13979
|
+
var currentTime = requestCurrentTimeForUpdate();
|
|
13860
13980
|
var priorityLevel = inferPriorityFromExpirationTime(currentTime, expirationTime); // If there's an existing render task, confirm it has the correct priority and
|
|
13861
13981
|
// expiration time. Otherwise, we'll cancel it and schedule a new one.
|
|
13862
13982
|
|
|
@@ -13907,7 +14027,7 @@ function performConcurrentWorkOnRoot(root, didTimeout) {
|
|
|
13907
14027
|
if (didTimeout) {
|
|
13908
14028
|
// The render task took too long to complete. Mark the current time as
|
|
13909
14029
|
// expired to synchronously render all expired work in a single batch.
|
|
13910
|
-
var currentTime =
|
|
14030
|
+
var currentTime = requestCurrentTimeForUpdate();
|
|
13911
14031
|
markRootExpiredAtTime(root, currentTime); // This will schedule a synchronous callback.
|
|
13912
14032
|
|
|
13913
14033
|
ensureRootIsScheduled(root);
|
|
@@ -13921,13 +14041,11 @@ function performConcurrentWorkOnRoot(root, didTimeout) {
|
|
|
13921
14041
|
if (expirationTime !== NoWork) {
|
|
13922
14042
|
var originalCallbackNode = root.callbackNode;
|
|
13923
14043
|
|
|
13924
|
-
(
|
|
13925
|
-
|
|
13926
|
-
|
|
13927
|
-
throw ReactError(Error("Should not already be working."));
|
|
13928
|
-
}
|
|
14044
|
+
if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) {
|
|
14045
|
+
{
|
|
14046
|
+
throw Error("Should not already be working.");
|
|
13929
14047
|
}
|
|
13930
|
-
}
|
|
14048
|
+
}
|
|
13931
14049
|
|
|
13932
14050
|
flushPassiveEffects(); // If the root or expiration time have changed, throw out the existing stack
|
|
13933
14051
|
// and prepare a fresh one. Otherwise we'll continue where we left off.
|
|
@@ -13981,7 +14099,6 @@ function performConcurrentWorkOnRoot(root, didTimeout) {
|
|
|
13981
14099
|
stopFinishedWorkLoopTimer();
|
|
13982
14100
|
var finishedWork = root.finishedWork = root.current.alternate;
|
|
13983
14101
|
root.finishedExpirationTime = expirationTime;
|
|
13984
|
-
resolveLocksOnRoot(root, expirationTime);
|
|
13985
14102
|
finishConcurrentRender(root, finishedWork, workInProgressRootExitStatus, expirationTime);
|
|
13986
14103
|
}
|
|
13987
14104
|
|
|
@@ -14006,13 +14123,11 @@ function finishConcurrentRender(root, finishedWork, exitStatus, expirationTime)
|
|
|
14006
14123
|
case RootIncomplete:
|
|
14007
14124
|
case RootFatalErrored:
|
|
14008
14125
|
{
|
|
14009
|
-
|
|
14126
|
+
{
|
|
14010
14127
|
{
|
|
14011
|
-
|
|
14012
|
-
throw ReactError(Error("Root did not complete. This is a bug in React."));
|
|
14013
|
-
}
|
|
14128
|
+
throw Error("Root did not complete. This is a bug in React.");
|
|
14014
14129
|
}
|
|
14015
|
-
}
|
|
14130
|
+
}
|
|
14016
14131
|
}
|
|
14017
14132
|
// Flow knows about invariant, so it complains if I add a break
|
|
14018
14133
|
// statement, but eslint doesn't know about invariant, so it complains
|
|
@@ -14020,18 +14135,16 @@ function finishConcurrentRender(root, finishedWork, exitStatus, expirationTime)
|
|
|
14020
14135
|
|
|
14021
14136
|
case RootErrored:
|
|
14022
14137
|
{
|
|
14023
|
-
|
|
14024
|
-
|
|
14025
|
-
|
|
14026
|
-
|
|
14027
|
-
|
|
14028
|
-
|
|
14029
|
-
|
|
14030
|
-
|
|
14031
|
-
|
|
14032
|
-
|
|
14138
|
+
// If this was an async render, the error may have happened due to
|
|
14139
|
+
// a mutation in a concurrent event. Try rendering one more time,
|
|
14140
|
+
// synchronously, to see if the error goes away. If there are
|
|
14141
|
+
// lower priority updates, let's include those, too, in case they
|
|
14142
|
+
// fix the inconsistency. Render at Idle to include all updates.
|
|
14143
|
+
// If it was Idle or Never or some not-yet-invented time, render
|
|
14144
|
+
// at that time.
|
|
14145
|
+
markRootExpiredAtTime(root, expirationTime > Idle ? Idle : expirationTime); // We assume that this second render pass will be synchronous
|
|
14146
|
+
// and therefore not hit this path again.
|
|
14033
14147
|
|
|
14034
|
-
commitRoot(root);
|
|
14035
14148
|
break;
|
|
14036
14149
|
}
|
|
14037
14150
|
|
|
@@ -14215,24 +14328,13 @@ function finishConcurrentRender(root, finishedWork, exitStatus, expirationTime)
|
|
|
14215
14328
|
break;
|
|
14216
14329
|
}
|
|
14217
14330
|
|
|
14218
|
-
case RootLocked:
|
|
14219
|
-
{
|
|
14220
|
-
// This root has a lock that prevents it from committing. Exit. If
|
|
14221
|
-
// we begin work on the root again, without any intervening updates,
|
|
14222
|
-
// it will finish without doing additional work.
|
|
14223
|
-
markRootSuspendedAtTime(root, expirationTime);
|
|
14224
|
-
break;
|
|
14225
|
-
}
|
|
14226
|
-
|
|
14227
14331
|
default:
|
|
14228
14332
|
{
|
|
14229
|
-
|
|
14333
|
+
{
|
|
14230
14334
|
{
|
|
14231
|
-
|
|
14232
|
-
throw ReactError(Error("Unknown root exit status."));
|
|
14233
|
-
}
|
|
14335
|
+
throw Error("Unknown root exit status.");
|
|
14234
14336
|
}
|
|
14235
|
-
}
|
|
14337
|
+
}
|
|
14236
14338
|
}
|
|
14237
14339
|
}
|
|
14238
14340
|
} // This is the entry point for synchronous tasks that don't go
|
|
@@ -14250,13 +14352,11 @@ function performSyncWorkOnRoot(root) {
|
|
|
14250
14352
|
// batch.commit() API.
|
|
14251
14353
|
commitRoot(root);
|
|
14252
14354
|
} else {
|
|
14253
|
-
(
|
|
14254
|
-
|
|
14255
|
-
|
|
14256
|
-
throw ReactError(Error("Should not already be working."));
|
|
14257
|
-
}
|
|
14355
|
+
if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) {
|
|
14356
|
+
{
|
|
14357
|
+
throw Error("Should not already be working.");
|
|
14258
14358
|
}
|
|
14259
|
-
}
|
|
14359
|
+
}
|
|
14260
14360
|
|
|
14261
14361
|
flushPassiveEffects(); // If the root or expiration time have changed, throw out the existing stack
|
|
14262
14362
|
// and prepare a fresh one. Otherwise we'll continue where we left off.
|
|
@@ -14303,21 +14403,17 @@ function performSyncWorkOnRoot(root) {
|
|
|
14303
14403
|
|
|
14304
14404
|
if (workInProgress !== null) {
|
|
14305
14405
|
// This is a sync render, so we should have finished the whole tree.
|
|
14306
|
-
|
|
14406
|
+
{
|
|
14307
14407
|
{
|
|
14308
|
-
|
|
14309
|
-
throw ReactError(Error("Cannot commit an incomplete root. This error is likely caused by a bug in React. Please file an issue."));
|
|
14310
|
-
}
|
|
14408
|
+
throw Error("Cannot commit an incomplete root. This error is likely caused by a bug in React. Please file an issue.");
|
|
14311
14409
|
}
|
|
14312
|
-
}
|
|
14410
|
+
}
|
|
14313
14411
|
} else {
|
|
14314
14412
|
// We now have a consistent tree. Because this is a sync render, we
|
|
14315
|
-
// will commit it even if something suspended.
|
|
14316
|
-
// if the root is locked (using the unstable_createBatch API).
|
|
14413
|
+
// will commit it even if something suspended.
|
|
14317
14414
|
stopFinishedWorkLoopTimer();
|
|
14318
14415
|
root.finishedWork = root.current.alternate;
|
|
14319
14416
|
root.finishedExpirationTime = expirationTime;
|
|
14320
|
-
resolveLocksOnRoot(root, expirationTime);
|
|
14321
14417
|
finishSyncRender(root, workInProgressRootExitStatus, expirationTime);
|
|
14322
14418
|
} // Before exiting, make sure there's a callback scheduled for the next
|
|
14323
14419
|
// pending level.
|
|
@@ -14331,44 +14427,25 @@ function performSyncWorkOnRoot(root) {
|
|
|
14331
14427
|
}
|
|
14332
14428
|
|
|
14333
14429
|
function finishSyncRender(root, exitStatus, expirationTime) {
|
|
14334
|
-
|
|
14335
|
-
|
|
14336
|
-
// begin work on the root again, without any intervening updates, it
|
|
14337
|
-
// will finish without doing additional work.
|
|
14338
|
-
markRootSuspendedAtTime(root, expirationTime);
|
|
14339
|
-
} else {
|
|
14340
|
-
// Set this to null to indicate there's no in-progress render.
|
|
14341
|
-
workInProgressRoot = null;
|
|
14430
|
+
// Set this to null to indicate there's no in-progress render.
|
|
14431
|
+
workInProgressRoot = null;
|
|
14342
14432
|
|
|
14343
|
-
|
|
14344
|
-
|
|
14345
|
-
|
|
14346
|
-
}
|
|
14433
|
+
{
|
|
14434
|
+
if (exitStatus === RootSuspended || exitStatus === RootSuspendedWithDelay) {
|
|
14435
|
+
flushSuspensePriorityWarningInDEV();
|
|
14347
14436
|
}
|
|
14348
|
-
|
|
14349
|
-
commitRoot(root);
|
|
14350
14437
|
}
|
|
14351
|
-
}
|
|
14352
|
-
|
|
14353
14438
|
|
|
14439
|
+
commitRoot(root);
|
|
14440
|
+
}
|
|
14354
14441
|
|
|
14355
14442
|
|
|
14356
|
-
function resolveLocksOnRoot(root, expirationTime) {
|
|
14357
|
-
var firstBatch = root.firstBatch;
|
|
14358
14443
|
|
|
14359
|
-
if (firstBatch !== null && firstBatch._defer && firstBatch._expirationTime >= expirationTime) {
|
|
14360
|
-
scheduleCallback(NormalPriority, function () {
|
|
14361
|
-
firstBatch._onComplete();
|
|
14362
14444
|
|
|
14363
|
-
|
|
14364
|
-
|
|
14365
|
-
workInProgressRootExitStatus = RootLocked;
|
|
14366
|
-
}
|
|
14445
|
+
function syncUpdates(fn, a, b, c) {
|
|
14446
|
+
return runWithPriority(ImmediatePriority, fn.bind(null, a, b, c));
|
|
14367
14447
|
}
|
|
14368
14448
|
|
|
14369
|
-
|
|
14370
|
-
|
|
14371
|
-
|
|
14372
14449
|
function batchedUpdates(fn, a) {
|
|
14373
14450
|
var prevExecutionContext = executionContext;
|
|
14374
14451
|
executionContext |= BatchedContext;
|
|
@@ -14389,13 +14466,11 @@ function batchedUpdates(fn, a) {
|
|
|
14389
14466
|
|
|
14390
14467
|
function flushSync(fn, a) {
|
|
14391
14468
|
if ((executionContext & (RenderContext | CommitContext)) !== NoContext) {
|
|
14392
|
-
|
|
14469
|
+
{
|
|
14393
14470
|
{
|
|
14394
|
-
|
|
14395
|
-
throw ReactError(Error("flushSync was called from inside a lifecycle method. It cannot be called when React is already rendering."));
|
|
14396
|
-
}
|
|
14471
|
+
throw Error("flushSync was called from inside a lifecycle method. It cannot be called when React is already rendering.");
|
|
14397
14472
|
}
|
|
14398
|
-
}
|
|
14473
|
+
}
|
|
14399
14474
|
}
|
|
14400
14475
|
|
|
14401
14476
|
var prevExecutionContext = executionContext;
|
|
@@ -14462,6 +14537,7 @@ function handleError(root, thrownValue) {
|
|
|
14462
14537
|
// Reset module-level state that was set during the render phase.
|
|
14463
14538
|
resetContextDependencies();
|
|
14464
14539
|
resetHooks();
|
|
14540
|
+
resetCurrentFiber();
|
|
14465
14541
|
|
|
14466
14542
|
if (workInProgress === null || workInProgress.return === null) {
|
|
14467
14543
|
// Expected to be working on a non-root fiber. This is a fatal error
|
|
@@ -14858,16 +14934,23 @@ function commitRoot(root) {
|
|
|
14858
14934
|
}
|
|
14859
14935
|
|
|
14860
14936
|
function commitRootImpl(root, renderPriorityLevel) {
|
|
14861
|
-
|
|
14937
|
+
do {
|
|
14938
|
+
// `flushPassiveEffects` will call `flushSyncUpdateQueue` at the end, which
|
|
14939
|
+
// means `flushPassiveEffects` will sometimes result in additional
|
|
14940
|
+
// passive effects. So we need to keep flushing in a loop until there are
|
|
14941
|
+
// no more pending effects.
|
|
14942
|
+
// TODO: Might be better if `flushPassiveEffects` did not automatically
|
|
14943
|
+
// flush synchronous work at the end, to avoid factoring hazards like this.
|
|
14944
|
+
flushPassiveEffects();
|
|
14945
|
+
} while (rootWithPendingPassiveEffects !== null);
|
|
14946
|
+
|
|
14862
14947
|
flushRenderPhaseStrictModeWarningsInDEV();
|
|
14863
14948
|
|
|
14864
|
-
(
|
|
14865
|
-
|
|
14866
|
-
|
|
14867
|
-
throw ReactError(Error("Should not already be working."));
|
|
14868
|
-
}
|
|
14949
|
+
if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) {
|
|
14950
|
+
{
|
|
14951
|
+
throw Error("Should not already be working.");
|
|
14869
14952
|
}
|
|
14870
|
-
}
|
|
14953
|
+
}
|
|
14871
14954
|
|
|
14872
14955
|
var finishedWork = root.finishedWork;
|
|
14873
14956
|
var expirationTime = root.finishedExpirationTime;
|
|
@@ -14879,13 +14962,11 @@ function commitRootImpl(root, renderPriorityLevel) {
|
|
|
14879
14962
|
root.finishedWork = null;
|
|
14880
14963
|
root.finishedExpirationTime = NoWork;
|
|
14881
14964
|
|
|
14882
|
-
(
|
|
14883
|
-
|
|
14884
|
-
|
|
14885
|
-
throw ReactError(Error("Cannot commit the same tree as before. This error is likely caused by a bug in React. Please file an issue."));
|
|
14886
|
-
}
|
|
14965
|
+
if (!(finishedWork !== root.current)) {
|
|
14966
|
+
{
|
|
14967
|
+
throw Error("Cannot commit the same tree as before. This error is likely caused by a bug in React. Please file an issue.");
|
|
14887
14968
|
}
|
|
14888
|
-
}
|
|
14969
|
+
} // commitRoot never returns a continuation; it always finishes synchronously.
|
|
14889
14970
|
// So we can clear these now to allow a new callback to be scheduled.
|
|
14890
14971
|
|
|
14891
14972
|
|
|
@@ -14949,13 +15030,11 @@ function commitRootImpl(root, renderPriorityLevel) {
|
|
|
14949
15030
|
invokeGuardedCallback(null, commitBeforeMutationEffects, null);
|
|
14950
15031
|
|
|
14951
15032
|
if (hasCaughtError()) {
|
|
14952
|
-
(
|
|
14953
|
-
|
|
14954
|
-
|
|
14955
|
-
throw ReactError(Error("Should be working on an effect."));
|
|
14956
|
-
}
|
|
15033
|
+
if (!(nextEffect !== null)) {
|
|
15034
|
+
{
|
|
15035
|
+
throw Error("Should be working on an effect.");
|
|
14957
15036
|
}
|
|
14958
|
-
}
|
|
15037
|
+
}
|
|
14959
15038
|
|
|
14960
15039
|
var error = clearCaughtError();
|
|
14961
15040
|
captureCommitPhaseError(nextEffect, error);
|
|
@@ -14981,13 +15060,11 @@ function commitRootImpl(root, renderPriorityLevel) {
|
|
|
14981
15060
|
invokeGuardedCallback(null, commitMutationEffects, null, root, renderPriorityLevel);
|
|
14982
15061
|
|
|
14983
15062
|
if (hasCaughtError()) {
|
|
14984
|
-
(
|
|
14985
|
-
|
|
14986
|
-
|
|
14987
|
-
throw ReactError(Error("Should be working on an effect."));
|
|
14988
|
-
}
|
|
15063
|
+
if (!(nextEffect !== null)) {
|
|
15064
|
+
{
|
|
15065
|
+
throw Error("Should be working on an effect.");
|
|
14989
15066
|
}
|
|
14990
|
-
}
|
|
15067
|
+
}
|
|
14991
15068
|
|
|
14992
15069
|
var _error = clearCaughtError();
|
|
14993
15070
|
|
|
@@ -15015,13 +15092,11 @@ function commitRootImpl(root, renderPriorityLevel) {
|
|
|
15015
15092
|
invokeGuardedCallback(null, commitLayoutEffects, null, root, expirationTime);
|
|
15016
15093
|
|
|
15017
15094
|
if (hasCaughtError()) {
|
|
15018
|
-
(
|
|
15019
|
-
|
|
15020
|
-
|
|
15021
|
-
throw ReactError(Error("Should be working on an effect."));
|
|
15022
|
-
}
|
|
15095
|
+
if (!(nextEffect !== null)) {
|
|
15096
|
+
{
|
|
15097
|
+
throw Error("Should be working on an effect.");
|
|
15023
15098
|
}
|
|
15024
|
-
}
|
|
15099
|
+
}
|
|
15025
15100
|
|
|
15026
15101
|
var _error2 = clearCaughtError();
|
|
15027
15102
|
|
|
@@ -15307,13 +15382,11 @@ function flushPassiveEffectsImpl() {
|
|
|
15307
15382
|
rootWithPendingPassiveEffects = null;
|
|
15308
15383
|
pendingPassiveEffectsExpirationTime = NoWork;
|
|
15309
15384
|
|
|
15310
|
-
(
|
|
15311
|
-
|
|
15312
|
-
|
|
15313
|
-
throw ReactError(Error("Cannot flush passive effects while already rendering."));
|
|
15314
|
-
}
|
|
15385
|
+
if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) {
|
|
15386
|
+
{
|
|
15387
|
+
throw Error("Cannot flush passive effects while already rendering.");
|
|
15315
15388
|
}
|
|
15316
|
-
}
|
|
15389
|
+
}
|
|
15317
15390
|
|
|
15318
15391
|
var prevExecutionContext = executionContext;
|
|
15319
15392
|
executionContext |= CommitContext;
|
|
@@ -15329,13 +15402,11 @@ function flushPassiveEffectsImpl() {
|
|
|
15329
15402
|
invokeGuardedCallback(null, commitPassiveHookEffects, null, effect);
|
|
15330
15403
|
|
|
15331
15404
|
if (hasCaughtError()) {
|
|
15332
|
-
(
|
|
15333
|
-
|
|
15334
|
-
|
|
15335
|
-
throw ReactError(Error("Should be working on an effect."));
|
|
15336
|
-
}
|
|
15405
|
+
if (!(effect !== null)) {
|
|
15406
|
+
{
|
|
15407
|
+
throw Error("Should be working on an effect.");
|
|
15337
15408
|
}
|
|
15338
|
-
}
|
|
15409
|
+
}
|
|
15339
15410
|
|
|
15340
15411
|
var error = clearCaughtError();
|
|
15341
15412
|
captureCommitPhaseError(effect, error);
|
|
@@ -15496,10 +15567,10 @@ function retryTimedOutBoundary(boundaryFiber, retryTime) {
|
|
|
15496
15567
|
// previously was rendered in its fallback state. One of the promises that
|
|
15497
15568
|
// suspended it has resolved, which means at least part of the tree was
|
|
15498
15569
|
// likely unblocked. Try rendering again, at a new expiration time.
|
|
15499
|
-
if (retryTime ===
|
|
15570
|
+
if (retryTime === NoWork) {
|
|
15500
15571
|
var suspenseConfig = null; // Retries don't carry over the already committed update.
|
|
15501
15572
|
|
|
15502
|
-
var currentTime =
|
|
15573
|
+
var currentTime = requestCurrentTimeForUpdate();
|
|
15503
15574
|
retryTime = computeExpirationForFiber(currentTime, boundaryFiber, suspenseConfig);
|
|
15504
15575
|
} // TODO: Special case idle priority?
|
|
15505
15576
|
|
|
@@ -15514,7 +15585,7 @@ function retryTimedOutBoundary(boundaryFiber, retryTime) {
|
|
|
15514
15585
|
|
|
15515
15586
|
function retryDehydratedSuspenseBoundary(boundaryFiber) {
|
|
15516
15587
|
var suspenseState = boundaryFiber.memoizedState;
|
|
15517
|
-
var retryTime =
|
|
15588
|
+
var retryTime = NoWork;
|
|
15518
15589
|
|
|
15519
15590
|
if (suspenseState !== null) {
|
|
15520
15591
|
retryTime = suspenseState.retryTime;
|
|
@@ -15523,7 +15594,7 @@ function retryDehydratedSuspenseBoundary(boundaryFiber) {
|
|
|
15523
15594
|
retryTimedOutBoundary(boundaryFiber, retryTime);
|
|
15524
15595
|
}
|
|
15525
15596
|
function resolveRetryThenable(boundaryFiber, thenable) {
|
|
15526
|
-
var retryTime =
|
|
15597
|
+
var retryTime = NoWork; // Default
|
|
15527
15598
|
|
|
15528
15599
|
var retryCache;
|
|
15529
15600
|
|
|
@@ -15544,13 +15615,11 @@ function resolveRetryThenable(boundaryFiber, thenable) {
|
|
|
15544
15615
|
break;
|
|
15545
15616
|
|
|
15546
15617
|
default:
|
|
15547
|
-
|
|
15618
|
+
{
|
|
15548
15619
|
{
|
|
15549
|
-
|
|
15550
|
-
throw ReactError(Error("Pinged unknown suspense boundary type. This is probably a bug in React."));
|
|
15551
|
-
}
|
|
15620
|
+
throw Error("Pinged unknown suspense boundary type. This is probably a bug in React.");
|
|
15552
15621
|
}
|
|
15553
|
-
}
|
|
15622
|
+
}
|
|
15554
15623
|
|
|
15555
15624
|
}
|
|
15556
15625
|
} else {
|
|
@@ -15607,13 +15676,11 @@ function checkForNestedUpdates() {
|
|
|
15607
15676
|
nestedUpdateCount = 0;
|
|
15608
15677
|
rootWithNestedUpdates = null;
|
|
15609
15678
|
|
|
15610
|
-
|
|
15679
|
+
{
|
|
15611
15680
|
{
|
|
15612
|
-
|
|
15613
|
-
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."));
|
|
15614
|
-
}
|
|
15681
|
+
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.");
|
|
15615
15682
|
}
|
|
15616
|
-
}
|
|
15683
|
+
}
|
|
15617
15684
|
}
|
|
15618
15685
|
|
|
15619
15686
|
{
|
|
@@ -15701,12 +15768,14 @@ if (true && replayFailedUnitOfWorkWithInvokeGuardedCallback) {
|
|
|
15701
15768
|
if (originalError !== null && typeof originalError === 'object' && typeof originalError.then === 'function') {
|
|
15702
15769
|
// Don't replay promises. Treat everything else like an error.
|
|
15703
15770
|
throw originalError;
|
|
15704
|
-
} // Keep this code in sync with
|
|
15771
|
+
} // Keep this code in sync with handleError; any changes here must have
|
|
15705
15772
|
// corresponding changes there.
|
|
15706
15773
|
|
|
15707
15774
|
|
|
15708
15775
|
resetContextDependencies();
|
|
15709
|
-
resetHooks(); //
|
|
15776
|
+
resetHooks(); // Don't reset current debug fiber, since we're about to work on the
|
|
15777
|
+
// same fiber again.
|
|
15778
|
+
// Unwind the failed stack frame
|
|
15710
15779
|
|
|
15711
15780
|
unwindInterruptedWork(unitOfWork); // Restore the original properties of the fiber.
|
|
15712
15781
|
|
|
@@ -15801,7 +15870,7 @@ var didWarnAboutUnmockedScheduler = false; // TODO Before we release concurrent
|
|
|
15801
15870
|
function warnIfUnmockedScheduler(fiber) {
|
|
15802
15871
|
{
|
|
15803
15872
|
if (didWarnAboutUnmockedScheduler === false && Scheduler$1.unstable_flushAllWithoutAsserting === undefined) {
|
|
15804
|
-
if (fiber.mode &
|
|
15873
|
+
if (fiber.mode & BlockingMode || fiber.mode & ConcurrentMode) {
|
|
15805
15874
|
didWarnAboutUnmockedScheduler = true;
|
|
15806
15875
|
warningWithoutStack$1(false, 'In Concurrent or Sync modes, the "scheduler" module needs to be mocked ' + 'to guarantee consistent behaviour across tests and browsers. ' + 'For example, with jest: \n' + "jest.mock('scheduler', () => require('scheduler/unstable_mock'));\n\n" + 'For more info, visit https://fb.me/react-mock-scheduler');
|
|
15807
15876
|
} else if (warnAboutUnmockedScheduler === true) {
|
|
@@ -15905,7 +15974,7 @@ function flushSuspensePriorityWarningInDEV() {
|
|
|
15905
15974
|
componentsThatTriggeredHighPriSuspend = null;
|
|
15906
15975
|
|
|
15907
15976
|
if (componentNames.length > 0) {
|
|
15908
|
-
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
|
|
15977
|
+
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
|
|
15909
15978
|
componentNames.sort().join(', '));
|
|
15910
15979
|
}
|
|
15911
15980
|
}
|
|
@@ -15992,10 +16061,10 @@ function startWorkOnPendingInteractions(root, expirationTime) {
|
|
|
15992
16061
|
});
|
|
15993
16062
|
}
|
|
15994
16063
|
}); // Store the current set of interactions on the FiberRoot for a few reasons:
|
|
15995
|
-
// We can re-use it in hot functions like
|
|
15996
|
-
// recalculate it. We will also use it in commitWork() to
|
|
15997
|
-
// onRender() hooks. This also provides DevTools with a
|
|
15998
|
-
// the onCommitRoot() hook is called.
|
|
16064
|
+
// We can re-use it in hot functions like performConcurrentWorkOnRoot()
|
|
16065
|
+
// without having to recalculate it. We will also use it in commitWork() to
|
|
16066
|
+
// pass to any Profiler onRender() hooks. This also provides DevTools with a
|
|
16067
|
+
// way to access it when the onCommitRoot() hook is called.
|
|
15999
16068
|
|
|
16000
16069
|
root.memoizedInteractions = interactions;
|
|
16001
16070
|
|
|
@@ -16103,7 +16172,7 @@ function injectInternals(internals) {
|
|
|
16103
16172
|
var didError = (root.current.effectTag & DidCapture) === DidCapture;
|
|
16104
16173
|
|
|
16105
16174
|
if (enableProfilerTimer) {
|
|
16106
|
-
var currentTime =
|
|
16175
|
+
var currentTime = getCurrentTime();
|
|
16107
16176
|
var priorityLevel = inferPriorityFromExpirationTime(currentTime, expirationTime);
|
|
16108
16177
|
hook.onCommitFiberRoot(rendererID, root, priorityLevel, didError);
|
|
16109
16178
|
} else {
|
|
@@ -16444,9 +16513,9 @@ function createHostRootFiber(tag) {
|
|
|
16444
16513
|
var mode;
|
|
16445
16514
|
|
|
16446
16515
|
if (tag === ConcurrentRoot) {
|
|
16447
|
-
mode = ConcurrentMode |
|
|
16448
|
-
} else if (tag ===
|
|
16449
|
-
mode =
|
|
16516
|
+
mode = ConcurrentMode | BlockingMode | StrictMode;
|
|
16517
|
+
} else if (tag === BlockingRoot) {
|
|
16518
|
+
mode = BlockingMode | StrictMode;
|
|
16450
16519
|
} else {
|
|
16451
16520
|
mode = NoMode;
|
|
16452
16521
|
}
|
|
@@ -16488,7 +16557,7 @@ key, pendingProps, owner, mode, expirationTime) {
|
|
|
16488
16557
|
|
|
16489
16558
|
case REACT_CONCURRENT_MODE_TYPE:
|
|
16490
16559
|
fiberTag = Mode;
|
|
16491
|
-
mode |= ConcurrentMode |
|
|
16560
|
+
mode |= ConcurrentMode | BlockingMode | StrictMode;
|
|
16492
16561
|
break;
|
|
16493
16562
|
|
|
16494
16563
|
case REACT_STRICT_MODE_TYPE:
|
|
@@ -16565,13 +16634,11 @@ key, pendingProps, owner, mode, expirationTime) {
|
|
|
16565
16634
|
}
|
|
16566
16635
|
}
|
|
16567
16636
|
|
|
16568
|
-
|
|
16637
|
+
{
|
|
16569
16638
|
{
|
|
16570
|
-
|
|
16571
|
-
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));
|
|
16572
|
-
}
|
|
16639
|
+
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);
|
|
16573
16640
|
}
|
|
16574
|
-
}
|
|
16641
|
+
}
|
|
16575
16642
|
}
|
|
16576
16643
|
}
|
|
16577
16644
|
}
|
|
@@ -16755,7 +16822,6 @@ function FiberRootNode(containerInfo, tag, hydrate) {
|
|
|
16755
16822
|
this.context = null;
|
|
16756
16823
|
this.pendingContext = null;
|
|
16757
16824
|
this.hydrate = hydrate;
|
|
16758
|
-
this.firstBatch = null;
|
|
16759
16825
|
this.callbackNode = null;
|
|
16760
16826
|
this.callbackPriority = NoPriority;
|
|
16761
16827
|
this.firstPendingTime = NoWork;
|
|
@@ -16909,35 +16975,23 @@ function getContextForSubtree(parentComponent) {
|
|
|
16909
16975
|
return parentContext;
|
|
16910
16976
|
}
|
|
16911
16977
|
|
|
16912
|
-
function
|
|
16978
|
+
function createContainer(containerInfo, tag, hydrate, hydrationCallbacks) {
|
|
16979
|
+
return createFiberRoot(containerInfo, tag, hydrate, hydrationCallbacks);
|
|
16980
|
+
}
|
|
16981
|
+
function updateContainer(element, container, parentComponent, callback) {
|
|
16982
|
+
var current$$1 = container.current;
|
|
16983
|
+
var currentTime = requestCurrentTimeForUpdate();
|
|
16984
|
+
|
|
16913
16985
|
{
|
|
16914
|
-
|
|
16915
|
-
|
|
16916
|
-
|
|
16986
|
+
// $FlowExpectedError - jest isn't a global, and isn't recognized outside of tests
|
|
16987
|
+
if ('undefined' !== typeof jest) {
|
|
16988
|
+
warnIfUnmockedScheduler(current$$1);
|
|
16989
|
+
warnIfNotScopedWithMatchingAct(current$$1);
|
|
16917
16990
|
}
|
|
16918
16991
|
}
|
|
16919
16992
|
|
|
16920
|
-
var
|
|
16921
|
-
|
|
16922
|
-
|
|
16923
|
-
update.payload = {
|
|
16924
|
-
element: element
|
|
16925
|
-
};
|
|
16926
|
-
callback = callback === undefined ? null : callback;
|
|
16927
|
-
|
|
16928
|
-
if (callback !== null) {
|
|
16929
|
-
!(typeof callback === 'function') ? warningWithoutStack$1(false, 'render(...): Expected the last optional `callback` argument to be a ' + 'function. Instead received: %s.', callback) : void 0;
|
|
16930
|
-
update.callback = callback;
|
|
16931
|
-
}
|
|
16932
|
-
|
|
16933
|
-
enqueueUpdate(current$$1, update);
|
|
16934
|
-
scheduleWork(current$$1, expirationTime);
|
|
16935
|
-
return expirationTime;
|
|
16936
|
-
}
|
|
16937
|
-
|
|
16938
|
-
function updateContainerAtExpirationTime(element, container, parentComponent, expirationTime, suspenseConfig, callback) {
|
|
16939
|
-
// TODO: If this is a nested container, this won't be the root.
|
|
16940
|
-
var current$$1 = container.current;
|
|
16993
|
+
var suspenseConfig = requestCurrentSuspenseConfig();
|
|
16994
|
+
var expirationTime = computeExpirationForFiber(currentTime, current$$1, suspenseConfig);
|
|
16941
16995
|
|
|
16942
16996
|
{
|
|
16943
16997
|
if (ReactFiberInstrumentation_1.debugTool) {
|
|
@@ -16959,27 +17013,29 @@ function updateContainerAtExpirationTime(element, container, parentComponent, ex
|
|
|
16959
17013
|
container.pendingContext = context;
|
|
16960
17014
|
}
|
|
16961
17015
|
|
|
16962
|
-
return scheduleRootUpdate(current$$1, element, expirationTime, suspenseConfig, callback);
|
|
16963
|
-
}
|
|
16964
|
-
|
|
16965
|
-
function createContainer(containerInfo, tag, hydrate, hydrationCallbacks) {
|
|
16966
|
-
return createFiberRoot(containerInfo, tag, hydrate, hydrationCallbacks);
|
|
16967
|
-
}
|
|
16968
|
-
function updateContainer(element, container, parentComponent, callback) {
|
|
16969
|
-
var current$$1 = container.current;
|
|
16970
|
-
var currentTime = requestCurrentTime();
|
|
16971
|
-
|
|
16972
17016
|
{
|
|
16973
|
-
|
|
16974
|
-
|
|
16975
|
-
|
|
16976
|
-
warnIfNotScopedWithMatchingAct(current$$1);
|
|
17017
|
+
if (phase === 'render' && current !== null && !didWarnAboutNestedUpdates) {
|
|
17018
|
+
didWarnAboutNestedUpdates = true;
|
|
17019
|
+
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');
|
|
16977
17020
|
}
|
|
16978
17021
|
}
|
|
16979
17022
|
|
|
16980
|
-
var
|
|
16981
|
-
|
|
16982
|
-
|
|
17023
|
+
var update = createUpdate(expirationTime, suspenseConfig); // Caution: React DevTools currently depends on this property
|
|
17024
|
+
// being called "element".
|
|
17025
|
+
|
|
17026
|
+
update.payload = {
|
|
17027
|
+
element: element
|
|
17028
|
+
};
|
|
17029
|
+
callback = callback === undefined ? null : callback;
|
|
17030
|
+
|
|
17031
|
+
if (callback !== null) {
|
|
17032
|
+
!(typeof callback === 'function') ? warningWithoutStack$1(false, 'render(...): Expected the last optional `callback` argument to be a ' + 'function. Instead received: %s.', callback) : void 0;
|
|
17033
|
+
update.callback = callback;
|
|
17034
|
+
}
|
|
17035
|
+
|
|
17036
|
+
enqueueUpdate(current$$1, update);
|
|
17037
|
+
scheduleWork(current$$1, expirationTime);
|
|
17038
|
+
return expirationTime;
|
|
16983
17039
|
}
|
|
16984
17040
|
function getPublicRootInstance(container) {
|
|
16985
17041
|
var containerFiber = container.current;
|
|
@@ -16999,6 +17055,10 @@ function getPublicRootInstance(container) {
|
|
|
16999
17055
|
|
|
17000
17056
|
|
|
17001
17057
|
|
|
17058
|
+
|
|
17059
|
+
|
|
17060
|
+
|
|
17061
|
+
|
|
17002
17062
|
var shouldSuspendImpl = function (fiber) {
|
|
17003
17063
|
return false;
|
|
17004
17064
|
};
|
|
@@ -17116,7 +17176,7 @@ function injectIntoDevTools(devToolsConfig) {
|
|
|
17116
17176
|
|
|
17117
17177
|
// TODO: this is special because it gets imported during build.
|
|
17118
17178
|
|
|
17119
|
-
var ReactVersion = '16.
|
|
17179
|
+
var ReactVersion = '16.12.0';
|
|
17120
17180
|
|
|
17121
17181
|
var didWarnAboutMessageChannel = false;
|
|
17122
17182
|
var enqueueTask;
|
|
@@ -17470,13 +17530,11 @@ function toTree(node) {
|
|
|
17470
17530
|
return childrenToTree(node.child);
|
|
17471
17531
|
|
|
17472
17532
|
default:
|
|
17473
|
-
|
|
17533
|
+
{
|
|
17474
17534
|
{
|
|
17475
|
-
|
|
17476
|
-
throw ReactError(Error("toTree() does not yet know how to handle nodes with tag=" + node.tag));
|
|
17477
|
-
}
|
|
17535
|
+
throw Error("toTree() does not yet know how to handle nodes with tag=" + node.tag);
|
|
17478
17536
|
}
|
|
17479
|
-
}
|
|
17537
|
+
}
|
|
17480
17538
|
|
|
17481
17539
|
}
|
|
17482
17540
|
}
|
|
@@ -17537,25 +17595,21 @@ function () {
|
|
|
17537
17595
|
// Throws if this component has been unmounted.
|
|
17538
17596
|
var fiber = findCurrentFiberUsingSlowPath(this._fiber);
|
|
17539
17597
|
|
|
17540
|
-
(
|
|
17541
|
-
|
|
17542
|
-
|
|
17543
|
-
throw ReactError(Error("Can't read from currently-mounting component. This error is likely caused by a bug in React. Please file an issue."));
|
|
17544
|
-
}
|
|
17598
|
+
if (!(fiber !== null)) {
|
|
17599
|
+
{
|
|
17600
|
+
throw Error("Can't read from currently-mounting component. This error is likely caused by a bug in React. Please file an issue.");
|
|
17545
17601
|
}
|
|
17546
|
-
}
|
|
17602
|
+
}
|
|
17547
17603
|
|
|
17548
17604
|
return fiber;
|
|
17549
17605
|
};
|
|
17550
17606
|
|
|
17551
17607
|
function ReactTestInstance(fiber) {
|
|
17552
|
-
|
|
17553
|
-
|
|
17554
|
-
|
|
17555
|
-
throw ReactError(Error("Unexpected object passed to ReactTestInstance constructor (tag: " + fiber.tag + "). This is probably a bug in React."));
|
|
17556
|
-
}
|
|
17608
|
+
if (!validWrapperTypes.has(fiber.tag)) {
|
|
17609
|
+
{
|
|
17610
|
+
throw Error("Unexpected object passed to ReactTestInstance constructor (tag: " + fiber.tag + "). This is probably a bug in React.");
|
|
17557
17611
|
}
|
|
17558
|
-
}
|
|
17612
|
+
}
|
|
17559
17613
|
|
|
17560
17614
|
this._fiber = fiber;
|
|
17561
17615
|
}
|
|
@@ -17714,13 +17768,11 @@ var ReactTestRendererFiber = {
|
|
|
17714
17768
|
};
|
|
17715
17769
|
var root = createContainer(container, isConcurrent ? ConcurrentRoot : LegacyRoot, false, null);
|
|
17716
17770
|
|
|
17717
|
-
(
|
|
17718
|
-
|
|
17719
|
-
|
|
17720
|
-
throw ReactError(Error("something went wrong"));
|
|
17721
|
-
}
|
|
17771
|
+
if (!(root != null)) {
|
|
17772
|
+
{
|
|
17773
|
+
throw Error("something went wrong");
|
|
17722
17774
|
}
|
|
17723
|
-
}
|
|
17775
|
+
}
|
|
17724
17776
|
|
|
17725
17777
|
updateContainer(element, root, null, null);
|
|
17726
17778
|
var entry = {
|