react-reconciler 0.22.2 → 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build-info.json +5 -5
- package/cjs/react-reconciler-persistent.development.js +737 -671
- package/cjs/react-reconciler-persistent.production.min.js +164 -164
- package/cjs/react-reconciler-reflection.development.js +27 -55
- package/cjs/react-reconciler-reflection.production.min.js +5 -5
- package/cjs/react-reconciler.development.js +739 -679
- package/cjs/react-reconciler.production.min.js +164 -164
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license React v0.
|
|
1
|
+
/** @license React v0.23.0
|
|
2
2
|
* react-reconciler-persistent.development.js
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
@@ -20,16 +20,8 @@ var Scheduler = require('scheduler');
|
|
|
20
20
|
var tracing = require('scheduler/tracing');
|
|
21
21
|
|
|
22
22
|
// Do not require this module directly! Use normal `invariant` calls with
|
|
23
|
-
// template literal strings. The messages will be
|
|
24
|
-
// build
|
|
25
|
-
|
|
26
|
-
// Do not require this module directly! Use normal `invariant` calls with
|
|
27
|
-
// template literal strings. The messages will be converted to ReactError during
|
|
28
|
-
// build, and in production they will be minified.
|
|
29
|
-
function ReactError(error) {
|
|
30
|
-
error.name = 'Invariant Violation';
|
|
31
|
-
return error;
|
|
32
|
-
}
|
|
23
|
+
// template literal strings. The messages will be replaced with error codes
|
|
24
|
+
// during build.
|
|
33
25
|
|
|
34
26
|
var FunctionComponent = 0;
|
|
35
27
|
var ClassComponent = 1;
|
|
@@ -410,14 +402,12 @@ var enableSuspenseServerRenderer = false;
|
|
|
410
402
|
|
|
411
403
|
|
|
412
404
|
|
|
413
|
-
|
|
414
405
|
var enableFlareAPI = false;
|
|
415
406
|
var enableFundamentalAPI = false;
|
|
416
407
|
var enableScopeAPI = false;
|
|
417
408
|
|
|
418
409
|
var warnAboutUnmockedScheduler = true;
|
|
419
410
|
var flushSuspenseFallbacksInTests = true;
|
|
420
|
-
|
|
421
411
|
var enableSuspenseCallback = false;
|
|
422
412
|
var warnAboutDefaultPropsOnFunctionComponents = false;
|
|
423
413
|
var warnAboutStringRefs = false;
|
|
@@ -492,13 +482,11 @@ function isMounted(component) {
|
|
|
492
482
|
}
|
|
493
483
|
|
|
494
484
|
function assertIsMounted(fiber) {
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
throw ReactError(Error("Unable to find node on an unmounted component."));
|
|
499
|
-
}
|
|
485
|
+
if (!(getNearestMountedFiber(fiber) === fiber)) {
|
|
486
|
+
{
|
|
487
|
+
throw Error("Unable to find node on an unmounted component.");
|
|
500
488
|
}
|
|
501
|
-
}
|
|
489
|
+
}
|
|
502
490
|
}
|
|
503
491
|
|
|
504
492
|
function findCurrentFiberUsingSlowPath(fiber) {
|
|
@@ -508,13 +496,11 @@ function findCurrentFiberUsingSlowPath(fiber) {
|
|
|
508
496
|
// If there is no alternate, then we only need to check if it is mounted.
|
|
509
497
|
var nearestMounted = getNearestMountedFiber(fiber);
|
|
510
498
|
|
|
511
|
-
(
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
throw ReactError(Error("Unable to find node on an unmounted component."));
|
|
515
|
-
}
|
|
499
|
+
if (!(nearestMounted !== null)) {
|
|
500
|
+
{
|
|
501
|
+
throw Error("Unable to find node on an unmounted component.");
|
|
516
502
|
}
|
|
517
|
-
}
|
|
503
|
+
}
|
|
518
504
|
|
|
519
505
|
if (nearestMounted !== fiber) {
|
|
520
506
|
return null;
|
|
@@ -579,13 +565,11 @@ function findCurrentFiberUsingSlowPath(fiber) {
|
|
|
579
565
|
// way this could possibly happen is if this was unmounted, if at all.
|
|
580
566
|
|
|
581
567
|
|
|
582
|
-
|
|
568
|
+
{
|
|
583
569
|
{
|
|
584
|
-
|
|
585
|
-
throw ReactError(Error("Unable to find node on an unmounted component."));
|
|
586
|
-
}
|
|
570
|
+
throw Error("Unable to find node on an unmounted component.");
|
|
587
571
|
}
|
|
588
|
-
}
|
|
572
|
+
}
|
|
589
573
|
}
|
|
590
574
|
|
|
591
575
|
if (a.return !== b.return) {
|
|
@@ -644,34 +628,28 @@ function findCurrentFiberUsingSlowPath(fiber) {
|
|
|
644
628
|
_child = _child.sibling;
|
|
645
629
|
}
|
|
646
630
|
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
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."));
|
|
651
|
-
}
|
|
631
|
+
if (!didFindChild) {
|
|
632
|
+
{
|
|
633
|
+
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.");
|
|
652
634
|
}
|
|
653
|
-
}
|
|
635
|
+
}
|
|
654
636
|
}
|
|
655
637
|
}
|
|
656
638
|
|
|
657
|
-
(
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
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."));
|
|
661
|
-
}
|
|
639
|
+
if (!(a.alternate === b)) {
|
|
640
|
+
{
|
|
641
|
+
throw Error("Return fibers should always be each others' alternates. This error is likely caused by a bug in React. Please file an issue.");
|
|
662
642
|
}
|
|
663
|
-
}
|
|
643
|
+
}
|
|
664
644
|
} // If the root is not a host container, we're in a disconnected tree. I.e.
|
|
665
645
|
// unmounted.
|
|
666
646
|
|
|
667
647
|
|
|
668
|
-
(
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
throw ReactError(Error("Unable to find node on an unmounted component."));
|
|
672
|
-
}
|
|
648
|
+
if (!(a.tag === HostRoot)) {
|
|
649
|
+
{
|
|
650
|
+
throw Error("Unable to find node on an unmounted component.");
|
|
673
651
|
}
|
|
674
|
-
}
|
|
652
|
+
}
|
|
675
653
|
|
|
676
654
|
if (a.stateNode.current === a) {
|
|
677
655
|
// We've determined that A is the current branch.
|
|
@@ -813,7 +791,8 @@ var mountResponderInstance = $$$hostConfig.mountResponderInstance;
|
|
|
813
791
|
var unmountResponderInstance = $$$hostConfig.unmountResponderInstance;
|
|
814
792
|
var getFundamentalComponentInstance = $$$hostConfig.getFundamentalComponentInstance;
|
|
815
793
|
var mountFundamentalComponent = $$$hostConfig.mountFundamentalComponent;
|
|
816
|
-
var shouldUpdateFundamentalComponent = $$$hostConfig.shouldUpdateFundamentalComponent;
|
|
794
|
+
var shouldUpdateFundamentalComponent = $$$hostConfig.shouldUpdateFundamentalComponent;
|
|
795
|
+
var getInstanceFromNode = $$$hostConfig.getInstanceFromNode; // -------------------
|
|
817
796
|
// Mutation
|
|
818
797
|
// (optional)
|
|
819
798
|
// -------------------
|
|
@@ -1597,13 +1576,11 @@ function pushTopLevelContextObject(fiber, context, didChange) {
|
|
|
1597
1576
|
if (disableLegacyContext) {
|
|
1598
1577
|
return;
|
|
1599
1578
|
} else {
|
|
1600
|
-
(
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
throw ReactError(Error("Unexpected context found on stack. This error is likely caused by a bug in React. Please file an issue."));
|
|
1604
|
-
}
|
|
1579
|
+
if (!(contextStackCursor.current === emptyContextObject)) {
|
|
1580
|
+
{
|
|
1581
|
+
throw Error("Unexpected context found on stack. This error is likely caused by a bug in React. Please file an issue.");
|
|
1605
1582
|
}
|
|
1606
|
-
}
|
|
1583
|
+
}
|
|
1607
1584
|
|
|
1608
1585
|
push(contextStackCursor, context, fiber);
|
|
1609
1586
|
push(didPerformWorkStackCursor, didChange, fiber);
|
|
@@ -1646,13 +1623,11 @@ function processChildContext(fiber, type, parentContext) {
|
|
|
1646
1623
|
}
|
|
1647
1624
|
|
|
1648
1625
|
for (var contextKey in childContext) {
|
|
1649
|
-
(
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
throw ReactError(Error((getComponentName(type) || 'Unknown') + ".getChildContext(): key \"" + contextKey + "\" is not defined in childContextTypes."));
|
|
1653
|
-
}
|
|
1626
|
+
if (!(contextKey in childContextTypes)) {
|
|
1627
|
+
{
|
|
1628
|
+
throw Error((getComponentName(type) || 'Unknown') + ".getChildContext(): key \"" + contextKey + "\" is not defined in childContextTypes.");
|
|
1654
1629
|
}
|
|
1655
|
-
}
|
|
1630
|
+
}
|
|
1656
1631
|
}
|
|
1657
1632
|
|
|
1658
1633
|
{
|
|
@@ -1693,13 +1668,11 @@ function invalidateContextProvider(workInProgress, type, didChange) {
|
|
|
1693
1668
|
} else {
|
|
1694
1669
|
var instance = workInProgress.stateNode;
|
|
1695
1670
|
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
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."));
|
|
1700
|
-
}
|
|
1671
|
+
if (!instance) {
|
|
1672
|
+
{
|
|
1673
|
+
throw Error("Expected to have an instance by this point. This error is likely caused by a bug in React. Please file an issue.");
|
|
1701
1674
|
}
|
|
1702
|
-
}
|
|
1675
|
+
}
|
|
1703
1676
|
|
|
1704
1677
|
if (didChange) {
|
|
1705
1678
|
// Merge parent and own context.
|
|
@@ -1727,13 +1700,11 @@ function findCurrentUnmaskedContext(fiber) {
|
|
|
1727
1700
|
} else {
|
|
1728
1701
|
// Currently this is only used with renderSubtreeIntoContainer; not sure if it
|
|
1729
1702
|
// makes sense elsewhere
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
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."));
|
|
1734
|
-
}
|
|
1703
|
+
if (!(isFiberMounted(fiber) && fiber.tag === ClassComponent)) {
|
|
1704
|
+
{
|
|
1705
|
+
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.");
|
|
1735
1706
|
}
|
|
1736
|
-
}
|
|
1707
|
+
}
|
|
1737
1708
|
|
|
1738
1709
|
var node = fiber;
|
|
1739
1710
|
|
|
@@ -1757,13 +1728,11 @@ function findCurrentUnmaskedContext(fiber) {
|
|
|
1757
1728
|
node = node.return;
|
|
1758
1729
|
} while (node !== null);
|
|
1759
1730
|
|
|
1760
|
-
|
|
1731
|
+
{
|
|
1761
1732
|
{
|
|
1762
|
-
|
|
1763
|
-
throw ReactError(Error("Found unexpected detached subtree parent. This error is likely caused by a bug in React. Please file an issue."));
|
|
1764
|
-
}
|
|
1733
|
+
throw Error("Found unexpected detached subtree parent. This error is likely caused by a bug in React. Please file an issue.");
|
|
1765
1734
|
}
|
|
1766
|
-
}
|
|
1735
|
+
}
|
|
1767
1736
|
}
|
|
1768
1737
|
}
|
|
1769
1738
|
|
|
@@ -1789,13 +1758,11 @@ if (enableSchedulerTracing) {
|
|
|
1789
1758
|
// Provide explicit error message when production+profiling bundle of e.g.
|
|
1790
1759
|
// react-dom is used with production (non-profiling) bundle of
|
|
1791
1760
|
// scheduler/tracing
|
|
1792
|
-
(
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
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"));
|
|
1796
|
-
}
|
|
1761
|
+
if (!(tracing.__interactionsRef != null && tracing.__interactionsRef.current != null)) {
|
|
1762
|
+
{
|
|
1763
|
+
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");
|
|
1797
1764
|
}
|
|
1798
|
-
}
|
|
1765
|
+
}
|
|
1799
1766
|
}
|
|
1800
1767
|
|
|
1801
1768
|
var fakeCallbackNode = {}; // Except for NoPriority, these correspond to Scheduler priorities. We use
|
|
@@ -1844,13 +1811,11 @@ function getCurrentPriorityLevel() {
|
|
|
1844
1811
|
return IdlePriority;
|
|
1845
1812
|
|
|
1846
1813
|
default:
|
|
1847
|
-
|
|
1814
|
+
{
|
|
1848
1815
|
{
|
|
1849
|
-
|
|
1850
|
-
throw ReactError(Error("Unknown priority level."));
|
|
1851
|
-
}
|
|
1816
|
+
throw Error("Unknown priority level.");
|
|
1852
1817
|
}
|
|
1853
|
-
}
|
|
1818
|
+
}
|
|
1854
1819
|
|
|
1855
1820
|
}
|
|
1856
1821
|
}
|
|
@@ -1873,13 +1838,11 @@ function reactPriorityToSchedulerPriority(reactPriorityLevel) {
|
|
|
1873
1838
|
return Scheduler_IdlePriority;
|
|
1874
1839
|
|
|
1875
1840
|
default:
|
|
1876
|
-
|
|
1841
|
+
{
|
|
1877
1842
|
{
|
|
1878
|
-
|
|
1879
|
-
throw ReactError(Error("Unknown priority level."));
|
|
1880
|
-
}
|
|
1843
|
+
throw Error("Unknown priority level.");
|
|
1881
1844
|
}
|
|
1882
|
-
}
|
|
1845
|
+
}
|
|
1883
1846
|
|
|
1884
1847
|
}
|
|
1885
1848
|
}
|
|
@@ -1980,7 +1943,11 @@ var NoWork = 0; // TODO: Think of a better name for Never. The key difference wi
|
|
|
1980
1943
|
var Never = 1; // Idle is slightly higher priority than Never. It must completely finish in
|
|
1981
1944
|
// order to be consistent.
|
|
1982
1945
|
|
|
1983
|
-
var Idle = 2;
|
|
1946
|
+
var Idle = 2; // Continuous Hydration is a moving priority. It is slightly higher than Idle
|
|
1947
|
+
// and is used to increase priority of hover targets. It is increasing with
|
|
1948
|
+
// each usage so that last always wins.
|
|
1949
|
+
|
|
1950
|
+
var ContinuousHydration = 3;
|
|
1984
1951
|
var Sync = MAX_SIGNED_31_BIT_INT;
|
|
1985
1952
|
var Batched = Sync - 1;
|
|
1986
1953
|
var UNIT_SIZE = 10;
|
|
@@ -2029,6 +1996,12 @@ var HIGH_PRIORITY_BATCH_SIZE = 100;
|
|
|
2029
1996
|
function computeInteractiveExpiration(currentTime) {
|
|
2030
1997
|
return computeExpirationBucket(currentTime, HIGH_PRIORITY_EXPIRATION, HIGH_PRIORITY_BATCH_SIZE);
|
|
2031
1998
|
}
|
|
1999
|
+
function computeContinuousHydrationExpiration(currentTime) {
|
|
2000
|
+
// Each time we ask for a new one of these we increase the priority.
|
|
2001
|
+
// This ensures that the last one always wins since we can't deprioritize
|
|
2002
|
+
// once we've scheduled work already.
|
|
2003
|
+
return ContinuousHydration++;
|
|
2004
|
+
}
|
|
2032
2005
|
function inferPriorityFromExpirationTime(currentTime, expirationTime) {
|
|
2033
2006
|
if (expirationTime === Sync) {
|
|
2034
2007
|
return ImmediatePriority;
|
|
@@ -2576,7 +2549,9 @@ var scheduleRoot = function (root, element) {
|
|
|
2576
2549
|
}
|
|
2577
2550
|
|
|
2578
2551
|
flushPassiveEffects();
|
|
2579
|
-
|
|
2552
|
+
syncUpdates(function () {
|
|
2553
|
+
updateContainer(element, root, null, null);
|
|
2554
|
+
});
|
|
2580
2555
|
}
|
|
2581
2556
|
};
|
|
2582
2557
|
|
|
@@ -2978,13 +2953,11 @@ function propagateContextChange(workInProgress, context, changedBits, renderExpi
|
|
|
2978
2953
|
// mark it as having updates.
|
|
2979
2954
|
var parentSuspense = fiber.return;
|
|
2980
2955
|
|
|
2981
|
-
(
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
throw ReactError(Error("We just came from a parent so we must have had a parent. This is a bug in React."));
|
|
2985
|
-
}
|
|
2956
|
+
if (!(parentSuspense !== null)) {
|
|
2957
|
+
{
|
|
2958
|
+
throw Error("We just came from a parent so we must have had a parent. This is a bug in React.");
|
|
2986
2959
|
}
|
|
2987
|
-
}
|
|
2960
|
+
}
|
|
2988
2961
|
|
|
2989
2962
|
if (parentSuspense.expirationTime < renderExpirationTime) {
|
|
2990
2963
|
parentSuspense.expirationTime = renderExpirationTime;
|
|
@@ -3085,13 +3058,11 @@ function readContext(context, observedBits) {
|
|
|
3085
3058
|
};
|
|
3086
3059
|
|
|
3087
3060
|
if (lastContextDependency === null) {
|
|
3088
|
-
(
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
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()."));
|
|
3092
|
-
}
|
|
3061
|
+
if (!(currentlyRenderingFiber !== null)) {
|
|
3062
|
+
{
|
|
3063
|
+
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().");
|
|
3093
3064
|
}
|
|
3094
|
-
}
|
|
3065
|
+
} // This is the first dependency for this component. Create a new list.
|
|
3095
3066
|
|
|
3096
3067
|
|
|
3097
3068
|
lastContextDependency = contextItem;
|
|
@@ -3596,13 +3567,11 @@ function processUpdateQueue(workInProgress, queue, props, instance, renderExpira
|
|
|
3596
3567
|
}
|
|
3597
3568
|
|
|
3598
3569
|
function callCallback(callback, context) {
|
|
3599
|
-
(function
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
throw ReactError(Error("Invalid argument passed as callback. Expected a function. Instead received: " + callback));
|
|
3603
|
-
}
|
|
3570
|
+
if (!(typeof callback === 'function')) {
|
|
3571
|
+
{
|
|
3572
|
+
throw Error("Invalid argument passed as callback. Expected a function. Instead received: " + callback);
|
|
3604
3573
|
}
|
|
3605
|
-
}
|
|
3574
|
+
}
|
|
3606
3575
|
|
|
3607
3576
|
callback.call(context);
|
|
3608
3577
|
}
|
|
@@ -3713,13 +3682,11 @@ var didWarnAboutInvalidateContextType;
|
|
|
3713
3682
|
Object.defineProperty(fakeInternalInstance, '_processChildContext', {
|
|
3714
3683
|
enumerable: false,
|
|
3715
3684
|
value: function () {
|
|
3716
|
-
|
|
3685
|
+
{
|
|
3717
3686
|
{
|
|
3718
|
-
|
|
3719
|
-
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)."));
|
|
3720
|
-
}
|
|
3687
|
+
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).");
|
|
3721
3688
|
}
|
|
3722
|
-
}
|
|
3689
|
+
}
|
|
3723
3690
|
}
|
|
3724
3691
|
});
|
|
3725
3692
|
Object.freeze(fakeInternalInstance);
|
|
@@ -3756,7 +3723,7 @@ var classComponentUpdater = {
|
|
|
3756
3723
|
isMounted: isMounted,
|
|
3757
3724
|
enqueueSetState: function (inst, payload, callback) {
|
|
3758
3725
|
var fiber = get(inst);
|
|
3759
|
-
var currentTime =
|
|
3726
|
+
var currentTime = requestCurrentTimeForUpdate();
|
|
3760
3727
|
var suspenseConfig = requestCurrentSuspenseConfig();
|
|
3761
3728
|
var expirationTime = computeExpirationForFiber(currentTime, fiber, suspenseConfig);
|
|
3762
3729
|
var update = createUpdate(expirationTime, suspenseConfig);
|
|
@@ -3775,7 +3742,7 @@ var classComponentUpdater = {
|
|
|
3775
3742
|
},
|
|
3776
3743
|
enqueueReplaceState: function (inst, payload, callback) {
|
|
3777
3744
|
var fiber = get(inst);
|
|
3778
|
-
var currentTime =
|
|
3745
|
+
var currentTime = requestCurrentTimeForUpdate();
|
|
3779
3746
|
var suspenseConfig = requestCurrentSuspenseConfig();
|
|
3780
3747
|
var expirationTime = computeExpirationForFiber(currentTime, fiber, suspenseConfig);
|
|
3781
3748
|
var update = createUpdate(expirationTime, suspenseConfig);
|
|
@@ -3795,7 +3762,7 @@ var classComponentUpdater = {
|
|
|
3795
3762
|
},
|
|
3796
3763
|
enqueueForceUpdate: function (inst, callback) {
|
|
3797
3764
|
var fiber = get(inst);
|
|
3798
|
-
var currentTime =
|
|
3765
|
+
var currentTime = requestCurrentTimeForUpdate();
|
|
3799
3766
|
var suspenseConfig = requestCurrentSuspenseConfig();
|
|
3800
3767
|
var expirationTime = computeExpirationForFiber(currentTime, fiber, suspenseConfig);
|
|
3801
3768
|
var update = createUpdate(expirationTime, suspenseConfig);
|
|
@@ -4410,13 +4377,11 @@ var warnForMissingKey = function (child) {};
|
|
|
4410
4377
|
return;
|
|
4411
4378
|
}
|
|
4412
4379
|
|
|
4413
|
-
(
|
|
4414
|
-
|
|
4415
|
-
|
|
4416
|
-
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."));
|
|
4417
|
-
}
|
|
4380
|
+
if (!(typeof child._store === 'object')) {
|
|
4381
|
+
{
|
|
4382
|
+
throw Error("React Component in warnForMissingKey should have a _store. This error is likely caused by a bug in React. Please file an issue.");
|
|
4418
4383
|
}
|
|
4419
|
-
}
|
|
4384
|
+
}
|
|
4420
4385
|
|
|
4421
4386
|
child._store.validated = true;
|
|
4422
4387
|
var currentComponentErrorInfo = 'Each child in a list should have a unique ' + '"key" prop. See https://fb.me/react-warning-keys for ' + 'more information.' + getCurrentFiberStackInDev();
|
|
@@ -4461,24 +4426,20 @@ function coerceRef(returnFiber, current$$1, element) {
|
|
|
4461
4426
|
if (owner) {
|
|
4462
4427
|
var ownerFiber = owner;
|
|
4463
4428
|
|
|
4464
|
-
(
|
|
4465
|
-
|
|
4466
|
-
|
|
4467
|
-
throw ReactError(Error("Function components cannot have refs. Did you mean to use React.forwardRef()?"));
|
|
4468
|
-
}
|
|
4429
|
+
if (!(ownerFiber.tag === ClassComponent)) {
|
|
4430
|
+
{
|
|
4431
|
+
throw Error("Function components cannot have refs. Did you mean to use React.forwardRef()?");
|
|
4469
4432
|
}
|
|
4470
|
-
}
|
|
4433
|
+
}
|
|
4471
4434
|
|
|
4472
4435
|
inst = ownerFiber.stateNode;
|
|
4473
4436
|
}
|
|
4474
4437
|
|
|
4475
|
-
|
|
4476
|
-
|
|
4477
|
-
|
|
4478
|
-
throw ReactError(Error("Missing owner for string ref " + mixedRef + ". This error is likely caused by a bug in React. Please file an issue."));
|
|
4479
|
-
}
|
|
4438
|
+
if (!inst) {
|
|
4439
|
+
{
|
|
4440
|
+
throw Error("Missing owner for string ref " + mixedRef + ". This error is likely caused by a bug in React. Please file an issue.");
|
|
4480
4441
|
}
|
|
4481
|
-
}
|
|
4442
|
+
}
|
|
4482
4443
|
|
|
4483
4444
|
var stringRef = '' + mixedRef; // Check if previous string ref matches new string ref
|
|
4484
4445
|
|
|
@@ -4504,21 +4465,17 @@ function coerceRef(returnFiber, current$$1, element) {
|
|
|
4504
4465
|
ref._stringRef = stringRef;
|
|
4505
4466
|
return ref;
|
|
4506
4467
|
} else {
|
|
4507
|
-
(
|
|
4508
|
-
|
|
4509
|
-
|
|
4510
|
-
throw ReactError(Error("Expected ref to be a function, a string, an object returned by React.createRef(), or null."));
|
|
4511
|
-
}
|
|
4468
|
+
if (!(typeof mixedRef === 'string')) {
|
|
4469
|
+
{
|
|
4470
|
+
throw Error("Expected ref to be a function, a string, an object returned by React.createRef(), or null.");
|
|
4512
4471
|
}
|
|
4513
|
-
}
|
|
4472
|
+
}
|
|
4514
4473
|
|
|
4515
|
-
|
|
4516
|
-
|
|
4517
|
-
|
|
4518
|
-
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."));
|
|
4519
|
-
}
|
|
4474
|
+
if (!element._owner) {
|
|
4475
|
+
{
|
|
4476
|
+
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.");
|
|
4520
4477
|
}
|
|
4521
|
-
}
|
|
4478
|
+
}
|
|
4522
4479
|
}
|
|
4523
4480
|
}
|
|
4524
4481
|
|
|
@@ -4533,13 +4490,11 @@ function throwOnInvalidObjectType(returnFiber, newChild) {
|
|
|
4533
4490
|
addendum = ' If you meant to render a collection of children, use an array ' + 'instead.' + getCurrentFiberStackInDev();
|
|
4534
4491
|
}
|
|
4535
4492
|
|
|
4536
|
-
|
|
4493
|
+
{
|
|
4537
4494
|
{
|
|
4538
|
-
{
|
|
4539
|
-
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));
|
|
4540
|
-
}
|
|
4495
|
+
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);
|
|
4541
4496
|
}
|
|
4542
|
-
}
|
|
4497
|
+
}
|
|
4543
4498
|
}
|
|
4544
4499
|
}
|
|
4545
4500
|
|
|
@@ -5087,13 +5042,11 @@ function ChildReconciler(shouldTrackSideEffects) {
|
|
|
5087
5042
|
// but using the iterator instead.
|
|
5088
5043
|
var iteratorFn = getIteratorFn(newChildrenIterable);
|
|
5089
5044
|
|
|
5090
|
-
(function
|
|
5091
|
-
|
|
5092
|
-
|
|
5093
|
-
throw ReactError(Error("An object is not an iterable. This error is likely caused by a bug in React. Please file an issue."));
|
|
5094
|
-
}
|
|
5045
|
+
if (!(typeof iteratorFn === 'function')) {
|
|
5046
|
+
{
|
|
5047
|
+
throw Error("An object is not an iterable. This error is likely caused by a bug in React. Please file an issue.");
|
|
5095
5048
|
}
|
|
5096
|
-
}
|
|
5049
|
+
}
|
|
5097
5050
|
|
|
5098
5051
|
{
|
|
5099
5052
|
// We don't support rendering Generators because it's a mutation.
|
|
@@ -5128,13 +5081,11 @@ function ChildReconciler(shouldTrackSideEffects) {
|
|
|
5128
5081
|
|
|
5129
5082
|
var newChildren = iteratorFn.call(newChildrenIterable);
|
|
5130
5083
|
|
|
5131
|
-
(
|
|
5132
|
-
|
|
5133
|
-
|
|
5134
|
-
throw ReactError(Error("An iterable object provided no iterator."));
|
|
5135
|
-
}
|
|
5084
|
+
if (!(newChildren != null)) {
|
|
5085
|
+
{
|
|
5086
|
+
throw Error("An iterable object provided no iterator.");
|
|
5136
5087
|
}
|
|
5137
|
-
}
|
|
5088
|
+
}
|
|
5138
5089
|
|
|
5139
5090
|
var resultingFirstChild = null;
|
|
5140
5091
|
var previousNewFiber = null;
|
|
@@ -5432,13 +5383,11 @@ function ChildReconciler(shouldTrackSideEffects) {
|
|
|
5432
5383
|
{
|
|
5433
5384
|
var Component = returnFiber.type;
|
|
5434
5385
|
|
|
5435
|
-
|
|
5386
|
+
{
|
|
5436
5387
|
{
|
|
5437
|
-
|
|
5438
|
-
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."));
|
|
5439
|
-
}
|
|
5388
|
+
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.");
|
|
5440
5389
|
}
|
|
5441
|
-
}
|
|
5390
|
+
}
|
|
5442
5391
|
}
|
|
5443
5392
|
}
|
|
5444
5393
|
} // Remaining cases are all treated as empty.
|
|
@@ -5453,13 +5402,11 @@ function ChildReconciler(shouldTrackSideEffects) {
|
|
|
5453
5402
|
var reconcileChildFibers = ChildReconciler(true);
|
|
5454
5403
|
var mountChildFibers = ChildReconciler(false);
|
|
5455
5404
|
function cloneChildFibers(current$$1, workInProgress) {
|
|
5456
|
-
(
|
|
5457
|
-
|
|
5458
|
-
|
|
5459
|
-
throw ReactError(Error("Resuming work not yet implemented."));
|
|
5460
|
-
}
|
|
5405
|
+
if (!(current$$1 === null || workInProgress.child === current$$1.child)) {
|
|
5406
|
+
{
|
|
5407
|
+
throw Error("Resuming work not yet implemented.");
|
|
5461
5408
|
}
|
|
5462
|
-
}
|
|
5409
|
+
}
|
|
5463
5410
|
|
|
5464
5411
|
if (workInProgress.child === null) {
|
|
5465
5412
|
return;
|
|
@@ -5494,13 +5441,11 @@ var contextFiberStackCursor = createCursor(NO_CONTEXT);
|
|
|
5494
5441
|
var rootInstanceStackCursor = createCursor(NO_CONTEXT);
|
|
5495
5442
|
|
|
5496
5443
|
function requiredContext(c) {
|
|
5497
|
-
(
|
|
5498
|
-
|
|
5499
|
-
|
|
5500
|
-
throw ReactError(Error("Expected host context to exist. This error is likely caused by a bug in React. Please file an issue."));
|
|
5501
|
-
}
|
|
5444
|
+
if (!(c !== NO_CONTEXT)) {
|
|
5445
|
+
{
|
|
5446
|
+
throw Error("Expected host context to exist. This error is likely caused by a bug in React. Please file an issue.");
|
|
5502
5447
|
}
|
|
5503
|
-
}
|
|
5448
|
+
}
|
|
5504
5449
|
|
|
5505
5450
|
return c;
|
|
5506
5451
|
}
|
|
@@ -5738,13 +5683,11 @@ function updateEventListener(listener, fiber, visistedResponders, respondersMap,
|
|
|
5738
5683
|
props = listener.props;
|
|
5739
5684
|
}
|
|
5740
5685
|
|
|
5741
|
-
(
|
|
5742
|
-
|
|
5743
|
-
|
|
5744
|
-
throw ReactError(Error("An invalid value was used as an event listener. Expect one or many event listeners created via React.unstable_useResponder()."));
|
|
5745
|
-
}
|
|
5686
|
+
if (!(responder && responder.$$typeof === REACT_RESPONDER_TYPE)) {
|
|
5687
|
+
{
|
|
5688
|
+
throw Error("An invalid value was used as an event listener. Expect one or many event listeners created via React.unstable_useResponder().");
|
|
5746
5689
|
}
|
|
5747
|
-
}
|
|
5690
|
+
}
|
|
5748
5691
|
|
|
5749
5692
|
var listenerProps = props;
|
|
5750
5693
|
|
|
@@ -5859,6 +5802,7 @@ var UnmountPassive =
|
|
|
5859
5802
|
128;
|
|
5860
5803
|
|
|
5861
5804
|
var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher;
|
|
5805
|
+
var ReactCurrentBatchConfig$1 = ReactSharedInternals.ReactCurrentBatchConfig;
|
|
5862
5806
|
var didWarnAboutMismatchedHooksForComponent;
|
|
5863
5807
|
|
|
5864
5808
|
{
|
|
@@ -5976,13 +5920,11 @@ function warnOnHookMismatchInDev(currentHookName) {
|
|
|
5976
5920
|
}
|
|
5977
5921
|
|
|
5978
5922
|
function throwInvalidHookError() {
|
|
5979
|
-
|
|
5923
|
+
{
|
|
5980
5924
|
{
|
|
5981
|
-
|
|
5982
|
-
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."));
|
|
5983
|
-
}
|
|
5925
|
+
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.");
|
|
5984
5926
|
}
|
|
5985
|
-
}
|
|
5927
|
+
}
|
|
5986
5928
|
}
|
|
5987
5929
|
|
|
5988
5930
|
function areHookInputsEqual(nextDeps, prevDeps) {
|
|
@@ -6132,13 +6074,11 @@ function renderWithHooks(current, workInProgress, Component, props, refOrContext
|
|
|
6132
6074
|
// renderPhaseUpdates = null;
|
|
6133
6075
|
// numberOfReRenders = 0;
|
|
6134
6076
|
|
|
6135
|
-
|
|
6136
|
-
|
|
6137
|
-
|
|
6138
|
-
throw ReactError(Error("Rendered fewer hooks than expected. This may be caused by an accidental early return statement."));
|
|
6139
|
-
}
|
|
6077
|
+
if (!!didRenderTooFewHooks) {
|
|
6078
|
+
{
|
|
6079
|
+
throw Error("Rendered fewer hooks than expected. This may be caused by an accidental early return statement.");
|
|
6140
6080
|
}
|
|
6141
|
-
}
|
|
6081
|
+
}
|
|
6142
6082
|
|
|
6143
6083
|
return children;
|
|
6144
6084
|
}
|
|
@@ -6213,13 +6153,11 @@ function updateWorkInProgressHook() {
|
|
|
6213
6153
|
nextCurrentHook = currentHook !== null ? currentHook.next : null;
|
|
6214
6154
|
} else {
|
|
6215
6155
|
// Clone from the current hook.
|
|
6216
|
-
(
|
|
6217
|
-
|
|
6218
|
-
|
|
6219
|
-
throw ReactError(Error("Rendered more hooks than during the previous render."));
|
|
6220
|
-
}
|
|
6156
|
+
if (!(nextCurrentHook !== null)) {
|
|
6157
|
+
{
|
|
6158
|
+
throw Error("Rendered more hooks than during the previous render.");
|
|
6221
6159
|
}
|
|
6222
|
-
}
|
|
6160
|
+
}
|
|
6223
6161
|
|
|
6224
6162
|
currentHook = nextCurrentHook;
|
|
6225
6163
|
var newHook = {
|
|
@@ -6280,13 +6218,11 @@ function updateReducer(reducer, initialArg, init) {
|
|
|
6280
6218
|
var hook = updateWorkInProgressHook();
|
|
6281
6219
|
var queue = hook.queue;
|
|
6282
6220
|
|
|
6283
|
-
(
|
|
6284
|
-
|
|
6285
|
-
|
|
6286
|
-
throw ReactError(Error("Should have a queue. This is likely a bug in React. Please file an issue."));
|
|
6287
|
-
}
|
|
6221
|
+
if (!(queue !== null)) {
|
|
6222
|
+
{
|
|
6223
|
+
throw Error("Should have a queue. This is likely a bug in React. Please file an issue.");
|
|
6288
6224
|
}
|
|
6289
|
-
}
|
|
6225
|
+
}
|
|
6290
6226
|
|
|
6291
6227
|
queue.lastRenderedReducer = reducer;
|
|
6292
6228
|
|
|
@@ -6667,14 +6603,96 @@ function updateMemo(nextCreate, deps) {
|
|
|
6667
6603
|
return nextValue;
|
|
6668
6604
|
}
|
|
6669
6605
|
|
|
6670
|
-
function
|
|
6671
|
-
|
|
6672
|
-
|
|
6673
|
-
|
|
6674
|
-
|
|
6606
|
+
function mountDeferredValue(value, config) {
|
|
6607
|
+
var _mountState = mountState(value),
|
|
6608
|
+
prevValue = _mountState[0],
|
|
6609
|
+
setValue = _mountState[1];
|
|
6610
|
+
|
|
6611
|
+
mountEffect(function () {
|
|
6612
|
+
Scheduler.unstable_next(function () {
|
|
6613
|
+
var previousConfig = ReactCurrentBatchConfig$1.suspense;
|
|
6614
|
+
ReactCurrentBatchConfig$1.suspense = config === undefined ? null : config;
|
|
6615
|
+
|
|
6616
|
+
try {
|
|
6617
|
+
setValue(value);
|
|
6618
|
+
} finally {
|
|
6619
|
+
ReactCurrentBatchConfig$1.suspense = previousConfig;
|
|
6620
|
+
}
|
|
6621
|
+
});
|
|
6622
|
+
}, [value, config]);
|
|
6623
|
+
return prevValue;
|
|
6624
|
+
}
|
|
6625
|
+
|
|
6626
|
+
function updateDeferredValue(value, config) {
|
|
6627
|
+
var _updateState = updateState(value),
|
|
6628
|
+
prevValue = _updateState[0],
|
|
6629
|
+
setValue = _updateState[1];
|
|
6630
|
+
|
|
6631
|
+
updateEffect(function () {
|
|
6632
|
+
Scheduler.unstable_next(function () {
|
|
6633
|
+
var previousConfig = ReactCurrentBatchConfig$1.suspense;
|
|
6634
|
+
ReactCurrentBatchConfig$1.suspense = config === undefined ? null : config;
|
|
6635
|
+
|
|
6636
|
+
try {
|
|
6637
|
+
setValue(value);
|
|
6638
|
+
} finally {
|
|
6639
|
+
ReactCurrentBatchConfig$1.suspense = previousConfig;
|
|
6640
|
+
}
|
|
6641
|
+
});
|
|
6642
|
+
}, [value, config]);
|
|
6643
|
+
return prevValue;
|
|
6644
|
+
}
|
|
6645
|
+
|
|
6646
|
+
function mountTransition(config) {
|
|
6647
|
+
var _mountState2 = mountState(false),
|
|
6648
|
+
isPending = _mountState2[0],
|
|
6649
|
+
setPending = _mountState2[1];
|
|
6650
|
+
|
|
6651
|
+
var startTransition = mountCallback(function (callback) {
|
|
6652
|
+
setPending(true);
|
|
6653
|
+
Scheduler.unstable_next(function () {
|
|
6654
|
+
var previousConfig = ReactCurrentBatchConfig$1.suspense;
|
|
6655
|
+
ReactCurrentBatchConfig$1.suspense = config === undefined ? null : config;
|
|
6656
|
+
|
|
6657
|
+
try {
|
|
6658
|
+
setPending(false);
|
|
6659
|
+
callback();
|
|
6660
|
+
} finally {
|
|
6661
|
+
ReactCurrentBatchConfig$1.suspense = previousConfig;
|
|
6662
|
+
}
|
|
6663
|
+
});
|
|
6664
|
+
}, [config, isPending]);
|
|
6665
|
+
return [startTransition, isPending];
|
|
6666
|
+
}
|
|
6667
|
+
|
|
6668
|
+
function updateTransition(config) {
|
|
6669
|
+
var _updateState2 = updateState(false),
|
|
6670
|
+
isPending = _updateState2[0],
|
|
6671
|
+
setPending = _updateState2[1];
|
|
6672
|
+
|
|
6673
|
+
var startTransition = updateCallback(function (callback) {
|
|
6674
|
+
setPending(true);
|
|
6675
|
+
Scheduler.unstable_next(function () {
|
|
6676
|
+
var previousConfig = ReactCurrentBatchConfig$1.suspense;
|
|
6677
|
+
ReactCurrentBatchConfig$1.suspense = config === undefined ? null : config;
|
|
6678
|
+
|
|
6679
|
+
try {
|
|
6680
|
+
setPending(false);
|
|
6681
|
+
callback();
|
|
6682
|
+
} finally {
|
|
6683
|
+
ReactCurrentBatchConfig$1.suspense = previousConfig;
|
|
6675
6684
|
}
|
|
6685
|
+
});
|
|
6686
|
+
}, [config, isPending]);
|
|
6687
|
+
return [startTransition, isPending];
|
|
6688
|
+
}
|
|
6689
|
+
|
|
6690
|
+
function dispatchAction(fiber, queue, action) {
|
|
6691
|
+
if (!(numberOfReRenders < RE_RENDER_LIMIT)) {
|
|
6692
|
+
{
|
|
6693
|
+
throw Error("Too many re-renders. React limits the number of renders to prevent an infinite loop.");
|
|
6676
6694
|
}
|
|
6677
|
-
}
|
|
6695
|
+
}
|
|
6678
6696
|
|
|
6679
6697
|
{
|
|
6680
6698
|
!(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;
|
|
@@ -6719,7 +6737,7 @@ function dispatchAction(fiber, queue, action) {
|
|
|
6719
6737
|
lastRenderPhaseUpdate.next = update;
|
|
6720
6738
|
}
|
|
6721
6739
|
} else {
|
|
6722
|
-
var currentTime =
|
|
6740
|
+
var currentTime = requestCurrentTimeForUpdate();
|
|
6723
6741
|
var suspenseConfig = requestCurrentSuspenseConfig();
|
|
6724
6742
|
var expirationTime = computeExpirationForFiber(currentTime, fiber, suspenseConfig);
|
|
6725
6743
|
var _update2 = {
|
|
@@ -6818,7 +6836,9 @@ var ContextOnlyDispatcher = {
|
|
|
6818
6836
|
useRef: throwInvalidHookError,
|
|
6819
6837
|
useState: throwInvalidHookError,
|
|
6820
6838
|
useDebugValue: throwInvalidHookError,
|
|
6821
|
-
useResponder: throwInvalidHookError
|
|
6839
|
+
useResponder: throwInvalidHookError,
|
|
6840
|
+
useDeferredValue: throwInvalidHookError,
|
|
6841
|
+
useTransition: throwInvalidHookError
|
|
6822
6842
|
};
|
|
6823
6843
|
var HooksDispatcherOnMountInDEV = null;
|
|
6824
6844
|
var HooksDispatcherOnMountWithHookTypesInDEV = null;
|
|
@@ -6919,6 +6939,16 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
|
6919
6939
|
currentHookNameInDev = 'useResponder';
|
|
6920
6940
|
mountHookTypesDev();
|
|
6921
6941
|
return createResponderListener(responder, props);
|
|
6942
|
+
},
|
|
6943
|
+
useDeferredValue: function (value, config) {
|
|
6944
|
+
currentHookNameInDev = 'useDeferredValue';
|
|
6945
|
+
mountHookTypesDev();
|
|
6946
|
+
return mountDeferredValue(value, config);
|
|
6947
|
+
},
|
|
6948
|
+
useTransition: function (config) {
|
|
6949
|
+
currentHookNameInDev = 'useTransition';
|
|
6950
|
+
mountHookTypesDev();
|
|
6951
|
+
return mountTransition(config);
|
|
6922
6952
|
}
|
|
6923
6953
|
};
|
|
6924
6954
|
HooksDispatcherOnMountWithHookTypesInDEV = {
|
|
@@ -7000,6 +7030,16 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
|
7000
7030
|
currentHookNameInDev = 'useResponder';
|
|
7001
7031
|
updateHookTypesDev();
|
|
7002
7032
|
return createResponderListener(responder, props);
|
|
7033
|
+
},
|
|
7034
|
+
useDeferredValue: function (value, config) {
|
|
7035
|
+
currentHookNameInDev = 'useDeferredValue';
|
|
7036
|
+
updateHookTypesDev();
|
|
7037
|
+
return mountDeferredValue(value, config);
|
|
7038
|
+
},
|
|
7039
|
+
useTransition: function (config) {
|
|
7040
|
+
currentHookNameInDev = 'useTransition';
|
|
7041
|
+
updateHookTypesDev();
|
|
7042
|
+
return mountTransition(config);
|
|
7003
7043
|
}
|
|
7004
7044
|
};
|
|
7005
7045
|
HooksDispatcherOnUpdateInDEV = {
|
|
@@ -7081,6 +7121,16 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
|
7081
7121
|
currentHookNameInDev = 'useResponder';
|
|
7082
7122
|
updateHookTypesDev();
|
|
7083
7123
|
return createResponderListener(responder, props);
|
|
7124
|
+
},
|
|
7125
|
+
useDeferredValue: function (value, config) {
|
|
7126
|
+
currentHookNameInDev = 'useDeferredValue';
|
|
7127
|
+
updateHookTypesDev();
|
|
7128
|
+
return updateDeferredValue(value, config);
|
|
7129
|
+
},
|
|
7130
|
+
useTransition: function (config) {
|
|
7131
|
+
currentHookNameInDev = 'useTransition';
|
|
7132
|
+
updateHookTypesDev();
|
|
7133
|
+
return updateTransition(config);
|
|
7084
7134
|
}
|
|
7085
7135
|
};
|
|
7086
7136
|
InvalidNestedHooksDispatcherOnMountInDEV = {
|
|
@@ -7174,6 +7224,18 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
|
7174
7224
|
warnInvalidHookAccess();
|
|
7175
7225
|
mountHookTypesDev();
|
|
7176
7226
|
return createResponderListener(responder, props);
|
|
7227
|
+
},
|
|
7228
|
+
useDeferredValue: function (value, config) {
|
|
7229
|
+
currentHookNameInDev = 'useDeferredValue';
|
|
7230
|
+
warnInvalidHookAccess();
|
|
7231
|
+
mountHookTypesDev();
|
|
7232
|
+
return mountDeferredValue(value, config);
|
|
7233
|
+
},
|
|
7234
|
+
useTransition: function (config) {
|
|
7235
|
+
currentHookNameInDev = 'useTransition';
|
|
7236
|
+
warnInvalidHookAccess();
|
|
7237
|
+
mountHookTypesDev();
|
|
7238
|
+
return mountTransition(config);
|
|
7177
7239
|
}
|
|
7178
7240
|
};
|
|
7179
7241
|
InvalidNestedHooksDispatcherOnUpdateInDEV = {
|
|
@@ -7267,6 +7329,18 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
|
7267
7329
|
warnInvalidHookAccess();
|
|
7268
7330
|
updateHookTypesDev();
|
|
7269
7331
|
return createResponderListener(responder, props);
|
|
7332
|
+
},
|
|
7333
|
+
useDeferredValue: function (value, config) {
|
|
7334
|
+
currentHookNameInDev = 'useDeferredValue';
|
|
7335
|
+
warnInvalidHookAccess();
|
|
7336
|
+
updateHookTypesDev();
|
|
7337
|
+
return updateDeferredValue(value, config);
|
|
7338
|
+
},
|
|
7339
|
+
useTransition: function (config) {
|
|
7340
|
+
currentHookNameInDev = 'useTransition';
|
|
7341
|
+
warnInvalidHookAccess();
|
|
7342
|
+
updateHookTypesDev();
|
|
7343
|
+
return updateTransition(config);
|
|
7270
7344
|
}
|
|
7271
7345
|
};
|
|
7272
7346
|
}
|
|
@@ -7555,13 +7629,11 @@ function tryToClaimNextHydratableInstance(fiber) {
|
|
|
7555
7629
|
|
|
7556
7630
|
function prepareToHydrateHostInstance(fiber, rootContainerInstance, hostContext) {
|
|
7557
7631
|
if (!supportsHydration) {
|
|
7558
|
-
|
|
7632
|
+
{
|
|
7559
7633
|
{
|
|
7560
|
-
|
|
7561
|
-
throw ReactError(Error("Expected prepareToHydrateHostInstance() to never be called. This error is likely caused by a bug in React. Please file an issue."));
|
|
7562
|
-
}
|
|
7634
|
+
throw Error("Expected prepareToHydrateHostInstance() to never be called. This error is likely caused by a bug in React. Please file an issue.");
|
|
7563
7635
|
}
|
|
7564
|
-
}
|
|
7636
|
+
}
|
|
7565
7637
|
}
|
|
7566
7638
|
|
|
7567
7639
|
var instance = fiber.stateNode;
|
|
@@ -7579,13 +7651,11 @@ function prepareToHydrateHostInstance(fiber, rootContainerInstance, hostContext)
|
|
|
7579
7651
|
|
|
7580
7652
|
function prepareToHydrateHostTextInstance(fiber) {
|
|
7581
7653
|
if (!supportsHydration) {
|
|
7582
|
-
|
|
7654
|
+
{
|
|
7583
7655
|
{
|
|
7584
|
-
|
|
7585
|
-
throw ReactError(Error("Expected prepareToHydrateHostTextInstance() to never be called. This error is likely caused by a bug in React. Please file an issue."));
|
|
7586
|
-
}
|
|
7656
|
+
throw Error("Expected prepareToHydrateHostTextInstance() to never be called. This error is likely caused by a bug in React. Please file an issue.");
|
|
7587
7657
|
}
|
|
7588
|
-
}
|
|
7658
|
+
}
|
|
7589
7659
|
}
|
|
7590
7660
|
|
|
7591
7661
|
var textInstance = fiber.stateNode;
|
|
@@ -7625,46 +7695,41 @@ function prepareToHydrateHostTextInstance(fiber) {
|
|
|
7625
7695
|
|
|
7626
7696
|
function prepareToHydrateHostSuspenseInstance(fiber) {
|
|
7627
7697
|
if (!supportsHydration) {
|
|
7628
|
-
|
|
7698
|
+
{
|
|
7629
7699
|
{
|
|
7630
|
-
|
|
7631
|
-
throw ReactError(Error("Expected prepareToHydrateHostSuspenseInstance() to never be called. This error is likely caused by a bug in React. Please file an issue."));
|
|
7632
|
-
}
|
|
7700
|
+
throw Error("Expected prepareToHydrateHostSuspenseInstance() to never be called. This error is likely caused by a bug in React. Please file an issue.");
|
|
7633
7701
|
}
|
|
7634
|
-
}
|
|
7702
|
+
}
|
|
7635
7703
|
}
|
|
7636
7704
|
|
|
7637
7705
|
var suspenseState = fiber.memoizedState;
|
|
7638
7706
|
var suspenseInstance = suspenseState !== null ? suspenseState.dehydrated : null;
|
|
7639
7707
|
|
|
7640
|
-
|
|
7641
|
-
|
|
7642
|
-
|
|
7643
|
-
throw ReactError(Error("Expected to have a hydrated suspense instance. This error is likely caused by a bug in React. Please file an issue."));
|
|
7644
|
-
}
|
|
7708
|
+
if (!suspenseInstance) {
|
|
7709
|
+
{
|
|
7710
|
+
throw Error("Expected to have a hydrated suspense instance. This error is likely caused by a bug in React. Please file an issue.");
|
|
7645
7711
|
}
|
|
7646
|
-
}
|
|
7712
|
+
}
|
|
7647
7713
|
|
|
7648
7714
|
hydrateSuspenseInstance(suspenseInstance, fiber);
|
|
7649
7715
|
}
|
|
7650
7716
|
|
|
7651
7717
|
function skipPastDehydratedSuspenseInstance(fiber) {
|
|
7652
7718
|
if (!supportsHydration) {
|
|
7653
|
-
|
|
7719
|
+
{
|
|
7654
7720
|
{
|
|
7655
|
-
|
|
7656
|
-
throw ReactError(Error("Expected skipPastDehydratedSuspenseInstance() to never be called. This error is likely caused by a bug in React. Please file an issue."));
|
|
7657
|
-
}
|
|
7721
|
+
throw Error("Expected skipPastDehydratedSuspenseInstance() to never be called. This error is likely caused by a bug in React. Please file an issue.");
|
|
7658
7722
|
}
|
|
7659
|
-
}
|
|
7723
|
+
}
|
|
7660
7724
|
}
|
|
7661
7725
|
|
|
7662
7726
|
var suspenseState = fiber.memoizedState;
|
|
7663
7727
|
var suspenseInstance = suspenseState !== null ? suspenseState.dehydrated : null;
|
|
7664
7728
|
|
|
7665
|
-
if (suspenseInstance
|
|
7666
|
-
|
|
7667
|
-
|
|
7729
|
+
if (!suspenseInstance) {
|
|
7730
|
+
{
|
|
7731
|
+
throw Error("Expected to have a hydrated suspense instance. This error is likely caused by a bug in React. Please file an issue.");
|
|
7732
|
+
}
|
|
7668
7733
|
}
|
|
7669
7734
|
|
|
7670
7735
|
return getNextHydratableInstanceAfterSuspenseInstance(suspenseInstance);
|
|
@@ -8200,13 +8265,11 @@ function updateHostRoot(current$$1, workInProgress, renderExpirationTime) {
|
|
|
8200
8265
|
pushHostRootContext(workInProgress);
|
|
8201
8266
|
var updateQueue = workInProgress.updateQueue;
|
|
8202
8267
|
|
|
8203
|
-
(
|
|
8204
|
-
|
|
8205
|
-
|
|
8206
|
-
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."));
|
|
8207
|
-
}
|
|
8268
|
+
if (!(updateQueue !== null)) {
|
|
8269
|
+
{
|
|
8270
|
+
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.");
|
|
8208
8271
|
}
|
|
8209
|
-
}
|
|
8272
|
+
}
|
|
8210
8273
|
|
|
8211
8274
|
var nextProps = workInProgress.pendingProps;
|
|
8212
8275
|
var prevState = workInProgress.memoizedState;
|
|
@@ -8393,13 +8456,11 @@ function mountLazyComponent(_current, workInProgress, elementType, updateExpirat
|
|
|
8393
8456
|
// implementation detail.
|
|
8394
8457
|
|
|
8395
8458
|
|
|
8396
|
-
|
|
8459
|
+
{
|
|
8397
8460
|
{
|
|
8398
|
-
|
|
8399
|
-
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));
|
|
8400
|
-
}
|
|
8461
|
+
throw Error("Element type is invalid. Received a promise that resolves to: " + Component + ". Lazy element type must resolve to a class or function." + hint);
|
|
8401
8462
|
}
|
|
8402
|
-
}
|
|
8463
|
+
}
|
|
8403
8464
|
}
|
|
8404
8465
|
}
|
|
8405
8466
|
|
|
@@ -8602,7 +8663,7 @@ function validateFunctionComponentInDev(workInProgress, Component) {
|
|
|
8602
8663
|
|
|
8603
8664
|
var SUSPENDED_MARKER = {
|
|
8604
8665
|
dehydrated: null,
|
|
8605
|
-
retryTime:
|
|
8666
|
+
retryTime: NoWork
|
|
8606
8667
|
};
|
|
8607
8668
|
|
|
8608
8669
|
function shouldRemainOnFallback(suspenseContext, current$$1, workInProgress) {
|
|
@@ -8678,12 +8739,12 @@ function updateSuspenseComponent(current$$1, workInProgress, renderExpirationTim
|
|
|
8678
8739
|
|
|
8679
8740
|
|
|
8680
8741
|
if (current$$1 === null) {
|
|
8681
|
-
|
|
8682
|
-
|
|
8683
|
-
|
|
8684
|
-
|
|
8685
|
-
tryToClaimNextHydratableInstance(workInProgress); // This could've been a dehydrated suspense component.
|
|
8742
|
+
// If we're currently hydrating, try to hydrate this boundary.
|
|
8743
|
+
// But only if this has a fallback.
|
|
8744
|
+
if (nextProps.fallback !== undefined) {
|
|
8745
|
+
tryToClaimNextHydratableInstance(workInProgress); // This could've been a dehydrated suspense component.
|
|
8686
8746
|
|
|
8747
|
+
if (enableSuspenseServerRenderer) {
|
|
8687
8748
|
var suspenseState = workInProgress.memoizedState;
|
|
8688
8749
|
|
|
8689
8750
|
if (suspenseState !== null) {
|
|
@@ -8985,7 +9046,7 @@ function mountDehydratedSuspenseComponent(workInProgress, suspenseInstance, rend
|
|
|
8985
9046
|
// Instead, we'll leave the content in place and try to hydrate it later.
|
|
8986
9047
|
if ((workInProgress.mode & BatchedMode) === NoMode) {
|
|
8987
9048
|
{
|
|
8988
|
-
warning$1(false, 'Cannot hydrate Suspense in legacy mode. Switch from ' + 'ReactDOM.hydrate(element, container) to ' + 'ReactDOM.
|
|
9049
|
+
warning$1(false, 'Cannot hydrate Suspense in legacy mode. Switch from ' + 'ReactDOM.hydrate(element, container) to ' + 'ReactDOM.createSyncRoot(container, { hydrate: true })' + '.render(element) or remove the Suspense components from ' + 'the server rendered components.');
|
|
8989
9050
|
}
|
|
8990
9051
|
|
|
8991
9052
|
workInProgress.expirationTime = Sync;
|
|
@@ -9000,7 +9061,7 @@ function mountDehydratedSuspenseComponent(workInProgress, suspenseInstance, rend
|
|
|
9000
9061
|
// a protocol to transfer that time, we'll just estimate it by using the current
|
|
9001
9062
|
// time. This will mean that Suspense timeouts are slightly shifted to later than
|
|
9002
9063
|
// they should be.
|
|
9003
|
-
var serverDisplayTime =
|
|
9064
|
+
var serverDisplayTime = requestCurrentTimeForUpdate(); // Schedule a normal pri update to render this content.
|
|
9004
9065
|
|
|
9005
9066
|
var newExpirationTime = computeAsyncExpiration(serverDisplayTime);
|
|
9006
9067
|
|
|
@@ -9109,6 +9170,20 @@ function updateDehydratedSuspenseComponent(current$$1, workInProgress, suspenseI
|
|
|
9109
9170
|
}
|
|
9110
9171
|
}
|
|
9111
9172
|
|
|
9173
|
+
function scheduleWorkOnFiber(fiber, renderExpirationTime) {
|
|
9174
|
+
if (fiber.expirationTime < renderExpirationTime) {
|
|
9175
|
+
fiber.expirationTime = renderExpirationTime;
|
|
9176
|
+
}
|
|
9177
|
+
|
|
9178
|
+
var alternate = fiber.alternate;
|
|
9179
|
+
|
|
9180
|
+
if (alternate !== null && alternate.expirationTime < renderExpirationTime) {
|
|
9181
|
+
alternate.expirationTime = renderExpirationTime;
|
|
9182
|
+
}
|
|
9183
|
+
|
|
9184
|
+
scheduleWorkOnParentPath(fiber.return, renderExpirationTime);
|
|
9185
|
+
}
|
|
9186
|
+
|
|
9112
9187
|
function propagateSuspenseContextChange(workInProgress, firstChild, renderExpirationTime) {
|
|
9113
9188
|
// Mark any Suspense boundaries with fallbacks as having work to do.
|
|
9114
9189
|
// If they were previously forced into fallbacks, they may now be able
|
|
@@ -9120,18 +9195,15 @@ function propagateSuspenseContextChange(workInProgress, firstChild, renderExpira
|
|
|
9120
9195
|
var state = node.memoizedState;
|
|
9121
9196
|
|
|
9122
9197
|
if (state !== null) {
|
|
9123
|
-
|
|
9124
|
-
|
|
9125
|
-
|
|
9126
|
-
|
|
9127
|
-
|
|
9128
|
-
|
|
9129
|
-
|
|
9130
|
-
|
|
9131
|
-
|
|
9132
|
-
|
|
9133
|
-
scheduleWorkOnParentPath(node.return, renderExpirationTime);
|
|
9134
|
-
}
|
|
9198
|
+
scheduleWorkOnFiber(node, renderExpirationTime);
|
|
9199
|
+
}
|
|
9200
|
+
} else if (node.tag === SuspenseListComponent) {
|
|
9201
|
+
// If the tail is hidden there might not be an Suspense boundaries
|
|
9202
|
+
// to schedule work on. In this case we have to schedule it on the
|
|
9203
|
+
// list itself.
|
|
9204
|
+
// We don't have to traverse to the children of the list since
|
|
9205
|
+
// the list will propagate the change when it rerenders.
|
|
9206
|
+
scheduleWorkOnFiber(node, renderExpirationTime);
|
|
9135
9207
|
} else if (node.child !== null) {
|
|
9136
9208
|
node.child.return = node;
|
|
9137
9209
|
node = node.child;
|
|
@@ -9276,7 +9348,7 @@ function validateSuspenseListChildren(children, revealOrder) {
|
|
|
9276
9348
|
}
|
|
9277
9349
|
}
|
|
9278
9350
|
|
|
9279
|
-
function initSuspenseListRenderState(workInProgress, isBackwards, tail, lastContentRow, tailMode) {
|
|
9351
|
+
function initSuspenseListRenderState(workInProgress, isBackwards, tail, lastContentRow, tailMode, lastEffectBeforeRendering) {
|
|
9280
9352
|
var renderState = workInProgress.memoizedState;
|
|
9281
9353
|
|
|
9282
9354
|
if (renderState === null) {
|
|
@@ -9286,7 +9358,8 @@ function initSuspenseListRenderState(workInProgress, isBackwards, tail, lastCont
|
|
|
9286
9358
|
last: lastContentRow,
|
|
9287
9359
|
tail: tail,
|
|
9288
9360
|
tailExpiration: 0,
|
|
9289
|
-
tailMode: tailMode
|
|
9361
|
+
tailMode: tailMode,
|
|
9362
|
+
lastEffect: lastEffectBeforeRendering
|
|
9290
9363
|
};
|
|
9291
9364
|
} else {
|
|
9292
9365
|
// We can reuse the existing object from previous renders.
|
|
@@ -9296,6 +9369,7 @@ function initSuspenseListRenderState(workInProgress, isBackwards, tail, lastCont
|
|
|
9296
9369
|
renderState.tail = tail;
|
|
9297
9370
|
renderState.tailExpiration = 0;
|
|
9298
9371
|
renderState.tailMode = tailMode;
|
|
9372
|
+
renderState.lastEffect = lastEffectBeforeRendering;
|
|
9299
9373
|
}
|
|
9300
9374
|
} // This can end up rendering this component multiple passes.
|
|
9301
9375
|
// The first pass splits the children fibers into two sets. A head and tail.
|
|
@@ -9360,7 +9434,7 @@ function updateSuspenseListComponent(current$$1, workInProgress, renderExpiratio
|
|
|
9360
9434
|
}
|
|
9361
9435
|
|
|
9362
9436
|
initSuspenseListRenderState(workInProgress, false, // isBackwards
|
|
9363
|
-
tail, lastContentRow, tailMode);
|
|
9437
|
+
tail, lastContentRow, tailMode, workInProgress.lastEffect);
|
|
9364
9438
|
break;
|
|
9365
9439
|
}
|
|
9366
9440
|
|
|
@@ -9392,7 +9466,7 @@ function updateSuspenseListComponent(current$$1, workInProgress, renderExpiratio
|
|
|
9392
9466
|
|
|
9393
9467
|
initSuspenseListRenderState(workInProgress, true, // isBackwards
|
|
9394
9468
|
_tail, null, // last
|
|
9395
|
-
tailMode);
|
|
9469
|
+
tailMode, workInProgress.lastEffect);
|
|
9396
9470
|
break;
|
|
9397
9471
|
}
|
|
9398
9472
|
|
|
@@ -9401,7 +9475,7 @@ function updateSuspenseListComponent(current$$1, workInProgress, renderExpiratio
|
|
|
9401
9475
|
initSuspenseListRenderState(workInProgress, false, // isBackwards
|
|
9402
9476
|
null, // tail
|
|
9403
9477
|
null, // last
|
|
9404
|
-
undefined);
|
|
9478
|
+
undefined, workInProgress.lastEffect);
|
|
9405
9479
|
break;
|
|
9406
9480
|
}
|
|
9407
9481
|
|
|
@@ -9954,13 +10028,11 @@ function beginWork$1(current$$1, workInProgress, renderExpirationTime) {
|
|
|
9954
10028
|
}
|
|
9955
10029
|
}
|
|
9956
10030
|
|
|
9957
|
-
|
|
10031
|
+
{
|
|
9958
10032
|
{
|
|
9959
|
-
|
|
9960
|
-
throw ReactError(Error("Unknown unit of work tag (" + workInProgress.tag + "). This error is likely caused by a bug in React. Please file an issue."));
|
|
9961
|
-
}
|
|
10033
|
+
throw Error("Unknown unit of work tag (" + workInProgress.tag + "). This error is likely caused by a bug in React. Please file an issue.");
|
|
9962
10034
|
}
|
|
9963
|
-
}
|
|
10035
|
+
}
|
|
9964
10036
|
}
|
|
9965
10037
|
|
|
9966
10038
|
function createFundamentalStateInstance(currentFiber, props, impl, state) {
|
|
@@ -10005,15 +10077,56 @@ function collectScopedNodes(node, fn, scopedNodes) {
|
|
|
10005
10077
|
}
|
|
10006
10078
|
}
|
|
10007
10079
|
|
|
10008
|
-
function
|
|
10009
|
-
|
|
10010
|
-
|
|
10011
|
-
|
|
10080
|
+
function collectFirstScopedNode(node, fn) {
|
|
10081
|
+
if (enableScopeAPI) {
|
|
10082
|
+
if (node.tag === HostComponent) {
|
|
10083
|
+
var _type2 = node.type,
|
|
10084
|
+
memoizedProps = node.memoizedProps;
|
|
10085
|
+
|
|
10086
|
+
if (fn(_type2, memoizedProps) === true) {
|
|
10087
|
+
return getPublicInstance(node.stateNode);
|
|
10088
|
+
}
|
|
10089
|
+
}
|
|
10090
|
+
|
|
10091
|
+
var child = node.child;
|
|
10092
|
+
|
|
10093
|
+
if (isFiberSuspenseAndTimedOut(node)) {
|
|
10094
|
+
child = getSuspenseFallbackChild(node);
|
|
10095
|
+
}
|
|
10096
|
+
|
|
10097
|
+
if (child !== null) {
|
|
10098
|
+
return collectFirstScopedNodeFromChildren(child, fn);
|
|
10099
|
+
}
|
|
10100
|
+
}
|
|
10101
|
+
|
|
10102
|
+
return null;
|
|
10103
|
+
}
|
|
10104
|
+
|
|
10105
|
+
function collectScopedNodesFromChildren(startingChild, fn, scopedNodes) {
|
|
10106
|
+
var child = startingChild;
|
|
10107
|
+
|
|
10108
|
+
while (child !== null) {
|
|
10012
10109
|
collectScopedNodes(child, fn, scopedNodes);
|
|
10013
10110
|
child = child.sibling;
|
|
10014
10111
|
}
|
|
10015
10112
|
}
|
|
10016
10113
|
|
|
10114
|
+
function collectFirstScopedNodeFromChildren(startingChild, fn) {
|
|
10115
|
+
var child = startingChild;
|
|
10116
|
+
|
|
10117
|
+
while (child !== null) {
|
|
10118
|
+
var scopedNode = collectFirstScopedNode(child, fn);
|
|
10119
|
+
|
|
10120
|
+
if (scopedNode !== null) {
|
|
10121
|
+
return scopedNode;
|
|
10122
|
+
}
|
|
10123
|
+
|
|
10124
|
+
child = child.sibling;
|
|
10125
|
+
}
|
|
10126
|
+
|
|
10127
|
+
return null;
|
|
10128
|
+
}
|
|
10129
|
+
|
|
10017
10130
|
function collectNearestScopeMethods(node, scope, childrenScopes) {
|
|
10018
10131
|
if (isValidScopeNode(node, scope)) {
|
|
10019
10132
|
childrenScopes.push(node.stateNode.methods);
|
|
@@ -10040,11 +10153,10 @@ function collectNearestChildScopeMethods(startingChild, scope, childrenScopes) {
|
|
|
10040
10153
|
}
|
|
10041
10154
|
|
|
10042
10155
|
function isValidScopeNode(node, scope) {
|
|
10043
|
-
return node.tag === ScopeComponent && node.type === scope;
|
|
10156
|
+
return node.tag === ScopeComponent && node.type === scope && node.stateNode !== null;
|
|
10044
10157
|
}
|
|
10045
10158
|
|
|
10046
10159
|
function createScopeMethods(scope, instance) {
|
|
10047
|
-
var fn = scope.fn;
|
|
10048
10160
|
return {
|
|
10049
10161
|
getChildren: function () {
|
|
10050
10162
|
var currentFiber = instance.fiber;
|
|
@@ -10096,7 +10208,7 @@ function createScopeMethods(scope, instance) {
|
|
|
10096
10208
|
var currentFiber = instance.fiber;
|
|
10097
10209
|
return currentFiber.memoizedProps;
|
|
10098
10210
|
},
|
|
10099
|
-
|
|
10211
|
+
queryAllNodes: function (fn) {
|
|
10100
10212
|
var currentFiber = instance.fiber;
|
|
10101
10213
|
var child = currentFiber.child;
|
|
10102
10214
|
var scopedNodes = [];
|
|
@@ -10106,6 +10218,29 @@ function createScopeMethods(scope, instance) {
|
|
|
10106
10218
|
}
|
|
10107
10219
|
|
|
10108
10220
|
return scopedNodes.length === 0 ? null : scopedNodes;
|
|
10221
|
+
},
|
|
10222
|
+
queryFirstNode: function (fn) {
|
|
10223
|
+
var currentFiber = instance.fiber;
|
|
10224
|
+
var child = currentFiber.child;
|
|
10225
|
+
|
|
10226
|
+
if (child !== null) {
|
|
10227
|
+
return collectFirstScopedNodeFromChildren(child, fn);
|
|
10228
|
+
}
|
|
10229
|
+
|
|
10230
|
+
return null;
|
|
10231
|
+
},
|
|
10232
|
+
containsNode: function (node) {
|
|
10233
|
+
var fiber = getInstanceFromNode(node);
|
|
10234
|
+
|
|
10235
|
+
while (fiber !== null) {
|
|
10236
|
+
if (fiber.tag === ScopeComponent && fiber.type === scope && fiber.stateNode === instance) {
|
|
10237
|
+
return true;
|
|
10238
|
+
}
|
|
10239
|
+
|
|
10240
|
+
fiber = fiber.return;
|
|
10241
|
+
}
|
|
10242
|
+
|
|
10243
|
+
return false;
|
|
10109
10244
|
}
|
|
10110
10245
|
};
|
|
10111
10246
|
}
|
|
@@ -10640,13 +10775,11 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
10640
10775
|
}
|
|
10641
10776
|
} else {
|
|
10642
10777
|
if (!newProps) {
|
|
10643
|
-
(
|
|
10644
|
-
|
|
10645
|
-
|
|
10646
|
-
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."));
|
|
10647
|
-
}
|
|
10778
|
+
if (!(workInProgress.stateNode !== null)) {
|
|
10779
|
+
{
|
|
10780
|
+
throw Error("We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue.");
|
|
10648
10781
|
}
|
|
10649
|
-
}
|
|
10782
|
+
} // This can happen when we abort work.
|
|
10650
10783
|
|
|
10651
10784
|
|
|
10652
10785
|
break;
|
|
@@ -10717,13 +10850,11 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
10717
10850
|
updateHostText$1(current, workInProgress, oldText, newText);
|
|
10718
10851
|
} else {
|
|
10719
10852
|
if (typeof newText !== 'string') {
|
|
10720
|
-
(
|
|
10721
|
-
|
|
10722
|
-
|
|
10723
|
-
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."));
|
|
10724
|
-
}
|
|
10853
|
+
if (!(workInProgress.stateNode !== null)) {
|
|
10854
|
+
{
|
|
10855
|
+
throw Error("We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue.");
|
|
10725
10856
|
}
|
|
10726
|
-
}
|
|
10857
|
+
} // This can happen when we abort work.
|
|
10727
10858
|
|
|
10728
10859
|
}
|
|
10729
10860
|
|
|
@@ -10758,13 +10889,11 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
10758
10889
|
if (current === null) {
|
|
10759
10890
|
var _wasHydrated3 = popHydrationState(workInProgress);
|
|
10760
10891
|
|
|
10761
|
-
|
|
10762
|
-
|
|
10763
|
-
|
|
10764
|
-
throw ReactError(Error("A dehydrated suspense component was completed without a hydrated node. This is probably a bug in React."));
|
|
10765
|
-
}
|
|
10892
|
+
if (!_wasHydrated3) {
|
|
10893
|
+
{
|
|
10894
|
+
throw Error("A dehydrated suspense component was completed without a hydrated node. This is probably a bug in React.");
|
|
10766
10895
|
}
|
|
10767
|
-
}
|
|
10896
|
+
}
|
|
10768
10897
|
|
|
10769
10898
|
prepareToHydrateHostSuspenseInstance(workInProgress);
|
|
10770
10899
|
|
|
@@ -10807,10 +10936,9 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
10807
10936
|
var prevDidTimeout = false;
|
|
10808
10937
|
|
|
10809
10938
|
if (current === null) {
|
|
10810
|
-
|
|
10811
|
-
|
|
10812
|
-
|
|
10813
|
-
popHydrationState(workInProgress);
|
|
10939
|
+
if (workInProgress.memoizedProps.fallback !== undefined) {
|
|
10940
|
+
popHydrationState(workInProgress);
|
|
10941
|
+
}
|
|
10814
10942
|
} else {
|
|
10815
10943
|
var prevState = current.memoizedState;
|
|
10816
10944
|
prevDidTimeout = prevState !== null;
|
|
@@ -10995,7 +11123,11 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
10995
11123
|
// Reset the effect list before doing the second pass since that's now invalid.
|
|
10996
11124
|
|
|
10997
11125
|
|
|
10998
|
-
|
|
11126
|
+
if (renderState.lastEffect === null) {
|
|
11127
|
+
workInProgress.firstEffect = null;
|
|
11128
|
+
}
|
|
11129
|
+
|
|
11130
|
+
workInProgress.lastEffect = renderState.lastEffect; // Reset the child fibers to their original state.
|
|
10999
11131
|
|
|
11000
11132
|
resetChildFibers(workInProgress, renderExpirationTime); // Set up the Suspense Context to force suspense and immediately
|
|
11001
11133
|
// rerender the children.
|
|
@@ -11018,21 +11150,22 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
11018
11150
|
|
|
11019
11151
|
if (_suspended !== null) {
|
|
11020
11152
|
workInProgress.effectTag |= DidCapture;
|
|
11021
|
-
didSuspendAlready = true;
|
|
11153
|
+
didSuspendAlready = true; // Ensure we transfer the update queue to the parent so that it doesn't
|
|
11154
|
+
// get lost if this row ends up dropped during a second pass.
|
|
11155
|
+
|
|
11156
|
+
var _newThennables = _suspended.updateQueue;
|
|
11157
|
+
|
|
11158
|
+
if (_newThennables !== null) {
|
|
11159
|
+
workInProgress.updateQueue = _newThennables;
|
|
11160
|
+
workInProgress.effectTag |= Update;
|
|
11161
|
+
}
|
|
11162
|
+
|
|
11022
11163
|
cutOffTailIfNeeded(renderState, true); // This might have been modified.
|
|
11023
11164
|
|
|
11024
11165
|
if (renderState.tail === null && renderState.tailMode === 'hidden') {
|
|
11025
11166
|
// We need to delete the row we just rendered.
|
|
11026
|
-
//
|
|
11027
|
-
var _newThennables = _suspended.updateQueue;
|
|
11028
|
-
|
|
11029
|
-
if (_newThennables !== null) {
|
|
11030
|
-
workInProgress.updateQueue = _newThennables;
|
|
11031
|
-
workInProgress.effectTag |= Update;
|
|
11032
|
-
} // Reset the effect list to what it w as before we rendered this
|
|
11167
|
+
// Reset the effect list to what it w as before we rendered this
|
|
11033
11168
|
// child. The nested children have already appended themselves.
|
|
11034
|
-
|
|
11035
|
-
|
|
11036
11169
|
var lastEffect = workInProgress.lastEffect = renderState.lastEffect; // Remove any effects that were appended after this point.
|
|
11037
11170
|
|
|
11038
11171
|
if (lastEffect !== null) {
|
|
@@ -11219,13 +11352,11 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
11219
11352
|
}
|
|
11220
11353
|
|
|
11221
11354
|
default:
|
|
11222
|
-
|
|
11355
|
+
{
|
|
11223
11356
|
{
|
|
11224
|
-
|
|
11225
|
-
throw ReactError(Error("Unknown unit of work tag (" + workInProgress.tag + "). This error is likely caused by a bug in React. Please file an issue."));
|
|
11226
|
-
}
|
|
11357
|
+
throw Error("Unknown unit of work tag (" + workInProgress.tag + "). This error is likely caused by a bug in React. Please file an issue.");
|
|
11227
11358
|
}
|
|
11228
|
-
}
|
|
11359
|
+
}
|
|
11229
11360
|
|
|
11230
11361
|
}
|
|
11231
11362
|
|
|
@@ -11258,13 +11389,11 @@ function unwindWork(workInProgress, renderExpirationTime) {
|
|
|
11258
11389
|
popTopLevelContextObject(workInProgress);
|
|
11259
11390
|
var _effectTag = workInProgress.effectTag;
|
|
11260
11391
|
|
|
11261
|
-
(
|
|
11262
|
-
|
|
11263
|
-
|
|
11264
|
-
throw ReactError(Error("The root failed to unmount after an error. This is likely a bug in React. Please file an issue."));
|
|
11265
|
-
}
|
|
11392
|
+
if (!((_effectTag & DidCapture) === NoEffect)) {
|
|
11393
|
+
{
|
|
11394
|
+
throw Error("The root failed to unmount after an error. This is likely a bug in React. Please file an issue.");
|
|
11266
11395
|
}
|
|
11267
|
-
}
|
|
11396
|
+
}
|
|
11268
11397
|
|
|
11269
11398
|
workInProgress.effectTag = _effectTag & ~ShouldCapture | DidCapture;
|
|
11270
11399
|
return workInProgress;
|
|
@@ -11285,13 +11414,11 @@ function unwindWork(workInProgress, renderExpirationTime) {
|
|
|
11285
11414
|
var suspenseState = workInProgress.memoizedState;
|
|
11286
11415
|
|
|
11287
11416
|
if (suspenseState !== null && suspenseState.dehydrated !== null) {
|
|
11288
|
-
(
|
|
11289
|
-
|
|
11290
|
-
|
|
11291
|
-
throw ReactError(Error("Threw in newly mounted dehydrated component. This is likely a bug in React. Please file an issue."));
|
|
11292
|
-
}
|
|
11417
|
+
if (!(workInProgress.alternate !== null)) {
|
|
11418
|
+
{
|
|
11419
|
+
throw Error("Threw in newly mounted dehydrated component. This is likely a bug in React. Please file an issue.");
|
|
11293
11420
|
}
|
|
11294
|
-
}
|
|
11421
|
+
}
|
|
11295
11422
|
|
|
11296
11423
|
resetHydrationState();
|
|
11297
11424
|
}
|
|
@@ -11425,13 +11552,11 @@ var invokeGuardedCallbackImpl = function (name, func, context, a, b, c, d, e, f)
|
|
|
11425
11552
|
// when we call document.createEvent(). However this can cause confusing
|
|
11426
11553
|
// errors: https://github.com/facebookincubator/create-react-app/issues/3482
|
|
11427
11554
|
// So we preemptively throw with a better message instead.
|
|
11428
|
-
(
|
|
11429
|
-
|
|
11430
|
-
|
|
11431
|
-
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."));
|
|
11432
|
-
}
|
|
11555
|
+
if (!(typeof document !== 'undefined')) {
|
|
11556
|
+
{
|
|
11557
|
+
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.");
|
|
11433
11558
|
}
|
|
11434
|
-
}
|
|
11559
|
+
}
|
|
11435
11560
|
|
|
11436
11561
|
var evt = document.createEvent('Event'); // Keeps track of whether the user-provided callback threw an error. We
|
|
11437
11562
|
// set this to true at the beginning, then set it to false right after
|
|
@@ -11599,13 +11724,11 @@ function clearCaughtError() {
|
|
|
11599
11724
|
caughtError = null;
|
|
11600
11725
|
return error;
|
|
11601
11726
|
} else {
|
|
11602
|
-
|
|
11727
|
+
{
|
|
11603
11728
|
{
|
|
11604
|
-
|
|
11605
|
-
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."));
|
|
11606
|
-
}
|
|
11729
|
+
throw Error("clearCaughtError was called but no error was captured. This error is likely caused by a bug in React. Please file an issue.");
|
|
11607
11730
|
}
|
|
11608
|
-
}
|
|
11731
|
+
}
|
|
11609
11732
|
}
|
|
11610
11733
|
}
|
|
11611
11734
|
|
|
@@ -11825,13 +11948,11 @@ function commitBeforeMutationLifeCycles(current$$1, finishedWork) {
|
|
|
11825
11948
|
|
|
11826
11949
|
default:
|
|
11827
11950
|
{
|
|
11828
|
-
|
|
11951
|
+
{
|
|
11829
11952
|
{
|
|
11830
|
-
|
|
11831
|
-
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."));
|
|
11832
|
-
}
|
|
11953
|
+
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.");
|
|
11833
11954
|
}
|
|
11834
|
-
}
|
|
11955
|
+
}
|
|
11835
11956
|
}
|
|
11836
11957
|
}
|
|
11837
11958
|
}
|
|
@@ -12053,13 +12174,11 @@ function commitLifeCycles(finishedRoot, current$$1, finishedWork, committedExpir
|
|
|
12053
12174
|
|
|
12054
12175
|
default:
|
|
12055
12176
|
{
|
|
12056
|
-
|
|
12177
|
+
{
|
|
12057
12178
|
{
|
|
12058
|
-
|
|
12059
|
-
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."));
|
|
12060
|
-
}
|
|
12179
|
+
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.");
|
|
12061
12180
|
}
|
|
12062
|
-
}
|
|
12181
|
+
}
|
|
12063
12182
|
}
|
|
12064
12183
|
}
|
|
12065
12184
|
}
|
|
@@ -12404,13 +12523,11 @@ function commitContainer(finishedWork) {
|
|
|
12404
12523
|
|
|
12405
12524
|
default:
|
|
12406
12525
|
{
|
|
12407
|
-
|
|
12526
|
+
{
|
|
12408
12527
|
{
|
|
12409
|
-
|
|
12410
|
-
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."));
|
|
12411
|
-
}
|
|
12528
|
+
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.");
|
|
12412
12529
|
}
|
|
12413
|
-
}
|
|
12530
|
+
}
|
|
12414
12531
|
}
|
|
12415
12532
|
}
|
|
12416
12533
|
}
|
|
@@ -12426,13 +12543,11 @@ function getHostParentFiber(fiber) {
|
|
|
12426
12543
|
parent = parent.return;
|
|
12427
12544
|
}
|
|
12428
12545
|
|
|
12429
|
-
|
|
12546
|
+
{
|
|
12430
12547
|
{
|
|
12431
|
-
|
|
12432
|
-
throw ReactError(Error("Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue."));
|
|
12433
|
-
}
|
|
12548
|
+
throw Error("Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue.");
|
|
12434
12549
|
}
|
|
12435
|
-
}
|
|
12550
|
+
}
|
|
12436
12551
|
}
|
|
12437
12552
|
|
|
12438
12553
|
function isHostParent(fiber) {
|
|
@@ -12524,13 +12639,11 @@ function commitPlacement(finishedWork) {
|
|
|
12524
12639
|
// eslint-disable-next-line-no-fallthrough
|
|
12525
12640
|
|
|
12526
12641
|
default:
|
|
12527
|
-
|
|
12642
|
+
{
|
|
12528
12643
|
{
|
|
12529
|
-
|
|
12530
|
-
throw ReactError(Error("Invalid host parent fiber. This error is likely caused by a bug in React. Please file an issue."));
|
|
12531
|
-
}
|
|
12644
|
+
throw Error("Invalid host parent fiber. This error is likely caused by a bug in React. Please file an issue.");
|
|
12532
12645
|
}
|
|
12533
|
-
}
|
|
12646
|
+
}
|
|
12534
12647
|
|
|
12535
12648
|
}
|
|
12536
12649
|
|
|
@@ -12607,13 +12720,11 @@ function unmountHostComponents(finishedRoot, current$$1, renderPriorityLevel) {
|
|
|
12607
12720
|
var parent = node.return;
|
|
12608
12721
|
|
|
12609
12722
|
findParent: while (true) {
|
|
12610
|
-
(
|
|
12611
|
-
|
|
12612
|
-
|
|
12613
|
-
throw ReactError(Error("Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue."));
|
|
12614
|
-
}
|
|
12723
|
+
if (!(parent !== null)) {
|
|
12724
|
+
{
|
|
12725
|
+
throw Error("Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue.");
|
|
12615
12726
|
}
|
|
12616
|
-
}
|
|
12727
|
+
}
|
|
12617
12728
|
|
|
12618
12729
|
var parentStateNode = parent.stateNode;
|
|
12619
12730
|
|
|
@@ -12847,13 +12958,11 @@ function commitWork(current$$1, finishedWork) {
|
|
|
12847
12958
|
|
|
12848
12959
|
case HostText:
|
|
12849
12960
|
{
|
|
12850
|
-
(
|
|
12851
|
-
|
|
12852
|
-
|
|
12853
|
-
throw ReactError(Error("This should have a text node initialized. This error is likely caused by a bug in React. Please file an issue."));
|
|
12854
|
-
}
|
|
12961
|
+
if (!(finishedWork.stateNode !== null)) {
|
|
12962
|
+
{
|
|
12963
|
+
throw Error("This should have a text node initialized. This error is likely caused by a bug in React. Please file an issue.");
|
|
12855
12964
|
}
|
|
12856
|
-
}
|
|
12965
|
+
}
|
|
12857
12966
|
|
|
12858
12967
|
var textInstance = finishedWork.stateNode;
|
|
12859
12968
|
var newText = finishedWork.memoizedProps; // For hydration we reuse the update path but we treat the oldProps
|
|
@@ -12938,13 +13047,11 @@ function commitWork(current$$1, finishedWork) {
|
|
|
12938
13047
|
|
|
12939
13048
|
default:
|
|
12940
13049
|
{
|
|
12941
|
-
|
|
13050
|
+
{
|
|
12942
13051
|
{
|
|
12943
|
-
|
|
12944
|
-
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."));
|
|
12945
|
-
}
|
|
13052
|
+
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.");
|
|
12946
13053
|
}
|
|
12947
|
-
}
|
|
13054
|
+
}
|
|
12948
13055
|
}
|
|
12949
13056
|
}
|
|
12950
13057
|
}
|
|
@@ -13368,7 +13475,6 @@ var RootErrored = 2;
|
|
|
13368
13475
|
var RootSuspended = 3;
|
|
13369
13476
|
var RootSuspendedWithDelay = 4;
|
|
13370
13477
|
var RootCompleted = 5;
|
|
13371
|
-
var RootLocked = 6;
|
|
13372
13478
|
// Describes where we are in the React execution stack
|
|
13373
13479
|
var executionContext = NoContext; // The root we're working on
|
|
13374
13480
|
|
|
@@ -13428,7 +13534,7 @@ var spawnedWorkDuringRender = null; // Expiration times are computed by adding t
|
|
|
13428
13534
|
// receive the same expiration time. Otherwise we get tearing.
|
|
13429
13535
|
|
|
13430
13536
|
var currentEventTime = NoWork;
|
|
13431
|
-
function
|
|
13537
|
+
function requestCurrentTimeForUpdate() {
|
|
13432
13538
|
if ((executionContext & (RenderContext | CommitContext)) !== NoContext) {
|
|
13433
13539
|
// We're inside React, so it's fine to read the actual time.
|
|
13434
13540
|
return msToExpirationTime(now$1());
|
|
@@ -13444,6 +13550,9 @@ function requestCurrentTime() {
|
|
|
13444
13550
|
currentEventTime = msToExpirationTime(now$1());
|
|
13445
13551
|
return currentEventTime;
|
|
13446
13552
|
}
|
|
13553
|
+
function getCurrentTime() {
|
|
13554
|
+
return msToExpirationTime(now$1());
|
|
13555
|
+
}
|
|
13447
13556
|
function computeExpirationForFiber(currentTime, fiber, suspenseConfig) {
|
|
13448
13557
|
var mode = fiber.mode;
|
|
13449
13558
|
|
|
@@ -13492,13 +13601,11 @@ function computeExpirationForFiber(currentTime, fiber, suspenseConfig) {
|
|
|
13492
13601
|
break;
|
|
13493
13602
|
|
|
13494
13603
|
default:
|
|
13495
|
-
|
|
13604
|
+
{
|
|
13496
13605
|
{
|
|
13497
|
-
|
|
13498
|
-
throw ReactError(Error("Expected a valid priority level"));
|
|
13499
|
-
}
|
|
13606
|
+
throw Error("Expected a valid priority level");
|
|
13500
13607
|
}
|
|
13501
|
-
}
|
|
13608
|
+
}
|
|
13502
13609
|
|
|
13503
13610
|
}
|
|
13504
13611
|
} // If we're in the middle of rendering a tree, do not update at the same
|
|
@@ -13515,21 +13622,6 @@ function computeExpirationForFiber(currentTime, fiber, suspenseConfig) {
|
|
|
13515
13622
|
|
|
13516
13623
|
return expirationTime;
|
|
13517
13624
|
}
|
|
13518
|
-
var lastUniqueAsyncExpiration = NoWork;
|
|
13519
|
-
function computeUniqueAsyncExpiration() {
|
|
13520
|
-
var currentTime = requestCurrentTime();
|
|
13521
|
-
var result = computeAsyncExpiration(currentTime);
|
|
13522
|
-
|
|
13523
|
-
if (result <= lastUniqueAsyncExpiration) {
|
|
13524
|
-
// Since we assume the current time monotonically increases, we only hit
|
|
13525
|
-
// this branch when computeUniqueAsyncExpiration is fired multiple times
|
|
13526
|
-
// within a 200ms window (or whatever the async bucket size is).
|
|
13527
|
-
result -= 1;
|
|
13528
|
-
}
|
|
13529
|
-
|
|
13530
|
-
lastUniqueAsyncExpiration = result;
|
|
13531
|
-
return result;
|
|
13532
|
-
}
|
|
13533
13625
|
function scheduleUpdateOnFiber(fiber, expirationTime) {
|
|
13534
13626
|
checkForNestedUpdates();
|
|
13535
13627
|
warnAboutInvalidUpdatesOnClassComponentsInDEV(fiber);
|
|
@@ -13726,7 +13818,7 @@ function ensureRootIsScheduled(root) {
|
|
|
13726
13818
|
// time as an argument.
|
|
13727
13819
|
|
|
13728
13820
|
|
|
13729
|
-
var currentTime =
|
|
13821
|
+
var currentTime = requestCurrentTimeForUpdate();
|
|
13730
13822
|
var priorityLevel = inferPriorityFromExpirationTime(currentTime, expirationTime); // If there's an existing render task, confirm it has the correct priority and
|
|
13731
13823
|
// expiration time. Otherwise, we'll cancel it and schedule a new one.
|
|
13732
13824
|
|
|
@@ -13777,7 +13869,7 @@ function performConcurrentWorkOnRoot(root, didTimeout) {
|
|
|
13777
13869
|
if (didTimeout) {
|
|
13778
13870
|
// The render task took too long to complete. Mark the current time as
|
|
13779
13871
|
// expired to synchronously render all expired work in a single batch.
|
|
13780
|
-
var currentTime =
|
|
13872
|
+
var currentTime = requestCurrentTimeForUpdate();
|
|
13781
13873
|
markRootExpiredAtTime(root, currentTime); // This will schedule a synchronous callback.
|
|
13782
13874
|
|
|
13783
13875
|
ensureRootIsScheduled(root);
|
|
@@ -13791,13 +13883,11 @@ function performConcurrentWorkOnRoot(root, didTimeout) {
|
|
|
13791
13883
|
if (expirationTime !== NoWork) {
|
|
13792
13884
|
var originalCallbackNode = root.callbackNode;
|
|
13793
13885
|
|
|
13794
|
-
(
|
|
13795
|
-
|
|
13796
|
-
|
|
13797
|
-
throw ReactError(Error("Should not already be working."));
|
|
13798
|
-
}
|
|
13886
|
+
if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) {
|
|
13887
|
+
{
|
|
13888
|
+
throw Error("Should not already be working.");
|
|
13799
13889
|
}
|
|
13800
|
-
}
|
|
13890
|
+
}
|
|
13801
13891
|
|
|
13802
13892
|
flushPassiveEffects(); // If the root or expiration time have changed, throw out the existing stack
|
|
13803
13893
|
// and prepare a fresh one. Otherwise we'll continue where we left off.
|
|
@@ -13851,7 +13941,6 @@ function performConcurrentWorkOnRoot(root, didTimeout) {
|
|
|
13851
13941
|
stopFinishedWorkLoopTimer();
|
|
13852
13942
|
var finishedWork = root.finishedWork = root.current.alternate;
|
|
13853
13943
|
root.finishedExpirationTime = expirationTime;
|
|
13854
|
-
resolveLocksOnRoot(root, expirationTime);
|
|
13855
13944
|
finishConcurrentRender(root, finishedWork, workInProgressRootExitStatus, expirationTime);
|
|
13856
13945
|
}
|
|
13857
13946
|
|
|
@@ -13876,13 +13965,11 @@ function finishConcurrentRender(root, finishedWork, exitStatus, expirationTime)
|
|
|
13876
13965
|
case RootIncomplete:
|
|
13877
13966
|
case RootFatalErrored:
|
|
13878
13967
|
{
|
|
13879
|
-
|
|
13968
|
+
{
|
|
13880
13969
|
{
|
|
13881
|
-
|
|
13882
|
-
throw ReactError(Error("Root did not complete. This is a bug in React."));
|
|
13883
|
-
}
|
|
13970
|
+
throw Error("Root did not complete. This is a bug in React.");
|
|
13884
13971
|
}
|
|
13885
|
-
}
|
|
13972
|
+
}
|
|
13886
13973
|
}
|
|
13887
13974
|
// Flow knows about invariant, so it complains if I add a break
|
|
13888
13975
|
// statement, but eslint doesn't know about invariant, so it complains
|
|
@@ -13890,18 +13977,16 @@ function finishConcurrentRender(root, finishedWork, exitStatus, expirationTime)
|
|
|
13890
13977
|
|
|
13891
13978
|
case RootErrored:
|
|
13892
13979
|
{
|
|
13893
|
-
|
|
13894
|
-
|
|
13895
|
-
|
|
13896
|
-
|
|
13897
|
-
|
|
13898
|
-
|
|
13899
|
-
|
|
13900
|
-
|
|
13901
|
-
|
|
13902
|
-
|
|
13980
|
+
// If this was an async render, the error may have happened due to
|
|
13981
|
+
// a mutation in a concurrent event. Try rendering one more time,
|
|
13982
|
+
// synchronously, to see if the error goes away. If there are
|
|
13983
|
+
// lower priority updates, let's include those, too, in case they
|
|
13984
|
+
// fix the inconsistency. Render at Idle to include all updates.
|
|
13985
|
+
// If it was Idle or Never or some not-yet-invented time, render
|
|
13986
|
+
// at that time.
|
|
13987
|
+
markRootExpiredAtTime(root, expirationTime > Idle ? Idle : expirationTime); // We assume that this second render pass will be synchronous
|
|
13988
|
+
// and therefore not hit this path again.
|
|
13903
13989
|
|
|
13904
|
-
commitRoot(root);
|
|
13905
13990
|
break;
|
|
13906
13991
|
}
|
|
13907
13992
|
|
|
@@ -14085,24 +14170,13 @@ function finishConcurrentRender(root, finishedWork, exitStatus, expirationTime)
|
|
|
14085
14170
|
break;
|
|
14086
14171
|
}
|
|
14087
14172
|
|
|
14088
|
-
case RootLocked:
|
|
14089
|
-
{
|
|
14090
|
-
// This root has a lock that prevents it from committing. Exit. If
|
|
14091
|
-
// we begin work on the root again, without any intervening updates,
|
|
14092
|
-
// it will finish without doing additional work.
|
|
14093
|
-
markRootSuspendedAtTime(root, expirationTime);
|
|
14094
|
-
break;
|
|
14095
|
-
}
|
|
14096
|
-
|
|
14097
14173
|
default:
|
|
14098
14174
|
{
|
|
14099
|
-
|
|
14175
|
+
{
|
|
14100
14176
|
{
|
|
14101
|
-
|
|
14102
|
-
throw ReactError(Error("Unknown root exit status."));
|
|
14103
|
-
}
|
|
14177
|
+
throw Error("Unknown root exit status.");
|
|
14104
14178
|
}
|
|
14105
|
-
}
|
|
14179
|
+
}
|
|
14106
14180
|
}
|
|
14107
14181
|
}
|
|
14108
14182
|
} // This is the entry point for synchronous tasks that don't go
|
|
@@ -14120,13 +14194,11 @@ function performSyncWorkOnRoot(root) {
|
|
|
14120
14194
|
// batch.commit() API.
|
|
14121
14195
|
commitRoot(root);
|
|
14122
14196
|
} else {
|
|
14123
|
-
(
|
|
14124
|
-
|
|
14125
|
-
|
|
14126
|
-
throw ReactError(Error("Should not already be working."));
|
|
14127
|
-
}
|
|
14197
|
+
if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) {
|
|
14198
|
+
{
|
|
14199
|
+
throw Error("Should not already be working.");
|
|
14128
14200
|
}
|
|
14129
|
-
}
|
|
14201
|
+
}
|
|
14130
14202
|
|
|
14131
14203
|
flushPassiveEffects(); // If the root or expiration time have changed, throw out the existing stack
|
|
14132
14204
|
// and prepare a fresh one. Otherwise we'll continue where we left off.
|
|
@@ -14173,21 +14245,17 @@ function performSyncWorkOnRoot(root) {
|
|
|
14173
14245
|
|
|
14174
14246
|
if (workInProgress !== null) {
|
|
14175
14247
|
// This is a sync render, so we should have finished the whole tree.
|
|
14176
|
-
|
|
14248
|
+
{
|
|
14177
14249
|
{
|
|
14178
|
-
|
|
14179
|
-
throw ReactError(Error("Cannot commit an incomplete root. This error is likely caused by a bug in React. Please file an issue."));
|
|
14180
|
-
}
|
|
14250
|
+
throw Error("Cannot commit an incomplete root. This error is likely caused by a bug in React. Please file an issue.");
|
|
14181
14251
|
}
|
|
14182
|
-
}
|
|
14252
|
+
}
|
|
14183
14253
|
} else {
|
|
14184
14254
|
// We now have a consistent tree. Because this is a sync render, we
|
|
14185
|
-
// will commit it even if something suspended.
|
|
14186
|
-
// if the root is locked (using the unstable_createBatch API).
|
|
14255
|
+
// will commit it even if something suspended.
|
|
14187
14256
|
stopFinishedWorkLoopTimer();
|
|
14188
14257
|
root.finishedWork = root.current.alternate;
|
|
14189
14258
|
root.finishedExpirationTime = expirationTime;
|
|
14190
|
-
resolveLocksOnRoot(root, expirationTime);
|
|
14191
14259
|
finishSyncRender(root, workInProgressRootExitStatus, expirationTime);
|
|
14192
14260
|
} // Before exiting, make sure there's a callback scheduled for the next
|
|
14193
14261
|
// pending level.
|
|
@@ -14201,39 +14269,25 @@ function performSyncWorkOnRoot(root) {
|
|
|
14201
14269
|
}
|
|
14202
14270
|
|
|
14203
14271
|
function finishSyncRender(root, exitStatus, expirationTime) {
|
|
14204
|
-
|
|
14205
|
-
|
|
14206
|
-
// begin work on the root again, without any intervening updates, it
|
|
14207
|
-
// will finish without doing additional work.
|
|
14208
|
-
markRootSuspendedAtTime(root, expirationTime);
|
|
14209
|
-
} else {
|
|
14210
|
-
// Set this to null to indicate there's no in-progress render.
|
|
14211
|
-
workInProgressRoot = null;
|
|
14272
|
+
// Set this to null to indicate there's no in-progress render.
|
|
14273
|
+
workInProgressRoot = null;
|
|
14212
14274
|
|
|
14213
|
-
|
|
14214
|
-
|
|
14215
|
-
|
|
14216
|
-
}
|
|
14275
|
+
{
|
|
14276
|
+
if (exitStatus === RootSuspended || exitStatus === RootSuspendedWithDelay) {
|
|
14277
|
+
flushSuspensePriorityWarningInDEV();
|
|
14217
14278
|
}
|
|
14218
|
-
|
|
14219
|
-
commitRoot(root);
|
|
14220
14279
|
}
|
|
14280
|
+
|
|
14281
|
+
commitRoot(root);
|
|
14221
14282
|
}
|
|
14222
14283
|
|
|
14223
14284
|
function flushRoot(root, expirationTime) {
|
|
14224
|
-
if ((executionContext & (RenderContext | CommitContext)) !== NoContext) {
|
|
14225
|
-
(function () {
|
|
14226
|
-
{
|
|
14227
|
-
{
|
|
14228
|
-
throw ReactError(Error("work.commit(): Cannot commit while already rendering. This likely means you attempted to commit from inside a lifecycle method."));
|
|
14229
|
-
}
|
|
14230
|
-
}
|
|
14231
|
-
})();
|
|
14232
|
-
}
|
|
14233
|
-
|
|
14234
14285
|
markRootExpiredAtTime(root, expirationTime);
|
|
14235
14286
|
ensureRootIsScheduled(root);
|
|
14236
|
-
|
|
14287
|
+
|
|
14288
|
+
if ((executionContext & (RenderContext | CommitContext)) === NoContext) {
|
|
14289
|
+
flushSyncCallbackQueue();
|
|
14290
|
+
}
|
|
14237
14291
|
}
|
|
14238
14292
|
function flushDiscreteUpdates() {
|
|
14239
14293
|
// TODO: Should be able to flush inside batchedUpdates, but not inside `act`.
|
|
@@ -14256,20 +14310,6 @@ function flushDiscreteUpdates() {
|
|
|
14256
14310
|
|
|
14257
14311
|
flushPassiveEffects();
|
|
14258
14312
|
}
|
|
14259
|
-
|
|
14260
|
-
function resolveLocksOnRoot(root, expirationTime) {
|
|
14261
|
-
var firstBatch = root.firstBatch;
|
|
14262
|
-
|
|
14263
|
-
if (firstBatch !== null && firstBatch._defer && firstBatch._expirationTime >= expirationTime) {
|
|
14264
|
-
scheduleCallback(NormalPriority, function () {
|
|
14265
|
-
firstBatch._onComplete();
|
|
14266
|
-
|
|
14267
|
-
return null;
|
|
14268
|
-
});
|
|
14269
|
-
workInProgressRootExitStatus = RootLocked;
|
|
14270
|
-
}
|
|
14271
|
-
}
|
|
14272
|
-
|
|
14273
14313
|
function deferredUpdates(fn) {
|
|
14274
14314
|
// TODO: Remove in favor of Scheduler.next
|
|
14275
14315
|
return runWithPriority(NormalPriority, fn);
|
|
@@ -14357,13 +14397,11 @@ function unbatchedUpdates(fn, a) {
|
|
|
14357
14397
|
}
|
|
14358
14398
|
function flushSync(fn, a) {
|
|
14359
14399
|
if ((executionContext & (RenderContext | CommitContext)) !== NoContext) {
|
|
14360
|
-
|
|
14400
|
+
{
|
|
14361
14401
|
{
|
|
14362
|
-
|
|
14363
|
-
throw ReactError(Error("flushSync was called from inside a lifecycle method. It cannot be called when React is already rendering."));
|
|
14364
|
-
}
|
|
14402
|
+
throw Error("flushSync was called from inside a lifecycle method. It cannot be called when React is already rendering.");
|
|
14365
14403
|
}
|
|
14366
|
-
}
|
|
14404
|
+
}
|
|
14367
14405
|
}
|
|
14368
14406
|
|
|
14369
14407
|
var prevExecutionContext = executionContext;
|
|
@@ -14444,6 +14482,7 @@ function handleError(root, thrownValue) {
|
|
|
14444
14482
|
// Reset module-level state that was set during the render phase.
|
|
14445
14483
|
resetContextDependencies();
|
|
14446
14484
|
resetHooks();
|
|
14485
|
+
resetCurrentFiber();
|
|
14447
14486
|
|
|
14448
14487
|
if (workInProgress === null || workInProgress.return === null) {
|
|
14449
14488
|
// Expected to be working on a non-root fiber. This is a fatal error
|
|
@@ -14843,13 +14882,11 @@ function commitRootImpl(root, renderPriorityLevel) {
|
|
|
14843
14882
|
flushPassiveEffects();
|
|
14844
14883
|
flushRenderPhaseStrictModeWarningsInDEV();
|
|
14845
14884
|
|
|
14846
|
-
(
|
|
14847
|
-
|
|
14848
|
-
|
|
14849
|
-
throw ReactError(Error("Should not already be working."));
|
|
14850
|
-
}
|
|
14885
|
+
if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) {
|
|
14886
|
+
{
|
|
14887
|
+
throw Error("Should not already be working.");
|
|
14851
14888
|
}
|
|
14852
|
-
}
|
|
14889
|
+
}
|
|
14853
14890
|
|
|
14854
14891
|
var finishedWork = root.finishedWork;
|
|
14855
14892
|
var expirationTime = root.finishedExpirationTime;
|
|
@@ -14861,13 +14898,11 @@ function commitRootImpl(root, renderPriorityLevel) {
|
|
|
14861
14898
|
root.finishedWork = null;
|
|
14862
14899
|
root.finishedExpirationTime = NoWork;
|
|
14863
14900
|
|
|
14864
|
-
(
|
|
14865
|
-
|
|
14866
|
-
|
|
14867
|
-
throw ReactError(Error("Cannot commit the same tree as before. This error is likely caused by a bug in React. Please file an issue."));
|
|
14868
|
-
}
|
|
14901
|
+
if (!(finishedWork !== root.current)) {
|
|
14902
|
+
{
|
|
14903
|
+
throw Error("Cannot commit the same tree as before. This error is likely caused by a bug in React. Please file an issue.");
|
|
14869
14904
|
}
|
|
14870
|
-
}
|
|
14905
|
+
} // commitRoot never returns a continuation; it always finishes synchronously.
|
|
14871
14906
|
// So we can clear these now to allow a new callback to be scheduled.
|
|
14872
14907
|
|
|
14873
14908
|
|
|
@@ -14931,13 +14966,11 @@ function commitRootImpl(root, renderPriorityLevel) {
|
|
|
14931
14966
|
invokeGuardedCallback(null, commitBeforeMutationEffects, null);
|
|
14932
14967
|
|
|
14933
14968
|
if (hasCaughtError()) {
|
|
14934
|
-
(
|
|
14935
|
-
|
|
14936
|
-
|
|
14937
|
-
throw ReactError(Error("Should be working on an effect."));
|
|
14938
|
-
}
|
|
14969
|
+
if (!(nextEffect !== null)) {
|
|
14970
|
+
{
|
|
14971
|
+
throw Error("Should be working on an effect.");
|
|
14939
14972
|
}
|
|
14940
|
-
}
|
|
14973
|
+
}
|
|
14941
14974
|
|
|
14942
14975
|
var error = clearCaughtError();
|
|
14943
14976
|
captureCommitPhaseError(nextEffect, error);
|
|
@@ -14963,13 +14996,11 @@ function commitRootImpl(root, renderPriorityLevel) {
|
|
|
14963
14996
|
invokeGuardedCallback(null, commitMutationEffects, null, root, renderPriorityLevel);
|
|
14964
14997
|
|
|
14965
14998
|
if (hasCaughtError()) {
|
|
14966
|
-
(
|
|
14967
|
-
|
|
14968
|
-
|
|
14969
|
-
throw ReactError(Error("Should be working on an effect."));
|
|
14970
|
-
}
|
|
14999
|
+
if (!(nextEffect !== null)) {
|
|
15000
|
+
{
|
|
15001
|
+
throw Error("Should be working on an effect.");
|
|
14971
15002
|
}
|
|
14972
|
-
}
|
|
15003
|
+
}
|
|
14973
15004
|
|
|
14974
15005
|
var _error = clearCaughtError();
|
|
14975
15006
|
|
|
@@ -14997,13 +15028,11 @@ function commitRootImpl(root, renderPriorityLevel) {
|
|
|
14997
15028
|
invokeGuardedCallback(null, commitLayoutEffects, null, root, expirationTime);
|
|
14998
15029
|
|
|
14999
15030
|
if (hasCaughtError()) {
|
|
15000
|
-
(
|
|
15001
|
-
|
|
15002
|
-
|
|
15003
|
-
throw ReactError(Error("Should be working on an effect."));
|
|
15004
|
-
}
|
|
15031
|
+
if (!(nextEffect !== null)) {
|
|
15032
|
+
{
|
|
15033
|
+
throw Error("Should be working on an effect.");
|
|
15005
15034
|
}
|
|
15006
|
-
}
|
|
15035
|
+
}
|
|
15007
15036
|
|
|
15008
15037
|
var _error2 = clearCaughtError();
|
|
15009
15038
|
|
|
@@ -15289,13 +15318,11 @@ function flushPassiveEffectsImpl() {
|
|
|
15289
15318
|
rootWithPendingPassiveEffects = null;
|
|
15290
15319
|
pendingPassiveEffectsExpirationTime = NoWork;
|
|
15291
15320
|
|
|
15292
|
-
(
|
|
15293
|
-
|
|
15294
|
-
|
|
15295
|
-
throw ReactError(Error("Cannot flush passive effects while already rendering."));
|
|
15296
|
-
}
|
|
15321
|
+
if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) {
|
|
15322
|
+
{
|
|
15323
|
+
throw Error("Cannot flush passive effects while already rendering.");
|
|
15297
15324
|
}
|
|
15298
|
-
}
|
|
15325
|
+
}
|
|
15299
15326
|
|
|
15300
15327
|
var prevExecutionContext = executionContext;
|
|
15301
15328
|
executionContext |= CommitContext;
|
|
@@ -15311,13 +15338,11 @@ function flushPassiveEffectsImpl() {
|
|
|
15311
15338
|
invokeGuardedCallback(null, commitPassiveHookEffects, null, effect);
|
|
15312
15339
|
|
|
15313
15340
|
if (hasCaughtError()) {
|
|
15314
|
-
(
|
|
15315
|
-
|
|
15316
|
-
|
|
15317
|
-
throw ReactError(Error("Should be working on an effect."));
|
|
15318
|
-
}
|
|
15341
|
+
if (!(effect !== null)) {
|
|
15342
|
+
{
|
|
15343
|
+
throw Error("Should be working on an effect.");
|
|
15319
15344
|
}
|
|
15320
|
-
}
|
|
15345
|
+
}
|
|
15321
15346
|
|
|
15322
15347
|
var error = clearCaughtError();
|
|
15323
15348
|
captureCommitPhaseError(effect, error);
|
|
@@ -15478,10 +15503,10 @@ function retryTimedOutBoundary(boundaryFiber, retryTime) {
|
|
|
15478
15503
|
// previously was rendered in its fallback state. One of the promises that
|
|
15479
15504
|
// suspended it has resolved, which means at least part of the tree was
|
|
15480
15505
|
// likely unblocked. Try rendering again, at a new expiration time.
|
|
15481
|
-
if (retryTime ===
|
|
15506
|
+
if (retryTime === NoWork) {
|
|
15482
15507
|
var suspenseConfig = null; // Retries don't carry over the already committed update.
|
|
15483
15508
|
|
|
15484
|
-
var currentTime =
|
|
15509
|
+
var currentTime = requestCurrentTimeForUpdate();
|
|
15485
15510
|
retryTime = computeExpirationForFiber(currentTime, boundaryFiber, suspenseConfig);
|
|
15486
15511
|
} // TODO: Special case idle priority?
|
|
15487
15512
|
|
|
@@ -15496,7 +15521,7 @@ function retryTimedOutBoundary(boundaryFiber, retryTime) {
|
|
|
15496
15521
|
|
|
15497
15522
|
function retryDehydratedSuspenseBoundary(boundaryFiber) {
|
|
15498
15523
|
var suspenseState = boundaryFiber.memoizedState;
|
|
15499
|
-
var retryTime =
|
|
15524
|
+
var retryTime = NoWork;
|
|
15500
15525
|
|
|
15501
15526
|
if (suspenseState !== null) {
|
|
15502
15527
|
retryTime = suspenseState.retryTime;
|
|
@@ -15505,7 +15530,7 @@ function retryDehydratedSuspenseBoundary(boundaryFiber) {
|
|
|
15505
15530
|
retryTimedOutBoundary(boundaryFiber, retryTime);
|
|
15506
15531
|
}
|
|
15507
15532
|
function resolveRetryThenable(boundaryFiber, thenable) {
|
|
15508
|
-
var retryTime =
|
|
15533
|
+
var retryTime = NoWork; // Default
|
|
15509
15534
|
|
|
15510
15535
|
var retryCache;
|
|
15511
15536
|
|
|
@@ -15526,13 +15551,11 @@ function resolveRetryThenable(boundaryFiber, thenable) {
|
|
|
15526
15551
|
break;
|
|
15527
15552
|
|
|
15528
15553
|
default:
|
|
15529
|
-
|
|
15554
|
+
{
|
|
15530
15555
|
{
|
|
15531
|
-
|
|
15532
|
-
throw ReactError(Error("Pinged unknown suspense boundary type. This is probably a bug in React."));
|
|
15533
|
-
}
|
|
15556
|
+
throw Error("Pinged unknown suspense boundary type. This is probably a bug in React.");
|
|
15534
15557
|
}
|
|
15535
|
-
}
|
|
15558
|
+
}
|
|
15536
15559
|
|
|
15537
15560
|
}
|
|
15538
15561
|
} else {
|
|
@@ -15589,13 +15612,11 @@ function checkForNestedUpdates() {
|
|
|
15589
15612
|
nestedUpdateCount = 0;
|
|
15590
15613
|
rootWithNestedUpdates = null;
|
|
15591
15614
|
|
|
15592
|
-
|
|
15615
|
+
{
|
|
15593
15616
|
{
|
|
15594
|
-
|
|
15595
|
-
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."));
|
|
15596
|
-
}
|
|
15617
|
+
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.");
|
|
15597
15618
|
}
|
|
15598
|
-
}
|
|
15619
|
+
}
|
|
15599
15620
|
}
|
|
15600
15621
|
|
|
15601
15622
|
{
|
|
@@ -15683,12 +15704,14 @@ if (true && replayFailedUnitOfWorkWithInvokeGuardedCallback) {
|
|
|
15683
15704
|
if (originalError !== null && typeof originalError === 'object' && typeof originalError.then === 'function') {
|
|
15684
15705
|
// Don't replay promises. Treat everything else like an error.
|
|
15685
15706
|
throw originalError;
|
|
15686
|
-
} // Keep this code in sync with
|
|
15707
|
+
} // Keep this code in sync with handleError; any changes here must have
|
|
15687
15708
|
// corresponding changes there.
|
|
15688
15709
|
|
|
15689
15710
|
|
|
15690
15711
|
resetContextDependencies();
|
|
15691
|
-
resetHooks(); //
|
|
15712
|
+
resetHooks(); // Don't reset current debug fiber, since we're about to work on the
|
|
15713
|
+
// same fiber again.
|
|
15714
|
+
// Unwind the failed stack frame
|
|
15692
15715
|
|
|
15693
15716
|
unwindInterruptedWork(unitOfWork); // Restore the original properties of the fiber.
|
|
15694
15717
|
|
|
@@ -15887,7 +15910,7 @@ function flushSuspensePriorityWarningInDEV() {
|
|
|
15887
15910
|
componentsThatTriggeredHighPriSuspend = null;
|
|
15888
15911
|
|
|
15889
15912
|
if (componentNames.length > 0) {
|
|
15890
|
-
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
|
|
15913
|
+
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
|
|
15891
15914
|
componentNames.sort().join(', '));
|
|
15892
15915
|
}
|
|
15893
15916
|
}
|
|
@@ -15974,10 +15997,10 @@ function startWorkOnPendingInteractions(root, expirationTime) {
|
|
|
15974
15997
|
});
|
|
15975
15998
|
}
|
|
15976
15999
|
}); // Store the current set of interactions on the FiberRoot for a few reasons:
|
|
15977
|
-
// We can re-use it in hot functions like
|
|
15978
|
-
// recalculate it. We will also use it in commitWork() to
|
|
15979
|
-
// onRender() hooks. This also provides DevTools with a
|
|
15980
|
-
// the onCommitRoot() hook is called.
|
|
16000
|
+
// We can re-use it in hot functions like performConcurrentWorkOnRoot()
|
|
16001
|
+
// without having to recalculate it. We will also use it in commitWork() to
|
|
16002
|
+
// pass to any Profiler onRender() hooks. This also provides DevTools with a
|
|
16003
|
+
// way to access it when the onCommitRoot() hook is called.
|
|
15981
16004
|
|
|
15982
16005
|
root.memoizedInteractions = interactions;
|
|
15983
16006
|
|
|
@@ -16085,7 +16108,7 @@ function injectInternals(internals) {
|
|
|
16085
16108
|
var didError = (root.current.effectTag & DidCapture) === DidCapture;
|
|
16086
16109
|
|
|
16087
16110
|
if (enableProfilerTimer) {
|
|
16088
|
-
var currentTime =
|
|
16111
|
+
var currentTime = getCurrentTime();
|
|
16089
16112
|
var priorityLevel = inferPriorityFromExpirationTime(currentTime, expirationTime);
|
|
16090
16113
|
hook.onCommitFiberRoot(rendererID, root, priorityLevel, didError);
|
|
16091
16114
|
} else {
|
|
@@ -16547,13 +16570,11 @@ key, pendingProps, owner, mode, expirationTime) {
|
|
|
16547
16570
|
}
|
|
16548
16571
|
}
|
|
16549
16572
|
|
|
16550
|
-
|
|
16573
|
+
{
|
|
16551
16574
|
{
|
|
16552
|
-
|
|
16553
|
-
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));
|
|
16554
|
-
}
|
|
16575
|
+
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);
|
|
16555
16576
|
}
|
|
16556
|
-
}
|
|
16577
|
+
}
|
|
16557
16578
|
}
|
|
16558
16579
|
}
|
|
16559
16580
|
}
|
|
@@ -16737,7 +16758,6 @@ function FiberRootNode(containerInfo, tag, hydrate) {
|
|
|
16737
16758
|
this.context = null;
|
|
16738
16759
|
this.pendingContext = null;
|
|
16739
16760
|
this.hydrate = hydrate;
|
|
16740
|
-
this.firstBatch = null;
|
|
16741
16761
|
this.callbackNode = null;
|
|
16742
16762
|
this.callbackPriority = NoPriority;
|
|
16743
16763
|
this.firstPendingTime = NoWork;
|
|
@@ -16893,79 +16913,22 @@ function getContextForSubtree(parentComponent) {
|
|
|
16893
16913
|
return parentContext;
|
|
16894
16914
|
}
|
|
16895
16915
|
|
|
16896
|
-
function scheduleRootUpdate(current$$1, element, expirationTime, suspenseConfig, callback) {
|
|
16897
|
-
{
|
|
16898
|
-
if (phase === 'render' && current !== null && !didWarnAboutNestedUpdates) {
|
|
16899
|
-
didWarnAboutNestedUpdates = true;
|
|
16900
|
-
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');
|
|
16901
|
-
}
|
|
16902
|
-
}
|
|
16903
|
-
|
|
16904
|
-
var update = createUpdate(expirationTime, suspenseConfig); // Caution: React DevTools currently depends on this property
|
|
16905
|
-
// being called "element".
|
|
16906
|
-
|
|
16907
|
-
update.payload = {
|
|
16908
|
-
element: element
|
|
16909
|
-
};
|
|
16910
|
-
callback = callback === undefined ? null : callback;
|
|
16911
|
-
|
|
16912
|
-
if (callback !== null) {
|
|
16913
|
-
!(typeof callback === 'function') ? warningWithoutStack$1(false, 'render(...): Expected the last optional `callback` argument to be a ' + 'function. Instead received: %s.', callback) : void 0;
|
|
16914
|
-
update.callback = callback;
|
|
16915
|
-
}
|
|
16916
|
-
|
|
16917
|
-
enqueueUpdate(current$$1, update);
|
|
16918
|
-
scheduleWork(current$$1, expirationTime);
|
|
16919
|
-
return expirationTime;
|
|
16920
|
-
}
|
|
16921
|
-
|
|
16922
|
-
function updateContainerAtExpirationTime(element, container, parentComponent, expirationTime, suspenseConfig, callback) {
|
|
16923
|
-
// TODO: If this is a nested container, this won't be the root.
|
|
16924
|
-
var current$$1 = container.current;
|
|
16925
|
-
|
|
16926
|
-
{
|
|
16927
|
-
if (ReactFiberInstrumentation_1.debugTool) {
|
|
16928
|
-
if (current$$1.alternate === null) {
|
|
16929
|
-
ReactFiberInstrumentation_1.debugTool.onMountContainer(container);
|
|
16930
|
-
} else if (element === null) {
|
|
16931
|
-
ReactFiberInstrumentation_1.debugTool.onUnmountContainer(container);
|
|
16932
|
-
} else {
|
|
16933
|
-
ReactFiberInstrumentation_1.debugTool.onUpdateContainer(container);
|
|
16934
|
-
}
|
|
16935
|
-
}
|
|
16936
|
-
}
|
|
16937
|
-
|
|
16938
|
-
var context = getContextForSubtree(parentComponent);
|
|
16939
|
-
|
|
16940
|
-
if (container.context === null) {
|
|
16941
|
-
container.context = context;
|
|
16942
|
-
} else {
|
|
16943
|
-
container.pendingContext = context;
|
|
16944
|
-
}
|
|
16945
|
-
|
|
16946
|
-
return scheduleRootUpdate(current$$1, element, expirationTime, suspenseConfig, callback);
|
|
16947
|
-
}
|
|
16948
|
-
|
|
16949
16916
|
function findHostInstance(component) {
|
|
16950
16917
|
var fiber = get(component);
|
|
16951
16918
|
|
|
16952
16919
|
if (fiber === undefined) {
|
|
16953
16920
|
if (typeof component.render === 'function') {
|
|
16954
|
-
|
|
16921
|
+
{
|
|
16955
16922
|
{
|
|
16956
|
-
|
|
16957
|
-
throw ReactError(Error("Unable to find node on an unmounted component."));
|
|
16958
|
-
}
|
|
16923
|
+
throw Error("Unable to find node on an unmounted component.");
|
|
16959
16924
|
}
|
|
16960
|
-
}
|
|
16925
|
+
}
|
|
16961
16926
|
} else {
|
|
16962
|
-
|
|
16927
|
+
{
|
|
16963
16928
|
{
|
|
16964
|
-
|
|
16965
|
-
throw ReactError(Error("Argument appears to not be a ReactComponent. Keys: " + Object.keys(component)));
|
|
16966
|
-
}
|
|
16929
|
+
throw Error("Argument appears to not be a ReactComponent. Keys: " + Object.keys(component));
|
|
16967
16930
|
}
|
|
16968
|
-
}
|
|
16931
|
+
}
|
|
16969
16932
|
}
|
|
16970
16933
|
}
|
|
16971
16934
|
|
|
@@ -16984,21 +16947,17 @@ function findHostInstanceWithWarning(component, methodName) {
|
|
|
16984
16947
|
|
|
16985
16948
|
if (fiber === undefined) {
|
|
16986
16949
|
if (typeof component.render === 'function') {
|
|
16987
|
-
|
|
16950
|
+
{
|
|
16988
16951
|
{
|
|
16989
|
-
|
|
16990
|
-
throw ReactError(Error("Unable to find node on an unmounted component."));
|
|
16991
|
-
}
|
|
16952
|
+
throw Error("Unable to find node on an unmounted component.");
|
|
16992
16953
|
}
|
|
16993
|
-
}
|
|
16954
|
+
}
|
|
16994
16955
|
} else {
|
|
16995
|
-
|
|
16956
|
+
{
|
|
16996
16957
|
{
|
|
16997
|
-
|
|
16998
|
-
throw ReactError(Error("Argument appears to not be a ReactComponent. Keys: " + Object.keys(component)));
|
|
16999
|
-
}
|
|
16958
|
+
throw Error("Argument appears to not be a ReactComponent. Keys: " + Object.keys(component));
|
|
17000
16959
|
}
|
|
17001
|
-
}
|
|
16960
|
+
}
|
|
17002
16961
|
}
|
|
17003
16962
|
}
|
|
17004
16963
|
|
|
@@ -17033,7 +16992,7 @@ function createContainer(containerInfo, tag, hydrate, hydrationCallbacks) {
|
|
|
17033
16992
|
}
|
|
17034
16993
|
function updateContainer(element, container, parentComponent, callback) {
|
|
17035
16994
|
var current$$1 = container.current;
|
|
17036
|
-
var currentTime =
|
|
16995
|
+
var currentTime = requestCurrentTimeForUpdate();
|
|
17037
16996
|
|
|
17038
16997
|
{
|
|
17039
16998
|
// $FlowExpectedError - jest isn't a global, and isn't recognized outside of tests
|
|
@@ -17045,7 +17004,50 @@ function updateContainer(element, container, parentComponent, callback) {
|
|
|
17045
17004
|
|
|
17046
17005
|
var suspenseConfig = requestCurrentSuspenseConfig();
|
|
17047
17006
|
var expirationTime = computeExpirationForFiber(currentTime, current$$1, suspenseConfig);
|
|
17048
|
-
|
|
17007
|
+
|
|
17008
|
+
{
|
|
17009
|
+
if (ReactFiberInstrumentation_1.debugTool) {
|
|
17010
|
+
if (current$$1.alternate === null) {
|
|
17011
|
+
ReactFiberInstrumentation_1.debugTool.onMountContainer(container);
|
|
17012
|
+
} else if (element === null) {
|
|
17013
|
+
ReactFiberInstrumentation_1.debugTool.onUnmountContainer(container);
|
|
17014
|
+
} else {
|
|
17015
|
+
ReactFiberInstrumentation_1.debugTool.onUpdateContainer(container);
|
|
17016
|
+
}
|
|
17017
|
+
}
|
|
17018
|
+
}
|
|
17019
|
+
|
|
17020
|
+
var context = getContextForSubtree(parentComponent);
|
|
17021
|
+
|
|
17022
|
+
if (container.context === null) {
|
|
17023
|
+
container.context = context;
|
|
17024
|
+
} else {
|
|
17025
|
+
container.pendingContext = context;
|
|
17026
|
+
}
|
|
17027
|
+
|
|
17028
|
+
{
|
|
17029
|
+
if (phase === 'render' && current !== null && !didWarnAboutNestedUpdates) {
|
|
17030
|
+
didWarnAboutNestedUpdates = true;
|
|
17031
|
+
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');
|
|
17032
|
+
}
|
|
17033
|
+
}
|
|
17034
|
+
|
|
17035
|
+
var update = createUpdate(expirationTime, suspenseConfig); // Caution: React DevTools currently depends on this property
|
|
17036
|
+
// being called "element".
|
|
17037
|
+
|
|
17038
|
+
update.payload = {
|
|
17039
|
+
element: element
|
|
17040
|
+
};
|
|
17041
|
+
callback = callback === undefined ? null : callback;
|
|
17042
|
+
|
|
17043
|
+
if (callback !== null) {
|
|
17044
|
+
!(typeof callback === 'function') ? warningWithoutStack$1(false, 'render(...): Expected the last optional `callback` argument to be a ' + 'function. Instead received: %s.', callback) : void 0;
|
|
17045
|
+
update.callback = callback;
|
|
17046
|
+
}
|
|
17047
|
+
|
|
17048
|
+
enqueueUpdate(current$$1, update);
|
|
17049
|
+
scheduleWork(current$$1, expirationTime);
|
|
17050
|
+
return expirationTime;
|
|
17049
17051
|
}
|
|
17050
17052
|
function getPublicRootInstance(container) {
|
|
17051
17053
|
var containerFiber = container.current;
|
|
@@ -17077,10 +17079,74 @@ function attemptSynchronousHydration(fiber) {
|
|
|
17077
17079
|
case SuspenseComponent:
|
|
17078
17080
|
flushSync(function () {
|
|
17079
17081
|
return scheduleWork(fiber, Sync);
|
|
17080
|
-
});
|
|
17082
|
+
}); // If we're still blocked after this, we need to increase
|
|
17083
|
+
// the priority of any promises resolving within this
|
|
17084
|
+
// boundary so that they next attempt also has higher pri.
|
|
17085
|
+
|
|
17086
|
+
var retryExpTime = computeInteractiveExpiration(requestCurrentTimeForUpdate());
|
|
17087
|
+
markRetryTimeIfNotHydrated(fiber, retryExpTime);
|
|
17081
17088
|
break;
|
|
17082
17089
|
}
|
|
17083
17090
|
}
|
|
17091
|
+
|
|
17092
|
+
function markRetryTimeImpl(fiber, retryTime) {
|
|
17093
|
+
var suspenseState = fiber.memoizedState;
|
|
17094
|
+
|
|
17095
|
+
if (suspenseState !== null && suspenseState.dehydrated !== null) {
|
|
17096
|
+
if (suspenseState.retryTime < retryTime) {
|
|
17097
|
+
suspenseState.retryTime = retryTime;
|
|
17098
|
+
}
|
|
17099
|
+
}
|
|
17100
|
+
} // Increases the priority of thennables when they resolve within this boundary.
|
|
17101
|
+
|
|
17102
|
+
|
|
17103
|
+
function markRetryTimeIfNotHydrated(fiber, retryTime) {
|
|
17104
|
+
markRetryTimeImpl(fiber, retryTime);
|
|
17105
|
+
var alternate = fiber.alternate;
|
|
17106
|
+
|
|
17107
|
+
if (alternate) {
|
|
17108
|
+
markRetryTimeImpl(alternate, retryTime);
|
|
17109
|
+
}
|
|
17110
|
+
}
|
|
17111
|
+
|
|
17112
|
+
function attemptUserBlockingHydration(fiber) {
|
|
17113
|
+
if (fiber.tag !== SuspenseComponent) {
|
|
17114
|
+
// We ignore HostRoots here because we can't increase
|
|
17115
|
+
// their priority and they should not suspend on I/O,
|
|
17116
|
+
// since you have to wrap anything that might suspend in
|
|
17117
|
+
// Suspense.
|
|
17118
|
+
return;
|
|
17119
|
+
}
|
|
17120
|
+
|
|
17121
|
+
var expTime = computeInteractiveExpiration(requestCurrentTimeForUpdate());
|
|
17122
|
+
scheduleWork(fiber, expTime);
|
|
17123
|
+
markRetryTimeIfNotHydrated(fiber, expTime);
|
|
17124
|
+
}
|
|
17125
|
+
function attemptContinuousHydration(fiber) {
|
|
17126
|
+
if (fiber.tag !== SuspenseComponent) {
|
|
17127
|
+
// We ignore HostRoots here because we can't increase
|
|
17128
|
+
// their priority and they should not suspend on I/O,
|
|
17129
|
+
// since you have to wrap anything that might suspend in
|
|
17130
|
+
// Suspense.
|
|
17131
|
+
return;
|
|
17132
|
+
}
|
|
17133
|
+
|
|
17134
|
+
var expTime = computeContinuousHydrationExpiration(requestCurrentTimeForUpdate());
|
|
17135
|
+
scheduleWork(fiber, expTime);
|
|
17136
|
+
markRetryTimeIfNotHydrated(fiber, expTime);
|
|
17137
|
+
}
|
|
17138
|
+
function attemptHydrationAtCurrentPriority(fiber) {
|
|
17139
|
+
if (fiber.tag !== SuspenseComponent) {
|
|
17140
|
+
// We ignore HostRoots here because we can't increase
|
|
17141
|
+
// their priority other than synchronously flush it.
|
|
17142
|
+
return;
|
|
17143
|
+
}
|
|
17144
|
+
|
|
17145
|
+
var currentTime = requestCurrentTimeForUpdate();
|
|
17146
|
+
var expTime = computeExpirationForFiber(currentTime, fiber, null);
|
|
17147
|
+
scheduleWork(fiber, expTime);
|
|
17148
|
+
markRetryTimeIfNotHydrated(fiber, expTime);
|
|
17149
|
+
}
|
|
17084
17150
|
function findHostInstanceWithNoPortals(fiber) {
|
|
17085
17151
|
var hostFiber = findCurrentHostFiberWithNoPortals(fiber);
|
|
17086
17152
|
|
|
@@ -17208,11 +17274,8 @@ function injectIntoDevTools(devToolsConfig) {
|
|
|
17208
17274
|
}
|
|
17209
17275
|
|
|
17210
17276
|
var ReactFiberReconciler = Object.freeze({
|
|
17211
|
-
updateContainerAtExpirationTime: updateContainerAtExpirationTime,
|
|
17212
17277
|
createContainer: createContainer,
|
|
17213
17278
|
updateContainer: updateContainer,
|
|
17214
|
-
flushRoot: flushRoot,
|
|
17215
|
-
computeUniqueAsyncExpiration: computeUniqueAsyncExpiration,
|
|
17216
17279
|
batchedEventUpdates: batchedEventUpdates,
|
|
17217
17280
|
batchedUpdates: batchedUpdates,
|
|
17218
17281
|
unbatchedUpdates: unbatchedUpdates,
|
|
@@ -17226,6 +17289,9 @@ var ReactFiberReconciler = Object.freeze({
|
|
|
17226
17289
|
IsThisRendererActing: IsThisRendererActing,
|
|
17227
17290
|
getPublicRootInstance: getPublicRootInstance,
|
|
17228
17291
|
attemptSynchronousHydration: attemptSynchronousHydration,
|
|
17292
|
+
attemptUserBlockingHydration: attemptUserBlockingHydration,
|
|
17293
|
+
attemptContinuousHydration: attemptContinuousHydration,
|
|
17294
|
+
attemptHydrationAtCurrentPriority: attemptHydrationAtCurrentPriority,
|
|
17229
17295
|
findHostInstance: findHostInstance,
|
|
17230
17296
|
findHostInstanceWithWarning: findHostInstanceWithWarning,
|
|
17231
17297
|
findHostInstanceWithNoPortals: findHostInstanceWithNoPortals,
|