react-reconciler 0.22.0 → 0.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build-info.json +4 -4
- package/cjs/react-reconciler-persistent.development.js +804 -718
- package/cjs/react-reconciler-persistent.production.min.js +164 -164
- package/cjs/react-reconciler-reflection.development.js +36 -62
- package/cjs/react-reconciler-reflection.production.min.js +5 -5
- package/cjs/react-reconciler.development.js +809 -732
- 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.24.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;
|
|
@@ -396,7 +388,6 @@ var ShouldCapture =
|
|
|
396
388
|
/* */
|
|
397
389
|
4096;
|
|
398
390
|
|
|
399
|
-
var debugRenderPhaseSideEffects = false;
|
|
400
391
|
var debugRenderPhaseSideEffectsForStrictMode = false;
|
|
401
392
|
var enableUserTimingAPI = true;
|
|
402
393
|
var warnAboutDeprecatedLifecycles = true;
|
|
@@ -410,19 +401,18 @@ var enableSuspenseServerRenderer = false;
|
|
|
410
401
|
|
|
411
402
|
|
|
412
403
|
|
|
413
|
-
|
|
414
404
|
var enableFlareAPI = false;
|
|
415
405
|
var enableFundamentalAPI = false;
|
|
416
406
|
var enableScopeAPI = false;
|
|
417
407
|
|
|
418
408
|
var warnAboutUnmockedScheduler = true;
|
|
419
409
|
var flushSuspenseFallbacksInTests = true;
|
|
420
|
-
|
|
421
410
|
var enableSuspenseCallback = false;
|
|
422
411
|
var warnAboutDefaultPropsOnFunctionComponents = false;
|
|
423
412
|
var warnAboutStringRefs = false;
|
|
424
413
|
var disableLegacyContext = false;
|
|
425
414
|
var disableSchedulerTimeoutBasedOnReactExpirationTime = false;
|
|
415
|
+
|
|
426
416
|
// Only used in www builds.
|
|
427
417
|
|
|
428
418
|
// Flow magic to verify the exports of this file match the original version.
|
|
@@ -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,17 +1728,15 @@ 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
|
|
|
1770
|
-
var
|
|
1739
|
+
var BlockingRoot = 1;
|
|
1771
1740
|
var ConcurrentRoot = 2;
|
|
1772
1741
|
|
|
1773
1742
|
// Intentionally not named imports because Rollup would use dynamic dispatch for
|
|
@@ -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
|
}
|
|
@@ -1957,10 +1920,10 @@ function flushSyncCallbackQueueImpl() {
|
|
|
1957
1920
|
}
|
|
1958
1921
|
|
|
1959
1922
|
var NoMode = 0;
|
|
1960
|
-
var StrictMode = 1; // TODO: Remove
|
|
1923
|
+
var StrictMode = 1; // TODO: Remove BlockingMode and ConcurrentMode by reading from the root
|
|
1961
1924
|
// tag instead
|
|
1962
1925
|
|
|
1963
|
-
var
|
|
1926
|
+
var BlockingMode = 2;
|
|
1964
1927
|
var ConcurrentMode = 4;
|
|
1965
1928
|
var ProfileMode = 8;
|
|
1966
1929
|
|
|
@@ -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;
|
|
@@ -3378,7 +3349,7 @@ function getStateFromUpdate(workInProgress, queue, update, prevState, nextProps,
|
|
|
3378
3349
|
{
|
|
3379
3350
|
enterDisallowedContextReadInDEV();
|
|
3380
3351
|
|
|
3381
|
-
if (
|
|
3352
|
+
if (debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
|
|
3382
3353
|
payload.call(instance, prevState, nextProps);
|
|
3383
3354
|
}
|
|
3384
3355
|
}
|
|
@@ -3412,7 +3383,7 @@ function getStateFromUpdate(workInProgress, queue, update, prevState, nextProps,
|
|
|
3412
3383
|
{
|
|
3413
3384
|
enterDisallowedContextReadInDEV();
|
|
3414
3385
|
|
|
3415
|
-
if (
|
|
3386
|
+
if (debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
|
|
3416
3387
|
_payload.call(instance, prevState, nextProps);
|
|
3417
3388
|
}
|
|
3418
3389
|
}
|
|
@@ -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);
|
|
@@ -3729,7 +3696,7 @@ function applyDerivedStateFromProps(workInProgress, ctor, getDerivedStateFromPro
|
|
|
3729
3696
|
var prevState = workInProgress.memoizedState;
|
|
3730
3697
|
|
|
3731
3698
|
{
|
|
3732
|
-
if (
|
|
3699
|
+
if (debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
|
|
3733
3700
|
// Invoke the function an extra time to help detect side-effects.
|
|
3734
3701
|
getDerivedStateFromProps(nextProps, prevState);
|
|
3735
3702
|
}
|
|
@@ -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);
|
|
@@ -3976,7 +3943,7 @@ function constructClassInstance(workInProgress, ctor, props, renderExpirationTim
|
|
|
3976
3943
|
|
|
3977
3944
|
|
|
3978
3945
|
{
|
|
3979
|
-
if (
|
|
3946
|
+
if (debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
|
|
3980
3947
|
new ctor(props, context); // eslint-disable-line no-new
|
|
3981
3948
|
}
|
|
3982
3949
|
}
|
|
@@ -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,50 +7695,42 @@ 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
|
-
|
|
7666
|
-
|
|
7667
|
-
|
|
7668
|
-
throw ReactError(Error("Expected to have a hydrated suspense instance. This error is likely caused by a bug in React. Please file an issue."));
|
|
7669
|
-
}
|
|
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.");
|
|
7670
7732
|
}
|
|
7671
|
-
}
|
|
7733
|
+
}
|
|
7672
7734
|
|
|
7673
7735
|
return getNextHydratableInstanceAfterSuspenseInstance(suspenseInstance);
|
|
7674
7736
|
}
|
|
@@ -7827,7 +7889,7 @@ function updateForwardRef(current$$1, workInProgress, Component, nextProps, rend
|
|
|
7827
7889
|
setCurrentPhase('render');
|
|
7828
7890
|
nextChildren = renderWithHooks(current$$1, workInProgress, render, nextProps, ref, renderExpirationTime);
|
|
7829
7891
|
|
|
7830
|
-
if (
|
|
7892
|
+
if (debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
|
|
7831
7893
|
// Only double-render components with Hooks
|
|
7832
7894
|
if (workInProgress.memoizedState !== null) {
|
|
7833
7895
|
nextChildren = renderWithHooks(current$$1, workInProgress, render, nextProps, ref, renderExpirationTime);
|
|
@@ -8031,7 +8093,7 @@ function updateFunctionComponent(current$$1, workInProgress, Component, nextProp
|
|
|
8031
8093
|
setCurrentPhase('render');
|
|
8032
8094
|
nextChildren = renderWithHooks(current$$1, workInProgress, Component, nextProps, context, renderExpirationTime);
|
|
8033
8095
|
|
|
8034
|
-
if (
|
|
8096
|
+
if (debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
|
|
8035
8097
|
// Only double-render components with Hooks
|
|
8036
8098
|
if (workInProgress.memoizedState !== null) {
|
|
8037
8099
|
nextChildren = renderWithHooks(current$$1, workInProgress, Component, nextProps, context, renderExpirationTime);
|
|
@@ -8154,7 +8216,7 @@ function finishClassComponent(current$$1, workInProgress, Component, shouldUpdat
|
|
|
8154
8216
|
setCurrentPhase('render');
|
|
8155
8217
|
nextChildren = instance.render();
|
|
8156
8218
|
|
|
8157
|
-
if (
|
|
8219
|
+
if (debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
|
|
8158
8220
|
instance.render();
|
|
8159
8221
|
}
|
|
8160
8222
|
|
|
@@ -8203,13 +8265,11 @@ function updateHostRoot(current$$1, workInProgress, renderExpirationTime) {
|
|
|
8203
8265
|
pushHostRootContext(workInProgress);
|
|
8204
8266
|
var updateQueue = workInProgress.updateQueue;
|
|
8205
8267
|
|
|
8206
|
-
(
|
|
8207
|
-
|
|
8208
|
-
|
|
8209
|
-
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."));
|
|
8210
|
-
}
|
|
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.");
|
|
8211
8271
|
}
|
|
8212
|
-
}
|
|
8272
|
+
}
|
|
8213
8273
|
|
|
8214
8274
|
var nextProps = workInProgress.pendingProps;
|
|
8215
8275
|
var prevState = workInProgress.memoizedState;
|
|
@@ -8396,13 +8456,11 @@ function mountLazyComponent(_current, workInProgress, elementType, updateExpirat
|
|
|
8396
8456
|
// implementation detail.
|
|
8397
8457
|
|
|
8398
8458
|
|
|
8399
|
-
|
|
8459
|
+
{
|
|
8400
8460
|
{
|
|
8401
|
-
|
|
8402
|
-
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));
|
|
8403
|
-
}
|
|
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);
|
|
8404
8462
|
}
|
|
8405
|
-
}
|
|
8463
|
+
}
|
|
8406
8464
|
}
|
|
8407
8465
|
}
|
|
8408
8466
|
|
|
@@ -8531,7 +8589,7 @@ function mountIndeterminateComponent(_current, workInProgress, Component, render
|
|
|
8531
8589
|
warningWithoutStack$1(false, '%s uses the legacy contextTypes API which is no longer supported. ' + 'Use React.createContext() with React.useContext() instead.', getComponentName(Component) || 'Unknown');
|
|
8532
8590
|
}
|
|
8533
8591
|
|
|
8534
|
-
if (
|
|
8592
|
+
if (debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
|
|
8535
8593
|
// Only double-render components with Hooks
|
|
8536
8594
|
if (workInProgress.memoizedState !== null) {
|
|
8537
8595
|
value = renderWithHooks(null, workInProgress, Component, props, context, renderExpirationTime);
|
|
@@ -8605,7 +8663,7 @@ function validateFunctionComponentInDev(workInProgress, Component) {
|
|
|
8605
8663
|
|
|
8606
8664
|
var SUSPENDED_MARKER = {
|
|
8607
8665
|
dehydrated: null,
|
|
8608
|
-
retryTime:
|
|
8666
|
+
retryTime: NoWork
|
|
8609
8667
|
};
|
|
8610
8668
|
|
|
8611
8669
|
function shouldRemainOnFallback(suspenseContext, current$$1, workInProgress) {
|
|
@@ -8681,12 +8739,12 @@ function updateSuspenseComponent(current$$1, workInProgress, renderExpirationTim
|
|
|
8681
8739
|
|
|
8682
8740
|
|
|
8683
8741
|
if (current$$1 === null) {
|
|
8684
|
-
|
|
8685
|
-
|
|
8686
|
-
|
|
8687
|
-
|
|
8688
|
-
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.
|
|
8689
8746
|
|
|
8747
|
+
if (enableSuspenseServerRenderer) {
|
|
8690
8748
|
var suspenseState = workInProgress.memoizedState;
|
|
8691
8749
|
|
|
8692
8750
|
if (suspenseState !== null) {
|
|
@@ -8707,8 +8765,8 @@ function updateSuspenseComponent(current$$1, workInProgress, renderExpirationTim
|
|
|
8707
8765
|
var primaryChildFragment = createFiberFromFragment(null, mode, NoWork, null);
|
|
8708
8766
|
primaryChildFragment.return = workInProgress;
|
|
8709
8767
|
|
|
8710
|
-
if ((workInProgress.mode &
|
|
8711
|
-
// Outside of
|
|
8768
|
+
if ((workInProgress.mode & BlockingMode) === NoMode) {
|
|
8769
|
+
// Outside of blocking mode, we commit the effects from the
|
|
8712
8770
|
// partially completed, timed-out tree, too.
|
|
8713
8771
|
var progressedState = workInProgress.memoizedState;
|
|
8714
8772
|
var progressedPrimaryChild = progressedState !== null ? workInProgress.child.child : workInProgress.child;
|
|
@@ -8771,8 +8829,8 @@ function updateSuspenseComponent(current$$1, workInProgress, renderExpirationTim
|
|
|
8771
8829
|
|
|
8772
8830
|
_primaryChildFragment.child = null;
|
|
8773
8831
|
|
|
8774
|
-
if ((workInProgress.mode &
|
|
8775
|
-
// Outside of
|
|
8832
|
+
if ((workInProgress.mode & BlockingMode) === NoMode) {
|
|
8833
|
+
// Outside of blocking mode, we commit the effects from the
|
|
8776
8834
|
// partially completed, timed-out tree, too.
|
|
8777
8835
|
var _progressedChild = _primaryChildFragment.child = workInProgress.child;
|
|
8778
8836
|
|
|
@@ -8831,8 +8889,8 @@ function updateSuspenseComponent(current$$1, workInProgress, renderExpirationTim
|
|
|
8831
8889
|
|
|
8832
8890
|
_primaryChildFragment2.return = workInProgress;
|
|
8833
8891
|
|
|
8834
|
-
if ((workInProgress.mode &
|
|
8835
|
-
// Outside of
|
|
8892
|
+
if ((workInProgress.mode & BlockingMode) === NoMode) {
|
|
8893
|
+
// Outside of blocking mode, we commit the effects from the
|
|
8836
8894
|
// partially completed, timed-out tree, too.
|
|
8837
8895
|
var _progressedState = workInProgress.memoizedState;
|
|
8838
8896
|
|
|
@@ -8916,8 +8974,8 @@ function updateSuspenseComponent(current$$1, workInProgress, renderExpirationTim
|
|
|
8916
8974
|
// primaryChildFragment.effectTag |= Placement;
|
|
8917
8975
|
|
|
8918
8976
|
|
|
8919
|
-
if ((workInProgress.mode &
|
|
8920
|
-
// Outside of
|
|
8977
|
+
if ((workInProgress.mode & BlockingMode) === NoMode) {
|
|
8978
|
+
// Outside of blocking mode, we commit the effects from the
|
|
8921
8979
|
// partially completed, timed-out tree, too.
|
|
8922
8980
|
var _progressedState2 = workInProgress.memoizedState;
|
|
8923
8981
|
|
|
@@ -8986,9 +9044,9 @@ function retrySuspenseComponentWithoutHydrating(current$$1, workInProgress, rend
|
|
|
8986
9044
|
function mountDehydratedSuspenseComponent(workInProgress, suspenseInstance, renderExpirationTime) {
|
|
8987
9045
|
// During the first pass, we'll bail out and not drill into the children.
|
|
8988
9046
|
// Instead, we'll leave the content in place and try to hydrate it later.
|
|
8989
|
-
if ((workInProgress.mode &
|
|
9047
|
+
if ((workInProgress.mode & BlockingMode) === NoMode) {
|
|
8990
9048
|
{
|
|
8991
|
-
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.createBlockingRoot(container, { hydrate: true })' + '.render(element) or remove the Suspense components from ' + 'the server rendered components.');
|
|
8992
9050
|
}
|
|
8993
9051
|
|
|
8994
9052
|
workInProgress.expirationTime = Sync;
|
|
@@ -9003,7 +9061,7 @@ function mountDehydratedSuspenseComponent(workInProgress, suspenseInstance, rend
|
|
|
9003
9061
|
// a protocol to transfer that time, we'll just estimate it by using the current
|
|
9004
9062
|
// time. This will mean that Suspense timeouts are slightly shifted to later than
|
|
9005
9063
|
// they should be.
|
|
9006
|
-
var serverDisplayTime =
|
|
9064
|
+
var serverDisplayTime = requestCurrentTimeForUpdate(); // Schedule a normal pri update to render this content.
|
|
9007
9065
|
|
|
9008
9066
|
var newExpirationTime = computeAsyncExpiration(serverDisplayTime);
|
|
9009
9067
|
|
|
@@ -9030,7 +9088,7 @@ function updateDehydratedSuspenseComponent(current$$1, workInProgress, suspenseI
|
|
|
9030
9088
|
// but after we've already committed once.
|
|
9031
9089
|
warnIfHydrating();
|
|
9032
9090
|
|
|
9033
|
-
if ((workInProgress.mode &
|
|
9091
|
+
if ((workInProgress.mode & BlockingMode) === NoMode) {
|
|
9034
9092
|
return retrySuspenseComponentWithoutHydrating(current$$1, workInProgress, renderExpirationTime);
|
|
9035
9093
|
}
|
|
9036
9094
|
|
|
@@ -9112,6 +9170,20 @@ function updateDehydratedSuspenseComponent(current$$1, workInProgress, suspenseI
|
|
|
9112
9170
|
}
|
|
9113
9171
|
}
|
|
9114
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
|
+
|
|
9115
9187
|
function propagateSuspenseContextChange(workInProgress, firstChild, renderExpirationTime) {
|
|
9116
9188
|
// Mark any Suspense boundaries with fallbacks as having work to do.
|
|
9117
9189
|
// If they were previously forced into fallbacks, they may now be able
|
|
@@ -9123,18 +9195,15 @@ function propagateSuspenseContextChange(workInProgress, firstChild, renderExpira
|
|
|
9123
9195
|
var state = node.memoizedState;
|
|
9124
9196
|
|
|
9125
9197
|
if (state !== null) {
|
|
9126
|
-
|
|
9127
|
-
|
|
9128
|
-
|
|
9129
|
-
|
|
9130
|
-
|
|
9131
|
-
|
|
9132
|
-
|
|
9133
|
-
|
|
9134
|
-
|
|
9135
|
-
|
|
9136
|
-
scheduleWorkOnParentPath(node.return, renderExpirationTime);
|
|
9137
|
-
}
|
|
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);
|
|
9138
9207
|
} else if (node.child !== null) {
|
|
9139
9208
|
node.child.return = node;
|
|
9140
9209
|
node = node.child;
|
|
@@ -9279,7 +9348,7 @@ function validateSuspenseListChildren(children, revealOrder) {
|
|
|
9279
9348
|
}
|
|
9280
9349
|
}
|
|
9281
9350
|
|
|
9282
|
-
function initSuspenseListRenderState(workInProgress, isBackwards, tail, lastContentRow, tailMode) {
|
|
9351
|
+
function initSuspenseListRenderState(workInProgress, isBackwards, tail, lastContentRow, tailMode, lastEffectBeforeRendering) {
|
|
9283
9352
|
var renderState = workInProgress.memoizedState;
|
|
9284
9353
|
|
|
9285
9354
|
if (renderState === null) {
|
|
@@ -9289,7 +9358,8 @@ function initSuspenseListRenderState(workInProgress, isBackwards, tail, lastCont
|
|
|
9289
9358
|
last: lastContentRow,
|
|
9290
9359
|
tail: tail,
|
|
9291
9360
|
tailExpiration: 0,
|
|
9292
|
-
tailMode: tailMode
|
|
9361
|
+
tailMode: tailMode,
|
|
9362
|
+
lastEffect: lastEffectBeforeRendering
|
|
9293
9363
|
};
|
|
9294
9364
|
} else {
|
|
9295
9365
|
// We can reuse the existing object from previous renders.
|
|
@@ -9299,6 +9369,7 @@ function initSuspenseListRenderState(workInProgress, isBackwards, tail, lastCont
|
|
|
9299
9369
|
renderState.tail = tail;
|
|
9300
9370
|
renderState.tailExpiration = 0;
|
|
9301
9371
|
renderState.tailMode = tailMode;
|
|
9372
|
+
renderState.lastEffect = lastEffectBeforeRendering;
|
|
9302
9373
|
}
|
|
9303
9374
|
} // This can end up rendering this component multiple passes.
|
|
9304
9375
|
// The first pass splits the children fibers into two sets. A head and tail.
|
|
@@ -9339,8 +9410,8 @@ function updateSuspenseListComponent(current$$1, workInProgress, renderExpiratio
|
|
|
9339
9410
|
|
|
9340
9411
|
pushSuspenseContext(workInProgress, suspenseContext);
|
|
9341
9412
|
|
|
9342
|
-
if ((workInProgress.mode &
|
|
9343
|
-
// Outside of
|
|
9413
|
+
if ((workInProgress.mode & BlockingMode) === NoMode) {
|
|
9414
|
+
// Outside of blocking mode, SuspenseList doesn't work so we just
|
|
9344
9415
|
// use make it a noop by treating it as the default revealOrder.
|
|
9345
9416
|
workInProgress.memoizedState = null;
|
|
9346
9417
|
} else {
|
|
@@ -9363,7 +9434,7 @@ function updateSuspenseListComponent(current$$1, workInProgress, renderExpiratio
|
|
|
9363
9434
|
}
|
|
9364
9435
|
|
|
9365
9436
|
initSuspenseListRenderState(workInProgress, false, // isBackwards
|
|
9366
|
-
tail, lastContentRow, tailMode);
|
|
9437
|
+
tail, lastContentRow, tailMode, workInProgress.lastEffect);
|
|
9367
9438
|
break;
|
|
9368
9439
|
}
|
|
9369
9440
|
|
|
@@ -9395,7 +9466,7 @@ function updateSuspenseListComponent(current$$1, workInProgress, renderExpiratio
|
|
|
9395
9466
|
|
|
9396
9467
|
initSuspenseListRenderState(workInProgress, true, // isBackwards
|
|
9397
9468
|
_tail, null, // last
|
|
9398
|
-
tailMode);
|
|
9469
|
+
tailMode, workInProgress.lastEffect);
|
|
9399
9470
|
break;
|
|
9400
9471
|
}
|
|
9401
9472
|
|
|
@@ -9404,7 +9475,7 @@ function updateSuspenseListComponent(current$$1, workInProgress, renderExpiratio
|
|
|
9404
9475
|
initSuspenseListRenderState(workInProgress, false, // isBackwards
|
|
9405
9476
|
null, // tail
|
|
9406
9477
|
null, // last
|
|
9407
|
-
undefined);
|
|
9478
|
+
undefined, workInProgress.lastEffect);
|
|
9408
9479
|
break;
|
|
9409
9480
|
}
|
|
9410
9481
|
|
|
@@ -9712,10 +9783,15 @@ function beginWork$1(current$$1, workInProgress, renderExpirationTime) {
|
|
|
9712
9783
|
|
|
9713
9784
|
case Profiler:
|
|
9714
9785
|
if (enableProfilerTimer) {
|
|
9715
|
-
|
|
9716
|
-
|
|
9717
|
-
|
|
9718
|
-
|
|
9786
|
+
// Profiler should only call onRender when one of its descendants actually rendered.
|
|
9787
|
+
var hasChildWork = workInProgress.childExpirationTime >= renderExpirationTime;
|
|
9788
|
+
|
|
9789
|
+
if (hasChildWork) {
|
|
9790
|
+
workInProgress.effectTag |= Update;
|
|
9791
|
+
}
|
|
9792
|
+
}
|
|
9793
|
+
|
|
9794
|
+
break;
|
|
9719
9795
|
|
|
9720
9796
|
case SuspenseComponent:
|
|
9721
9797
|
{
|
|
@@ -9768,10 +9844,11 @@ function beginWork$1(current$$1, workInProgress, renderExpirationTime) {
|
|
|
9768
9844
|
case SuspenseListComponent:
|
|
9769
9845
|
{
|
|
9770
9846
|
var didSuspendBefore = (current$$1.effectTag & DidCapture) !== NoEffect;
|
|
9771
|
-
|
|
9847
|
+
|
|
9848
|
+
var _hasChildWork = workInProgress.childExpirationTime >= renderExpirationTime;
|
|
9772
9849
|
|
|
9773
9850
|
if (didSuspendBefore) {
|
|
9774
|
-
if (
|
|
9851
|
+
if (_hasChildWork) {
|
|
9775
9852
|
// If something was in fallback state last time, and we have all the
|
|
9776
9853
|
// same children then we're still in progressive loading state.
|
|
9777
9854
|
// Something might get unblocked by state updates or retries in the
|
|
@@ -9800,7 +9877,7 @@ function beginWork$1(current$$1, workInProgress, renderExpirationTime) {
|
|
|
9800
9877
|
|
|
9801
9878
|
pushSuspenseContext(workInProgress, suspenseStackCursor.current);
|
|
9802
9879
|
|
|
9803
|
-
if (
|
|
9880
|
+
if (_hasChildWork) {
|
|
9804
9881
|
break;
|
|
9805
9882
|
} else {
|
|
9806
9883
|
// If none of the children had any work, that means that none of
|
|
@@ -9957,13 +10034,11 @@ function beginWork$1(current$$1, workInProgress, renderExpirationTime) {
|
|
|
9957
10034
|
}
|
|
9958
10035
|
}
|
|
9959
10036
|
|
|
9960
|
-
|
|
10037
|
+
{
|
|
9961
10038
|
{
|
|
9962
|
-
|
|
9963
|
-
throw ReactError(Error("Unknown unit of work tag (" + workInProgress.tag + "). This error is likely caused by a bug in React. Please file an issue."));
|
|
9964
|
-
}
|
|
10039
|
+
throw Error("Unknown unit of work tag (" + workInProgress.tag + "). This error is likely caused by a bug in React. Please file an issue.");
|
|
9965
10040
|
}
|
|
9966
|
-
}
|
|
10041
|
+
}
|
|
9967
10042
|
}
|
|
9968
10043
|
|
|
9969
10044
|
function createFundamentalStateInstance(currentFiber, props, impl, state) {
|
|
@@ -9985,14 +10060,19 @@ function getSuspenseFallbackChild(fiber) {
|
|
|
9985
10060
|
return fiber.child.sibling.child;
|
|
9986
10061
|
}
|
|
9987
10062
|
|
|
10063
|
+
var emptyObject$1 = {};
|
|
10064
|
+
|
|
9988
10065
|
function collectScopedNodes(node, fn, scopedNodes) {
|
|
9989
10066
|
if (enableScopeAPI) {
|
|
9990
10067
|
if (node.tag === HostComponent) {
|
|
9991
10068
|
var _type = node.type,
|
|
9992
|
-
memoizedProps = node.memoizedProps
|
|
10069
|
+
memoizedProps = node.memoizedProps,
|
|
10070
|
+
stateNode = node.stateNode;
|
|
10071
|
+
|
|
10072
|
+
var _instance = getPublicInstance(stateNode);
|
|
9993
10073
|
|
|
9994
|
-
if (fn(_type, memoizedProps) === true) {
|
|
9995
|
-
scopedNodes.push(
|
|
10074
|
+
if (_instance !== null && fn(_type, memoizedProps || emptyObject$1, _instance) === true) {
|
|
10075
|
+
scopedNodes.push(_instance);
|
|
9996
10076
|
}
|
|
9997
10077
|
}
|
|
9998
10078
|
|
|
@@ -10008,6 +10088,34 @@ function collectScopedNodes(node, fn, scopedNodes) {
|
|
|
10008
10088
|
}
|
|
10009
10089
|
}
|
|
10010
10090
|
|
|
10091
|
+
function collectFirstScopedNode(node, fn) {
|
|
10092
|
+
if (enableScopeAPI) {
|
|
10093
|
+
if (node.tag === HostComponent) {
|
|
10094
|
+
var _type2 = node.type,
|
|
10095
|
+
memoizedProps = node.memoizedProps,
|
|
10096
|
+
stateNode = node.stateNode;
|
|
10097
|
+
|
|
10098
|
+
var _instance2 = getPublicInstance(stateNode);
|
|
10099
|
+
|
|
10100
|
+
if (_instance2 !== null && fn(_type2, memoizedProps, _instance2) === true) {
|
|
10101
|
+
return _instance2;
|
|
10102
|
+
}
|
|
10103
|
+
}
|
|
10104
|
+
|
|
10105
|
+
var child = node.child;
|
|
10106
|
+
|
|
10107
|
+
if (isFiberSuspenseAndTimedOut(node)) {
|
|
10108
|
+
child = getSuspenseFallbackChild(node);
|
|
10109
|
+
}
|
|
10110
|
+
|
|
10111
|
+
if (child !== null) {
|
|
10112
|
+
return collectFirstScopedNodeFromChildren(child, fn);
|
|
10113
|
+
}
|
|
10114
|
+
}
|
|
10115
|
+
|
|
10116
|
+
return null;
|
|
10117
|
+
}
|
|
10118
|
+
|
|
10011
10119
|
function collectScopedNodesFromChildren(startingChild, fn, scopedNodes) {
|
|
10012
10120
|
var child = startingChild;
|
|
10013
10121
|
|
|
@@ -10017,6 +10125,22 @@ function collectScopedNodesFromChildren(startingChild, fn, scopedNodes) {
|
|
|
10017
10125
|
}
|
|
10018
10126
|
}
|
|
10019
10127
|
|
|
10128
|
+
function collectFirstScopedNodeFromChildren(startingChild, fn) {
|
|
10129
|
+
var child = startingChild;
|
|
10130
|
+
|
|
10131
|
+
while (child !== null) {
|
|
10132
|
+
var scopedNode = collectFirstScopedNode(child, fn);
|
|
10133
|
+
|
|
10134
|
+
if (scopedNode !== null) {
|
|
10135
|
+
return scopedNode;
|
|
10136
|
+
}
|
|
10137
|
+
|
|
10138
|
+
child = child.sibling;
|
|
10139
|
+
}
|
|
10140
|
+
|
|
10141
|
+
return null;
|
|
10142
|
+
}
|
|
10143
|
+
|
|
10020
10144
|
function collectNearestScopeMethods(node, scope, childrenScopes) {
|
|
10021
10145
|
if (isValidScopeNode(node, scope)) {
|
|
10022
10146
|
childrenScopes.push(node.stateNode.methods);
|
|
@@ -10043,11 +10167,10 @@ function collectNearestChildScopeMethods(startingChild, scope, childrenScopes) {
|
|
|
10043
10167
|
}
|
|
10044
10168
|
|
|
10045
10169
|
function isValidScopeNode(node, scope) {
|
|
10046
|
-
return node.tag === ScopeComponent && node.type === scope;
|
|
10170
|
+
return node.tag === ScopeComponent && node.type === scope && node.stateNode !== null;
|
|
10047
10171
|
}
|
|
10048
10172
|
|
|
10049
10173
|
function createScopeMethods(scope, instance) {
|
|
10050
|
-
var fn = scope.fn;
|
|
10051
10174
|
return {
|
|
10052
10175
|
getChildren: function () {
|
|
10053
10176
|
var currentFiber = instance.fiber;
|
|
@@ -10099,7 +10222,7 @@ function createScopeMethods(scope, instance) {
|
|
|
10099
10222
|
var currentFiber = instance.fiber;
|
|
10100
10223
|
return currentFiber.memoizedProps;
|
|
10101
10224
|
},
|
|
10102
|
-
|
|
10225
|
+
queryAllNodes: function (fn) {
|
|
10103
10226
|
var currentFiber = instance.fiber;
|
|
10104
10227
|
var child = currentFiber.child;
|
|
10105
10228
|
var scopedNodes = [];
|
|
@@ -10109,6 +10232,29 @@ function createScopeMethods(scope, instance) {
|
|
|
10109
10232
|
}
|
|
10110
10233
|
|
|
10111
10234
|
return scopedNodes.length === 0 ? null : scopedNodes;
|
|
10235
|
+
},
|
|
10236
|
+
queryFirstNode: function (fn) {
|
|
10237
|
+
var currentFiber = instance.fiber;
|
|
10238
|
+
var child = currentFiber.child;
|
|
10239
|
+
|
|
10240
|
+
if (child !== null) {
|
|
10241
|
+
return collectFirstScopedNodeFromChildren(child, fn);
|
|
10242
|
+
}
|
|
10243
|
+
|
|
10244
|
+
return null;
|
|
10245
|
+
},
|
|
10246
|
+
containsNode: function (node) {
|
|
10247
|
+
var fiber = getInstanceFromNode(node);
|
|
10248
|
+
|
|
10249
|
+
while (fiber !== null) {
|
|
10250
|
+
if (fiber.tag === ScopeComponent && fiber.type === scope && fiber.stateNode === instance) {
|
|
10251
|
+
return true;
|
|
10252
|
+
}
|
|
10253
|
+
|
|
10254
|
+
fiber = fiber.return;
|
|
10255
|
+
}
|
|
10256
|
+
|
|
10257
|
+
return false;
|
|
10112
10258
|
}
|
|
10113
10259
|
};
|
|
10114
10260
|
}
|
|
@@ -10643,13 +10789,11 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
10643
10789
|
}
|
|
10644
10790
|
} else {
|
|
10645
10791
|
if (!newProps) {
|
|
10646
|
-
(
|
|
10647
|
-
|
|
10648
|
-
|
|
10649
|
-
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."));
|
|
10650
|
-
}
|
|
10792
|
+
if (!(workInProgress.stateNode !== null)) {
|
|
10793
|
+
{
|
|
10794
|
+
throw Error("We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue.");
|
|
10651
10795
|
}
|
|
10652
|
-
}
|
|
10796
|
+
} // This can happen when we abort work.
|
|
10653
10797
|
|
|
10654
10798
|
|
|
10655
10799
|
break;
|
|
@@ -10720,13 +10864,11 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
10720
10864
|
updateHostText$1(current, workInProgress, oldText, newText);
|
|
10721
10865
|
} else {
|
|
10722
10866
|
if (typeof newText !== 'string') {
|
|
10723
|
-
(
|
|
10724
|
-
|
|
10725
|
-
|
|
10726
|
-
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."));
|
|
10727
|
-
}
|
|
10867
|
+
if (!(workInProgress.stateNode !== null)) {
|
|
10868
|
+
{
|
|
10869
|
+
throw Error("We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue.");
|
|
10728
10870
|
}
|
|
10729
|
-
}
|
|
10871
|
+
} // This can happen when we abort work.
|
|
10730
10872
|
|
|
10731
10873
|
}
|
|
10732
10874
|
|
|
@@ -10761,13 +10903,11 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
10761
10903
|
if (current === null) {
|
|
10762
10904
|
var _wasHydrated3 = popHydrationState(workInProgress);
|
|
10763
10905
|
|
|
10764
|
-
|
|
10765
|
-
|
|
10766
|
-
|
|
10767
|
-
throw ReactError(Error("A dehydrated suspense component was completed without a hydrated node. This is probably a bug in React."));
|
|
10768
|
-
}
|
|
10906
|
+
if (!_wasHydrated3) {
|
|
10907
|
+
{
|
|
10908
|
+
throw Error("A dehydrated suspense component was completed without a hydrated node. This is probably a bug in React.");
|
|
10769
10909
|
}
|
|
10770
|
-
}
|
|
10910
|
+
}
|
|
10771
10911
|
|
|
10772
10912
|
prepareToHydrateHostSuspenseInstance(workInProgress);
|
|
10773
10913
|
|
|
@@ -10810,10 +10950,9 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
10810
10950
|
var prevDidTimeout = false;
|
|
10811
10951
|
|
|
10812
10952
|
if (current === null) {
|
|
10813
|
-
|
|
10814
|
-
|
|
10815
|
-
|
|
10816
|
-
popHydrationState(workInProgress);
|
|
10953
|
+
if (workInProgress.memoizedProps.fallback !== undefined) {
|
|
10954
|
+
popHydrationState(workInProgress);
|
|
10955
|
+
}
|
|
10817
10956
|
} else {
|
|
10818
10957
|
var prevState = current.memoizedState;
|
|
10819
10958
|
prevDidTimeout = prevState !== null;
|
|
@@ -10843,12 +10982,12 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
10843
10982
|
}
|
|
10844
10983
|
|
|
10845
10984
|
if (nextDidTimeout && !prevDidTimeout) {
|
|
10846
|
-
// If this subtreee is running in
|
|
10985
|
+
// If this subtreee is running in blocking mode we can suspend,
|
|
10847
10986
|
// otherwise we won't suspend.
|
|
10848
10987
|
// TODO: This will still suspend a synchronous tree if anything
|
|
10849
10988
|
// in the concurrent tree already suspended during this render.
|
|
10850
10989
|
// This is a known bug.
|
|
10851
|
-
if ((workInProgress.mode &
|
|
10990
|
+
if ((workInProgress.mode & BlockingMode) !== NoMode) {
|
|
10852
10991
|
// TODO: Move this back to throwException because this is too late
|
|
10853
10992
|
// if this is a large tree which is common for initial loads. We
|
|
10854
10993
|
// don't know if we should restart a render or not until we get
|
|
@@ -10998,7 +11137,11 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
10998
11137
|
// Reset the effect list before doing the second pass since that's now invalid.
|
|
10999
11138
|
|
|
11000
11139
|
|
|
11001
|
-
|
|
11140
|
+
if (renderState.lastEffect === null) {
|
|
11141
|
+
workInProgress.firstEffect = null;
|
|
11142
|
+
}
|
|
11143
|
+
|
|
11144
|
+
workInProgress.lastEffect = renderState.lastEffect; // Reset the child fibers to their original state.
|
|
11002
11145
|
|
|
11003
11146
|
resetChildFibers(workInProgress, renderExpirationTime); // Set up the Suspense Context to force suspense and immediately
|
|
11004
11147
|
// rerender the children.
|
|
@@ -11021,21 +11164,22 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
11021
11164
|
|
|
11022
11165
|
if (_suspended !== null) {
|
|
11023
11166
|
workInProgress.effectTag |= DidCapture;
|
|
11024
|
-
didSuspendAlready = true;
|
|
11025
|
-
|
|
11167
|
+
didSuspendAlready = true; // Ensure we transfer the update queue to the parent so that it doesn't
|
|
11168
|
+
// get lost if this row ends up dropped during a second pass.
|
|
11026
11169
|
|
|
11027
|
-
|
|
11028
|
-
// We need to delete the row we just rendered.
|
|
11029
|
-
// Ensure we transfer the update queue to the parent.
|
|
11030
|
-
var _newThennables = _suspended.updateQueue;
|
|
11170
|
+
var _newThennables = _suspended.updateQueue;
|
|
11031
11171
|
|
|
11032
|
-
|
|
11033
|
-
|
|
11034
|
-
|
|
11035
|
-
|
|
11036
|
-
// child. The nested children have already appended themselves.
|
|
11172
|
+
if (_newThennables !== null) {
|
|
11173
|
+
workInProgress.updateQueue = _newThennables;
|
|
11174
|
+
workInProgress.effectTag |= Update;
|
|
11175
|
+
}
|
|
11037
11176
|
|
|
11177
|
+
cutOffTailIfNeeded(renderState, true); // This might have been modified.
|
|
11038
11178
|
|
|
11179
|
+
if (renderState.tail === null && renderState.tailMode === 'hidden' && !renderedTail.alternate) {
|
|
11180
|
+
// We need to delete the row we just rendered.
|
|
11181
|
+
// Reset the effect list to what it was before we rendered this
|
|
11182
|
+
// child. The nested children have already appended themselves.
|
|
11039
11183
|
var lastEffect = workInProgress.lastEffect = renderState.lastEffect; // Remove any effects that were appended after this point.
|
|
11040
11184
|
|
|
11041
11185
|
if (lastEffect !== null) {
|
|
@@ -11222,13 +11366,11 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
11222
11366
|
}
|
|
11223
11367
|
|
|
11224
11368
|
default:
|
|
11225
|
-
|
|
11369
|
+
{
|
|
11226
11370
|
{
|
|
11227
|
-
|
|
11228
|
-
throw ReactError(Error("Unknown unit of work tag (" + workInProgress.tag + "). This error is likely caused by a bug in React. Please file an issue."));
|
|
11229
|
-
}
|
|
11371
|
+
throw Error("Unknown unit of work tag (" + workInProgress.tag + "). This error is likely caused by a bug in React. Please file an issue.");
|
|
11230
11372
|
}
|
|
11231
|
-
}
|
|
11373
|
+
}
|
|
11232
11374
|
|
|
11233
11375
|
}
|
|
11234
11376
|
|
|
@@ -11261,13 +11403,11 @@ function unwindWork(workInProgress, renderExpirationTime) {
|
|
|
11261
11403
|
popTopLevelContextObject(workInProgress);
|
|
11262
11404
|
var _effectTag = workInProgress.effectTag;
|
|
11263
11405
|
|
|
11264
|
-
(
|
|
11265
|
-
|
|
11266
|
-
|
|
11267
|
-
throw ReactError(Error("The root failed to unmount after an error. This is likely a bug in React. Please file an issue."));
|
|
11268
|
-
}
|
|
11406
|
+
if (!((_effectTag & DidCapture) === NoEffect)) {
|
|
11407
|
+
{
|
|
11408
|
+
throw Error("The root failed to unmount after an error. This is likely a bug in React. Please file an issue.");
|
|
11269
11409
|
}
|
|
11270
|
-
}
|
|
11410
|
+
}
|
|
11271
11411
|
|
|
11272
11412
|
workInProgress.effectTag = _effectTag & ~ShouldCapture | DidCapture;
|
|
11273
11413
|
return workInProgress;
|
|
@@ -11288,13 +11428,11 @@ function unwindWork(workInProgress, renderExpirationTime) {
|
|
|
11288
11428
|
var suspenseState = workInProgress.memoizedState;
|
|
11289
11429
|
|
|
11290
11430
|
if (suspenseState !== null && suspenseState.dehydrated !== null) {
|
|
11291
|
-
(
|
|
11292
|
-
|
|
11293
|
-
|
|
11294
|
-
throw ReactError(Error("Threw in newly mounted dehydrated component. This is likely a bug in React. Please file an issue."));
|
|
11295
|
-
}
|
|
11431
|
+
if (!(workInProgress.alternate !== null)) {
|
|
11432
|
+
{
|
|
11433
|
+
throw Error("Threw in newly mounted dehydrated component. This is likely a bug in React. Please file an issue.");
|
|
11296
11434
|
}
|
|
11297
|
-
}
|
|
11435
|
+
}
|
|
11298
11436
|
|
|
11299
11437
|
resetHydrationState();
|
|
11300
11438
|
}
|
|
@@ -11428,13 +11566,11 @@ var invokeGuardedCallbackImpl = function (name, func, context, a, b, c, d, e, f)
|
|
|
11428
11566
|
// when we call document.createEvent(). However this can cause confusing
|
|
11429
11567
|
// errors: https://github.com/facebookincubator/create-react-app/issues/3482
|
|
11430
11568
|
// So we preemptively throw with a better message instead.
|
|
11431
|
-
(
|
|
11432
|
-
|
|
11433
|
-
|
|
11434
|
-
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."));
|
|
11435
|
-
}
|
|
11569
|
+
if (!(typeof document !== 'undefined')) {
|
|
11570
|
+
{
|
|
11571
|
+
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.");
|
|
11436
11572
|
}
|
|
11437
|
-
}
|
|
11573
|
+
}
|
|
11438
11574
|
|
|
11439
11575
|
var evt = document.createEvent('Event'); // Keeps track of whether the user-provided callback threw an error. We
|
|
11440
11576
|
// set this to true at the beginning, then set it to false right after
|
|
@@ -11602,13 +11738,11 @@ function clearCaughtError() {
|
|
|
11602
11738
|
caughtError = null;
|
|
11603
11739
|
return error;
|
|
11604
11740
|
} else {
|
|
11605
|
-
|
|
11741
|
+
{
|
|
11606
11742
|
{
|
|
11607
|
-
|
|
11608
|
-
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."));
|
|
11609
|
-
}
|
|
11743
|
+
throw Error("clearCaughtError was called but no error was captured. This error is likely caused by a bug in React. Please file an issue.");
|
|
11610
11744
|
}
|
|
11611
|
-
}
|
|
11745
|
+
}
|
|
11612
11746
|
}
|
|
11613
11747
|
}
|
|
11614
11748
|
|
|
@@ -11828,13 +11962,11 @@ function commitBeforeMutationLifeCycles(current$$1, finishedWork) {
|
|
|
11828
11962
|
|
|
11829
11963
|
default:
|
|
11830
11964
|
{
|
|
11831
|
-
|
|
11965
|
+
{
|
|
11832
11966
|
{
|
|
11833
|
-
|
|
11834
|
-
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."));
|
|
11835
|
-
}
|
|
11967
|
+
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.");
|
|
11836
11968
|
}
|
|
11837
|
-
}
|
|
11969
|
+
}
|
|
11838
11970
|
}
|
|
11839
11971
|
}
|
|
11840
11972
|
}
|
|
@@ -12056,13 +12188,11 @@ function commitLifeCycles(finishedRoot, current$$1, finishedWork, committedExpir
|
|
|
12056
12188
|
|
|
12057
12189
|
default:
|
|
12058
12190
|
{
|
|
12059
|
-
|
|
12191
|
+
{
|
|
12060
12192
|
{
|
|
12061
|
-
|
|
12062
|
-
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."));
|
|
12063
|
-
}
|
|
12193
|
+
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.");
|
|
12064
12194
|
}
|
|
12065
|
-
}
|
|
12195
|
+
}
|
|
12066
12196
|
}
|
|
12067
12197
|
}
|
|
12068
12198
|
}
|
|
@@ -12407,13 +12537,11 @@ function commitContainer(finishedWork) {
|
|
|
12407
12537
|
|
|
12408
12538
|
default:
|
|
12409
12539
|
{
|
|
12410
|
-
|
|
12540
|
+
{
|
|
12411
12541
|
{
|
|
12412
|
-
|
|
12413
|
-
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."));
|
|
12414
|
-
}
|
|
12542
|
+
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.");
|
|
12415
12543
|
}
|
|
12416
|
-
}
|
|
12544
|
+
}
|
|
12417
12545
|
}
|
|
12418
12546
|
}
|
|
12419
12547
|
}
|
|
@@ -12429,13 +12557,11 @@ function getHostParentFiber(fiber) {
|
|
|
12429
12557
|
parent = parent.return;
|
|
12430
12558
|
}
|
|
12431
12559
|
|
|
12432
|
-
|
|
12560
|
+
{
|
|
12433
12561
|
{
|
|
12434
|
-
|
|
12435
|
-
throw ReactError(Error("Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue."));
|
|
12436
|
-
}
|
|
12562
|
+
throw Error("Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue.");
|
|
12437
12563
|
}
|
|
12438
|
-
}
|
|
12564
|
+
}
|
|
12439
12565
|
}
|
|
12440
12566
|
|
|
12441
12567
|
function isHostParent(fiber) {
|
|
@@ -12527,13 +12653,11 @@ function commitPlacement(finishedWork) {
|
|
|
12527
12653
|
// eslint-disable-next-line-no-fallthrough
|
|
12528
12654
|
|
|
12529
12655
|
default:
|
|
12530
|
-
|
|
12656
|
+
{
|
|
12531
12657
|
{
|
|
12532
|
-
|
|
12533
|
-
throw ReactError(Error("Invalid host parent fiber. This error is likely caused by a bug in React. Please file an issue."));
|
|
12534
|
-
}
|
|
12658
|
+
throw Error("Invalid host parent fiber. This error is likely caused by a bug in React. Please file an issue.");
|
|
12535
12659
|
}
|
|
12536
|
-
}
|
|
12660
|
+
}
|
|
12537
12661
|
|
|
12538
12662
|
}
|
|
12539
12663
|
|
|
@@ -12610,13 +12734,11 @@ function unmountHostComponents(finishedRoot, current$$1, renderPriorityLevel) {
|
|
|
12610
12734
|
var parent = node.return;
|
|
12611
12735
|
|
|
12612
12736
|
findParent: while (true) {
|
|
12613
|
-
(
|
|
12614
|
-
|
|
12615
|
-
|
|
12616
|
-
throw ReactError(Error("Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue."));
|
|
12617
|
-
}
|
|
12737
|
+
if (!(parent !== null)) {
|
|
12738
|
+
{
|
|
12739
|
+
throw Error("Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue.");
|
|
12618
12740
|
}
|
|
12619
|
-
}
|
|
12741
|
+
}
|
|
12620
12742
|
|
|
12621
12743
|
var parentStateNode = parent.stateNode;
|
|
12622
12744
|
|
|
@@ -12850,13 +12972,11 @@ function commitWork(current$$1, finishedWork) {
|
|
|
12850
12972
|
|
|
12851
12973
|
case HostText:
|
|
12852
12974
|
{
|
|
12853
|
-
(
|
|
12854
|
-
|
|
12855
|
-
|
|
12856
|
-
throw ReactError(Error("This should have a text node initialized. This error is likely caused by a bug in React. Please file an issue."));
|
|
12857
|
-
}
|
|
12975
|
+
if (!(finishedWork.stateNode !== null)) {
|
|
12976
|
+
{
|
|
12977
|
+
throw Error("This should have a text node initialized. This error is likely caused by a bug in React. Please file an issue.");
|
|
12858
12978
|
}
|
|
12859
|
-
}
|
|
12979
|
+
}
|
|
12860
12980
|
|
|
12861
12981
|
var textInstance = finishedWork.stateNode;
|
|
12862
12982
|
var newText = finishedWork.memoizedProps; // For hydration we reuse the update path but we treat the oldProps
|
|
@@ -12941,13 +13061,11 @@ function commitWork(current$$1, finishedWork) {
|
|
|
12941
13061
|
|
|
12942
13062
|
default:
|
|
12943
13063
|
{
|
|
12944
|
-
|
|
13064
|
+
{
|
|
12945
13065
|
{
|
|
12946
|
-
|
|
12947
|
-
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."));
|
|
12948
|
-
}
|
|
13066
|
+
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.");
|
|
12949
13067
|
}
|
|
12950
|
-
}
|
|
13068
|
+
}
|
|
12951
13069
|
}
|
|
12952
13070
|
}
|
|
12953
13071
|
}
|
|
@@ -13195,17 +13313,17 @@ function throwException(root, returnFiber, sourceFiber, value, renderExpirationT
|
|
|
13195
13313
|
_workInProgress.updateQueue = updateQueue;
|
|
13196
13314
|
} else {
|
|
13197
13315
|
thenables.add(thenable);
|
|
13198
|
-
} // If the boundary is outside of
|
|
13316
|
+
} // If the boundary is outside of blocking mode, we should *not*
|
|
13199
13317
|
// suspend the commit. Pretend as if the suspended component rendered
|
|
13200
13318
|
// null and keep rendering. In the commit phase, we'll schedule a
|
|
13201
13319
|
// subsequent synchronous update to re-render the Suspense.
|
|
13202
13320
|
//
|
|
13203
13321
|
// Note: It doesn't matter whether the component that suspended was
|
|
13204
|
-
// inside a
|
|
13322
|
+
// inside a blocking mode tree. If the Suspense is outside of it, we
|
|
13205
13323
|
// should *not* suspend the commit.
|
|
13206
13324
|
|
|
13207
13325
|
|
|
13208
|
-
if ((_workInProgress.mode &
|
|
13326
|
+
if ((_workInProgress.mode & BlockingMode) === NoMode) {
|
|
13209
13327
|
_workInProgress.effectTag |= DidCapture; // We're going to commit this fiber even though it didn't complete.
|
|
13210
13328
|
// But we shouldn't call any lifecycle methods or callbacks. Remove
|
|
13211
13329
|
// all lifecycle effect tags.
|
|
@@ -13371,7 +13489,6 @@ var RootErrored = 2;
|
|
|
13371
13489
|
var RootSuspended = 3;
|
|
13372
13490
|
var RootSuspendedWithDelay = 4;
|
|
13373
13491
|
var RootCompleted = 5;
|
|
13374
|
-
var RootLocked = 6;
|
|
13375
13492
|
// Describes where we are in the React execution stack
|
|
13376
13493
|
var executionContext = NoContext; // The root we're working on
|
|
13377
13494
|
|
|
@@ -13431,7 +13548,7 @@ var spawnedWorkDuringRender = null; // Expiration times are computed by adding t
|
|
|
13431
13548
|
// receive the same expiration time. Otherwise we get tearing.
|
|
13432
13549
|
|
|
13433
13550
|
var currentEventTime = NoWork;
|
|
13434
|
-
function
|
|
13551
|
+
function requestCurrentTimeForUpdate() {
|
|
13435
13552
|
if ((executionContext & (RenderContext | CommitContext)) !== NoContext) {
|
|
13436
13553
|
// We're inside React, so it's fine to read the actual time.
|
|
13437
13554
|
return msToExpirationTime(now$1());
|
|
@@ -13447,10 +13564,13 @@ function requestCurrentTime() {
|
|
|
13447
13564
|
currentEventTime = msToExpirationTime(now$1());
|
|
13448
13565
|
return currentEventTime;
|
|
13449
13566
|
}
|
|
13567
|
+
function getCurrentTime() {
|
|
13568
|
+
return msToExpirationTime(now$1());
|
|
13569
|
+
}
|
|
13450
13570
|
function computeExpirationForFiber(currentTime, fiber, suspenseConfig) {
|
|
13451
13571
|
var mode = fiber.mode;
|
|
13452
13572
|
|
|
13453
|
-
if ((mode &
|
|
13573
|
+
if ((mode & BlockingMode) === NoMode) {
|
|
13454
13574
|
return Sync;
|
|
13455
13575
|
}
|
|
13456
13576
|
|
|
@@ -13495,13 +13615,11 @@ function computeExpirationForFiber(currentTime, fiber, suspenseConfig) {
|
|
|
13495
13615
|
break;
|
|
13496
13616
|
|
|
13497
13617
|
default:
|
|
13498
|
-
|
|
13618
|
+
{
|
|
13499
13619
|
{
|
|
13500
|
-
|
|
13501
|
-
throw ReactError(Error("Expected a valid priority level"));
|
|
13502
|
-
}
|
|
13620
|
+
throw Error("Expected a valid priority level");
|
|
13503
13621
|
}
|
|
13504
|
-
}
|
|
13622
|
+
}
|
|
13505
13623
|
|
|
13506
13624
|
}
|
|
13507
13625
|
} // If we're in the middle of rendering a tree, do not update at the same
|
|
@@ -13518,21 +13636,6 @@ function computeExpirationForFiber(currentTime, fiber, suspenseConfig) {
|
|
|
13518
13636
|
|
|
13519
13637
|
return expirationTime;
|
|
13520
13638
|
}
|
|
13521
|
-
var lastUniqueAsyncExpiration = NoWork;
|
|
13522
|
-
function computeUniqueAsyncExpiration() {
|
|
13523
|
-
var currentTime = requestCurrentTime();
|
|
13524
|
-
var result = computeAsyncExpiration(currentTime);
|
|
13525
|
-
|
|
13526
|
-
if (result <= lastUniqueAsyncExpiration) {
|
|
13527
|
-
// Since we assume the current time monotonically increases, we only hit
|
|
13528
|
-
// this branch when computeUniqueAsyncExpiration is fired multiple times
|
|
13529
|
-
// within a 200ms window (or whatever the async bucket size is).
|
|
13530
|
-
result -= 1;
|
|
13531
|
-
}
|
|
13532
|
-
|
|
13533
|
-
lastUniqueAsyncExpiration = result;
|
|
13534
|
-
return result;
|
|
13535
|
-
}
|
|
13536
13639
|
function scheduleUpdateOnFiber(fiber, expirationTime) {
|
|
13537
13640
|
checkForNestedUpdates();
|
|
13538
13641
|
warnAboutInvalidUpdatesOnClassComponentsInDEV(fiber);
|
|
@@ -13568,7 +13671,7 @@ function scheduleUpdateOnFiber(fiber, expirationTime) {
|
|
|
13568
13671
|
// a batch. This is intentionally inside scheduleUpdateOnFiber instead of
|
|
13569
13672
|
// scheduleCallbackForFiber to preserve the ability to schedule a callback
|
|
13570
13673
|
// without immediately flushing it. We only do this for user-initiated
|
|
13571
|
-
// updates, to preserve historical behavior of
|
|
13674
|
+
// updates, to preserve historical behavior of legacy mode.
|
|
13572
13675
|
flushSyncCallbackQueue();
|
|
13573
13676
|
}
|
|
13574
13677
|
}
|
|
@@ -13729,7 +13832,7 @@ function ensureRootIsScheduled(root) {
|
|
|
13729
13832
|
// time as an argument.
|
|
13730
13833
|
|
|
13731
13834
|
|
|
13732
|
-
var currentTime =
|
|
13835
|
+
var currentTime = requestCurrentTimeForUpdate();
|
|
13733
13836
|
var priorityLevel = inferPriorityFromExpirationTime(currentTime, expirationTime); // If there's an existing render task, confirm it has the correct priority and
|
|
13734
13837
|
// expiration time. Otherwise, we'll cancel it and schedule a new one.
|
|
13735
13838
|
|
|
@@ -13780,7 +13883,7 @@ function performConcurrentWorkOnRoot(root, didTimeout) {
|
|
|
13780
13883
|
if (didTimeout) {
|
|
13781
13884
|
// The render task took too long to complete. Mark the current time as
|
|
13782
13885
|
// expired to synchronously render all expired work in a single batch.
|
|
13783
|
-
var currentTime =
|
|
13886
|
+
var currentTime = requestCurrentTimeForUpdate();
|
|
13784
13887
|
markRootExpiredAtTime(root, currentTime); // This will schedule a synchronous callback.
|
|
13785
13888
|
|
|
13786
13889
|
ensureRootIsScheduled(root);
|
|
@@ -13794,13 +13897,11 @@ function performConcurrentWorkOnRoot(root, didTimeout) {
|
|
|
13794
13897
|
if (expirationTime !== NoWork) {
|
|
13795
13898
|
var originalCallbackNode = root.callbackNode;
|
|
13796
13899
|
|
|
13797
|
-
(
|
|
13798
|
-
|
|
13799
|
-
|
|
13800
|
-
throw ReactError(Error("Should not already be working."));
|
|
13801
|
-
}
|
|
13900
|
+
if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) {
|
|
13901
|
+
{
|
|
13902
|
+
throw Error("Should not already be working.");
|
|
13802
13903
|
}
|
|
13803
|
-
}
|
|
13904
|
+
}
|
|
13804
13905
|
|
|
13805
13906
|
flushPassiveEffects(); // If the root or expiration time have changed, throw out the existing stack
|
|
13806
13907
|
// and prepare a fresh one. Otherwise we'll continue where we left off.
|
|
@@ -13854,7 +13955,6 @@ function performConcurrentWorkOnRoot(root, didTimeout) {
|
|
|
13854
13955
|
stopFinishedWorkLoopTimer();
|
|
13855
13956
|
var finishedWork = root.finishedWork = root.current.alternate;
|
|
13856
13957
|
root.finishedExpirationTime = expirationTime;
|
|
13857
|
-
resolveLocksOnRoot(root, expirationTime);
|
|
13858
13958
|
finishConcurrentRender(root, finishedWork, workInProgressRootExitStatus, expirationTime);
|
|
13859
13959
|
}
|
|
13860
13960
|
|
|
@@ -13879,13 +13979,11 @@ function finishConcurrentRender(root, finishedWork, exitStatus, expirationTime)
|
|
|
13879
13979
|
case RootIncomplete:
|
|
13880
13980
|
case RootFatalErrored:
|
|
13881
13981
|
{
|
|
13882
|
-
|
|
13982
|
+
{
|
|
13883
13983
|
{
|
|
13884
|
-
|
|
13885
|
-
throw ReactError(Error("Root did not complete. This is a bug in React."));
|
|
13886
|
-
}
|
|
13984
|
+
throw Error("Root did not complete. This is a bug in React.");
|
|
13887
13985
|
}
|
|
13888
|
-
}
|
|
13986
|
+
}
|
|
13889
13987
|
}
|
|
13890
13988
|
// Flow knows about invariant, so it complains if I add a break
|
|
13891
13989
|
// statement, but eslint doesn't know about invariant, so it complains
|
|
@@ -13893,18 +13991,16 @@ function finishConcurrentRender(root, finishedWork, exitStatus, expirationTime)
|
|
|
13893
13991
|
|
|
13894
13992
|
case RootErrored:
|
|
13895
13993
|
{
|
|
13896
|
-
|
|
13897
|
-
|
|
13898
|
-
|
|
13899
|
-
|
|
13900
|
-
|
|
13901
|
-
|
|
13902
|
-
|
|
13903
|
-
|
|
13904
|
-
|
|
13905
|
-
|
|
13994
|
+
// If this was an async render, the error may have happened due to
|
|
13995
|
+
// a mutation in a concurrent event. Try rendering one more time,
|
|
13996
|
+
// synchronously, to see if the error goes away. If there are
|
|
13997
|
+
// lower priority updates, let's include those, too, in case they
|
|
13998
|
+
// fix the inconsistency. Render at Idle to include all updates.
|
|
13999
|
+
// If it was Idle or Never or some not-yet-invented time, render
|
|
14000
|
+
// at that time.
|
|
14001
|
+
markRootExpiredAtTime(root, expirationTime > Idle ? Idle : expirationTime); // We assume that this second render pass will be synchronous
|
|
14002
|
+
// and therefore not hit this path again.
|
|
13906
14003
|
|
|
13907
|
-
commitRoot(root);
|
|
13908
14004
|
break;
|
|
13909
14005
|
}
|
|
13910
14006
|
|
|
@@ -14088,24 +14184,13 @@ function finishConcurrentRender(root, finishedWork, exitStatus, expirationTime)
|
|
|
14088
14184
|
break;
|
|
14089
14185
|
}
|
|
14090
14186
|
|
|
14091
|
-
case RootLocked:
|
|
14092
|
-
{
|
|
14093
|
-
// This root has a lock that prevents it from committing. Exit. If
|
|
14094
|
-
// we begin work on the root again, without any intervening updates,
|
|
14095
|
-
// it will finish without doing additional work.
|
|
14096
|
-
markRootSuspendedAtTime(root, expirationTime);
|
|
14097
|
-
break;
|
|
14098
|
-
}
|
|
14099
|
-
|
|
14100
14187
|
default:
|
|
14101
14188
|
{
|
|
14102
|
-
|
|
14189
|
+
{
|
|
14103
14190
|
{
|
|
14104
|
-
|
|
14105
|
-
throw ReactError(Error("Unknown root exit status."));
|
|
14106
|
-
}
|
|
14191
|
+
throw Error("Unknown root exit status.");
|
|
14107
14192
|
}
|
|
14108
|
-
}
|
|
14193
|
+
}
|
|
14109
14194
|
}
|
|
14110
14195
|
}
|
|
14111
14196
|
} // This is the entry point for synchronous tasks that don't go
|
|
@@ -14123,13 +14208,11 @@ function performSyncWorkOnRoot(root) {
|
|
|
14123
14208
|
// batch.commit() API.
|
|
14124
14209
|
commitRoot(root);
|
|
14125
14210
|
} else {
|
|
14126
|
-
(
|
|
14127
|
-
|
|
14128
|
-
|
|
14129
|
-
throw ReactError(Error("Should not already be working."));
|
|
14130
|
-
}
|
|
14211
|
+
if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) {
|
|
14212
|
+
{
|
|
14213
|
+
throw Error("Should not already be working.");
|
|
14131
14214
|
}
|
|
14132
|
-
}
|
|
14215
|
+
}
|
|
14133
14216
|
|
|
14134
14217
|
flushPassiveEffects(); // If the root or expiration time have changed, throw out the existing stack
|
|
14135
14218
|
// and prepare a fresh one. Otherwise we'll continue where we left off.
|
|
@@ -14176,21 +14259,17 @@ function performSyncWorkOnRoot(root) {
|
|
|
14176
14259
|
|
|
14177
14260
|
if (workInProgress !== null) {
|
|
14178
14261
|
// This is a sync render, so we should have finished the whole tree.
|
|
14179
|
-
|
|
14262
|
+
{
|
|
14180
14263
|
{
|
|
14181
|
-
|
|
14182
|
-
throw ReactError(Error("Cannot commit an incomplete root. This error is likely caused by a bug in React. Please file an issue."));
|
|
14183
|
-
}
|
|
14264
|
+
throw Error("Cannot commit an incomplete root. This error is likely caused by a bug in React. Please file an issue.");
|
|
14184
14265
|
}
|
|
14185
|
-
}
|
|
14266
|
+
}
|
|
14186
14267
|
} else {
|
|
14187
14268
|
// We now have a consistent tree. Because this is a sync render, we
|
|
14188
|
-
// will commit it even if something suspended.
|
|
14189
|
-
// if the root is locked (using the unstable_createBatch API).
|
|
14269
|
+
// will commit it even if something suspended.
|
|
14190
14270
|
stopFinishedWorkLoopTimer();
|
|
14191
14271
|
root.finishedWork = root.current.alternate;
|
|
14192
14272
|
root.finishedExpirationTime = expirationTime;
|
|
14193
|
-
resolveLocksOnRoot(root, expirationTime);
|
|
14194
14273
|
finishSyncRender(root, workInProgressRootExitStatus, expirationTime);
|
|
14195
14274
|
} // Before exiting, make sure there's a callback scheduled for the next
|
|
14196
14275
|
// pending level.
|
|
@@ -14204,39 +14283,25 @@ function performSyncWorkOnRoot(root) {
|
|
|
14204
14283
|
}
|
|
14205
14284
|
|
|
14206
14285
|
function finishSyncRender(root, exitStatus, expirationTime) {
|
|
14207
|
-
|
|
14208
|
-
|
|
14209
|
-
// begin work on the root again, without any intervening updates, it
|
|
14210
|
-
// will finish without doing additional work.
|
|
14211
|
-
markRootSuspendedAtTime(root, expirationTime);
|
|
14212
|
-
} else {
|
|
14213
|
-
// Set this to null to indicate there's no in-progress render.
|
|
14214
|
-
workInProgressRoot = null;
|
|
14286
|
+
// Set this to null to indicate there's no in-progress render.
|
|
14287
|
+
workInProgressRoot = null;
|
|
14215
14288
|
|
|
14216
|
-
|
|
14217
|
-
|
|
14218
|
-
|
|
14219
|
-
}
|
|
14289
|
+
{
|
|
14290
|
+
if (exitStatus === RootSuspended || exitStatus === RootSuspendedWithDelay) {
|
|
14291
|
+
flushSuspensePriorityWarningInDEV();
|
|
14220
14292
|
}
|
|
14221
|
-
|
|
14222
|
-
commitRoot(root);
|
|
14223
14293
|
}
|
|
14294
|
+
|
|
14295
|
+
commitRoot(root);
|
|
14224
14296
|
}
|
|
14225
14297
|
|
|
14226
14298
|
function flushRoot(root, expirationTime) {
|
|
14227
|
-
if ((executionContext & (RenderContext | CommitContext)) !== NoContext) {
|
|
14228
|
-
(function () {
|
|
14229
|
-
{
|
|
14230
|
-
{
|
|
14231
|
-
throw ReactError(Error("work.commit(): Cannot commit while already rendering. This likely means you attempted to commit from inside a lifecycle method."));
|
|
14232
|
-
}
|
|
14233
|
-
}
|
|
14234
|
-
})();
|
|
14235
|
-
}
|
|
14236
|
-
|
|
14237
14299
|
markRootExpiredAtTime(root, expirationTime);
|
|
14238
14300
|
ensureRootIsScheduled(root);
|
|
14239
|
-
|
|
14301
|
+
|
|
14302
|
+
if ((executionContext & (RenderContext | CommitContext)) === NoContext) {
|
|
14303
|
+
flushSyncCallbackQueue();
|
|
14304
|
+
}
|
|
14240
14305
|
}
|
|
14241
14306
|
function flushDiscreteUpdates() {
|
|
14242
14307
|
// TODO: Should be able to flush inside batchedUpdates, but not inside `act`.
|
|
@@ -14259,20 +14324,6 @@ function flushDiscreteUpdates() {
|
|
|
14259
14324
|
|
|
14260
14325
|
flushPassiveEffects();
|
|
14261
14326
|
}
|
|
14262
|
-
|
|
14263
|
-
function resolveLocksOnRoot(root, expirationTime) {
|
|
14264
|
-
var firstBatch = root.firstBatch;
|
|
14265
|
-
|
|
14266
|
-
if (firstBatch !== null && firstBatch._defer && firstBatch._expirationTime >= expirationTime) {
|
|
14267
|
-
scheduleCallback(NormalPriority, function () {
|
|
14268
|
-
firstBatch._onComplete();
|
|
14269
|
-
|
|
14270
|
-
return null;
|
|
14271
|
-
});
|
|
14272
|
-
workInProgressRootExitStatus = RootLocked;
|
|
14273
|
-
}
|
|
14274
|
-
}
|
|
14275
|
-
|
|
14276
14327
|
function deferredUpdates(fn) {
|
|
14277
14328
|
// TODO: Remove in favor of Scheduler.next
|
|
14278
14329
|
return runWithPriority(NormalPriority, fn);
|
|
@@ -14360,13 +14411,11 @@ function unbatchedUpdates(fn, a) {
|
|
|
14360
14411
|
}
|
|
14361
14412
|
function flushSync(fn, a) {
|
|
14362
14413
|
if ((executionContext & (RenderContext | CommitContext)) !== NoContext) {
|
|
14363
|
-
|
|
14414
|
+
{
|
|
14364
14415
|
{
|
|
14365
|
-
|
|
14366
|
-
throw ReactError(Error("flushSync was called from inside a lifecycle method. It cannot be called when React is already rendering."));
|
|
14367
|
-
}
|
|
14416
|
+
throw Error("flushSync was called from inside a lifecycle method. It cannot be called when React is already rendering.");
|
|
14368
14417
|
}
|
|
14369
|
-
}
|
|
14418
|
+
}
|
|
14370
14419
|
}
|
|
14371
14420
|
|
|
14372
14421
|
var prevExecutionContext = executionContext;
|
|
@@ -14447,6 +14496,7 @@ function handleError(root, thrownValue) {
|
|
|
14447
14496
|
// Reset module-level state that was set during the render phase.
|
|
14448
14497
|
resetContextDependencies();
|
|
14449
14498
|
resetHooks();
|
|
14499
|
+
resetCurrentFiber();
|
|
14450
14500
|
|
|
14451
14501
|
if (workInProgress === null || workInProgress.return === null) {
|
|
14452
14502
|
// Expected to be working on a non-root fiber. This is a fatal error
|
|
@@ -14843,16 +14893,23 @@ function commitRoot(root) {
|
|
|
14843
14893
|
}
|
|
14844
14894
|
|
|
14845
14895
|
function commitRootImpl(root, renderPriorityLevel) {
|
|
14846
|
-
|
|
14896
|
+
do {
|
|
14897
|
+
// `flushPassiveEffects` will call `flushSyncUpdateQueue` at the end, which
|
|
14898
|
+
// means `flushPassiveEffects` will sometimes result in additional
|
|
14899
|
+
// passive effects. So we need to keep flushing in a loop until there are
|
|
14900
|
+
// no more pending effects.
|
|
14901
|
+
// TODO: Might be better if `flushPassiveEffects` did not automatically
|
|
14902
|
+
// flush synchronous work at the end, to avoid factoring hazards like this.
|
|
14903
|
+
flushPassiveEffects();
|
|
14904
|
+
} while (rootWithPendingPassiveEffects !== null);
|
|
14905
|
+
|
|
14847
14906
|
flushRenderPhaseStrictModeWarningsInDEV();
|
|
14848
14907
|
|
|
14849
|
-
(
|
|
14850
|
-
|
|
14851
|
-
|
|
14852
|
-
throw ReactError(Error("Should not already be working."));
|
|
14853
|
-
}
|
|
14908
|
+
if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) {
|
|
14909
|
+
{
|
|
14910
|
+
throw Error("Should not already be working.");
|
|
14854
14911
|
}
|
|
14855
|
-
}
|
|
14912
|
+
}
|
|
14856
14913
|
|
|
14857
14914
|
var finishedWork = root.finishedWork;
|
|
14858
14915
|
var expirationTime = root.finishedExpirationTime;
|
|
@@ -14864,13 +14921,11 @@ function commitRootImpl(root, renderPriorityLevel) {
|
|
|
14864
14921
|
root.finishedWork = null;
|
|
14865
14922
|
root.finishedExpirationTime = NoWork;
|
|
14866
14923
|
|
|
14867
|
-
(
|
|
14868
|
-
|
|
14869
|
-
|
|
14870
|
-
throw ReactError(Error("Cannot commit the same tree as before. This error is likely caused by a bug in React. Please file an issue."));
|
|
14871
|
-
}
|
|
14924
|
+
if (!(finishedWork !== root.current)) {
|
|
14925
|
+
{
|
|
14926
|
+
throw Error("Cannot commit the same tree as before. This error is likely caused by a bug in React. Please file an issue.");
|
|
14872
14927
|
}
|
|
14873
|
-
}
|
|
14928
|
+
} // commitRoot never returns a continuation; it always finishes synchronously.
|
|
14874
14929
|
// So we can clear these now to allow a new callback to be scheduled.
|
|
14875
14930
|
|
|
14876
14931
|
|
|
@@ -14934,13 +14989,11 @@ function commitRootImpl(root, renderPriorityLevel) {
|
|
|
14934
14989
|
invokeGuardedCallback(null, commitBeforeMutationEffects, null);
|
|
14935
14990
|
|
|
14936
14991
|
if (hasCaughtError()) {
|
|
14937
|
-
(
|
|
14938
|
-
|
|
14939
|
-
|
|
14940
|
-
throw ReactError(Error("Should be working on an effect."));
|
|
14941
|
-
}
|
|
14992
|
+
if (!(nextEffect !== null)) {
|
|
14993
|
+
{
|
|
14994
|
+
throw Error("Should be working on an effect.");
|
|
14942
14995
|
}
|
|
14943
|
-
}
|
|
14996
|
+
}
|
|
14944
14997
|
|
|
14945
14998
|
var error = clearCaughtError();
|
|
14946
14999
|
captureCommitPhaseError(nextEffect, error);
|
|
@@ -14966,13 +15019,11 @@ function commitRootImpl(root, renderPriorityLevel) {
|
|
|
14966
15019
|
invokeGuardedCallback(null, commitMutationEffects, null, root, renderPriorityLevel);
|
|
14967
15020
|
|
|
14968
15021
|
if (hasCaughtError()) {
|
|
14969
|
-
(
|
|
14970
|
-
|
|
14971
|
-
|
|
14972
|
-
throw ReactError(Error("Should be working on an effect."));
|
|
14973
|
-
}
|
|
15022
|
+
if (!(nextEffect !== null)) {
|
|
15023
|
+
{
|
|
15024
|
+
throw Error("Should be working on an effect.");
|
|
14974
15025
|
}
|
|
14975
|
-
}
|
|
15026
|
+
}
|
|
14976
15027
|
|
|
14977
15028
|
var _error = clearCaughtError();
|
|
14978
15029
|
|
|
@@ -15000,13 +15051,11 @@ function commitRootImpl(root, renderPriorityLevel) {
|
|
|
15000
15051
|
invokeGuardedCallback(null, commitLayoutEffects, null, root, expirationTime);
|
|
15001
15052
|
|
|
15002
15053
|
if (hasCaughtError()) {
|
|
15003
|
-
(
|
|
15004
|
-
|
|
15005
|
-
|
|
15006
|
-
throw ReactError(Error("Should be working on an effect."));
|
|
15007
|
-
}
|
|
15054
|
+
if (!(nextEffect !== null)) {
|
|
15055
|
+
{
|
|
15056
|
+
throw Error("Should be working on an effect.");
|
|
15008
15057
|
}
|
|
15009
|
-
}
|
|
15058
|
+
}
|
|
15010
15059
|
|
|
15011
15060
|
var _error2 = clearCaughtError();
|
|
15012
15061
|
|
|
@@ -15292,13 +15341,11 @@ function flushPassiveEffectsImpl() {
|
|
|
15292
15341
|
rootWithPendingPassiveEffects = null;
|
|
15293
15342
|
pendingPassiveEffectsExpirationTime = NoWork;
|
|
15294
15343
|
|
|
15295
|
-
(
|
|
15296
|
-
|
|
15297
|
-
|
|
15298
|
-
throw ReactError(Error("Cannot flush passive effects while already rendering."));
|
|
15299
|
-
}
|
|
15344
|
+
if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) {
|
|
15345
|
+
{
|
|
15346
|
+
throw Error("Cannot flush passive effects while already rendering.");
|
|
15300
15347
|
}
|
|
15301
|
-
}
|
|
15348
|
+
}
|
|
15302
15349
|
|
|
15303
15350
|
var prevExecutionContext = executionContext;
|
|
15304
15351
|
executionContext |= CommitContext;
|
|
@@ -15314,13 +15361,11 @@ function flushPassiveEffectsImpl() {
|
|
|
15314
15361
|
invokeGuardedCallback(null, commitPassiveHookEffects, null, effect);
|
|
15315
15362
|
|
|
15316
15363
|
if (hasCaughtError()) {
|
|
15317
|
-
(
|
|
15318
|
-
|
|
15319
|
-
|
|
15320
|
-
throw ReactError(Error("Should be working on an effect."));
|
|
15321
|
-
}
|
|
15364
|
+
if (!(effect !== null)) {
|
|
15365
|
+
{
|
|
15366
|
+
throw Error("Should be working on an effect.");
|
|
15322
15367
|
}
|
|
15323
|
-
}
|
|
15368
|
+
}
|
|
15324
15369
|
|
|
15325
15370
|
var error = clearCaughtError();
|
|
15326
15371
|
captureCommitPhaseError(effect, error);
|
|
@@ -15481,10 +15526,10 @@ function retryTimedOutBoundary(boundaryFiber, retryTime) {
|
|
|
15481
15526
|
// previously was rendered in its fallback state. One of the promises that
|
|
15482
15527
|
// suspended it has resolved, which means at least part of the tree was
|
|
15483
15528
|
// likely unblocked. Try rendering again, at a new expiration time.
|
|
15484
|
-
if (retryTime ===
|
|
15529
|
+
if (retryTime === NoWork) {
|
|
15485
15530
|
var suspenseConfig = null; // Retries don't carry over the already committed update.
|
|
15486
15531
|
|
|
15487
|
-
var currentTime =
|
|
15532
|
+
var currentTime = requestCurrentTimeForUpdate();
|
|
15488
15533
|
retryTime = computeExpirationForFiber(currentTime, boundaryFiber, suspenseConfig);
|
|
15489
15534
|
} // TODO: Special case idle priority?
|
|
15490
15535
|
|
|
@@ -15499,7 +15544,7 @@ function retryTimedOutBoundary(boundaryFiber, retryTime) {
|
|
|
15499
15544
|
|
|
15500
15545
|
function retryDehydratedSuspenseBoundary(boundaryFiber) {
|
|
15501
15546
|
var suspenseState = boundaryFiber.memoizedState;
|
|
15502
|
-
var retryTime =
|
|
15547
|
+
var retryTime = NoWork;
|
|
15503
15548
|
|
|
15504
15549
|
if (suspenseState !== null) {
|
|
15505
15550
|
retryTime = suspenseState.retryTime;
|
|
@@ -15508,7 +15553,7 @@ function retryDehydratedSuspenseBoundary(boundaryFiber) {
|
|
|
15508
15553
|
retryTimedOutBoundary(boundaryFiber, retryTime);
|
|
15509
15554
|
}
|
|
15510
15555
|
function resolveRetryThenable(boundaryFiber, thenable) {
|
|
15511
|
-
var retryTime =
|
|
15556
|
+
var retryTime = NoWork; // Default
|
|
15512
15557
|
|
|
15513
15558
|
var retryCache;
|
|
15514
15559
|
|
|
@@ -15529,13 +15574,11 @@ function resolveRetryThenable(boundaryFiber, thenable) {
|
|
|
15529
15574
|
break;
|
|
15530
15575
|
|
|
15531
15576
|
default:
|
|
15532
|
-
|
|
15577
|
+
{
|
|
15533
15578
|
{
|
|
15534
|
-
|
|
15535
|
-
throw ReactError(Error("Pinged unknown suspense boundary type. This is probably a bug in React."));
|
|
15536
|
-
}
|
|
15579
|
+
throw Error("Pinged unknown suspense boundary type. This is probably a bug in React.");
|
|
15537
15580
|
}
|
|
15538
|
-
}
|
|
15581
|
+
}
|
|
15539
15582
|
|
|
15540
15583
|
}
|
|
15541
15584
|
} else {
|
|
@@ -15592,13 +15635,11 @@ function checkForNestedUpdates() {
|
|
|
15592
15635
|
nestedUpdateCount = 0;
|
|
15593
15636
|
rootWithNestedUpdates = null;
|
|
15594
15637
|
|
|
15595
|
-
|
|
15638
|
+
{
|
|
15596
15639
|
{
|
|
15597
|
-
|
|
15598
|
-
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."));
|
|
15599
|
-
}
|
|
15640
|
+
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.");
|
|
15600
15641
|
}
|
|
15601
|
-
}
|
|
15642
|
+
}
|
|
15602
15643
|
}
|
|
15603
15644
|
|
|
15604
15645
|
{
|
|
@@ -15686,12 +15727,14 @@ if (true && replayFailedUnitOfWorkWithInvokeGuardedCallback) {
|
|
|
15686
15727
|
if (originalError !== null && typeof originalError === 'object' && typeof originalError.then === 'function') {
|
|
15687
15728
|
// Don't replay promises. Treat everything else like an error.
|
|
15688
15729
|
throw originalError;
|
|
15689
|
-
} // Keep this code in sync with
|
|
15730
|
+
} // Keep this code in sync with handleError; any changes here must have
|
|
15690
15731
|
// corresponding changes there.
|
|
15691
15732
|
|
|
15692
15733
|
|
|
15693
15734
|
resetContextDependencies();
|
|
15694
|
-
resetHooks(); //
|
|
15735
|
+
resetHooks(); // Don't reset current debug fiber, since we're about to work on the
|
|
15736
|
+
// same fiber again.
|
|
15737
|
+
// Unwind the failed stack frame
|
|
15695
15738
|
|
|
15696
15739
|
unwindInterruptedWork(unitOfWork); // Restore the original properties of the fiber.
|
|
15697
15740
|
|
|
@@ -15786,7 +15829,7 @@ var didWarnAboutUnmockedScheduler = false; // TODO Before we release concurrent
|
|
|
15786
15829
|
function warnIfUnmockedScheduler(fiber) {
|
|
15787
15830
|
{
|
|
15788
15831
|
if (didWarnAboutUnmockedScheduler === false && Scheduler.unstable_flushAllWithoutAsserting === undefined) {
|
|
15789
|
-
if (fiber.mode &
|
|
15832
|
+
if (fiber.mode & BlockingMode || fiber.mode & ConcurrentMode) {
|
|
15790
15833
|
didWarnAboutUnmockedScheduler = true;
|
|
15791
15834
|
warningWithoutStack$1(false, 'In Concurrent or Sync modes, the "scheduler" module needs to be mocked ' + 'to guarantee consistent behaviour across tests and browsers. ' + 'For example, with jest: \n' + "jest.mock('scheduler', () => require('scheduler/unstable_mock'));\n\n" + 'For more info, visit https://fb.me/react-mock-scheduler');
|
|
15792
15835
|
} else if (warnAboutUnmockedScheduler === true) {
|
|
@@ -15890,7 +15933,7 @@ function flushSuspensePriorityWarningInDEV() {
|
|
|
15890
15933
|
componentsThatTriggeredHighPriSuspend = null;
|
|
15891
15934
|
|
|
15892
15935
|
if (componentNames.length > 0) {
|
|
15893
|
-
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
|
|
15936
|
+
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
|
|
15894
15937
|
componentNames.sort().join(', '));
|
|
15895
15938
|
}
|
|
15896
15939
|
}
|
|
@@ -15977,10 +16020,10 @@ function startWorkOnPendingInteractions(root, expirationTime) {
|
|
|
15977
16020
|
});
|
|
15978
16021
|
}
|
|
15979
16022
|
}); // Store the current set of interactions on the FiberRoot for a few reasons:
|
|
15980
|
-
// We can re-use it in hot functions like
|
|
15981
|
-
// recalculate it. We will also use it in commitWork() to
|
|
15982
|
-
// onRender() hooks. This also provides DevTools with a
|
|
15983
|
-
// the onCommitRoot() hook is called.
|
|
16023
|
+
// We can re-use it in hot functions like performConcurrentWorkOnRoot()
|
|
16024
|
+
// without having to recalculate it. We will also use it in commitWork() to
|
|
16025
|
+
// pass to any Profiler onRender() hooks. This also provides DevTools with a
|
|
16026
|
+
// way to access it when the onCommitRoot() hook is called.
|
|
15984
16027
|
|
|
15985
16028
|
root.memoizedInteractions = interactions;
|
|
15986
16029
|
|
|
@@ -16088,7 +16131,7 @@ function injectInternals(internals) {
|
|
|
16088
16131
|
var didError = (root.current.effectTag & DidCapture) === DidCapture;
|
|
16089
16132
|
|
|
16090
16133
|
if (enableProfilerTimer) {
|
|
16091
|
-
var currentTime =
|
|
16134
|
+
var currentTime = getCurrentTime();
|
|
16092
16135
|
var priorityLevel = inferPriorityFromExpirationTime(currentTime, expirationTime);
|
|
16093
16136
|
hook.onCommitFiberRoot(rendererID, root, priorityLevel, didError);
|
|
16094
16137
|
} else {
|
|
@@ -16429,9 +16472,9 @@ function createHostRootFiber(tag) {
|
|
|
16429
16472
|
var mode;
|
|
16430
16473
|
|
|
16431
16474
|
if (tag === ConcurrentRoot) {
|
|
16432
|
-
mode = ConcurrentMode |
|
|
16433
|
-
} else if (tag ===
|
|
16434
|
-
mode =
|
|
16475
|
+
mode = ConcurrentMode | BlockingMode | StrictMode;
|
|
16476
|
+
} else if (tag === BlockingRoot) {
|
|
16477
|
+
mode = BlockingMode | StrictMode;
|
|
16435
16478
|
} else {
|
|
16436
16479
|
mode = NoMode;
|
|
16437
16480
|
}
|
|
@@ -16473,7 +16516,7 @@ key, pendingProps, owner, mode, expirationTime) {
|
|
|
16473
16516
|
|
|
16474
16517
|
case REACT_CONCURRENT_MODE_TYPE:
|
|
16475
16518
|
fiberTag = Mode;
|
|
16476
|
-
mode |= ConcurrentMode |
|
|
16519
|
+
mode |= ConcurrentMode | BlockingMode | StrictMode;
|
|
16477
16520
|
break;
|
|
16478
16521
|
|
|
16479
16522
|
case REACT_STRICT_MODE_TYPE:
|
|
@@ -16550,13 +16593,11 @@ key, pendingProps, owner, mode, expirationTime) {
|
|
|
16550
16593
|
}
|
|
16551
16594
|
}
|
|
16552
16595
|
|
|
16553
|
-
|
|
16596
|
+
{
|
|
16554
16597
|
{
|
|
16555
|
-
|
|
16556
|
-
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));
|
|
16557
|
-
}
|
|
16598
|
+
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);
|
|
16558
16599
|
}
|
|
16559
|
-
}
|
|
16600
|
+
}
|
|
16560
16601
|
}
|
|
16561
16602
|
}
|
|
16562
16603
|
}
|
|
@@ -16740,7 +16781,6 @@ function FiberRootNode(containerInfo, tag, hydrate) {
|
|
|
16740
16781
|
this.context = null;
|
|
16741
16782
|
this.pendingContext = null;
|
|
16742
16783
|
this.hydrate = hydrate;
|
|
16743
|
-
this.firstBatch = null;
|
|
16744
16784
|
this.callbackNode = null;
|
|
16745
16785
|
this.callbackPriority = NoPriority;
|
|
16746
16786
|
this.firstPendingTime = NoWork;
|
|
@@ -16896,79 +16936,22 @@ function getContextForSubtree(parentComponent) {
|
|
|
16896
16936
|
return parentContext;
|
|
16897
16937
|
}
|
|
16898
16938
|
|
|
16899
|
-
function scheduleRootUpdate(current$$1, element, expirationTime, suspenseConfig, callback) {
|
|
16900
|
-
{
|
|
16901
|
-
if (phase === 'render' && current !== null && !didWarnAboutNestedUpdates) {
|
|
16902
|
-
didWarnAboutNestedUpdates = true;
|
|
16903
|
-
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');
|
|
16904
|
-
}
|
|
16905
|
-
}
|
|
16906
|
-
|
|
16907
|
-
var update = createUpdate(expirationTime, suspenseConfig); // Caution: React DevTools currently depends on this property
|
|
16908
|
-
// being called "element".
|
|
16909
|
-
|
|
16910
|
-
update.payload = {
|
|
16911
|
-
element: element
|
|
16912
|
-
};
|
|
16913
|
-
callback = callback === undefined ? null : callback;
|
|
16914
|
-
|
|
16915
|
-
if (callback !== null) {
|
|
16916
|
-
!(typeof callback === 'function') ? warningWithoutStack$1(false, 'render(...): Expected the last optional `callback` argument to be a ' + 'function. Instead received: %s.', callback) : void 0;
|
|
16917
|
-
update.callback = callback;
|
|
16918
|
-
}
|
|
16919
|
-
|
|
16920
|
-
enqueueUpdate(current$$1, update);
|
|
16921
|
-
scheduleWork(current$$1, expirationTime);
|
|
16922
|
-
return expirationTime;
|
|
16923
|
-
}
|
|
16924
|
-
|
|
16925
|
-
function updateContainerAtExpirationTime(element, container, parentComponent, expirationTime, suspenseConfig, callback) {
|
|
16926
|
-
// TODO: If this is a nested container, this won't be the root.
|
|
16927
|
-
var current$$1 = container.current;
|
|
16928
|
-
|
|
16929
|
-
{
|
|
16930
|
-
if (ReactFiberInstrumentation_1.debugTool) {
|
|
16931
|
-
if (current$$1.alternate === null) {
|
|
16932
|
-
ReactFiberInstrumentation_1.debugTool.onMountContainer(container);
|
|
16933
|
-
} else if (element === null) {
|
|
16934
|
-
ReactFiberInstrumentation_1.debugTool.onUnmountContainer(container);
|
|
16935
|
-
} else {
|
|
16936
|
-
ReactFiberInstrumentation_1.debugTool.onUpdateContainer(container);
|
|
16937
|
-
}
|
|
16938
|
-
}
|
|
16939
|
-
}
|
|
16940
|
-
|
|
16941
|
-
var context = getContextForSubtree(parentComponent);
|
|
16942
|
-
|
|
16943
|
-
if (container.context === null) {
|
|
16944
|
-
container.context = context;
|
|
16945
|
-
} else {
|
|
16946
|
-
container.pendingContext = context;
|
|
16947
|
-
}
|
|
16948
|
-
|
|
16949
|
-
return scheduleRootUpdate(current$$1, element, expirationTime, suspenseConfig, callback);
|
|
16950
|
-
}
|
|
16951
|
-
|
|
16952
16939
|
function findHostInstance(component) {
|
|
16953
16940
|
var fiber = get(component);
|
|
16954
16941
|
|
|
16955
16942
|
if (fiber === undefined) {
|
|
16956
16943
|
if (typeof component.render === 'function') {
|
|
16957
|
-
|
|
16944
|
+
{
|
|
16958
16945
|
{
|
|
16959
|
-
|
|
16960
|
-
throw ReactError(Error("Unable to find node on an unmounted component."));
|
|
16961
|
-
}
|
|
16946
|
+
throw Error("Unable to find node on an unmounted component.");
|
|
16962
16947
|
}
|
|
16963
|
-
}
|
|
16948
|
+
}
|
|
16964
16949
|
} else {
|
|
16965
|
-
|
|
16950
|
+
{
|
|
16966
16951
|
{
|
|
16967
|
-
|
|
16968
|
-
throw ReactError(Error("Argument appears to not be a ReactComponent. Keys: " + Object.keys(component)));
|
|
16969
|
-
}
|
|
16952
|
+
throw Error("Argument appears to not be a ReactComponent. Keys: " + Object.keys(component));
|
|
16970
16953
|
}
|
|
16971
|
-
}
|
|
16954
|
+
}
|
|
16972
16955
|
}
|
|
16973
16956
|
}
|
|
16974
16957
|
|
|
@@ -16987,21 +16970,17 @@ function findHostInstanceWithWarning(component, methodName) {
|
|
|
16987
16970
|
|
|
16988
16971
|
if (fiber === undefined) {
|
|
16989
16972
|
if (typeof component.render === 'function') {
|
|
16990
|
-
|
|
16973
|
+
{
|
|
16991
16974
|
{
|
|
16992
|
-
|
|
16993
|
-
throw ReactError(Error("Unable to find node on an unmounted component."));
|
|
16994
|
-
}
|
|
16975
|
+
throw Error("Unable to find node on an unmounted component.");
|
|
16995
16976
|
}
|
|
16996
|
-
}
|
|
16977
|
+
}
|
|
16997
16978
|
} else {
|
|
16998
|
-
|
|
16979
|
+
{
|
|
16999
16980
|
{
|
|
17000
|
-
|
|
17001
|
-
throw ReactError(Error("Argument appears to not be a ReactComponent. Keys: " + Object.keys(component)));
|
|
17002
|
-
}
|
|
16981
|
+
throw Error("Argument appears to not be a ReactComponent. Keys: " + Object.keys(component));
|
|
17003
16982
|
}
|
|
17004
|
-
}
|
|
16983
|
+
}
|
|
17005
16984
|
}
|
|
17006
16985
|
}
|
|
17007
16986
|
|
|
@@ -17036,7 +17015,7 @@ function createContainer(containerInfo, tag, hydrate, hydrationCallbacks) {
|
|
|
17036
17015
|
}
|
|
17037
17016
|
function updateContainer(element, container, parentComponent, callback) {
|
|
17038
17017
|
var current$$1 = container.current;
|
|
17039
|
-
var currentTime =
|
|
17018
|
+
var currentTime = requestCurrentTimeForUpdate();
|
|
17040
17019
|
|
|
17041
17020
|
{
|
|
17042
17021
|
// $FlowExpectedError - jest isn't a global, and isn't recognized outside of tests
|
|
@@ -17048,7 +17027,50 @@ function updateContainer(element, container, parentComponent, callback) {
|
|
|
17048
17027
|
|
|
17049
17028
|
var suspenseConfig = requestCurrentSuspenseConfig();
|
|
17050
17029
|
var expirationTime = computeExpirationForFiber(currentTime, current$$1, suspenseConfig);
|
|
17051
|
-
|
|
17030
|
+
|
|
17031
|
+
{
|
|
17032
|
+
if (ReactFiberInstrumentation_1.debugTool) {
|
|
17033
|
+
if (current$$1.alternate === null) {
|
|
17034
|
+
ReactFiberInstrumentation_1.debugTool.onMountContainer(container);
|
|
17035
|
+
} else if (element === null) {
|
|
17036
|
+
ReactFiberInstrumentation_1.debugTool.onUnmountContainer(container);
|
|
17037
|
+
} else {
|
|
17038
|
+
ReactFiberInstrumentation_1.debugTool.onUpdateContainer(container);
|
|
17039
|
+
}
|
|
17040
|
+
}
|
|
17041
|
+
}
|
|
17042
|
+
|
|
17043
|
+
var context = getContextForSubtree(parentComponent);
|
|
17044
|
+
|
|
17045
|
+
if (container.context === null) {
|
|
17046
|
+
container.context = context;
|
|
17047
|
+
} else {
|
|
17048
|
+
container.pendingContext = context;
|
|
17049
|
+
}
|
|
17050
|
+
|
|
17051
|
+
{
|
|
17052
|
+
if (phase === 'render' && current !== null && !didWarnAboutNestedUpdates) {
|
|
17053
|
+
didWarnAboutNestedUpdates = true;
|
|
17054
|
+
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');
|
|
17055
|
+
}
|
|
17056
|
+
}
|
|
17057
|
+
|
|
17058
|
+
var update = createUpdate(expirationTime, suspenseConfig); // Caution: React DevTools currently depends on this property
|
|
17059
|
+
// being called "element".
|
|
17060
|
+
|
|
17061
|
+
update.payload = {
|
|
17062
|
+
element: element
|
|
17063
|
+
};
|
|
17064
|
+
callback = callback === undefined ? null : callback;
|
|
17065
|
+
|
|
17066
|
+
if (callback !== null) {
|
|
17067
|
+
!(typeof callback === 'function') ? warningWithoutStack$1(false, 'render(...): Expected the last optional `callback` argument to be a ' + 'function. Instead received: %s.', callback) : void 0;
|
|
17068
|
+
update.callback = callback;
|
|
17069
|
+
}
|
|
17070
|
+
|
|
17071
|
+
enqueueUpdate(current$$1, update);
|
|
17072
|
+
scheduleWork(current$$1, expirationTime);
|
|
17073
|
+
return expirationTime;
|
|
17052
17074
|
}
|
|
17053
17075
|
function getPublicRootInstance(container) {
|
|
17054
17076
|
var containerFiber = container.current;
|
|
@@ -17080,10 +17102,74 @@ function attemptSynchronousHydration(fiber) {
|
|
|
17080
17102
|
case SuspenseComponent:
|
|
17081
17103
|
flushSync(function () {
|
|
17082
17104
|
return scheduleWork(fiber, Sync);
|
|
17083
|
-
});
|
|
17105
|
+
}); // If we're still blocked after this, we need to increase
|
|
17106
|
+
// the priority of any promises resolving within this
|
|
17107
|
+
// boundary so that they next attempt also has higher pri.
|
|
17108
|
+
|
|
17109
|
+
var retryExpTime = computeInteractiveExpiration(requestCurrentTimeForUpdate());
|
|
17110
|
+
markRetryTimeIfNotHydrated(fiber, retryExpTime);
|
|
17084
17111
|
break;
|
|
17085
17112
|
}
|
|
17086
17113
|
}
|
|
17114
|
+
|
|
17115
|
+
function markRetryTimeImpl(fiber, retryTime) {
|
|
17116
|
+
var suspenseState = fiber.memoizedState;
|
|
17117
|
+
|
|
17118
|
+
if (suspenseState !== null && suspenseState.dehydrated !== null) {
|
|
17119
|
+
if (suspenseState.retryTime < retryTime) {
|
|
17120
|
+
suspenseState.retryTime = retryTime;
|
|
17121
|
+
}
|
|
17122
|
+
}
|
|
17123
|
+
} // Increases the priority of thennables when they resolve within this boundary.
|
|
17124
|
+
|
|
17125
|
+
|
|
17126
|
+
function markRetryTimeIfNotHydrated(fiber, retryTime) {
|
|
17127
|
+
markRetryTimeImpl(fiber, retryTime);
|
|
17128
|
+
var alternate = fiber.alternate;
|
|
17129
|
+
|
|
17130
|
+
if (alternate) {
|
|
17131
|
+
markRetryTimeImpl(alternate, retryTime);
|
|
17132
|
+
}
|
|
17133
|
+
}
|
|
17134
|
+
|
|
17135
|
+
function attemptUserBlockingHydration(fiber) {
|
|
17136
|
+
if (fiber.tag !== SuspenseComponent) {
|
|
17137
|
+
// We ignore HostRoots here because we can't increase
|
|
17138
|
+
// their priority and they should not suspend on I/O,
|
|
17139
|
+
// since you have to wrap anything that might suspend in
|
|
17140
|
+
// Suspense.
|
|
17141
|
+
return;
|
|
17142
|
+
}
|
|
17143
|
+
|
|
17144
|
+
var expTime = computeInteractiveExpiration(requestCurrentTimeForUpdate());
|
|
17145
|
+
scheduleWork(fiber, expTime);
|
|
17146
|
+
markRetryTimeIfNotHydrated(fiber, expTime);
|
|
17147
|
+
}
|
|
17148
|
+
function attemptContinuousHydration(fiber) {
|
|
17149
|
+
if (fiber.tag !== SuspenseComponent) {
|
|
17150
|
+
// We ignore HostRoots here because we can't increase
|
|
17151
|
+
// their priority and they should not suspend on I/O,
|
|
17152
|
+
// since you have to wrap anything that might suspend in
|
|
17153
|
+
// Suspense.
|
|
17154
|
+
return;
|
|
17155
|
+
}
|
|
17156
|
+
|
|
17157
|
+
var expTime = computeContinuousHydrationExpiration(requestCurrentTimeForUpdate());
|
|
17158
|
+
scheduleWork(fiber, expTime);
|
|
17159
|
+
markRetryTimeIfNotHydrated(fiber, expTime);
|
|
17160
|
+
}
|
|
17161
|
+
function attemptHydrationAtCurrentPriority(fiber) {
|
|
17162
|
+
if (fiber.tag !== SuspenseComponent) {
|
|
17163
|
+
// We ignore HostRoots here because we can't increase
|
|
17164
|
+
// their priority other than synchronously flush it.
|
|
17165
|
+
return;
|
|
17166
|
+
}
|
|
17167
|
+
|
|
17168
|
+
var currentTime = requestCurrentTimeForUpdate();
|
|
17169
|
+
var expTime = computeExpirationForFiber(currentTime, fiber, null);
|
|
17170
|
+
scheduleWork(fiber, expTime);
|
|
17171
|
+
markRetryTimeIfNotHydrated(fiber, expTime);
|
|
17172
|
+
}
|
|
17087
17173
|
function findHostInstanceWithNoPortals(fiber) {
|
|
17088
17174
|
var hostFiber = findCurrentHostFiberWithNoPortals(fiber);
|
|
17089
17175
|
|
|
@@ -17211,11 +17297,8 @@ function injectIntoDevTools(devToolsConfig) {
|
|
|
17211
17297
|
}
|
|
17212
17298
|
|
|
17213
17299
|
var ReactFiberReconciler = Object.freeze({
|
|
17214
|
-
updateContainerAtExpirationTime: updateContainerAtExpirationTime,
|
|
17215
17300
|
createContainer: createContainer,
|
|
17216
17301
|
updateContainer: updateContainer,
|
|
17217
|
-
flushRoot: flushRoot,
|
|
17218
|
-
computeUniqueAsyncExpiration: computeUniqueAsyncExpiration,
|
|
17219
17302
|
batchedEventUpdates: batchedEventUpdates,
|
|
17220
17303
|
batchedUpdates: batchedUpdates,
|
|
17221
17304
|
unbatchedUpdates: unbatchedUpdates,
|
|
@@ -17229,6 +17312,9 @@ var ReactFiberReconciler = Object.freeze({
|
|
|
17229
17312
|
IsThisRendererActing: IsThisRendererActing,
|
|
17230
17313
|
getPublicRootInstance: getPublicRootInstance,
|
|
17231
17314
|
attemptSynchronousHydration: attemptSynchronousHydration,
|
|
17315
|
+
attemptUserBlockingHydration: attemptUserBlockingHydration,
|
|
17316
|
+
attemptContinuousHydration: attemptContinuousHydration,
|
|
17317
|
+
attemptHydrationAtCurrentPriority: attemptHydrationAtCurrentPriority,
|
|
17232
17318
|
findHostInstance: findHostInstance,
|
|
17233
17319
|
findHostInstanceWithWarning: findHostInstanceWithWarning,
|
|
17234
17320
|
findHostInstanceWithNoPortals: findHostInstanceWithNoPortals,
|