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.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,12 +388,8 @@ var ShouldCapture =
|
|
|
396
388
|
/* */
|
|
397
389
|
4096;
|
|
398
390
|
|
|
399
|
-
var enableUserTimingAPI = true; // Helps identify side effects in
|
|
400
|
-
|
|
401
|
-
var debugRenderPhaseSideEffects = false; // In some cases, StrictMode should also double-render lifecycles.
|
|
402
|
-
// This can be confusing for tests though,
|
|
403
|
-
// And it can be bad for performance in production.
|
|
404
|
-
// This feature flag can be used to control the behavior:
|
|
391
|
+
var enableUserTimingAPI = true; // Helps identify side effects in render-phase lifecycle hooks and setState
|
|
392
|
+
// reducers by double invoking them in Strict Mode.
|
|
405
393
|
|
|
406
394
|
var debugRenderPhaseSideEffectsForStrictMode = true; // To preserve the "Pause on caught exceptions" behavior of the debugger, we
|
|
407
395
|
// replay the begin phase of a failed component inside invokeGuardedCallback.
|
|
@@ -412,10 +400,9 @@ var warnAboutDeprecatedLifecycles = true; // Gather advanced timing metrics for
|
|
|
412
400
|
|
|
413
401
|
var enableProfilerTimer = true; // Trace which interactions trigger each commit.
|
|
414
402
|
|
|
415
|
-
var enableSchedulerTracing = true; //
|
|
416
|
-
|
|
417
|
-
var enableSuspenseServerRenderer = false; // TODO: true? Here it might just be false.
|
|
403
|
+
var enableSchedulerTracing = true; // SSR experiments
|
|
418
404
|
|
|
405
|
+
var enableSuspenseServerRenderer = false;
|
|
419
406
|
// Only used in www builds.
|
|
420
407
|
|
|
421
408
|
// Only used in www builds.
|
|
@@ -429,9 +416,6 @@ var enableSuspenseServerRenderer = false; // TODO: true? Here it might just be f
|
|
|
429
416
|
// Control this behavior with a flag to support 16.6 minor releases in the meanwhile.
|
|
430
417
|
|
|
431
418
|
|
|
432
|
-
// See https://github.com/react-native-community/discussions-and-proposals/issues/72 for more information
|
|
433
|
-
// This is a flag so we can fix warnings in RN core before turning it on
|
|
434
|
-
|
|
435
419
|
// Experimental React Flare event system and event components support.
|
|
436
420
|
|
|
437
421
|
var enableFlareAPI = false; // Experimental Host Component support.
|
|
@@ -441,16 +425,12 @@ var enableFundamentalAPI = false; // Experimental Scope support.
|
|
|
441
425
|
var enableScopeAPI = false; // New API for JSX transforms to target - https://github.com/reactjs/rfcs/pull/107
|
|
442
426
|
|
|
443
427
|
// We will enforce mocking scheduler with scheduler/unstable_mock at some point. (v17?)
|
|
444
|
-
// Till then, we warn about the missing mock, but still fallback to a
|
|
428
|
+
// Till then, we warn about the missing mock, but still fallback to a legacy mode compatible version
|
|
445
429
|
|
|
446
430
|
var warnAboutUnmockedScheduler = false; // For tests, we flush suspense fallbacks in an act scope;
|
|
447
431
|
// *except* in some of our own tests, where we test incremental loading states.
|
|
448
432
|
|
|
449
|
-
var flushSuspenseFallbacksInTests = true; //
|
|
450
|
-
// but without making them discrete. The flag exists in case it causes
|
|
451
|
-
// starvation problems.
|
|
452
|
-
|
|
453
|
-
// Add a callback property to suspense to notify which promises are currently
|
|
433
|
+
var flushSuspenseFallbacksInTests = true; // Add a callback property to suspense to notify which promises are currently
|
|
454
434
|
// in the update queue. This allows reporting and tracing of what is causing
|
|
455
435
|
// the user to see a loading state.
|
|
456
436
|
// Also allows hydration callbacks to fire when a dehydrated boundary gets
|
|
@@ -464,6 +444,7 @@ var warnAboutDefaultPropsOnFunctionComponents = false;
|
|
|
464
444
|
var warnAboutStringRefs = false;
|
|
465
445
|
var disableLegacyContext = false;
|
|
466
446
|
var disableSchedulerTimeoutBasedOnReactExpirationTime = false;
|
|
447
|
+
// Flag to turn event.target and event.currentTarget in ReactNative from a reactTag to a component instance
|
|
467
448
|
|
|
468
449
|
var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
|
|
469
450
|
function getNearestMountedFiber(fiber) {
|
|
@@ -530,13 +511,11 @@ function isMounted(component) {
|
|
|
530
511
|
}
|
|
531
512
|
|
|
532
513
|
function assertIsMounted(fiber) {
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
throw ReactError(Error("Unable to find node on an unmounted component."));
|
|
537
|
-
}
|
|
514
|
+
if (!(getNearestMountedFiber(fiber) === fiber)) {
|
|
515
|
+
{
|
|
516
|
+
throw Error("Unable to find node on an unmounted component.");
|
|
538
517
|
}
|
|
539
|
-
}
|
|
518
|
+
}
|
|
540
519
|
}
|
|
541
520
|
|
|
542
521
|
function findCurrentFiberUsingSlowPath(fiber) {
|
|
@@ -546,13 +525,11 @@ function findCurrentFiberUsingSlowPath(fiber) {
|
|
|
546
525
|
// If there is no alternate, then we only need to check if it is mounted.
|
|
547
526
|
var nearestMounted = getNearestMountedFiber(fiber);
|
|
548
527
|
|
|
549
|
-
(
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
throw ReactError(Error("Unable to find node on an unmounted component."));
|
|
553
|
-
}
|
|
528
|
+
if (!(nearestMounted !== null)) {
|
|
529
|
+
{
|
|
530
|
+
throw Error("Unable to find node on an unmounted component.");
|
|
554
531
|
}
|
|
555
|
-
}
|
|
532
|
+
}
|
|
556
533
|
|
|
557
534
|
if (nearestMounted !== fiber) {
|
|
558
535
|
return null;
|
|
@@ -617,13 +594,11 @@ function findCurrentFiberUsingSlowPath(fiber) {
|
|
|
617
594
|
// way this could possibly happen is if this was unmounted, if at all.
|
|
618
595
|
|
|
619
596
|
|
|
620
|
-
|
|
597
|
+
{
|
|
621
598
|
{
|
|
622
|
-
|
|
623
|
-
throw ReactError(Error("Unable to find node on an unmounted component."));
|
|
624
|
-
}
|
|
599
|
+
throw Error("Unable to find node on an unmounted component.");
|
|
625
600
|
}
|
|
626
|
-
}
|
|
601
|
+
}
|
|
627
602
|
}
|
|
628
603
|
|
|
629
604
|
if (a.return !== b.return) {
|
|
@@ -682,34 +657,28 @@ function findCurrentFiberUsingSlowPath(fiber) {
|
|
|
682
657
|
_child = _child.sibling;
|
|
683
658
|
}
|
|
684
659
|
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
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."));
|
|
689
|
-
}
|
|
660
|
+
if (!didFindChild) {
|
|
661
|
+
{
|
|
662
|
+
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.");
|
|
690
663
|
}
|
|
691
|
-
}
|
|
664
|
+
}
|
|
692
665
|
}
|
|
693
666
|
}
|
|
694
667
|
|
|
695
|
-
(
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
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."));
|
|
699
|
-
}
|
|
668
|
+
if (!(a.alternate === b)) {
|
|
669
|
+
{
|
|
670
|
+
throw Error("Return fibers should always be each others' alternates. This error is likely caused by a bug in React. Please file an issue.");
|
|
700
671
|
}
|
|
701
|
-
}
|
|
672
|
+
}
|
|
702
673
|
} // If the root is not a host container, we're in a disconnected tree. I.e.
|
|
703
674
|
// unmounted.
|
|
704
675
|
|
|
705
676
|
|
|
706
|
-
(
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
throw ReactError(Error("Unable to find node on an unmounted component."));
|
|
710
|
-
}
|
|
677
|
+
if (!(a.tag === HostRoot)) {
|
|
678
|
+
{
|
|
679
|
+
throw Error("Unable to find node on an unmounted component.");
|
|
711
680
|
}
|
|
712
|
-
}
|
|
681
|
+
}
|
|
713
682
|
|
|
714
683
|
if (a.stateNode.current === a) {
|
|
715
684
|
// We've determined that A is the current branch.
|
|
@@ -851,7 +820,8 @@ var mountResponderInstance = $$$hostConfig.mountResponderInstance;
|
|
|
851
820
|
var unmountResponderInstance = $$$hostConfig.unmountResponderInstance;
|
|
852
821
|
var getFundamentalComponentInstance = $$$hostConfig.getFundamentalComponentInstance;
|
|
853
822
|
var mountFundamentalComponent = $$$hostConfig.mountFundamentalComponent;
|
|
854
|
-
var shouldUpdateFundamentalComponent = $$$hostConfig.shouldUpdateFundamentalComponent;
|
|
823
|
+
var shouldUpdateFundamentalComponent = $$$hostConfig.shouldUpdateFundamentalComponent;
|
|
824
|
+
var getInstanceFromNode = $$$hostConfig.getInstanceFromNode; // -------------------
|
|
855
825
|
// Mutation
|
|
856
826
|
// (optional)
|
|
857
827
|
// -------------------
|
|
@@ -1635,13 +1605,11 @@ function pushTopLevelContextObject(fiber, context, didChange) {
|
|
|
1635
1605
|
if (disableLegacyContext) {
|
|
1636
1606
|
return;
|
|
1637
1607
|
} else {
|
|
1638
|
-
(
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
throw ReactError(Error("Unexpected context found on stack. This error is likely caused by a bug in React. Please file an issue."));
|
|
1642
|
-
}
|
|
1608
|
+
if (!(contextStackCursor.current === emptyContextObject)) {
|
|
1609
|
+
{
|
|
1610
|
+
throw Error("Unexpected context found on stack. This error is likely caused by a bug in React. Please file an issue.");
|
|
1643
1611
|
}
|
|
1644
|
-
}
|
|
1612
|
+
}
|
|
1645
1613
|
|
|
1646
1614
|
push(contextStackCursor, context, fiber);
|
|
1647
1615
|
push(didPerformWorkStackCursor, didChange, fiber);
|
|
@@ -1684,13 +1652,11 @@ function processChildContext(fiber, type, parentContext) {
|
|
|
1684
1652
|
}
|
|
1685
1653
|
|
|
1686
1654
|
for (var contextKey in childContext) {
|
|
1687
|
-
(
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
throw ReactError(Error((getComponentName(type) || 'Unknown') + ".getChildContext(): key \"" + contextKey + "\" is not defined in childContextTypes."));
|
|
1691
|
-
}
|
|
1655
|
+
if (!(contextKey in childContextTypes)) {
|
|
1656
|
+
{
|
|
1657
|
+
throw Error((getComponentName(type) || 'Unknown') + ".getChildContext(): key \"" + contextKey + "\" is not defined in childContextTypes.");
|
|
1692
1658
|
}
|
|
1693
|
-
}
|
|
1659
|
+
}
|
|
1694
1660
|
}
|
|
1695
1661
|
|
|
1696
1662
|
{
|
|
@@ -1731,13 +1697,11 @@ function invalidateContextProvider(workInProgress, type, didChange) {
|
|
|
1731
1697
|
} else {
|
|
1732
1698
|
var instance = workInProgress.stateNode;
|
|
1733
1699
|
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
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."));
|
|
1738
|
-
}
|
|
1700
|
+
if (!instance) {
|
|
1701
|
+
{
|
|
1702
|
+
throw Error("Expected to have an instance by this point. This error is likely caused by a bug in React. Please file an issue.");
|
|
1739
1703
|
}
|
|
1740
|
-
}
|
|
1704
|
+
}
|
|
1741
1705
|
|
|
1742
1706
|
if (didChange) {
|
|
1743
1707
|
// Merge parent and own context.
|
|
@@ -1765,13 +1729,11 @@ function findCurrentUnmaskedContext(fiber) {
|
|
|
1765
1729
|
} else {
|
|
1766
1730
|
// Currently this is only used with renderSubtreeIntoContainer; not sure if it
|
|
1767
1731
|
// makes sense elsewhere
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
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."));
|
|
1772
|
-
}
|
|
1732
|
+
if (!(isFiberMounted(fiber) && fiber.tag === ClassComponent)) {
|
|
1733
|
+
{
|
|
1734
|
+
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.");
|
|
1773
1735
|
}
|
|
1774
|
-
}
|
|
1736
|
+
}
|
|
1775
1737
|
|
|
1776
1738
|
var node = fiber;
|
|
1777
1739
|
|
|
@@ -1795,17 +1757,15 @@ function findCurrentUnmaskedContext(fiber) {
|
|
|
1795
1757
|
node = node.return;
|
|
1796
1758
|
} while (node !== null);
|
|
1797
1759
|
|
|
1798
|
-
|
|
1760
|
+
{
|
|
1799
1761
|
{
|
|
1800
|
-
|
|
1801
|
-
throw ReactError(Error("Found unexpected detached subtree parent. This error is likely caused by a bug in React. Please file an issue."));
|
|
1802
|
-
}
|
|
1762
|
+
throw Error("Found unexpected detached subtree parent. This error is likely caused by a bug in React. Please file an issue.");
|
|
1803
1763
|
}
|
|
1804
|
-
}
|
|
1764
|
+
}
|
|
1805
1765
|
}
|
|
1806
1766
|
}
|
|
1807
1767
|
|
|
1808
|
-
var
|
|
1768
|
+
var BlockingRoot = 1;
|
|
1809
1769
|
var ConcurrentRoot = 2;
|
|
1810
1770
|
|
|
1811
1771
|
// Intentionally not named imports because Rollup would use dynamic dispatch for
|
|
@@ -1827,13 +1787,11 @@ if (enableSchedulerTracing) {
|
|
|
1827
1787
|
// Provide explicit error message when production+profiling bundle of e.g.
|
|
1828
1788
|
// react-dom is used with production (non-profiling) bundle of
|
|
1829
1789
|
// scheduler/tracing
|
|
1830
|
-
(
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
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"));
|
|
1834
|
-
}
|
|
1790
|
+
if (!(tracing.__interactionsRef != null && tracing.__interactionsRef.current != null)) {
|
|
1791
|
+
{
|
|
1792
|
+
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");
|
|
1835
1793
|
}
|
|
1836
|
-
}
|
|
1794
|
+
}
|
|
1837
1795
|
}
|
|
1838
1796
|
|
|
1839
1797
|
var fakeCallbackNode = {}; // Except for NoPriority, these correspond to Scheduler priorities. We use
|
|
@@ -1882,13 +1840,11 @@ function getCurrentPriorityLevel() {
|
|
|
1882
1840
|
return IdlePriority;
|
|
1883
1841
|
|
|
1884
1842
|
default:
|
|
1885
|
-
|
|
1843
|
+
{
|
|
1886
1844
|
{
|
|
1887
|
-
|
|
1888
|
-
throw ReactError(Error("Unknown priority level."));
|
|
1889
|
-
}
|
|
1845
|
+
throw Error("Unknown priority level.");
|
|
1890
1846
|
}
|
|
1891
|
-
}
|
|
1847
|
+
}
|
|
1892
1848
|
|
|
1893
1849
|
}
|
|
1894
1850
|
}
|
|
@@ -1911,13 +1867,11 @@ function reactPriorityToSchedulerPriority(reactPriorityLevel) {
|
|
|
1911
1867
|
return Scheduler_IdlePriority;
|
|
1912
1868
|
|
|
1913
1869
|
default:
|
|
1914
|
-
|
|
1870
|
+
{
|
|
1915
1871
|
{
|
|
1916
|
-
|
|
1917
|
-
throw ReactError(Error("Unknown priority level."));
|
|
1918
|
-
}
|
|
1872
|
+
throw Error("Unknown priority level.");
|
|
1919
1873
|
}
|
|
1920
|
-
}
|
|
1874
|
+
}
|
|
1921
1875
|
|
|
1922
1876
|
}
|
|
1923
1877
|
}
|
|
@@ -1995,10 +1949,10 @@ function flushSyncCallbackQueueImpl() {
|
|
|
1995
1949
|
}
|
|
1996
1950
|
|
|
1997
1951
|
var NoMode = 0;
|
|
1998
|
-
var StrictMode = 1; // TODO: Remove
|
|
1952
|
+
var StrictMode = 1; // TODO: Remove BlockingMode and ConcurrentMode by reading from the root
|
|
1999
1953
|
// tag instead
|
|
2000
1954
|
|
|
2001
|
-
var
|
|
1955
|
+
var BlockingMode = 2;
|
|
2002
1956
|
var ConcurrentMode = 4;
|
|
2003
1957
|
var ProfileMode = 8;
|
|
2004
1958
|
|
|
@@ -2018,7 +1972,11 @@ var NoWork = 0; // TODO: Think of a better name for Never. The key difference wi
|
|
|
2018
1972
|
var Never = 1; // Idle is slightly higher priority than Never. It must completely finish in
|
|
2019
1973
|
// order to be consistent.
|
|
2020
1974
|
|
|
2021
|
-
var Idle = 2;
|
|
1975
|
+
var Idle = 2; // Continuous Hydration is a moving priority. It is slightly higher than Idle
|
|
1976
|
+
// and is used to increase priority of hover targets. It is increasing with
|
|
1977
|
+
// each usage so that last always wins.
|
|
1978
|
+
|
|
1979
|
+
var ContinuousHydration = 3;
|
|
2022
1980
|
var Sync = MAX_SIGNED_31_BIT_INT;
|
|
2023
1981
|
var Batched = Sync - 1;
|
|
2024
1982
|
var UNIT_SIZE = 10;
|
|
@@ -2067,6 +2025,12 @@ var HIGH_PRIORITY_BATCH_SIZE = 100;
|
|
|
2067
2025
|
function computeInteractiveExpiration(currentTime) {
|
|
2068
2026
|
return computeExpirationBucket(currentTime, HIGH_PRIORITY_EXPIRATION, HIGH_PRIORITY_BATCH_SIZE);
|
|
2069
2027
|
}
|
|
2028
|
+
function computeContinuousHydrationExpiration(currentTime) {
|
|
2029
|
+
// Each time we ask for a new one of these we increase the priority.
|
|
2030
|
+
// This ensures that the last one always wins since we can't deprioritize
|
|
2031
|
+
// once we've scheduled work already.
|
|
2032
|
+
return ContinuousHydration++;
|
|
2033
|
+
}
|
|
2070
2034
|
function inferPriorityFromExpirationTime(currentTime, expirationTime) {
|
|
2071
2035
|
if (expirationTime === Sync) {
|
|
2072
2036
|
return ImmediatePriority;
|
|
@@ -2614,7 +2578,9 @@ var scheduleRoot = function (root, element) {
|
|
|
2614
2578
|
}
|
|
2615
2579
|
|
|
2616
2580
|
flushPassiveEffects();
|
|
2617
|
-
|
|
2581
|
+
syncUpdates(function () {
|
|
2582
|
+
updateContainer(element, root, null, null);
|
|
2583
|
+
});
|
|
2618
2584
|
}
|
|
2619
2585
|
};
|
|
2620
2586
|
|
|
@@ -3016,13 +2982,11 @@ function propagateContextChange(workInProgress, context, changedBits, renderExpi
|
|
|
3016
2982
|
// mark it as having updates.
|
|
3017
2983
|
var parentSuspense = fiber.return;
|
|
3018
2984
|
|
|
3019
|
-
(
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
throw ReactError(Error("We just came from a parent so we must have had a parent. This is a bug in React."));
|
|
3023
|
-
}
|
|
2985
|
+
if (!(parentSuspense !== null)) {
|
|
2986
|
+
{
|
|
2987
|
+
throw Error("We just came from a parent so we must have had a parent. This is a bug in React.");
|
|
3024
2988
|
}
|
|
3025
|
-
}
|
|
2989
|
+
}
|
|
3026
2990
|
|
|
3027
2991
|
if (parentSuspense.expirationTime < renderExpirationTime) {
|
|
3028
2992
|
parentSuspense.expirationTime = renderExpirationTime;
|
|
@@ -3123,13 +3087,11 @@ function readContext(context, observedBits) {
|
|
|
3123
3087
|
};
|
|
3124
3088
|
|
|
3125
3089
|
if (lastContextDependency === null) {
|
|
3126
|
-
(
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
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()."));
|
|
3130
|
-
}
|
|
3090
|
+
if (!(currentlyRenderingFiber !== null)) {
|
|
3091
|
+
{
|
|
3092
|
+
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().");
|
|
3131
3093
|
}
|
|
3132
|
-
}
|
|
3094
|
+
} // This is the first dependency for this component. Create a new list.
|
|
3133
3095
|
|
|
3134
3096
|
|
|
3135
3097
|
lastContextDependency = contextItem;
|
|
@@ -3416,7 +3378,7 @@ function getStateFromUpdate(workInProgress, queue, update, prevState, nextProps,
|
|
|
3416
3378
|
{
|
|
3417
3379
|
enterDisallowedContextReadInDEV();
|
|
3418
3380
|
|
|
3419
|
-
if (
|
|
3381
|
+
if (debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
|
|
3420
3382
|
payload.call(instance, prevState, nextProps);
|
|
3421
3383
|
}
|
|
3422
3384
|
}
|
|
@@ -3450,7 +3412,7 @@ function getStateFromUpdate(workInProgress, queue, update, prevState, nextProps,
|
|
|
3450
3412
|
{
|
|
3451
3413
|
enterDisallowedContextReadInDEV();
|
|
3452
3414
|
|
|
3453
|
-
if (
|
|
3415
|
+
if (debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
|
|
3454
3416
|
_payload.call(instance, prevState, nextProps);
|
|
3455
3417
|
}
|
|
3456
3418
|
}
|
|
@@ -3634,13 +3596,11 @@ function processUpdateQueue(workInProgress, queue, props, instance, renderExpira
|
|
|
3634
3596
|
}
|
|
3635
3597
|
|
|
3636
3598
|
function callCallback(callback, context) {
|
|
3637
|
-
(function
|
|
3638
|
-
|
|
3639
|
-
|
|
3640
|
-
throw ReactError(Error("Invalid argument passed as callback. Expected a function. Instead received: " + callback));
|
|
3641
|
-
}
|
|
3599
|
+
if (!(typeof callback === 'function')) {
|
|
3600
|
+
{
|
|
3601
|
+
throw Error("Invalid argument passed as callback. Expected a function. Instead received: " + callback);
|
|
3642
3602
|
}
|
|
3643
|
-
}
|
|
3603
|
+
}
|
|
3644
3604
|
|
|
3645
3605
|
callback.call(context);
|
|
3646
3606
|
}
|
|
@@ -3751,13 +3711,11 @@ var didWarnAboutInvalidateContextType;
|
|
|
3751
3711
|
Object.defineProperty(fakeInternalInstance, '_processChildContext', {
|
|
3752
3712
|
enumerable: false,
|
|
3753
3713
|
value: function () {
|
|
3754
|
-
|
|
3714
|
+
{
|
|
3755
3715
|
{
|
|
3756
|
-
|
|
3757
|
-
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)."));
|
|
3758
|
-
}
|
|
3716
|
+
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).");
|
|
3759
3717
|
}
|
|
3760
|
-
}
|
|
3718
|
+
}
|
|
3761
3719
|
}
|
|
3762
3720
|
});
|
|
3763
3721
|
Object.freeze(fakeInternalInstance);
|
|
@@ -3767,7 +3725,7 @@ function applyDerivedStateFromProps(workInProgress, ctor, getDerivedStateFromPro
|
|
|
3767
3725
|
var prevState = workInProgress.memoizedState;
|
|
3768
3726
|
|
|
3769
3727
|
{
|
|
3770
|
-
if (
|
|
3728
|
+
if (debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
|
|
3771
3729
|
// Invoke the function an extra time to help detect side-effects.
|
|
3772
3730
|
getDerivedStateFromProps(nextProps, prevState);
|
|
3773
3731
|
}
|
|
@@ -3794,7 +3752,7 @@ var classComponentUpdater = {
|
|
|
3794
3752
|
isMounted: isMounted,
|
|
3795
3753
|
enqueueSetState: function (inst, payload, callback) {
|
|
3796
3754
|
var fiber = get(inst);
|
|
3797
|
-
var currentTime =
|
|
3755
|
+
var currentTime = requestCurrentTimeForUpdate();
|
|
3798
3756
|
var suspenseConfig = requestCurrentSuspenseConfig();
|
|
3799
3757
|
var expirationTime = computeExpirationForFiber(currentTime, fiber, suspenseConfig);
|
|
3800
3758
|
var update = createUpdate(expirationTime, suspenseConfig);
|
|
@@ -3813,7 +3771,7 @@ var classComponentUpdater = {
|
|
|
3813
3771
|
},
|
|
3814
3772
|
enqueueReplaceState: function (inst, payload, callback) {
|
|
3815
3773
|
var fiber = get(inst);
|
|
3816
|
-
var currentTime =
|
|
3774
|
+
var currentTime = requestCurrentTimeForUpdate();
|
|
3817
3775
|
var suspenseConfig = requestCurrentSuspenseConfig();
|
|
3818
3776
|
var expirationTime = computeExpirationForFiber(currentTime, fiber, suspenseConfig);
|
|
3819
3777
|
var update = createUpdate(expirationTime, suspenseConfig);
|
|
@@ -3833,7 +3791,7 @@ var classComponentUpdater = {
|
|
|
3833
3791
|
},
|
|
3834
3792
|
enqueueForceUpdate: function (inst, callback) {
|
|
3835
3793
|
var fiber = get(inst);
|
|
3836
|
-
var currentTime =
|
|
3794
|
+
var currentTime = requestCurrentTimeForUpdate();
|
|
3837
3795
|
var suspenseConfig = requestCurrentSuspenseConfig();
|
|
3838
3796
|
var expirationTime = computeExpirationForFiber(currentTime, fiber, suspenseConfig);
|
|
3839
3797
|
var update = createUpdate(expirationTime, suspenseConfig);
|
|
@@ -4014,7 +3972,7 @@ function constructClassInstance(workInProgress, ctor, props, renderExpirationTim
|
|
|
4014
3972
|
|
|
4015
3973
|
|
|
4016
3974
|
{
|
|
4017
|
-
if (
|
|
3975
|
+
if (debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
|
|
4018
3976
|
new ctor(props, context); // eslint-disable-line no-new
|
|
4019
3977
|
}
|
|
4020
3978
|
}
|
|
@@ -4448,13 +4406,11 @@ var warnForMissingKey = function (child) {};
|
|
|
4448
4406
|
return;
|
|
4449
4407
|
}
|
|
4450
4408
|
|
|
4451
|
-
(
|
|
4452
|
-
|
|
4453
|
-
|
|
4454
|
-
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."));
|
|
4455
|
-
}
|
|
4409
|
+
if (!(typeof child._store === 'object')) {
|
|
4410
|
+
{
|
|
4411
|
+
throw Error("React Component in warnForMissingKey should have a _store. This error is likely caused by a bug in React. Please file an issue.");
|
|
4456
4412
|
}
|
|
4457
|
-
}
|
|
4413
|
+
}
|
|
4458
4414
|
|
|
4459
4415
|
child._store.validated = true;
|
|
4460
4416
|
var currentComponentErrorInfo = 'Each child in a list should have a unique ' + '"key" prop. See https://fb.me/react-warning-keys for ' + 'more information.' + getCurrentFiberStackInDev();
|
|
@@ -4499,24 +4455,20 @@ function coerceRef(returnFiber, current$$1, element) {
|
|
|
4499
4455
|
if (owner) {
|
|
4500
4456
|
var ownerFiber = owner;
|
|
4501
4457
|
|
|
4502
|
-
(
|
|
4503
|
-
|
|
4504
|
-
|
|
4505
|
-
throw ReactError(Error("Function components cannot have refs. Did you mean to use React.forwardRef()?"));
|
|
4506
|
-
}
|
|
4458
|
+
if (!(ownerFiber.tag === ClassComponent)) {
|
|
4459
|
+
{
|
|
4460
|
+
throw Error("Function components cannot have refs. Did you mean to use React.forwardRef()?");
|
|
4507
4461
|
}
|
|
4508
|
-
}
|
|
4462
|
+
}
|
|
4509
4463
|
|
|
4510
4464
|
inst = ownerFiber.stateNode;
|
|
4511
4465
|
}
|
|
4512
4466
|
|
|
4513
|
-
|
|
4514
|
-
|
|
4515
|
-
|
|
4516
|
-
throw ReactError(Error("Missing owner for string ref " + mixedRef + ". This error is likely caused by a bug in React. Please file an issue."));
|
|
4517
|
-
}
|
|
4467
|
+
if (!inst) {
|
|
4468
|
+
{
|
|
4469
|
+
throw Error("Missing owner for string ref " + mixedRef + ". This error is likely caused by a bug in React. Please file an issue.");
|
|
4518
4470
|
}
|
|
4519
|
-
}
|
|
4471
|
+
}
|
|
4520
4472
|
|
|
4521
4473
|
var stringRef = '' + mixedRef; // Check if previous string ref matches new string ref
|
|
4522
4474
|
|
|
@@ -4542,21 +4494,17 @@ function coerceRef(returnFiber, current$$1, element) {
|
|
|
4542
4494
|
ref._stringRef = stringRef;
|
|
4543
4495
|
return ref;
|
|
4544
4496
|
} else {
|
|
4545
|
-
(
|
|
4546
|
-
|
|
4547
|
-
|
|
4548
|
-
throw ReactError(Error("Expected ref to be a function, a string, an object returned by React.createRef(), or null."));
|
|
4549
|
-
}
|
|
4497
|
+
if (!(typeof mixedRef === 'string')) {
|
|
4498
|
+
{
|
|
4499
|
+
throw Error("Expected ref to be a function, a string, an object returned by React.createRef(), or null.");
|
|
4550
4500
|
}
|
|
4551
|
-
}
|
|
4501
|
+
}
|
|
4552
4502
|
|
|
4553
|
-
|
|
4554
|
-
|
|
4555
|
-
|
|
4556
|
-
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."));
|
|
4557
|
-
}
|
|
4503
|
+
if (!element._owner) {
|
|
4504
|
+
{
|
|
4505
|
+
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.");
|
|
4558
4506
|
}
|
|
4559
|
-
}
|
|
4507
|
+
}
|
|
4560
4508
|
}
|
|
4561
4509
|
}
|
|
4562
4510
|
|
|
@@ -4571,13 +4519,11 @@ function throwOnInvalidObjectType(returnFiber, newChild) {
|
|
|
4571
4519
|
addendum = ' If you meant to render a collection of children, use an array ' + 'instead.' + getCurrentFiberStackInDev();
|
|
4572
4520
|
}
|
|
4573
4521
|
|
|
4574
|
-
|
|
4522
|
+
{
|
|
4575
4523
|
{
|
|
4576
|
-
{
|
|
4577
|
-
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));
|
|
4578
|
-
}
|
|
4524
|
+
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);
|
|
4579
4525
|
}
|
|
4580
|
-
}
|
|
4526
|
+
}
|
|
4581
4527
|
}
|
|
4582
4528
|
}
|
|
4583
4529
|
|
|
@@ -5125,13 +5071,11 @@ function ChildReconciler(shouldTrackSideEffects) {
|
|
|
5125
5071
|
// but using the iterator instead.
|
|
5126
5072
|
var iteratorFn = getIteratorFn(newChildrenIterable);
|
|
5127
5073
|
|
|
5128
|
-
(function
|
|
5129
|
-
|
|
5130
|
-
|
|
5131
|
-
throw ReactError(Error("An object is not an iterable. This error is likely caused by a bug in React. Please file an issue."));
|
|
5132
|
-
}
|
|
5074
|
+
if (!(typeof iteratorFn === 'function')) {
|
|
5075
|
+
{
|
|
5076
|
+
throw Error("An object is not an iterable. This error is likely caused by a bug in React. Please file an issue.");
|
|
5133
5077
|
}
|
|
5134
|
-
}
|
|
5078
|
+
}
|
|
5135
5079
|
|
|
5136
5080
|
{
|
|
5137
5081
|
// We don't support rendering Generators because it's a mutation.
|
|
@@ -5166,13 +5110,11 @@ function ChildReconciler(shouldTrackSideEffects) {
|
|
|
5166
5110
|
|
|
5167
5111
|
var newChildren = iteratorFn.call(newChildrenIterable);
|
|
5168
5112
|
|
|
5169
|
-
(
|
|
5170
|
-
|
|
5171
|
-
|
|
5172
|
-
throw ReactError(Error("An iterable object provided no iterator."));
|
|
5173
|
-
}
|
|
5113
|
+
if (!(newChildren != null)) {
|
|
5114
|
+
{
|
|
5115
|
+
throw Error("An iterable object provided no iterator.");
|
|
5174
5116
|
}
|
|
5175
|
-
}
|
|
5117
|
+
}
|
|
5176
5118
|
|
|
5177
5119
|
var resultingFirstChild = null;
|
|
5178
5120
|
var previousNewFiber = null;
|
|
@@ -5470,13 +5412,11 @@ function ChildReconciler(shouldTrackSideEffects) {
|
|
|
5470
5412
|
{
|
|
5471
5413
|
var Component = returnFiber.type;
|
|
5472
5414
|
|
|
5473
|
-
|
|
5415
|
+
{
|
|
5474
5416
|
{
|
|
5475
|
-
|
|
5476
|
-
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."));
|
|
5477
|
-
}
|
|
5417
|
+
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.");
|
|
5478
5418
|
}
|
|
5479
|
-
}
|
|
5419
|
+
}
|
|
5480
5420
|
}
|
|
5481
5421
|
}
|
|
5482
5422
|
} // Remaining cases are all treated as empty.
|
|
@@ -5491,13 +5431,11 @@ function ChildReconciler(shouldTrackSideEffects) {
|
|
|
5491
5431
|
var reconcileChildFibers = ChildReconciler(true);
|
|
5492
5432
|
var mountChildFibers = ChildReconciler(false);
|
|
5493
5433
|
function cloneChildFibers(current$$1, workInProgress) {
|
|
5494
|
-
(
|
|
5495
|
-
|
|
5496
|
-
|
|
5497
|
-
throw ReactError(Error("Resuming work not yet implemented."));
|
|
5498
|
-
}
|
|
5434
|
+
if (!(current$$1 === null || workInProgress.child === current$$1.child)) {
|
|
5435
|
+
{
|
|
5436
|
+
throw Error("Resuming work not yet implemented.");
|
|
5499
5437
|
}
|
|
5500
|
-
}
|
|
5438
|
+
}
|
|
5501
5439
|
|
|
5502
5440
|
if (workInProgress.child === null) {
|
|
5503
5441
|
return;
|
|
@@ -5532,13 +5470,11 @@ var contextFiberStackCursor = createCursor(NO_CONTEXT);
|
|
|
5532
5470
|
var rootInstanceStackCursor = createCursor(NO_CONTEXT);
|
|
5533
5471
|
|
|
5534
5472
|
function requiredContext(c) {
|
|
5535
|
-
(
|
|
5536
|
-
|
|
5537
|
-
|
|
5538
|
-
throw ReactError(Error("Expected host context to exist. This error is likely caused by a bug in React. Please file an issue."));
|
|
5539
|
-
}
|
|
5473
|
+
if (!(c !== NO_CONTEXT)) {
|
|
5474
|
+
{
|
|
5475
|
+
throw Error("Expected host context to exist. This error is likely caused by a bug in React. Please file an issue.");
|
|
5540
5476
|
}
|
|
5541
|
-
}
|
|
5477
|
+
}
|
|
5542
5478
|
|
|
5543
5479
|
return c;
|
|
5544
5480
|
}
|
|
@@ -5776,13 +5712,11 @@ function updateEventListener(listener, fiber, visistedResponders, respondersMap,
|
|
|
5776
5712
|
props = listener.props;
|
|
5777
5713
|
}
|
|
5778
5714
|
|
|
5779
|
-
(
|
|
5780
|
-
|
|
5781
|
-
|
|
5782
|
-
throw ReactError(Error("An invalid value was used as an event listener. Expect one or many event listeners created via React.unstable_useResponder()."));
|
|
5783
|
-
}
|
|
5715
|
+
if (!(responder && responder.$$typeof === REACT_RESPONDER_TYPE)) {
|
|
5716
|
+
{
|
|
5717
|
+
throw Error("An invalid value was used as an event listener. Expect one or many event listeners created via React.unstable_useResponder().");
|
|
5784
5718
|
}
|
|
5785
|
-
}
|
|
5719
|
+
}
|
|
5786
5720
|
|
|
5787
5721
|
var listenerProps = props;
|
|
5788
5722
|
|
|
@@ -5897,6 +5831,7 @@ var UnmountPassive =
|
|
|
5897
5831
|
128;
|
|
5898
5832
|
|
|
5899
5833
|
var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher;
|
|
5834
|
+
var ReactCurrentBatchConfig$1 = ReactSharedInternals.ReactCurrentBatchConfig;
|
|
5900
5835
|
var didWarnAboutMismatchedHooksForComponent;
|
|
5901
5836
|
|
|
5902
5837
|
{
|
|
@@ -6014,13 +5949,11 @@ function warnOnHookMismatchInDev(currentHookName) {
|
|
|
6014
5949
|
}
|
|
6015
5950
|
|
|
6016
5951
|
function throwInvalidHookError() {
|
|
6017
|
-
|
|
5952
|
+
{
|
|
6018
5953
|
{
|
|
6019
|
-
|
|
6020
|
-
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."));
|
|
6021
|
-
}
|
|
5954
|
+
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.");
|
|
6022
5955
|
}
|
|
6023
|
-
}
|
|
5956
|
+
}
|
|
6024
5957
|
}
|
|
6025
5958
|
|
|
6026
5959
|
function areHookInputsEqual(nextDeps, prevDeps) {
|
|
@@ -6170,13 +6103,11 @@ function renderWithHooks(current, workInProgress, Component, props, refOrContext
|
|
|
6170
6103
|
// renderPhaseUpdates = null;
|
|
6171
6104
|
// numberOfReRenders = 0;
|
|
6172
6105
|
|
|
6173
|
-
|
|
6174
|
-
|
|
6175
|
-
|
|
6176
|
-
throw ReactError(Error("Rendered fewer hooks than expected. This may be caused by an accidental early return statement."));
|
|
6177
|
-
}
|
|
6106
|
+
if (!!didRenderTooFewHooks) {
|
|
6107
|
+
{
|
|
6108
|
+
throw Error("Rendered fewer hooks than expected. This may be caused by an accidental early return statement.");
|
|
6178
6109
|
}
|
|
6179
|
-
}
|
|
6110
|
+
}
|
|
6180
6111
|
|
|
6181
6112
|
return children;
|
|
6182
6113
|
}
|
|
@@ -6251,13 +6182,11 @@ function updateWorkInProgressHook() {
|
|
|
6251
6182
|
nextCurrentHook = currentHook !== null ? currentHook.next : null;
|
|
6252
6183
|
} else {
|
|
6253
6184
|
// Clone from the current hook.
|
|
6254
|
-
(
|
|
6255
|
-
|
|
6256
|
-
|
|
6257
|
-
throw ReactError(Error("Rendered more hooks than during the previous render."));
|
|
6258
|
-
}
|
|
6185
|
+
if (!(nextCurrentHook !== null)) {
|
|
6186
|
+
{
|
|
6187
|
+
throw Error("Rendered more hooks than during the previous render.");
|
|
6259
6188
|
}
|
|
6260
|
-
}
|
|
6189
|
+
}
|
|
6261
6190
|
|
|
6262
6191
|
currentHook = nextCurrentHook;
|
|
6263
6192
|
var newHook = {
|
|
@@ -6318,13 +6247,11 @@ function updateReducer(reducer, initialArg, init) {
|
|
|
6318
6247
|
var hook = updateWorkInProgressHook();
|
|
6319
6248
|
var queue = hook.queue;
|
|
6320
6249
|
|
|
6321
|
-
(
|
|
6322
|
-
|
|
6323
|
-
|
|
6324
|
-
throw ReactError(Error("Should have a queue. This is likely a bug in React. Please file an issue."));
|
|
6325
|
-
}
|
|
6250
|
+
if (!(queue !== null)) {
|
|
6251
|
+
{
|
|
6252
|
+
throw Error("Should have a queue. This is likely a bug in React. Please file an issue.");
|
|
6326
6253
|
}
|
|
6327
|
-
}
|
|
6254
|
+
}
|
|
6328
6255
|
|
|
6329
6256
|
queue.lastRenderedReducer = reducer;
|
|
6330
6257
|
|
|
@@ -6705,14 +6632,96 @@ function updateMemo(nextCreate, deps) {
|
|
|
6705
6632
|
return nextValue;
|
|
6706
6633
|
}
|
|
6707
6634
|
|
|
6708
|
-
function
|
|
6709
|
-
|
|
6710
|
-
|
|
6711
|
-
|
|
6712
|
-
|
|
6635
|
+
function mountDeferredValue(value, config) {
|
|
6636
|
+
var _mountState = mountState(value),
|
|
6637
|
+
prevValue = _mountState[0],
|
|
6638
|
+
setValue = _mountState[1];
|
|
6639
|
+
|
|
6640
|
+
mountEffect(function () {
|
|
6641
|
+
Scheduler.unstable_next(function () {
|
|
6642
|
+
var previousConfig = ReactCurrentBatchConfig$1.suspense;
|
|
6643
|
+
ReactCurrentBatchConfig$1.suspense = config === undefined ? null : config;
|
|
6644
|
+
|
|
6645
|
+
try {
|
|
6646
|
+
setValue(value);
|
|
6647
|
+
} finally {
|
|
6648
|
+
ReactCurrentBatchConfig$1.suspense = previousConfig;
|
|
6649
|
+
}
|
|
6650
|
+
});
|
|
6651
|
+
}, [value, config]);
|
|
6652
|
+
return prevValue;
|
|
6653
|
+
}
|
|
6654
|
+
|
|
6655
|
+
function updateDeferredValue(value, config) {
|
|
6656
|
+
var _updateState = updateState(value),
|
|
6657
|
+
prevValue = _updateState[0],
|
|
6658
|
+
setValue = _updateState[1];
|
|
6659
|
+
|
|
6660
|
+
updateEffect(function () {
|
|
6661
|
+
Scheduler.unstable_next(function () {
|
|
6662
|
+
var previousConfig = ReactCurrentBatchConfig$1.suspense;
|
|
6663
|
+
ReactCurrentBatchConfig$1.suspense = config === undefined ? null : config;
|
|
6664
|
+
|
|
6665
|
+
try {
|
|
6666
|
+
setValue(value);
|
|
6667
|
+
} finally {
|
|
6668
|
+
ReactCurrentBatchConfig$1.suspense = previousConfig;
|
|
6669
|
+
}
|
|
6670
|
+
});
|
|
6671
|
+
}, [value, config]);
|
|
6672
|
+
return prevValue;
|
|
6673
|
+
}
|
|
6674
|
+
|
|
6675
|
+
function mountTransition(config) {
|
|
6676
|
+
var _mountState2 = mountState(false),
|
|
6677
|
+
isPending = _mountState2[0],
|
|
6678
|
+
setPending = _mountState2[1];
|
|
6679
|
+
|
|
6680
|
+
var startTransition = mountCallback(function (callback) {
|
|
6681
|
+
setPending(true);
|
|
6682
|
+
Scheduler.unstable_next(function () {
|
|
6683
|
+
var previousConfig = ReactCurrentBatchConfig$1.suspense;
|
|
6684
|
+
ReactCurrentBatchConfig$1.suspense = config === undefined ? null : config;
|
|
6685
|
+
|
|
6686
|
+
try {
|
|
6687
|
+
setPending(false);
|
|
6688
|
+
callback();
|
|
6689
|
+
} finally {
|
|
6690
|
+
ReactCurrentBatchConfig$1.suspense = previousConfig;
|
|
6691
|
+
}
|
|
6692
|
+
});
|
|
6693
|
+
}, [config, isPending]);
|
|
6694
|
+
return [startTransition, isPending];
|
|
6695
|
+
}
|
|
6696
|
+
|
|
6697
|
+
function updateTransition(config) {
|
|
6698
|
+
var _updateState2 = updateState(false),
|
|
6699
|
+
isPending = _updateState2[0],
|
|
6700
|
+
setPending = _updateState2[1];
|
|
6701
|
+
|
|
6702
|
+
var startTransition = updateCallback(function (callback) {
|
|
6703
|
+
setPending(true);
|
|
6704
|
+
Scheduler.unstable_next(function () {
|
|
6705
|
+
var previousConfig = ReactCurrentBatchConfig$1.suspense;
|
|
6706
|
+
ReactCurrentBatchConfig$1.suspense = config === undefined ? null : config;
|
|
6707
|
+
|
|
6708
|
+
try {
|
|
6709
|
+
setPending(false);
|
|
6710
|
+
callback();
|
|
6711
|
+
} finally {
|
|
6712
|
+
ReactCurrentBatchConfig$1.suspense = previousConfig;
|
|
6713
6713
|
}
|
|
6714
|
+
});
|
|
6715
|
+
}, [config, isPending]);
|
|
6716
|
+
return [startTransition, isPending];
|
|
6717
|
+
}
|
|
6718
|
+
|
|
6719
|
+
function dispatchAction(fiber, queue, action) {
|
|
6720
|
+
if (!(numberOfReRenders < RE_RENDER_LIMIT)) {
|
|
6721
|
+
{
|
|
6722
|
+
throw Error("Too many re-renders. React limits the number of renders to prevent an infinite loop.");
|
|
6714
6723
|
}
|
|
6715
|
-
}
|
|
6724
|
+
}
|
|
6716
6725
|
|
|
6717
6726
|
{
|
|
6718
6727
|
!(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;
|
|
@@ -6757,7 +6766,7 @@ function dispatchAction(fiber, queue, action) {
|
|
|
6757
6766
|
lastRenderPhaseUpdate.next = update;
|
|
6758
6767
|
}
|
|
6759
6768
|
} else {
|
|
6760
|
-
var currentTime =
|
|
6769
|
+
var currentTime = requestCurrentTimeForUpdate();
|
|
6761
6770
|
var suspenseConfig = requestCurrentSuspenseConfig();
|
|
6762
6771
|
var expirationTime = computeExpirationForFiber(currentTime, fiber, suspenseConfig);
|
|
6763
6772
|
var _update2 = {
|
|
@@ -6856,7 +6865,9 @@ var ContextOnlyDispatcher = {
|
|
|
6856
6865
|
useRef: throwInvalidHookError,
|
|
6857
6866
|
useState: throwInvalidHookError,
|
|
6858
6867
|
useDebugValue: throwInvalidHookError,
|
|
6859
|
-
useResponder: throwInvalidHookError
|
|
6868
|
+
useResponder: throwInvalidHookError,
|
|
6869
|
+
useDeferredValue: throwInvalidHookError,
|
|
6870
|
+
useTransition: throwInvalidHookError
|
|
6860
6871
|
};
|
|
6861
6872
|
var HooksDispatcherOnMountInDEV = null;
|
|
6862
6873
|
var HooksDispatcherOnMountWithHookTypesInDEV = null;
|
|
@@ -6957,6 +6968,16 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
|
6957
6968
|
currentHookNameInDev = 'useResponder';
|
|
6958
6969
|
mountHookTypesDev();
|
|
6959
6970
|
return createResponderListener(responder, props);
|
|
6971
|
+
},
|
|
6972
|
+
useDeferredValue: function (value, config) {
|
|
6973
|
+
currentHookNameInDev = 'useDeferredValue';
|
|
6974
|
+
mountHookTypesDev();
|
|
6975
|
+
return mountDeferredValue(value, config);
|
|
6976
|
+
},
|
|
6977
|
+
useTransition: function (config) {
|
|
6978
|
+
currentHookNameInDev = 'useTransition';
|
|
6979
|
+
mountHookTypesDev();
|
|
6980
|
+
return mountTransition(config);
|
|
6960
6981
|
}
|
|
6961
6982
|
};
|
|
6962
6983
|
HooksDispatcherOnMountWithHookTypesInDEV = {
|
|
@@ -7038,6 +7059,16 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
|
7038
7059
|
currentHookNameInDev = 'useResponder';
|
|
7039
7060
|
updateHookTypesDev();
|
|
7040
7061
|
return createResponderListener(responder, props);
|
|
7062
|
+
},
|
|
7063
|
+
useDeferredValue: function (value, config) {
|
|
7064
|
+
currentHookNameInDev = 'useDeferredValue';
|
|
7065
|
+
updateHookTypesDev();
|
|
7066
|
+
return mountDeferredValue(value, config);
|
|
7067
|
+
},
|
|
7068
|
+
useTransition: function (config) {
|
|
7069
|
+
currentHookNameInDev = 'useTransition';
|
|
7070
|
+
updateHookTypesDev();
|
|
7071
|
+
return mountTransition(config);
|
|
7041
7072
|
}
|
|
7042
7073
|
};
|
|
7043
7074
|
HooksDispatcherOnUpdateInDEV = {
|
|
@@ -7119,6 +7150,16 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
|
7119
7150
|
currentHookNameInDev = 'useResponder';
|
|
7120
7151
|
updateHookTypesDev();
|
|
7121
7152
|
return createResponderListener(responder, props);
|
|
7153
|
+
},
|
|
7154
|
+
useDeferredValue: function (value, config) {
|
|
7155
|
+
currentHookNameInDev = 'useDeferredValue';
|
|
7156
|
+
updateHookTypesDev();
|
|
7157
|
+
return updateDeferredValue(value, config);
|
|
7158
|
+
},
|
|
7159
|
+
useTransition: function (config) {
|
|
7160
|
+
currentHookNameInDev = 'useTransition';
|
|
7161
|
+
updateHookTypesDev();
|
|
7162
|
+
return updateTransition(config);
|
|
7122
7163
|
}
|
|
7123
7164
|
};
|
|
7124
7165
|
InvalidNestedHooksDispatcherOnMountInDEV = {
|
|
@@ -7212,6 +7253,18 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
|
7212
7253
|
warnInvalidHookAccess();
|
|
7213
7254
|
mountHookTypesDev();
|
|
7214
7255
|
return createResponderListener(responder, props);
|
|
7256
|
+
},
|
|
7257
|
+
useDeferredValue: function (value, config) {
|
|
7258
|
+
currentHookNameInDev = 'useDeferredValue';
|
|
7259
|
+
warnInvalidHookAccess();
|
|
7260
|
+
mountHookTypesDev();
|
|
7261
|
+
return mountDeferredValue(value, config);
|
|
7262
|
+
},
|
|
7263
|
+
useTransition: function (config) {
|
|
7264
|
+
currentHookNameInDev = 'useTransition';
|
|
7265
|
+
warnInvalidHookAccess();
|
|
7266
|
+
mountHookTypesDev();
|
|
7267
|
+
return mountTransition(config);
|
|
7215
7268
|
}
|
|
7216
7269
|
};
|
|
7217
7270
|
InvalidNestedHooksDispatcherOnUpdateInDEV = {
|
|
@@ -7305,6 +7358,18 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
|
7305
7358
|
warnInvalidHookAccess();
|
|
7306
7359
|
updateHookTypesDev();
|
|
7307
7360
|
return createResponderListener(responder, props);
|
|
7361
|
+
},
|
|
7362
|
+
useDeferredValue: function (value, config) {
|
|
7363
|
+
currentHookNameInDev = 'useDeferredValue';
|
|
7364
|
+
warnInvalidHookAccess();
|
|
7365
|
+
updateHookTypesDev();
|
|
7366
|
+
return updateDeferredValue(value, config);
|
|
7367
|
+
},
|
|
7368
|
+
useTransition: function (config) {
|
|
7369
|
+
currentHookNameInDev = 'useTransition';
|
|
7370
|
+
warnInvalidHookAccess();
|
|
7371
|
+
updateHookTypesDev();
|
|
7372
|
+
return updateTransition(config);
|
|
7308
7373
|
}
|
|
7309
7374
|
};
|
|
7310
7375
|
}
|
|
@@ -7593,13 +7658,11 @@ function tryToClaimNextHydratableInstance(fiber) {
|
|
|
7593
7658
|
|
|
7594
7659
|
function prepareToHydrateHostInstance(fiber, rootContainerInstance, hostContext) {
|
|
7595
7660
|
if (!supportsHydration) {
|
|
7596
|
-
|
|
7661
|
+
{
|
|
7597
7662
|
{
|
|
7598
|
-
|
|
7599
|
-
throw ReactError(Error("Expected prepareToHydrateHostInstance() to never be called. This error is likely caused by a bug in React. Please file an issue."));
|
|
7600
|
-
}
|
|
7663
|
+
throw Error("Expected prepareToHydrateHostInstance() to never be called. This error is likely caused by a bug in React. Please file an issue.");
|
|
7601
7664
|
}
|
|
7602
|
-
}
|
|
7665
|
+
}
|
|
7603
7666
|
}
|
|
7604
7667
|
|
|
7605
7668
|
var instance = fiber.stateNode;
|
|
@@ -7617,13 +7680,11 @@ function prepareToHydrateHostInstance(fiber, rootContainerInstance, hostContext)
|
|
|
7617
7680
|
|
|
7618
7681
|
function prepareToHydrateHostTextInstance(fiber) {
|
|
7619
7682
|
if (!supportsHydration) {
|
|
7620
|
-
|
|
7683
|
+
{
|
|
7621
7684
|
{
|
|
7622
|
-
|
|
7623
|
-
throw ReactError(Error("Expected prepareToHydrateHostTextInstance() to never be called. This error is likely caused by a bug in React. Please file an issue."));
|
|
7624
|
-
}
|
|
7685
|
+
throw Error("Expected prepareToHydrateHostTextInstance() to never be called. This error is likely caused by a bug in React. Please file an issue.");
|
|
7625
7686
|
}
|
|
7626
|
-
}
|
|
7687
|
+
}
|
|
7627
7688
|
}
|
|
7628
7689
|
|
|
7629
7690
|
var textInstance = fiber.stateNode;
|
|
@@ -7663,50 +7724,42 @@ function prepareToHydrateHostTextInstance(fiber) {
|
|
|
7663
7724
|
|
|
7664
7725
|
function prepareToHydrateHostSuspenseInstance(fiber) {
|
|
7665
7726
|
if (!supportsHydration) {
|
|
7666
|
-
|
|
7727
|
+
{
|
|
7667
7728
|
{
|
|
7668
|
-
|
|
7669
|
-
throw ReactError(Error("Expected prepareToHydrateHostSuspenseInstance() to never be called. This error is likely caused by a bug in React. Please file an issue."));
|
|
7670
|
-
}
|
|
7729
|
+
throw Error("Expected prepareToHydrateHostSuspenseInstance() to never be called. This error is likely caused by a bug in React. Please file an issue.");
|
|
7671
7730
|
}
|
|
7672
|
-
}
|
|
7731
|
+
}
|
|
7673
7732
|
}
|
|
7674
7733
|
|
|
7675
7734
|
var suspenseState = fiber.memoizedState;
|
|
7676
7735
|
var suspenseInstance = suspenseState !== null ? suspenseState.dehydrated : null;
|
|
7677
7736
|
|
|
7678
|
-
|
|
7679
|
-
|
|
7680
|
-
|
|
7681
|
-
throw ReactError(Error("Expected to have a hydrated suspense instance. This error is likely caused by a bug in React. Please file an issue."));
|
|
7682
|
-
}
|
|
7737
|
+
if (!suspenseInstance) {
|
|
7738
|
+
{
|
|
7739
|
+
throw Error("Expected to have a hydrated suspense instance. This error is likely caused by a bug in React. Please file an issue.");
|
|
7683
7740
|
}
|
|
7684
|
-
}
|
|
7741
|
+
}
|
|
7685
7742
|
|
|
7686
7743
|
hydrateSuspenseInstance(suspenseInstance, fiber);
|
|
7687
7744
|
}
|
|
7688
7745
|
|
|
7689
7746
|
function skipPastDehydratedSuspenseInstance(fiber) {
|
|
7690
7747
|
if (!supportsHydration) {
|
|
7691
|
-
|
|
7748
|
+
{
|
|
7692
7749
|
{
|
|
7693
|
-
|
|
7694
|
-
throw ReactError(Error("Expected skipPastDehydratedSuspenseInstance() to never be called. This error is likely caused by a bug in React. Please file an issue."));
|
|
7695
|
-
}
|
|
7750
|
+
throw Error("Expected skipPastDehydratedSuspenseInstance() to never be called. This error is likely caused by a bug in React. Please file an issue.");
|
|
7696
7751
|
}
|
|
7697
|
-
}
|
|
7752
|
+
}
|
|
7698
7753
|
}
|
|
7699
7754
|
|
|
7700
7755
|
var suspenseState = fiber.memoizedState;
|
|
7701
7756
|
var suspenseInstance = suspenseState !== null ? suspenseState.dehydrated : null;
|
|
7702
7757
|
|
|
7703
|
-
|
|
7704
|
-
|
|
7705
|
-
|
|
7706
|
-
throw ReactError(Error("Expected to have a hydrated suspense instance. This error is likely caused by a bug in React. Please file an issue."));
|
|
7707
|
-
}
|
|
7758
|
+
if (!suspenseInstance) {
|
|
7759
|
+
{
|
|
7760
|
+
throw Error("Expected to have a hydrated suspense instance. This error is likely caused by a bug in React. Please file an issue.");
|
|
7708
7761
|
}
|
|
7709
|
-
}
|
|
7762
|
+
}
|
|
7710
7763
|
|
|
7711
7764
|
return getNextHydratableInstanceAfterSuspenseInstance(suspenseInstance);
|
|
7712
7765
|
}
|
|
@@ -7865,7 +7918,7 @@ function updateForwardRef(current$$1, workInProgress, Component, nextProps, rend
|
|
|
7865
7918
|
setCurrentPhase('render');
|
|
7866
7919
|
nextChildren = renderWithHooks(current$$1, workInProgress, render, nextProps, ref, renderExpirationTime);
|
|
7867
7920
|
|
|
7868
|
-
if (
|
|
7921
|
+
if (debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
|
|
7869
7922
|
// Only double-render components with Hooks
|
|
7870
7923
|
if (workInProgress.memoizedState !== null) {
|
|
7871
7924
|
nextChildren = renderWithHooks(current$$1, workInProgress, render, nextProps, ref, renderExpirationTime);
|
|
@@ -8069,7 +8122,7 @@ function updateFunctionComponent(current$$1, workInProgress, Component, nextProp
|
|
|
8069
8122
|
setCurrentPhase('render');
|
|
8070
8123
|
nextChildren = renderWithHooks(current$$1, workInProgress, Component, nextProps, context, renderExpirationTime);
|
|
8071
8124
|
|
|
8072
|
-
if (
|
|
8125
|
+
if (debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
|
|
8073
8126
|
// Only double-render components with Hooks
|
|
8074
8127
|
if (workInProgress.memoizedState !== null) {
|
|
8075
8128
|
nextChildren = renderWithHooks(current$$1, workInProgress, Component, nextProps, context, renderExpirationTime);
|
|
@@ -8192,7 +8245,7 @@ function finishClassComponent(current$$1, workInProgress, Component, shouldUpdat
|
|
|
8192
8245
|
setCurrentPhase('render');
|
|
8193
8246
|
nextChildren = instance.render();
|
|
8194
8247
|
|
|
8195
|
-
if (
|
|
8248
|
+
if (debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
|
|
8196
8249
|
instance.render();
|
|
8197
8250
|
}
|
|
8198
8251
|
|
|
@@ -8241,13 +8294,11 @@ function updateHostRoot(current$$1, workInProgress, renderExpirationTime) {
|
|
|
8241
8294
|
pushHostRootContext(workInProgress);
|
|
8242
8295
|
var updateQueue = workInProgress.updateQueue;
|
|
8243
8296
|
|
|
8244
|
-
(
|
|
8245
|
-
|
|
8246
|
-
|
|
8247
|
-
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."));
|
|
8248
|
-
}
|
|
8297
|
+
if (!(updateQueue !== null)) {
|
|
8298
|
+
{
|
|
8299
|
+
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.");
|
|
8249
8300
|
}
|
|
8250
|
-
}
|
|
8301
|
+
}
|
|
8251
8302
|
|
|
8252
8303
|
var nextProps = workInProgress.pendingProps;
|
|
8253
8304
|
var prevState = workInProgress.memoizedState;
|
|
@@ -8434,13 +8485,11 @@ function mountLazyComponent(_current, workInProgress, elementType, updateExpirat
|
|
|
8434
8485
|
// implementation detail.
|
|
8435
8486
|
|
|
8436
8487
|
|
|
8437
|
-
|
|
8488
|
+
{
|
|
8438
8489
|
{
|
|
8439
|
-
|
|
8440
|
-
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));
|
|
8441
|
-
}
|
|
8490
|
+
throw Error("Element type is invalid. Received a promise that resolves to: " + Component + ". Lazy element type must resolve to a class or function." + hint);
|
|
8442
8491
|
}
|
|
8443
|
-
}
|
|
8492
|
+
}
|
|
8444
8493
|
}
|
|
8445
8494
|
}
|
|
8446
8495
|
|
|
@@ -8569,7 +8618,7 @@ function mountIndeterminateComponent(_current, workInProgress, Component, render
|
|
|
8569
8618
|
warningWithoutStack$1(false, '%s uses the legacy contextTypes API which is no longer supported. ' + 'Use React.createContext() with React.useContext() instead.', getComponentName(Component) || 'Unknown');
|
|
8570
8619
|
}
|
|
8571
8620
|
|
|
8572
|
-
if (
|
|
8621
|
+
if (debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
|
|
8573
8622
|
// Only double-render components with Hooks
|
|
8574
8623
|
if (workInProgress.memoizedState !== null) {
|
|
8575
8624
|
value = renderWithHooks(null, workInProgress, Component, props, context, renderExpirationTime);
|
|
@@ -8643,7 +8692,7 @@ function validateFunctionComponentInDev(workInProgress, Component) {
|
|
|
8643
8692
|
|
|
8644
8693
|
var SUSPENDED_MARKER = {
|
|
8645
8694
|
dehydrated: null,
|
|
8646
|
-
retryTime:
|
|
8695
|
+
retryTime: NoWork
|
|
8647
8696
|
};
|
|
8648
8697
|
|
|
8649
8698
|
function shouldRemainOnFallback(suspenseContext, current$$1, workInProgress) {
|
|
@@ -8719,12 +8768,12 @@ function updateSuspenseComponent(current$$1, workInProgress, renderExpirationTim
|
|
|
8719
8768
|
|
|
8720
8769
|
|
|
8721
8770
|
if (current$$1 === null) {
|
|
8722
|
-
|
|
8723
|
-
|
|
8724
|
-
|
|
8725
|
-
|
|
8726
|
-
tryToClaimNextHydratableInstance(workInProgress); // This could've been a dehydrated suspense component.
|
|
8771
|
+
// If we're currently hydrating, try to hydrate this boundary.
|
|
8772
|
+
// But only if this has a fallback.
|
|
8773
|
+
if (nextProps.fallback !== undefined) {
|
|
8774
|
+
tryToClaimNextHydratableInstance(workInProgress); // This could've been a dehydrated suspense component.
|
|
8727
8775
|
|
|
8776
|
+
if (enableSuspenseServerRenderer) {
|
|
8728
8777
|
var suspenseState = workInProgress.memoizedState;
|
|
8729
8778
|
|
|
8730
8779
|
if (suspenseState !== null) {
|
|
@@ -8745,8 +8794,8 @@ function updateSuspenseComponent(current$$1, workInProgress, renderExpirationTim
|
|
|
8745
8794
|
var primaryChildFragment = createFiberFromFragment(null, mode, NoWork, null);
|
|
8746
8795
|
primaryChildFragment.return = workInProgress;
|
|
8747
8796
|
|
|
8748
|
-
if ((workInProgress.mode &
|
|
8749
|
-
// Outside of
|
|
8797
|
+
if ((workInProgress.mode & BlockingMode) === NoMode) {
|
|
8798
|
+
// Outside of blocking mode, we commit the effects from the
|
|
8750
8799
|
// partially completed, timed-out tree, too.
|
|
8751
8800
|
var progressedState = workInProgress.memoizedState;
|
|
8752
8801
|
var progressedPrimaryChild = progressedState !== null ? workInProgress.child.child : workInProgress.child;
|
|
@@ -8809,8 +8858,8 @@ function updateSuspenseComponent(current$$1, workInProgress, renderExpirationTim
|
|
|
8809
8858
|
|
|
8810
8859
|
_primaryChildFragment.child = null;
|
|
8811
8860
|
|
|
8812
|
-
if ((workInProgress.mode &
|
|
8813
|
-
// Outside of
|
|
8861
|
+
if ((workInProgress.mode & BlockingMode) === NoMode) {
|
|
8862
|
+
// Outside of blocking mode, we commit the effects from the
|
|
8814
8863
|
// partially completed, timed-out tree, too.
|
|
8815
8864
|
var _progressedChild = _primaryChildFragment.child = workInProgress.child;
|
|
8816
8865
|
|
|
@@ -8869,8 +8918,8 @@ function updateSuspenseComponent(current$$1, workInProgress, renderExpirationTim
|
|
|
8869
8918
|
|
|
8870
8919
|
_primaryChildFragment2.return = workInProgress;
|
|
8871
8920
|
|
|
8872
|
-
if ((workInProgress.mode &
|
|
8873
|
-
// Outside of
|
|
8921
|
+
if ((workInProgress.mode & BlockingMode) === NoMode) {
|
|
8922
|
+
// Outside of blocking mode, we commit the effects from the
|
|
8874
8923
|
// partially completed, timed-out tree, too.
|
|
8875
8924
|
var _progressedState = workInProgress.memoizedState;
|
|
8876
8925
|
|
|
@@ -8954,8 +9003,8 @@ function updateSuspenseComponent(current$$1, workInProgress, renderExpirationTim
|
|
|
8954
9003
|
// primaryChildFragment.effectTag |= Placement;
|
|
8955
9004
|
|
|
8956
9005
|
|
|
8957
|
-
if ((workInProgress.mode &
|
|
8958
|
-
// Outside of
|
|
9006
|
+
if ((workInProgress.mode & BlockingMode) === NoMode) {
|
|
9007
|
+
// Outside of blocking mode, we commit the effects from the
|
|
8959
9008
|
// partially completed, timed-out tree, too.
|
|
8960
9009
|
var _progressedState2 = workInProgress.memoizedState;
|
|
8961
9010
|
|
|
@@ -9024,9 +9073,9 @@ function retrySuspenseComponentWithoutHydrating(current$$1, workInProgress, rend
|
|
|
9024
9073
|
function mountDehydratedSuspenseComponent(workInProgress, suspenseInstance, renderExpirationTime) {
|
|
9025
9074
|
// During the first pass, we'll bail out and not drill into the children.
|
|
9026
9075
|
// Instead, we'll leave the content in place and try to hydrate it later.
|
|
9027
|
-
if ((workInProgress.mode &
|
|
9076
|
+
if ((workInProgress.mode & BlockingMode) === NoMode) {
|
|
9028
9077
|
{
|
|
9029
|
-
warning$1(false, 'Cannot hydrate Suspense in legacy mode. Switch from ' + 'ReactDOM.hydrate(element, container) to ' + 'ReactDOM.
|
|
9078
|
+
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.');
|
|
9030
9079
|
}
|
|
9031
9080
|
|
|
9032
9081
|
workInProgress.expirationTime = Sync;
|
|
@@ -9041,7 +9090,7 @@ function mountDehydratedSuspenseComponent(workInProgress, suspenseInstance, rend
|
|
|
9041
9090
|
// a protocol to transfer that time, we'll just estimate it by using the current
|
|
9042
9091
|
// time. This will mean that Suspense timeouts are slightly shifted to later than
|
|
9043
9092
|
// they should be.
|
|
9044
|
-
var serverDisplayTime =
|
|
9093
|
+
var serverDisplayTime = requestCurrentTimeForUpdate(); // Schedule a normal pri update to render this content.
|
|
9045
9094
|
|
|
9046
9095
|
var newExpirationTime = computeAsyncExpiration(serverDisplayTime);
|
|
9047
9096
|
|
|
@@ -9068,7 +9117,7 @@ function updateDehydratedSuspenseComponent(current$$1, workInProgress, suspenseI
|
|
|
9068
9117
|
// but after we've already committed once.
|
|
9069
9118
|
warnIfHydrating();
|
|
9070
9119
|
|
|
9071
|
-
if ((workInProgress.mode &
|
|
9120
|
+
if ((workInProgress.mode & BlockingMode) === NoMode) {
|
|
9072
9121
|
return retrySuspenseComponentWithoutHydrating(current$$1, workInProgress, renderExpirationTime);
|
|
9073
9122
|
}
|
|
9074
9123
|
|
|
@@ -9150,6 +9199,20 @@ function updateDehydratedSuspenseComponent(current$$1, workInProgress, suspenseI
|
|
|
9150
9199
|
}
|
|
9151
9200
|
}
|
|
9152
9201
|
|
|
9202
|
+
function scheduleWorkOnFiber(fiber, renderExpirationTime) {
|
|
9203
|
+
if (fiber.expirationTime < renderExpirationTime) {
|
|
9204
|
+
fiber.expirationTime = renderExpirationTime;
|
|
9205
|
+
}
|
|
9206
|
+
|
|
9207
|
+
var alternate = fiber.alternate;
|
|
9208
|
+
|
|
9209
|
+
if (alternate !== null && alternate.expirationTime < renderExpirationTime) {
|
|
9210
|
+
alternate.expirationTime = renderExpirationTime;
|
|
9211
|
+
}
|
|
9212
|
+
|
|
9213
|
+
scheduleWorkOnParentPath(fiber.return, renderExpirationTime);
|
|
9214
|
+
}
|
|
9215
|
+
|
|
9153
9216
|
function propagateSuspenseContextChange(workInProgress, firstChild, renderExpirationTime) {
|
|
9154
9217
|
// Mark any Suspense boundaries with fallbacks as having work to do.
|
|
9155
9218
|
// If they were previously forced into fallbacks, they may now be able
|
|
@@ -9161,18 +9224,15 @@ function propagateSuspenseContextChange(workInProgress, firstChild, renderExpira
|
|
|
9161
9224
|
var state = node.memoizedState;
|
|
9162
9225
|
|
|
9163
9226
|
if (state !== null) {
|
|
9164
|
-
|
|
9165
|
-
|
|
9166
|
-
|
|
9167
|
-
|
|
9168
|
-
|
|
9169
|
-
|
|
9170
|
-
|
|
9171
|
-
|
|
9172
|
-
|
|
9173
|
-
|
|
9174
|
-
scheduleWorkOnParentPath(node.return, renderExpirationTime);
|
|
9175
|
-
}
|
|
9227
|
+
scheduleWorkOnFiber(node, renderExpirationTime);
|
|
9228
|
+
}
|
|
9229
|
+
} else if (node.tag === SuspenseListComponent) {
|
|
9230
|
+
// If the tail is hidden there might not be an Suspense boundaries
|
|
9231
|
+
// to schedule work on. In this case we have to schedule it on the
|
|
9232
|
+
// list itself.
|
|
9233
|
+
// We don't have to traverse to the children of the list since
|
|
9234
|
+
// the list will propagate the change when it rerenders.
|
|
9235
|
+
scheduleWorkOnFiber(node, renderExpirationTime);
|
|
9176
9236
|
} else if (node.child !== null) {
|
|
9177
9237
|
node.child.return = node;
|
|
9178
9238
|
node = node.child;
|
|
@@ -9317,7 +9377,7 @@ function validateSuspenseListChildren(children, revealOrder) {
|
|
|
9317
9377
|
}
|
|
9318
9378
|
}
|
|
9319
9379
|
|
|
9320
|
-
function initSuspenseListRenderState(workInProgress, isBackwards, tail, lastContentRow, tailMode) {
|
|
9380
|
+
function initSuspenseListRenderState(workInProgress, isBackwards, tail, lastContentRow, tailMode, lastEffectBeforeRendering) {
|
|
9321
9381
|
var renderState = workInProgress.memoizedState;
|
|
9322
9382
|
|
|
9323
9383
|
if (renderState === null) {
|
|
@@ -9327,7 +9387,8 @@ function initSuspenseListRenderState(workInProgress, isBackwards, tail, lastCont
|
|
|
9327
9387
|
last: lastContentRow,
|
|
9328
9388
|
tail: tail,
|
|
9329
9389
|
tailExpiration: 0,
|
|
9330
|
-
tailMode: tailMode
|
|
9390
|
+
tailMode: tailMode,
|
|
9391
|
+
lastEffect: lastEffectBeforeRendering
|
|
9331
9392
|
};
|
|
9332
9393
|
} else {
|
|
9333
9394
|
// We can reuse the existing object from previous renders.
|
|
@@ -9337,6 +9398,7 @@ function initSuspenseListRenderState(workInProgress, isBackwards, tail, lastCont
|
|
|
9337
9398
|
renderState.tail = tail;
|
|
9338
9399
|
renderState.tailExpiration = 0;
|
|
9339
9400
|
renderState.tailMode = tailMode;
|
|
9401
|
+
renderState.lastEffect = lastEffectBeforeRendering;
|
|
9340
9402
|
}
|
|
9341
9403
|
} // This can end up rendering this component multiple passes.
|
|
9342
9404
|
// The first pass splits the children fibers into two sets. A head and tail.
|
|
@@ -9377,8 +9439,8 @@ function updateSuspenseListComponent(current$$1, workInProgress, renderExpiratio
|
|
|
9377
9439
|
|
|
9378
9440
|
pushSuspenseContext(workInProgress, suspenseContext);
|
|
9379
9441
|
|
|
9380
|
-
if ((workInProgress.mode &
|
|
9381
|
-
// Outside of
|
|
9442
|
+
if ((workInProgress.mode & BlockingMode) === NoMode) {
|
|
9443
|
+
// Outside of blocking mode, SuspenseList doesn't work so we just
|
|
9382
9444
|
// use make it a noop by treating it as the default revealOrder.
|
|
9383
9445
|
workInProgress.memoizedState = null;
|
|
9384
9446
|
} else {
|
|
@@ -9401,7 +9463,7 @@ function updateSuspenseListComponent(current$$1, workInProgress, renderExpiratio
|
|
|
9401
9463
|
}
|
|
9402
9464
|
|
|
9403
9465
|
initSuspenseListRenderState(workInProgress, false, // isBackwards
|
|
9404
|
-
tail, lastContentRow, tailMode);
|
|
9466
|
+
tail, lastContentRow, tailMode, workInProgress.lastEffect);
|
|
9405
9467
|
break;
|
|
9406
9468
|
}
|
|
9407
9469
|
|
|
@@ -9433,7 +9495,7 @@ function updateSuspenseListComponent(current$$1, workInProgress, renderExpiratio
|
|
|
9433
9495
|
|
|
9434
9496
|
initSuspenseListRenderState(workInProgress, true, // isBackwards
|
|
9435
9497
|
_tail, null, // last
|
|
9436
|
-
tailMode);
|
|
9498
|
+
tailMode, workInProgress.lastEffect);
|
|
9437
9499
|
break;
|
|
9438
9500
|
}
|
|
9439
9501
|
|
|
@@ -9442,7 +9504,7 @@ function updateSuspenseListComponent(current$$1, workInProgress, renderExpiratio
|
|
|
9442
9504
|
initSuspenseListRenderState(workInProgress, false, // isBackwards
|
|
9443
9505
|
null, // tail
|
|
9444
9506
|
null, // last
|
|
9445
|
-
undefined);
|
|
9507
|
+
undefined, workInProgress.lastEffect);
|
|
9446
9508
|
break;
|
|
9447
9509
|
}
|
|
9448
9510
|
|
|
@@ -9750,10 +9812,15 @@ function beginWork$1(current$$1, workInProgress, renderExpirationTime) {
|
|
|
9750
9812
|
|
|
9751
9813
|
case Profiler:
|
|
9752
9814
|
if (enableProfilerTimer) {
|
|
9753
|
-
|
|
9754
|
-
|
|
9815
|
+
// Profiler should only call onRender when one of its descendants actually rendered.
|
|
9816
|
+
var hasChildWork = workInProgress.childExpirationTime >= renderExpirationTime;
|
|
9755
9817
|
|
|
9756
|
-
|
|
9818
|
+
if (hasChildWork) {
|
|
9819
|
+
workInProgress.effectTag |= Update;
|
|
9820
|
+
}
|
|
9821
|
+
}
|
|
9822
|
+
|
|
9823
|
+
break;
|
|
9757
9824
|
|
|
9758
9825
|
case SuspenseComponent:
|
|
9759
9826
|
{
|
|
@@ -9806,10 +9873,11 @@ function beginWork$1(current$$1, workInProgress, renderExpirationTime) {
|
|
|
9806
9873
|
case SuspenseListComponent:
|
|
9807
9874
|
{
|
|
9808
9875
|
var didSuspendBefore = (current$$1.effectTag & DidCapture) !== NoEffect;
|
|
9809
|
-
|
|
9876
|
+
|
|
9877
|
+
var _hasChildWork = workInProgress.childExpirationTime >= renderExpirationTime;
|
|
9810
9878
|
|
|
9811
9879
|
if (didSuspendBefore) {
|
|
9812
|
-
if (
|
|
9880
|
+
if (_hasChildWork) {
|
|
9813
9881
|
// If something was in fallback state last time, and we have all the
|
|
9814
9882
|
// same children then we're still in progressive loading state.
|
|
9815
9883
|
// Something might get unblocked by state updates or retries in the
|
|
@@ -9838,7 +9906,7 @@ function beginWork$1(current$$1, workInProgress, renderExpirationTime) {
|
|
|
9838
9906
|
|
|
9839
9907
|
pushSuspenseContext(workInProgress, suspenseStackCursor.current);
|
|
9840
9908
|
|
|
9841
|
-
if (
|
|
9909
|
+
if (_hasChildWork) {
|
|
9842
9910
|
break;
|
|
9843
9911
|
} else {
|
|
9844
9912
|
// If none of the children had any work, that means that none of
|
|
@@ -9995,13 +10063,11 @@ function beginWork$1(current$$1, workInProgress, renderExpirationTime) {
|
|
|
9995
10063
|
}
|
|
9996
10064
|
}
|
|
9997
10065
|
|
|
9998
|
-
|
|
10066
|
+
{
|
|
9999
10067
|
{
|
|
10000
|
-
|
|
10001
|
-
throw ReactError(Error("Unknown unit of work tag (" + workInProgress.tag + "). This error is likely caused by a bug in React. Please file an issue."));
|
|
10002
|
-
}
|
|
10068
|
+
throw Error("Unknown unit of work tag (" + workInProgress.tag + "). This error is likely caused by a bug in React. Please file an issue.");
|
|
10003
10069
|
}
|
|
10004
|
-
}
|
|
10070
|
+
}
|
|
10005
10071
|
}
|
|
10006
10072
|
|
|
10007
10073
|
function createFundamentalStateInstance(currentFiber, props, impl, state) {
|
|
@@ -10023,14 +10089,19 @@ function getSuspenseFallbackChild(fiber) {
|
|
|
10023
10089
|
return fiber.child.sibling.child;
|
|
10024
10090
|
}
|
|
10025
10091
|
|
|
10092
|
+
var emptyObject$1 = {};
|
|
10093
|
+
|
|
10026
10094
|
function collectScopedNodes(node, fn, scopedNodes) {
|
|
10027
10095
|
if (enableScopeAPI) {
|
|
10028
10096
|
if (node.tag === HostComponent) {
|
|
10029
10097
|
var _type = node.type,
|
|
10030
|
-
memoizedProps = node.memoizedProps
|
|
10098
|
+
memoizedProps = node.memoizedProps,
|
|
10099
|
+
stateNode = node.stateNode;
|
|
10100
|
+
|
|
10101
|
+
var _instance = getPublicInstance(stateNode);
|
|
10031
10102
|
|
|
10032
|
-
if (fn(_type, memoizedProps) === true) {
|
|
10033
|
-
scopedNodes.push(
|
|
10103
|
+
if (_instance !== null && fn(_type, memoizedProps || emptyObject$1, _instance) === true) {
|
|
10104
|
+
scopedNodes.push(_instance);
|
|
10034
10105
|
}
|
|
10035
10106
|
}
|
|
10036
10107
|
|
|
@@ -10046,6 +10117,34 @@ function collectScopedNodes(node, fn, scopedNodes) {
|
|
|
10046
10117
|
}
|
|
10047
10118
|
}
|
|
10048
10119
|
|
|
10120
|
+
function collectFirstScopedNode(node, fn) {
|
|
10121
|
+
if (enableScopeAPI) {
|
|
10122
|
+
if (node.tag === HostComponent) {
|
|
10123
|
+
var _type2 = node.type,
|
|
10124
|
+
memoizedProps = node.memoizedProps,
|
|
10125
|
+
stateNode = node.stateNode;
|
|
10126
|
+
|
|
10127
|
+
var _instance2 = getPublicInstance(stateNode);
|
|
10128
|
+
|
|
10129
|
+
if (_instance2 !== null && fn(_type2, memoizedProps, _instance2) === true) {
|
|
10130
|
+
return _instance2;
|
|
10131
|
+
}
|
|
10132
|
+
}
|
|
10133
|
+
|
|
10134
|
+
var child = node.child;
|
|
10135
|
+
|
|
10136
|
+
if (isFiberSuspenseAndTimedOut(node)) {
|
|
10137
|
+
child = getSuspenseFallbackChild(node);
|
|
10138
|
+
}
|
|
10139
|
+
|
|
10140
|
+
if (child !== null) {
|
|
10141
|
+
return collectFirstScopedNodeFromChildren(child, fn);
|
|
10142
|
+
}
|
|
10143
|
+
}
|
|
10144
|
+
|
|
10145
|
+
return null;
|
|
10146
|
+
}
|
|
10147
|
+
|
|
10049
10148
|
function collectScopedNodesFromChildren(startingChild, fn, scopedNodes) {
|
|
10050
10149
|
var child = startingChild;
|
|
10051
10150
|
|
|
@@ -10055,6 +10154,22 @@ function collectScopedNodesFromChildren(startingChild, fn, scopedNodes) {
|
|
|
10055
10154
|
}
|
|
10056
10155
|
}
|
|
10057
10156
|
|
|
10157
|
+
function collectFirstScopedNodeFromChildren(startingChild, fn) {
|
|
10158
|
+
var child = startingChild;
|
|
10159
|
+
|
|
10160
|
+
while (child !== null) {
|
|
10161
|
+
var scopedNode = collectFirstScopedNode(child, fn);
|
|
10162
|
+
|
|
10163
|
+
if (scopedNode !== null) {
|
|
10164
|
+
return scopedNode;
|
|
10165
|
+
}
|
|
10166
|
+
|
|
10167
|
+
child = child.sibling;
|
|
10168
|
+
}
|
|
10169
|
+
|
|
10170
|
+
return null;
|
|
10171
|
+
}
|
|
10172
|
+
|
|
10058
10173
|
function collectNearestScopeMethods(node, scope, childrenScopes) {
|
|
10059
10174
|
if (isValidScopeNode(node, scope)) {
|
|
10060
10175
|
childrenScopes.push(node.stateNode.methods);
|
|
@@ -10081,11 +10196,10 @@ function collectNearestChildScopeMethods(startingChild, scope, childrenScopes) {
|
|
|
10081
10196
|
}
|
|
10082
10197
|
|
|
10083
10198
|
function isValidScopeNode(node, scope) {
|
|
10084
|
-
return node.tag === ScopeComponent && node.type === scope;
|
|
10199
|
+
return node.tag === ScopeComponent && node.type === scope && node.stateNode !== null;
|
|
10085
10200
|
}
|
|
10086
10201
|
|
|
10087
10202
|
function createScopeMethods(scope, instance) {
|
|
10088
|
-
var fn = scope.fn;
|
|
10089
10203
|
return {
|
|
10090
10204
|
getChildren: function () {
|
|
10091
10205
|
var currentFiber = instance.fiber;
|
|
@@ -10137,7 +10251,7 @@ function createScopeMethods(scope, instance) {
|
|
|
10137
10251
|
var currentFiber = instance.fiber;
|
|
10138
10252
|
return currentFiber.memoizedProps;
|
|
10139
10253
|
},
|
|
10140
|
-
|
|
10254
|
+
queryAllNodes: function (fn) {
|
|
10141
10255
|
var currentFiber = instance.fiber;
|
|
10142
10256
|
var child = currentFiber.child;
|
|
10143
10257
|
var scopedNodes = [];
|
|
@@ -10147,6 +10261,29 @@ function createScopeMethods(scope, instance) {
|
|
|
10147
10261
|
}
|
|
10148
10262
|
|
|
10149
10263
|
return scopedNodes.length === 0 ? null : scopedNodes;
|
|
10264
|
+
},
|
|
10265
|
+
queryFirstNode: function (fn) {
|
|
10266
|
+
var currentFiber = instance.fiber;
|
|
10267
|
+
var child = currentFiber.child;
|
|
10268
|
+
|
|
10269
|
+
if (child !== null) {
|
|
10270
|
+
return collectFirstScopedNodeFromChildren(child, fn);
|
|
10271
|
+
}
|
|
10272
|
+
|
|
10273
|
+
return null;
|
|
10274
|
+
},
|
|
10275
|
+
containsNode: function (node) {
|
|
10276
|
+
var fiber = getInstanceFromNode(node);
|
|
10277
|
+
|
|
10278
|
+
while (fiber !== null) {
|
|
10279
|
+
if (fiber.tag === ScopeComponent && fiber.type === scope && fiber.stateNode === instance) {
|
|
10280
|
+
return true;
|
|
10281
|
+
}
|
|
10282
|
+
|
|
10283
|
+
fiber = fiber.return;
|
|
10284
|
+
}
|
|
10285
|
+
|
|
10286
|
+
return false;
|
|
10150
10287
|
}
|
|
10151
10288
|
};
|
|
10152
10289
|
}
|
|
@@ -10681,13 +10818,11 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
10681
10818
|
}
|
|
10682
10819
|
} else {
|
|
10683
10820
|
if (!newProps) {
|
|
10684
|
-
(
|
|
10685
|
-
|
|
10686
|
-
|
|
10687
|
-
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."));
|
|
10688
|
-
}
|
|
10821
|
+
if (!(workInProgress.stateNode !== null)) {
|
|
10822
|
+
{
|
|
10823
|
+
throw Error("We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue.");
|
|
10689
10824
|
}
|
|
10690
|
-
}
|
|
10825
|
+
} // This can happen when we abort work.
|
|
10691
10826
|
|
|
10692
10827
|
|
|
10693
10828
|
break;
|
|
@@ -10758,13 +10893,11 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
10758
10893
|
updateHostText$1(current, workInProgress, oldText, newText);
|
|
10759
10894
|
} else {
|
|
10760
10895
|
if (typeof newText !== 'string') {
|
|
10761
|
-
(
|
|
10762
|
-
|
|
10763
|
-
|
|
10764
|
-
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."));
|
|
10765
|
-
}
|
|
10896
|
+
if (!(workInProgress.stateNode !== null)) {
|
|
10897
|
+
{
|
|
10898
|
+
throw Error("We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue.");
|
|
10766
10899
|
}
|
|
10767
|
-
}
|
|
10900
|
+
} // This can happen when we abort work.
|
|
10768
10901
|
|
|
10769
10902
|
}
|
|
10770
10903
|
|
|
@@ -10799,13 +10932,11 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
10799
10932
|
if (current === null) {
|
|
10800
10933
|
var _wasHydrated3 = popHydrationState(workInProgress);
|
|
10801
10934
|
|
|
10802
|
-
|
|
10803
|
-
|
|
10804
|
-
|
|
10805
|
-
throw ReactError(Error("A dehydrated suspense component was completed without a hydrated node. This is probably a bug in React."));
|
|
10806
|
-
}
|
|
10935
|
+
if (!_wasHydrated3) {
|
|
10936
|
+
{
|
|
10937
|
+
throw Error("A dehydrated suspense component was completed without a hydrated node. This is probably a bug in React.");
|
|
10807
10938
|
}
|
|
10808
|
-
}
|
|
10939
|
+
}
|
|
10809
10940
|
|
|
10810
10941
|
prepareToHydrateHostSuspenseInstance(workInProgress);
|
|
10811
10942
|
|
|
@@ -10848,10 +10979,9 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
10848
10979
|
var prevDidTimeout = false;
|
|
10849
10980
|
|
|
10850
10981
|
if (current === null) {
|
|
10851
|
-
|
|
10852
|
-
|
|
10853
|
-
|
|
10854
|
-
popHydrationState(workInProgress);
|
|
10982
|
+
if (workInProgress.memoizedProps.fallback !== undefined) {
|
|
10983
|
+
popHydrationState(workInProgress);
|
|
10984
|
+
}
|
|
10855
10985
|
} else {
|
|
10856
10986
|
var prevState = current.memoizedState;
|
|
10857
10987
|
prevDidTimeout = prevState !== null;
|
|
@@ -10881,12 +11011,12 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
10881
11011
|
}
|
|
10882
11012
|
|
|
10883
11013
|
if (nextDidTimeout && !prevDidTimeout) {
|
|
10884
|
-
// If this subtreee is running in
|
|
11014
|
+
// If this subtreee is running in blocking mode we can suspend,
|
|
10885
11015
|
// otherwise we won't suspend.
|
|
10886
11016
|
// TODO: This will still suspend a synchronous tree if anything
|
|
10887
11017
|
// in the concurrent tree already suspended during this render.
|
|
10888
11018
|
// This is a known bug.
|
|
10889
|
-
if ((workInProgress.mode &
|
|
11019
|
+
if ((workInProgress.mode & BlockingMode) !== NoMode) {
|
|
10890
11020
|
// TODO: Move this back to throwException because this is too late
|
|
10891
11021
|
// if this is a large tree which is common for initial loads. We
|
|
10892
11022
|
// don't know if we should restart a render or not until we get
|
|
@@ -11036,7 +11166,11 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
11036
11166
|
// Reset the effect list before doing the second pass since that's now invalid.
|
|
11037
11167
|
|
|
11038
11168
|
|
|
11039
|
-
|
|
11169
|
+
if (renderState.lastEffect === null) {
|
|
11170
|
+
workInProgress.firstEffect = null;
|
|
11171
|
+
}
|
|
11172
|
+
|
|
11173
|
+
workInProgress.lastEffect = renderState.lastEffect; // Reset the child fibers to their original state.
|
|
11040
11174
|
|
|
11041
11175
|
resetChildFibers(workInProgress, renderExpirationTime); // Set up the Suspense Context to force suspense and immediately
|
|
11042
11176
|
// rerender the children.
|
|
@@ -11059,21 +11193,22 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
11059
11193
|
|
|
11060
11194
|
if (_suspended !== null) {
|
|
11061
11195
|
workInProgress.effectTag |= DidCapture;
|
|
11062
|
-
didSuspendAlready = true;
|
|
11063
|
-
|
|
11196
|
+
didSuspendAlready = true; // Ensure we transfer the update queue to the parent so that it doesn't
|
|
11197
|
+
// get lost if this row ends up dropped during a second pass.
|
|
11064
11198
|
|
|
11065
|
-
|
|
11066
|
-
// We need to delete the row we just rendered.
|
|
11067
|
-
// Ensure we transfer the update queue to the parent.
|
|
11068
|
-
var _newThennables = _suspended.updateQueue;
|
|
11199
|
+
var _newThennables = _suspended.updateQueue;
|
|
11069
11200
|
|
|
11070
|
-
|
|
11071
|
-
|
|
11072
|
-
|
|
11073
|
-
|
|
11074
|
-
// child. The nested children have already appended themselves.
|
|
11201
|
+
if (_newThennables !== null) {
|
|
11202
|
+
workInProgress.updateQueue = _newThennables;
|
|
11203
|
+
workInProgress.effectTag |= Update;
|
|
11204
|
+
}
|
|
11075
11205
|
|
|
11206
|
+
cutOffTailIfNeeded(renderState, true); // This might have been modified.
|
|
11076
11207
|
|
|
11208
|
+
if (renderState.tail === null && renderState.tailMode === 'hidden' && !renderedTail.alternate) {
|
|
11209
|
+
// We need to delete the row we just rendered.
|
|
11210
|
+
// Reset the effect list to what it was before we rendered this
|
|
11211
|
+
// child. The nested children have already appended themselves.
|
|
11077
11212
|
var lastEffect = workInProgress.lastEffect = renderState.lastEffect; // Remove any effects that were appended after this point.
|
|
11078
11213
|
|
|
11079
11214
|
if (lastEffect !== null) {
|
|
@@ -11260,13 +11395,11 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
11260
11395
|
}
|
|
11261
11396
|
|
|
11262
11397
|
default:
|
|
11263
|
-
|
|
11398
|
+
{
|
|
11264
11399
|
{
|
|
11265
|
-
|
|
11266
|
-
throw ReactError(Error("Unknown unit of work tag (" + workInProgress.tag + "). This error is likely caused by a bug in React. Please file an issue."));
|
|
11267
|
-
}
|
|
11400
|
+
throw Error("Unknown unit of work tag (" + workInProgress.tag + "). This error is likely caused by a bug in React. Please file an issue.");
|
|
11268
11401
|
}
|
|
11269
|
-
}
|
|
11402
|
+
}
|
|
11270
11403
|
|
|
11271
11404
|
}
|
|
11272
11405
|
|
|
@@ -11299,13 +11432,11 @@ function unwindWork(workInProgress, renderExpirationTime) {
|
|
|
11299
11432
|
popTopLevelContextObject(workInProgress);
|
|
11300
11433
|
var _effectTag = workInProgress.effectTag;
|
|
11301
11434
|
|
|
11302
|
-
(
|
|
11303
|
-
|
|
11304
|
-
|
|
11305
|
-
throw ReactError(Error("The root failed to unmount after an error. This is likely a bug in React. Please file an issue."));
|
|
11306
|
-
}
|
|
11435
|
+
if (!((_effectTag & DidCapture) === NoEffect)) {
|
|
11436
|
+
{
|
|
11437
|
+
throw Error("The root failed to unmount after an error. This is likely a bug in React. Please file an issue.");
|
|
11307
11438
|
}
|
|
11308
|
-
}
|
|
11439
|
+
}
|
|
11309
11440
|
|
|
11310
11441
|
workInProgress.effectTag = _effectTag & ~ShouldCapture | DidCapture;
|
|
11311
11442
|
return workInProgress;
|
|
@@ -11326,13 +11457,11 @@ function unwindWork(workInProgress, renderExpirationTime) {
|
|
|
11326
11457
|
var suspenseState = workInProgress.memoizedState;
|
|
11327
11458
|
|
|
11328
11459
|
if (suspenseState !== null && suspenseState.dehydrated !== null) {
|
|
11329
|
-
(
|
|
11330
|
-
|
|
11331
|
-
|
|
11332
|
-
throw ReactError(Error("Threw in newly mounted dehydrated component. This is likely a bug in React. Please file an issue."));
|
|
11333
|
-
}
|
|
11460
|
+
if (!(workInProgress.alternate !== null)) {
|
|
11461
|
+
{
|
|
11462
|
+
throw Error("Threw in newly mounted dehydrated component. This is likely a bug in React. Please file an issue.");
|
|
11334
11463
|
}
|
|
11335
|
-
}
|
|
11464
|
+
}
|
|
11336
11465
|
|
|
11337
11466
|
resetHydrationState();
|
|
11338
11467
|
}
|
|
@@ -11466,13 +11595,11 @@ var invokeGuardedCallbackImpl = function (name, func, context, a, b, c, d, e, f)
|
|
|
11466
11595
|
// when we call document.createEvent(). However this can cause confusing
|
|
11467
11596
|
// errors: https://github.com/facebookincubator/create-react-app/issues/3482
|
|
11468
11597
|
// So we preemptively throw with a better message instead.
|
|
11469
|
-
(
|
|
11470
|
-
|
|
11471
|
-
|
|
11472
|
-
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."));
|
|
11473
|
-
}
|
|
11598
|
+
if (!(typeof document !== 'undefined')) {
|
|
11599
|
+
{
|
|
11600
|
+
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.");
|
|
11474
11601
|
}
|
|
11475
|
-
}
|
|
11602
|
+
}
|
|
11476
11603
|
|
|
11477
11604
|
var evt = document.createEvent('Event'); // Keeps track of whether the user-provided callback threw an error. We
|
|
11478
11605
|
// set this to true at the beginning, then set it to false right after
|
|
@@ -11640,13 +11767,11 @@ function clearCaughtError() {
|
|
|
11640
11767
|
caughtError = null;
|
|
11641
11768
|
return error;
|
|
11642
11769
|
} else {
|
|
11643
|
-
|
|
11770
|
+
{
|
|
11644
11771
|
{
|
|
11645
|
-
|
|
11646
|
-
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."));
|
|
11647
|
-
}
|
|
11772
|
+
throw Error("clearCaughtError was called but no error was captured. This error is likely caused by a bug in React. Please file an issue.");
|
|
11648
11773
|
}
|
|
11649
|
-
}
|
|
11774
|
+
}
|
|
11650
11775
|
}
|
|
11651
11776
|
}
|
|
11652
11777
|
|
|
@@ -11866,13 +11991,11 @@ function commitBeforeMutationLifeCycles(current$$1, finishedWork) {
|
|
|
11866
11991
|
|
|
11867
11992
|
default:
|
|
11868
11993
|
{
|
|
11869
|
-
|
|
11994
|
+
{
|
|
11870
11995
|
{
|
|
11871
|
-
|
|
11872
|
-
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."));
|
|
11873
|
-
}
|
|
11996
|
+
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.");
|
|
11874
11997
|
}
|
|
11875
|
-
}
|
|
11998
|
+
}
|
|
11876
11999
|
}
|
|
11877
12000
|
}
|
|
11878
12001
|
}
|
|
@@ -12094,13 +12217,11 @@ function commitLifeCycles(finishedRoot, current$$1, finishedWork, committedExpir
|
|
|
12094
12217
|
|
|
12095
12218
|
default:
|
|
12096
12219
|
{
|
|
12097
|
-
|
|
12220
|
+
{
|
|
12098
12221
|
{
|
|
12099
|
-
|
|
12100
|
-
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."));
|
|
12101
|
-
}
|
|
12222
|
+
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.");
|
|
12102
12223
|
}
|
|
12103
|
-
}
|
|
12224
|
+
}
|
|
12104
12225
|
}
|
|
12105
12226
|
}
|
|
12106
12227
|
}
|
|
@@ -12445,13 +12566,11 @@ function commitContainer(finishedWork) {
|
|
|
12445
12566
|
|
|
12446
12567
|
default:
|
|
12447
12568
|
{
|
|
12448
|
-
|
|
12569
|
+
{
|
|
12449
12570
|
{
|
|
12450
|
-
|
|
12451
|
-
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."));
|
|
12452
|
-
}
|
|
12571
|
+
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.");
|
|
12453
12572
|
}
|
|
12454
|
-
}
|
|
12573
|
+
}
|
|
12455
12574
|
}
|
|
12456
12575
|
}
|
|
12457
12576
|
}
|
|
@@ -12467,13 +12586,11 @@ function getHostParentFiber(fiber) {
|
|
|
12467
12586
|
parent = parent.return;
|
|
12468
12587
|
}
|
|
12469
12588
|
|
|
12470
|
-
|
|
12589
|
+
{
|
|
12471
12590
|
{
|
|
12472
|
-
|
|
12473
|
-
throw ReactError(Error("Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue."));
|
|
12474
|
-
}
|
|
12591
|
+
throw Error("Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue.");
|
|
12475
12592
|
}
|
|
12476
|
-
}
|
|
12593
|
+
}
|
|
12477
12594
|
}
|
|
12478
12595
|
|
|
12479
12596
|
function isHostParent(fiber) {
|
|
@@ -12565,13 +12682,11 @@ function commitPlacement(finishedWork) {
|
|
|
12565
12682
|
// eslint-disable-next-line-no-fallthrough
|
|
12566
12683
|
|
|
12567
12684
|
default:
|
|
12568
|
-
|
|
12685
|
+
{
|
|
12569
12686
|
{
|
|
12570
|
-
|
|
12571
|
-
throw ReactError(Error("Invalid host parent fiber. This error is likely caused by a bug in React. Please file an issue."));
|
|
12572
|
-
}
|
|
12687
|
+
throw Error("Invalid host parent fiber. This error is likely caused by a bug in React. Please file an issue.");
|
|
12573
12688
|
}
|
|
12574
|
-
}
|
|
12689
|
+
}
|
|
12575
12690
|
|
|
12576
12691
|
}
|
|
12577
12692
|
|
|
@@ -12648,13 +12763,11 @@ function unmountHostComponents(finishedRoot, current$$1, renderPriorityLevel) {
|
|
|
12648
12763
|
var parent = node.return;
|
|
12649
12764
|
|
|
12650
12765
|
findParent: while (true) {
|
|
12651
|
-
(
|
|
12652
|
-
|
|
12653
|
-
|
|
12654
|
-
throw ReactError(Error("Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue."));
|
|
12655
|
-
}
|
|
12766
|
+
if (!(parent !== null)) {
|
|
12767
|
+
{
|
|
12768
|
+
throw Error("Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue.");
|
|
12656
12769
|
}
|
|
12657
|
-
}
|
|
12770
|
+
}
|
|
12658
12771
|
|
|
12659
12772
|
var parentStateNode = parent.stateNode;
|
|
12660
12773
|
|
|
@@ -12888,13 +13001,11 @@ function commitWork(current$$1, finishedWork) {
|
|
|
12888
13001
|
|
|
12889
13002
|
case HostText:
|
|
12890
13003
|
{
|
|
12891
|
-
(
|
|
12892
|
-
|
|
12893
|
-
|
|
12894
|
-
throw ReactError(Error("This should have a text node initialized. This error is likely caused by a bug in React. Please file an issue."));
|
|
12895
|
-
}
|
|
13004
|
+
if (!(finishedWork.stateNode !== null)) {
|
|
13005
|
+
{
|
|
13006
|
+
throw Error("This should have a text node initialized. This error is likely caused by a bug in React. Please file an issue.");
|
|
12896
13007
|
}
|
|
12897
|
-
}
|
|
13008
|
+
}
|
|
12898
13009
|
|
|
12899
13010
|
var textInstance = finishedWork.stateNode;
|
|
12900
13011
|
var newText = finishedWork.memoizedProps; // For hydration we reuse the update path but we treat the oldProps
|
|
@@ -12979,13 +13090,11 @@ function commitWork(current$$1, finishedWork) {
|
|
|
12979
13090
|
|
|
12980
13091
|
default:
|
|
12981
13092
|
{
|
|
12982
|
-
|
|
13093
|
+
{
|
|
12983
13094
|
{
|
|
12984
|
-
|
|
12985
|
-
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."));
|
|
12986
|
-
}
|
|
13095
|
+
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.");
|
|
12987
13096
|
}
|
|
12988
|
-
}
|
|
13097
|
+
}
|
|
12989
13098
|
}
|
|
12990
13099
|
}
|
|
12991
13100
|
}
|
|
@@ -13233,17 +13342,17 @@ function throwException(root, returnFiber, sourceFiber, value, renderExpirationT
|
|
|
13233
13342
|
_workInProgress.updateQueue = updateQueue;
|
|
13234
13343
|
} else {
|
|
13235
13344
|
thenables.add(thenable);
|
|
13236
|
-
} // If the boundary is outside of
|
|
13345
|
+
} // If the boundary is outside of blocking mode, we should *not*
|
|
13237
13346
|
// suspend the commit. Pretend as if the suspended component rendered
|
|
13238
13347
|
// null and keep rendering. In the commit phase, we'll schedule a
|
|
13239
13348
|
// subsequent synchronous update to re-render the Suspense.
|
|
13240
13349
|
//
|
|
13241
13350
|
// Note: It doesn't matter whether the component that suspended was
|
|
13242
|
-
// inside a
|
|
13351
|
+
// inside a blocking mode tree. If the Suspense is outside of it, we
|
|
13243
13352
|
// should *not* suspend the commit.
|
|
13244
13353
|
|
|
13245
13354
|
|
|
13246
|
-
if ((_workInProgress.mode &
|
|
13355
|
+
if ((_workInProgress.mode & BlockingMode) === NoMode) {
|
|
13247
13356
|
_workInProgress.effectTag |= DidCapture; // We're going to commit this fiber even though it didn't complete.
|
|
13248
13357
|
// But we shouldn't call any lifecycle methods or callbacks. Remove
|
|
13249
13358
|
// all lifecycle effect tags.
|
|
@@ -13409,7 +13518,6 @@ var RootErrored = 2;
|
|
|
13409
13518
|
var RootSuspended = 3;
|
|
13410
13519
|
var RootSuspendedWithDelay = 4;
|
|
13411
13520
|
var RootCompleted = 5;
|
|
13412
|
-
var RootLocked = 6;
|
|
13413
13521
|
// Describes where we are in the React execution stack
|
|
13414
13522
|
var executionContext = NoContext; // The root we're working on
|
|
13415
13523
|
|
|
@@ -13469,7 +13577,7 @@ var spawnedWorkDuringRender = null; // Expiration times are computed by adding t
|
|
|
13469
13577
|
// receive the same expiration time. Otherwise we get tearing.
|
|
13470
13578
|
|
|
13471
13579
|
var currentEventTime = NoWork;
|
|
13472
|
-
function
|
|
13580
|
+
function requestCurrentTimeForUpdate() {
|
|
13473
13581
|
if ((executionContext & (RenderContext | CommitContext)) !== NoContext) {
|
|
13474
13582
|
// We're inside React, so it's fine to read the actual time.
|
|
13475
13583
|
return msToExpirationTime(now$1());
|
|
@@ -13485,10 +13593,13 @@ function requestCurrentTime() {
|
|
|
13485
13593
|
currentEventTime = msToExpirationTime(now$1());
|
|
13486
13594
|
return currentEventTime;
|
|
13487
13595
|
}
|
|
13596
|
+
function getCurrentTime() {
|
|
13597
|
+
return msToExpirationTime(now$1());
|
|
13598
|
+
}
|
|
13488
13599
|
function computeExpirationForFiber(currentTime, fiber, suspenseConfig) {
|
|
13489
13600
|
var mode = fiber.mode;
|
|
13490
13601
|
|
|
13491
|
-
if ((mode &
|
|
13602
|
+
if ((mode & BlockingMode) === NoMode) {
|
|
13492
13603
|
return Sync;
|
|
13493
13604
|
}
|
|
13494
13605
|
|
|
@@ -13533,13 +13644,11 @@ function computeExpirationForFiber(currentTime, fiber, suspenseConfig) {
|
|
|
13533
13644
|
break;
|
|
13534
13645
|
|
|
13535
13646
|
default:
|
|
13536
|
-
|
|
13647
|
+
{
|
|
13537
13648
|
{
|
|
13538
|
-
|
|
13539
|
-
throw ReactError(Error("Expected a valid priority level"));
|
|
13540
|
-
}
|
|
13649
|
+
throw Error("Expected a valid priority level");
|
|
13541
13650
|
}
|
|
13542
|
-
}
|
|
13651
|
+
}
|
|
13543
13652
|
|
|
13544
13653
|
}
|
|
13545
13654
|
} // If we're in the middle of rendering a tree, do not update at the same
|
|
@@ -13556,21 +13665,6 @@ function computeExpirationForFiber(currentTime, fiber, suspenseConfig) {
|
|
|
13556
13665
|
|
|
13557
13666
|
return expirationTime;
|
|
13558
13667
|
}
|
|
13559
|
-
var lastUniqueAsyncExpiration = NoWork;
|
|
13560
|
-
function computeUniqueAsyncExpiration() {
|
|
13561
|
-
var currentTime = requestCurrentTime();
|
|
13562
|
-
var result = computeAsyncExpiration(currentTime);
|
|
13563
|
-
|
|
13564
|
-
if (result <= lastUniqueAsyncExpiration) {
|
|
13565
|
-
// Since we assume the current time monotonically increases, we only hit
|
|
13566
|
-
// this branch when computeUniqueAsyncExpiration is fired multiple times
|
|
13567
|
-
// within a 200ms window (or whatever the async bucket size is).
|
|
13568
|
-
result -= 1;
|
|
13569
|
-
}
|
|
13570
|
-
|
|
13571
|
-
lastUniqueAsyncExpiration = result;
|
|
13572
|
-
return result;
|
|
13573
|
-
}
|
|
13574
13668
|
function scheduleUpdateOnFiber(fiber, expirationTime) {
|
|
13575
13669
|
checkForNestedUpdates();
|
|
13576
13670
|
warnAboutInvalidUpdatesOnClassComponentsInDEV(fiber);
|
|
@@ -13606,7 +13700,7 @@ function scheduleUpdateOnFiber(fiber, expirationTime) {
|
|
|
13606
13700
|
// a batch. This is intentionally inside scheduleUpdateOnFiber instead of
|
|
13607
13701
|
// scheduleCallbackForFiber to preserve the ability to schedule a callback
|
|
13608
13702
|
// without immediately flushing it. We only do this for user-initiated
|
|
13609
|
-
// updates, to preserve historical behavior of
|
|
13703
|
+
// updates, to preserve historical behavior of legacy mode.
|
|
13610
13704
|
flushSyncCallbackQueue();
|
|
13611
13705
|
}
|
|
13612
13706
|
}
|
|
@@ -13767,7 +13861,7 @@ function ensureRootIsScheduled(root) {
|
|
|
13767
13861
|
// time as an argument.
|
|
13768
13862
|
|
|
13769
13863
|
|
|
13770
|
-
var currentTime =
|
|
13864
|
+
var currentTime = requestCurrentTimeForUpdate();
|
|
13771
13865
|
var priorityLevel = inferPriorityFromExpirationTime(currentTime, expirationTime); // If there's an existing render task, confirm it has the correct priority and
|
|
13772
13866
|
// expiration time. Otherwise, we'll cancel it and schedule a new one.
|
|
13773
13867
|
|
|
@@ -13818,7 +13912,7 @@ function performConcurrentWorkOnRoot(root, didTimeout) {
|
|
|
13818
13912
|
if (didTimeout) {
|
|
13819
13913
|
// The render task took too long to complete. Mark the current time as
|
|
13820
13914
|
// expired to synchronously render all expired work in a single batch.
|
|
13821
|
-
var currentTime =
|
|
13915
|
+
var currentTime = requestCurrentTimeForUpdate();
|
|
13822
13916
|
markRootExpiredAtTime(root, currentTime); // This will schedule a synchronous callback.
|
|
13823
13917
|
|
|
13824
13918
|
ensureRootIsScheduled(root);
|
|
@@ -13832,13 +13926,11 @@ function performConcurrentWorkOnRoot(root, didTimeout) {
|
|
|
13832
13926
|
if (expirationTime !== NoWork) {
|
|
13833
13927
|
var originalCallbackNode = root.callbackNode;
|
|
13834
13928
|
|
|
13835
|
-
(
|
|
13836
|
-
|
|
13837
|
-
|
|
13838
|
-
throw ReactError(Error("Should not already be working."));
|
|
13839
|
-
}
|
|
13929
|
+
if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) {
|
|
13930
|
+
{
|
|
13931
|
+
throw Error("Should not already be working.");
|
|
13840
13932
|
}
|
|
13841
|
-
}
|
|
13933
|
+
}
|
|
13842
13934
|
|
|
13843
13935
|
flushPassiveEffects(); // If the root or expiration time have changed, throw out the existing stack
|
|
13844
13936
|
// and prepare a fresh one. Otherwise we'll continue where we left off.
|
|
@@ -13892,7 +13984,6 @@ function performConcurrentWorkOnRoot(root, didTimeout) {
|
|
|
13892
13984
|
stopFinishedWorkLoopTimer();
|
|
13893
13985
|
var finishedWork = root.finishedWork = root.current.alternate;
|
|
13894
13986
|
root.finishedExpirationTime = expirationTime;
|
|
13895
|
-
resolveLocksOnRoot(root, expirationTime);
|
|
13896
13987
|
finishConcurrentRender(root, finishedWork, workInProgressRootExitStatus, expirationTime);
|
|
13897
13988
|
}
|
|
13898
13989
|
|
|
@@ -13917,13 +14008,11 @@ function finishConcurrentRender(root, finishedWork, exitStatus, expirationTime)
|
|
|
13917
14008
|
case RootIncomplete:
|
|
13918
14009
|
case RootFatalErrored:
|
|
13919
14010
|
{
|
|
13920
|
-
|
|
14011
|
+
{
|
|
13921
14012
|
{
|
|
13922
|
-
|
|
13923
|
-
throw ReactError(Error("Root did not complete. This is a bug in React."));
|
|
13924
|
-
}
|
|
14013
|
+
throw Error("Root did not complete. This is a bug in React.");
|
|
13925
14014
|
}
|
|
13926
|
-
}
|
|
14015
|
+
}
|
|
13927
14016
|
}
|
|
13928
14017
|
// Flow knows about invariant, so it complains if I add a break
|
|
13929
14018
|
// statement, but eslint doesn't know about invariant, so it complains
|
|
@@ -13931,18 +14020,16 @@ function finishConcurrentRender(root, finishedWork, exitStatus, expirationTime)
|
|
|
13931
14020
|
|
|
13932
14021
|
case RootErrored:
|
|
13933
14022
|
{
|
|
13934
|
-
|
|
13935
|
-
|
|
13936
|
-
|
|
13937
|
-
|
|
13938
|
-
|
|
13939
|
-
|
|
13940
|
-
|
|
13941
|
-
|
|
13942
|
-
|
|
13943
|
-
|
|
14023
|
+
// If this was an async render, the error may have happened due to
|
|
14024
|
+
// a mutation in a concurrent event. Try rendering one more time,
|
|
14025
|
+
// synchronously, to see if the error goes away. If there are
|
|
14026
|
+
// lower priority updates, let's include those, too, in case they
|
|
14027
|
+
// fix the inconsistency. Render at Idle to include all updates.
|
|
14028
|
+
// If it was Idle or Never or some not-yet-invented time, render
|
|
14029
|
+
// at that time.
|
|
14030
|
+
markRootExpiredAtTime(root, expirationTime > Idle ? Idle : expirationTime); // We assume that this second render pass will be synchronous
|
|
14031
|
+
// and therefore not hit this path again.
|
|
13944
14032
|
|
|
13945
|
-
commitRoot(root);
|
|
13946
14033
|
break;
|
|
13947
14034
|
}
|
|
13948
14035
|
|
|
@@ -14126,24 +14213,13 @@ function finishConcurrentRender(root, finishedWork, exitStatus, expirationTime)
|
|
|
14126
14213
|
break;
|
|
14127
14214
|
}
|
|
14128
14215
|
|
|
14129
|
-
case RootLocked:
|
|
14130
|
-
{
|
|
14131
|
-
// This root has a lock that prevents it from committing. Exit. If
|
|
14132
|
-
// we begin work on the root again, without any intervening updates,
|
|
14133
|
-
// it will finish without doing additional work.
|
|
14134
|
-
markRootSuspendedAtTime(root, expirationTime);
|
|
14135
|
-
break;
|
|
14136
|
-
}
|
|
14137
|
-
|
|
14138
14216
|
default:
|
|
14139
14217
|
{
|
|
14140
|
-
|
|
14218
|
+
{
|
|
14141
14219
|
{
|
|
14142
|
-
|
|
14143
|
-
throw ReactError(Error("Unknown root exit status."));
|
|
14144
|
-
}
|
|
14220
|
+
throw Error("Unknown root exit status.");
|
|
14145
14221
|
}
|
|
14146
|
-
}
|
|
14222
|
+
}
|
|
14147
14223
|
}
|
|
14148
14224
|
}
|
|
14149
14225
|
} // This is the entry point for synchronous tasks that don't go
|
|
@@ -14161,13 +14237,11 @@ function performSyncWorkOnRoot(root) {
|
|
|
14161
14237
|
// batch.commit() API.
|
|
14162
14238
|
commitRoot(root);
|
|
14163
14239
|
} else {
|
|
14164
|
-
(
|
|
14165
|
-
|
|
14166
|
-
|
|
14167
|
-
throw ReactError(Error("Should not already be working."));
|
|
14168
|
-
}
|
|
14240
|
+
if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) {
|
|
14241
|
+
{
|
|
14242
|
+
throw Error("Should not already be working.");
|
|
14169
14243
|
}
|
|
14170
|
-
}
|
|
14244
|
+
}
|
|
14171
14245
|
|
|
14172
14246
|
flushPassiveEffects(); // If the root or expiration time have changed, throw out the existing stack
|
|
14173
14247
|
// and prepare a fresh one. Otherwise we'll continue where we left off.
|
|
@@ -14214,21 +14288,17 @@ function performSyncWorkOnRoot(root) {
|
|
|
14214
14288
|
|
|
14215
14289
|
if (workInProgress !== null) {
|
|
14216
14290
|
// This is a sync render, so we should have finished the whole tree.
|
|
14217
|
-
|
|
14291
|
+
{
|
|
14218
14292
|
{
|
|
14219
|
-
|
|
14220
|
-
throw ReactError(Error("Cannot commit an incomplete root. This error is likely caused by a bug in React. Please file an issue."));
|
|
14221
|
-
}
|
|
14293
|
+
throw Error("Cannot commit an incomplete root. This error is likely caused by a bug in React. Please file an issue.");
|
|
14222
14294
|
}
|
|
14223
|
-
}
|
|
14295
|
+
}
|
|
14224
14296
|
} else {
|
|
14225
14297
|
// We now have a consistent tree. Because this is a sync render, we
|
|
14226
|
-
// will commit it even if something suspended.
|
|
14227
|
-
// if the root is locked (using the unstable_createBatch API).
|
|
14298
|
+
// will commit it even if something suspended.
|
|
14228
14299
|
stopFinishedWorkLoopTimer();
|
|
14229
14300
|
root.finishedWork = root.current.alternate;
|
|
14230
14301
|
root.finishedExpirationTime = expirationTime;
|
|
14231
|
-
resolveLocksOnRoot(root, expirationTime);
|
|
14232
14302
|
finishSyncRender(root, workInProgressRootExitStatus, expirationTime);
|
|
14233
14303
|
} // Before exiting, make sure there's a callback scheduled for the next
|
|
14234
14304
|
// pending level.
|
|
@@ -14242,39 +14312,25 @@ function performSyncWorkOnRoot(root) {
|
|
|
14242
14312
|
}
|
|
14243
14313
|
|
|
14244
14314
|
function finishSyncRender(root, exitStatus, expirationTime) {
|
|
14245
|
-
|
|
14246
|
-
|
|
14247
|
-
// begin work on the root again, without any intervening updates, it
|
|
14248
|
-
// will finish without doing additional work.
|
|
14249
|
-
markRootSuspendedAtTime(root, expirationTime);
|
|
14250
|
-
} else {
|
|
14251
|
-
// Set this to null to indicate there's no in-progress render.
|
|
14252
|
-
workInProgressRoot = null;
|
|
14315
|
+
// Set this to null to indicate there's no in-progress render.
|
|
14316
|
+
workInProgressRoot = null;
|
|
14253
14317
|
|
|
14254
|
-
|
|
14255
|
-
|
|
14256
|
-
|
|
14257
|
-
}
|
|
14318
|
+
{
|
|
14319
|
+
if (exitStatus === RootSuspended || exitStatus === RootSuspendedWithDelay) {
|
|
14320
|
+
flushSuspensePriorityWarningInDEV();
|
|
14258
14321
|
}
|
|
14259
|
-
|
|
14260
|
-
commitRoot(root);
|
|
14261
14322
|
}
|
|
14323
|
+
|
|
14324
|
+
commitRoot(root);
|
|
14262
14325
|
}
|
|
14263
14326
|
|
|
14264
14327
|
function flushRoot(root, expirationTime) {
|
|
14265
|
-
if ((executionContext & (RenderContext | CommitContext)) !== NoContext) {
|
|
14266
|
-
(function () {
|
|
14267
|
-
{
|
|
14268
|
-
{
|
|
14269
|
-
throw ReactError(Error("work.commit(): Cannot commit while already rendering. This likely means you attempted to commit from inside a lifecycle method."));
|
|
14270
|
-
}
|
|
14271
|
-
}
|
|
14272
|
-
})();
|
|
14273
|
-
}
|
|
14274
|
-
|
|
14275
14328
|
markRootExpiredAtTime(root, expirationTime);
|
|
14276
14329
|
ensureRootIsScheduled(root);
|
|
14277
|
-
|
|
14330
|
+
|
|
14331
|
+
if ((executionContext & (RenderContext | CommitContext)) === NoContext) {
|
|
14332
|
+
flushSyncCallbackQueue();
|
|
14333
|
+
}
|
|
14278
14334
|
}
|
|
14279
14335
|
function flushDiscreteUpdates() {
|
|
14280
14336
|
// TODO: Should be able to flush inside batchedUpdates, but not inside `act`.
|
|
@@ -14297,20 +14353,6 @@ function flushDiscreteUpdates() {
|
|
|
14297
14353
|
|
|
14298
14354
|
flushPassiveEffects();
|
|
14299
14355
|
}
|
|
14300
|
-
|
|
14301
|
-
function resolveLocksOnRoot(root, expirationTime) {
|
|
14302
|
-
var firstBatch = root.firstBatch;
|
|
14303
|
-
|
|
14304
|
-
if (firstBatch !== null && firstBatch._defer && firstBatch._expirationTime >= expirationTime) {
|
|
14305
|
-
scheduleCallback(NormalPriority, function () {
|
|
14306
|
-
firstBatch._onComplete();
|
|
14307
|
-
|
|
14308
|
-
return null;
|
|
14309
|
-
});
|
|
14310
|
-
workInProgressRootExitStatus = RootLocked;
|
|
14311
|
-
}
|
|
14312
|
-
}
|
|
14313
|
-
|
|
14314
14356
|
function deferredUpdates(fn) {
|
|
14315
14357
|
// TODO: Remove in favor of Scheduler.next
|
|
14316
14358
|
return runWithPriority(NormalPriority, fn);
|
|
@@ -14398,13 +14440,11 @@ function unbatchedUpdates(fn, a) {
|
|
|
14398
14440
|
}
|
|
14399
14441
|
function flushSync(fn, a) {
|
|
14400
14442
|
if ((executionContext & (RenderContext | CommitContext)) !== NoContext) {
|
|
14401
|
-
|
|
14443
|
+
{
|
|
14402
14444
|
{
|
|
14403
|
-
|
|
14404
|
-
throw ReactError(Error("flushSync was called from inside a lifecycle method. It cannot be called when React is already rendering."));
|
|
14405
|
-
}
|
|
14445
|
+
throw Error("flushSync was called from inside a lifecycle method. It cannot be called when React is already rendering.");
|
|
14406
14446
|
}
|
|
14407
|
-
}
|
|
14447
|
+
}
|
|
14408
14448
|
}
|
|
14409
14449
|
|
|
14410
14450
|
var prevExecutionContext = executionContext;
|
|
@@ -14485,6 +14525,7 @@ function handleError(root, thrownValue) {
|
|
|
14485
14525
|
// Reset module-level state that was set during the render phase.
|
|
14486
14526
|
resetContextDependencies();
|
|
14487
14527
|
resetHooks();
|
|
14528
|
+
resetCurrentFiber();
|
|
14488
14529
|
|
|
14489
14530
|
if (workInProgress === null || workInProgress.return === null) {
|
|
14490
14531
|
// Expected to be working on a non-root fiber. This is a fatal error
|
|
@@ -14881,16 +14922,23 @@ function commitRoot(root) {
|
|
|
14881
14922
|
}
|
|
14882
14923
|
|
|
14883
14924
|
function commitRootImpl(root, renderPriorityLevel) {
|
|
14884
|
-
|
|
14925
|
+
do {
|
|
14926
|
+
// `flushPassiveEffects` will call `flushSyncUpdateQueue` at the end, which
|
|
14927
|
+
// means `flushPassiveEffects` will sometimes result in additional
|
|
14928
|
+
// passive effects. So we need to keep flushing in a loop until there are
|
|
14929
|
+
// no more pending effects.
|
|
14930
|
+
// TODO: Might be better if `flushPassiveEffects` did not automatically
|
|
14931
|
+
// flush synchronous work at the end, to avoid factoring hazards like this.
|
|
14932
|
+
flushPassiveEffects();
|
|
14933
|
+
} while (rootWithPendingPassiveEffects !== null);
|
|
14934
|
+
|
|
14885
14935
|
flushRenderPhaseStrictModeWarningsInDEV();
|
|
14886
14936
|
|
|
14887
|
-
(
|
|
14888
|
-
|
|
14889
|
-
|
|
14890
|
-
throw ReactError(Error("Should not already be working."));
|
|
14891
|
-
}
|
|
14937
|
+
if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) {
|
|
14938
|
+
{
|
|
14939
|
+
throw Error("Should not already be working.");
|
|
14892
14940
|
}
|
|
14893
|
-
}
|
|
14941
|
+
}
|
|
14894
14942
|
|
|
14895
14943
|
var finishedWork = root.finishedWork;
|
|
14896
14944
|
var expirationTime = root.finishedExpirationTime;
|
|
@@ -14902,13 +14950,11 @@ function commitRootImpl(root, renderPriorityLevel) {
|
|
|
14902
14950
|
root.finishedWork = null;
|
|
14903
14951
|
root.finishedExpirationTime = NoWork;
|
|
14904
14952
|
|
|
14905
|
-
(
|
|
14906
|
-
|
|
14907
|
-
|
|
14908
|
-
throw ReactError(Error("Cannot commit the same tree as before. This error is likely caused by a bug in React. Please file an issue."));
|
|
14909
|
-
}
|
|
14953
|
+
if (!(finishedWork !== root.current)) {
|
|
14954
|
+
{
|
|
14955
|
+
throw Error("Cannot commit the same tree as before. This error is likely caused by a bug in React. Please file an issue.");
|
|
14910
14956
|
}
|
|
14911
|
-
}
|
|
14957
|
+
} // commitRoot never returns a continuation; it always finishes synchronously.
|
|
14912
14958
|
// So we can clear these now to allow a new callback to be scheduled.
|
|
14913
14959
|
|
|
14914
14960
|
|
|
@@ -14972,13 +15018,11 @@ function commitRootImpl(root, renderPriorityLevel) {
|
|
|
14972
15018
|
invokeGuardedCallback(null, commitBeforeMutationEffects, null);
|
|
14973
15019
|
|
|
14974
15020
|
if (hasCaughtError()) {
|
|
14975
|
-
(
|
|
14976
|
-
|
|
14977
|
-
|
|
14978
|
-
throw ReactError(Error("Should be working on an effect."));
|
|
14979
|
-
}
|
|
15021
|
+
if (!(nextEffect !== null)) {
|
|
15022
|
+
{
|
|
15023
|
+
throw Error("Should be working on an effect.");
|
|
14980
15024
|
}
|
|
14981
|
-
}
|
|
15025
|
+
}
|
|
14982
15026
|
|
|
14983
15027
|
var error = clearCaughtError();
|
|
14984
15028
|
captureCommitPhaseError(nextEffect, error);
|
|
@@ -15004,13 +15048,11 @@ function commitRootImpl(root, renderPriorityLevel) {
|
|
|
15004
15048
|
invokeGuardedCallback(null, commitMutationEffects, null, root, renderPriorityLevel);
|
|
15005
15049
|
|
|
15006
15050
|
if (hasCaughtError()) {
|
|
15007
|
-
(
|
|
15008
|
-
|
|
15009
|
-
|
|
15010
|
-
throw ReactError(Error("Should be working on an effect."));
|
|
15011
|
-
}
|
|
15051
|
+
if (!(nextEffect !== null)) {
|
|
15052
|
+
{
|
|
15053
|
+
throw Error("Should be working on an effect.");
|
|
15012
15054
|
}
|
|
15013
|
-
}
|
|
15055
|
+
}
|
|
15014
15056
|
|
|
15015
15057
|
var _error = clearCaughtError();
|
|
15016
15058
|
|
|
@@ -15038,13 +15080,11 @@ function commitRootImpl(root, renderPriorityLevel) {
|
|
|
15038
15080
|
invokeGuardedCallback(null, commitLayoutEffects, null, root, expirationTime);
|
|
15039
15081
|
|
|
15040
15082
|
if (hasCaughtError()) {
|
|
15041
|
-
(
|
|
15042
|
-
|
|
15043
|
-
|
|
15044
|
-
throw ReactError(Error("Should be working on an effect."));
|
|
15045
|
-
}
|
|
15083
|
+
if (!(nextEffect !== null)) {
|
|
15084
|
+
{
|
|
15085
|
+
throw Error("Should be working on an effect.");
|
|
15046
15086
|
}
|
|
15047
|
-
}
|
|
15087
|
+
}
|
|
15048
15088
|
|
|
15049
15089
|
var _error2 = clearCaughtError();
|
|
15050
15090
|
|
|
@@ -15330,13 +15370,11 @@ function flushPassiveEffectsImpl() {
|
|
|
15330
15370
|
rootWithPendingPassiveEffects = null;
|
|
15331
15371
|
pendingPassiveEffectsExpirationTime = NoWork;
|
|
15332
15372
|
|
|
15333
|
-
(
|
|
15334
|
-
|
|
15335
|
-
|
|
15336
|
-
throw ReactError(Error("Cannot flush passive effects while already rendering."));
|
|
15337
|
-
}
|
|
15373
|
+
if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) {
|
|
15374
|
+
{
|
|
15375
|
+
throw Error("Cannot flush passive effects while already rendering.");
|
|
15338
15376
|
}
|
|
15339
|
-
}
|
|
15377
|
+
}
|
|
15340
15378
|
|
|
15341
15379
|
var prevExecutionContext = executionContext;
|
|
15342
15380
|
executionContext |= CommitContext;
|
|
@@ -15352,13 +15390,11 @@ function flushPassiveEffectsImpl() {
|
|
|
15352
15390
|
invokeGuardedCallback(null, commitPassiveHookEffects, null, effect);
|
|
15353
15391
|
|
|
15354
15392
|
if (hasCaughtError()) {
|
|
15355
|
-
(
|
|
15356
|
-
|
|
15357
|
-
|
|
15358
|
-
throw ReactError(Error("Should be working on an effect."));
|
|
15359
|
-
}
|
|
15393
|
+
if (!(effect !== null)) {
|
|
15394
|
+
{
|
|
15395
|
+
throw Error("Should be working on an effect.");
|
|
15360
15396
|
}
|
|
15361
|
-
}
|
|
15397
|
+
}
|
|
15362
15398
|
|
|
15363
15399
|
var error = clearCaughtError();
|
|
15364
15400
|
captureCommitPhaseError(effect, error);
|
|
@@ -15519,10 +15555,10 @@ function retryTimedOutBoundary(boundaryFiber, retryTime) {
|
|
|
15519
15555
|
// previously was rendered in its fallback state. One of the promises that
|
|
15520
15556
|
// suspended it has resolved, which means at least part of the tree was
|
|
15521
15557
|
// likely unblocked. Try rendering again, at a new expiration time.
|
|
15522
|
-
if (retryTime ===
|
|
15558
|
+
if (retryTime === NoWork) {
|
|
15523
15559
|
var suspenseConfig = null; // Retries don't carry over the already committed update.
|
|
15524
15560
|
|
|
15525
|
-
var currentTime =
|
|
15561
|
+
var currentTime = requestCurrentTimeForUpdate();
|
|
15526
15562
|
retryTime = computeExpirationForFiber(currentTime, boundaryFiber, suspenseConfig);
|
|
15527
15563
|
} // TODO: Special case idle priority?
|
|
15528
15564
|
|
|
@@ -15537,7 +15573,7 @@ function retryTimedOutBoundary(boundaryFiber, retryTime) {
|
|
|
15537
15573
|
|
|
15538
15574
|
function retryDehydratedSuspenseBoundary(boundaryFiber) {
|
|
15539
15575
|
var suspenseState = boundaryFiber.memoizedState;
|
|
15540
|
-
var retryTime =
|
|
15576
|
+
var retryTime = NoWork;
|
|
15541
15577
|
|
|
15542
15578
|
if (suspenseState !== null) {
|
|
15543
15579
|
retryTime = suspenseState.retryTime;
|
|
@@ -15546,7 +15582,7 @@ function retryDehydratedSuspenseBoundary(boundaryFiber) {
|
|
|
15546
15582
|
retryTimedOutBoundary(boundaryFiber, retryTime);
|
|
15547
15583
|
}
|
|
15548
15584
|
function resolveRetryThenable(boundaryFiber, thenable) {
|
|
15549
|
-
var retryTime =
|
|
15585
|
+
var retryTime = NoWork; // Default
|
|
15550
15586
|
|
|
15551
15587
|
var retryCache;
|
|
15552
15588
|
|
|
@@ -15567,13 +15603,11 @@ function resolveRetryThenable(boundaryFiber, thenable) {
|
|
|
15567
15603
|
break;
|
|
15568
15604
|
|
|
15569
15605
|
default:
|
|
15570
|
-
|
|
15606
|
+
{
|
|
15571
15607
|
{
|
|
15572
|
-
|
|
15573
|
-
throw ReactError(Error("Pinged unknown suspense boundary type. This is probably a bug in React."));
|
|
15574
|
-
}
|
|
15608
|
+
throw Error("Pinged unknown suspense boundary type. This is probably a bug in React.");
|
|
15575
15609
|
}
|
|
15576
|
-
}
|
|
15610
|
+
}
|
|
15577
15611
|
|
|
15578
15612
|
}
|
|
15579
15613
|
} else {
|
|
@@ -15630,13 +15664,11 @@ function checkForNestedUpdates() {
|
|
|
15630
15664
|
nestedUpdateCount = 0;
|
|
15631
15665
|
rootWithNestedUpdates = null;
|
|
15632
15666
|
|
|
15633
|
-
|
|
15667
|
+
{
|
|
15634
15668
|
{
|
|
15635
|
-
|
|
15636
|
-
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."));
|
|
15637
|
-
}
|
|
15669
|
+
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.");
|
|
15638
15670
|
}
|
|
15639
|
-
}
|
|
15671
|
+
}
|
|
15640
15672
|
}
|
|
15641
15673
|
|
|
15642
15674
|
{
|
|
@@ -15724,12 +15756,14 @@ if (true && replayFailedUnitOfWorkWithInvokeGuardedCallback) {
|
|
|
15724
15756
|
if (originalError !== null && typeof originalError === 'object' && typeof originalError.then === 'function') {
|
|
15725
15757
|
// Don't replay promises. Treat everything else like an error.
|
|
15726
15758
|
throw originalError;
|
|
15727
|
-
} // Keep this code in sync with
|
|
15759
|
+
} // Keep this code in sync with handleError; any changes here must have
|
|
15728
15760
|
// corresponding changes there.
|
|
15729
15761
|
|
|
15730
15762
|
|
|
15731
15763
|
resetContextDependencies();
|
|
15732
|
-
resetHooks(); //
|
|
15764
|
+
resetHooks(); // Don't reset current debug fiber, since we're about to work on the
|
|
15765
|
+
// same fiber again.
|
|
15766
|
+
// Unwind the failed stack frame
|
|
15733
15767
|
|
|
15734
15768
|
unwindInterruptedWork(unitOfWork); // Restore the original properties of the fiber.
|
|
15735
15769
|
|
|
@@ -15824,7 +15858,7 @@ var didWarnAboutUnmockedScheduler = false; // TODO Before we release concurrent
|
|
|
15824
15858
|
function warnIfUnmockedScheduler(fiber) {
|
|
15825
15859
|
{
|
|
15826
15860
|
if (didWarnAboutUnmockedScheduler === false && Scheduler.unstable_flushAllWithoutAsserting === undefined) {
|
|
15827
|
-
if (fiber.mode &
|
|
15861
|
+
if (fiber.mode & BlockingMode || fiber.mode & ConcurrentMode) {
|
|
15828
15862
|
didWarnAboutUnmockedScheduler = true;
|
|
15829
15863
|
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');
|
|
15830
15864
|
} else if (warnAboutUnmockedScheduler === true) {
|
|
@@ -15928,7 +15962,7 @@ function flushSuspensePriorityWarningInDEV() {
|
|
|
15928
15962
|
componentsThatTriggeredHighPriSuspend = null;
|
|
15929
15963
|
|
|
15930
15964
|
if (componentNames.length > 0) {
|
|
15931
|
-
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
|
|
15965
|
+
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
|
|
15932
15966
|
componentNames.sort().join(', '));
|
|
15933
15967
|
}
|
|
15934
15968
|
}
|
|
@@ -16015,10 +16049,10 @@ function startWorkOnPendingInteractions(root, expirationTime) {
|
|
|
16015
16049
|
});
|
|
16016
16050
|
}
|
|
16017
16051
|
}); // Store the current set of interactions on the FiberRoot for a few reasons:
|
|
16018
|
-
// We can re-use it in hot functions like
|
|
16019
|
-
// recalculate it. We will also use it in commitWork() to
|
|
16020
|
-
// onRender() hooks. This also provides DevTools with a
|
|
16021
|
-
// the onCommitRoot() hook is called.
|
|
16052
|
+
// We can re-use it in hot functions like performConcurrentWorkOnRoot()
|
|
16053
|
+
// without having to recalculate it. We will also use it in commitWork() to
|
|
16054
|
+
// pass to any Profiler onRender() hooks. This also provides DevTools with a
|
|
16055
|
+
// way to access it when the onCommitRoot() hook is called.
|
|
16022
16056
|
|
|
16023
16057
|
root.memoizedInteractions = interactions;
|
|
16024
16058
|
|
|
@@ -16126,7 +16160,7 @@ function injectInternals(internals) {
|
|
|
16126
16160
|
var didError = (root.current.effectTag & DidCapture) === DidCapture;
|
|
16127
16161
|
|
|
16128
16162
|
if (enableProfilerTimer) {
|
|
16129
|
-
var currentTime =
|
|
16163
|
+
var currentTime = getCurrentTime();
|
|
16130
16164
|
var priorityLevel = inferPriorityFromExpirationTime(currentTime, expirationTime);
|
|
16131
16165
|
hook.onCommitFiberRoot(rendererID, root, priorityLevel, didError);
|
|
16132
16166
|
} else {
|
|
@@ -16467,9 +16501,9 @@ function createHostRootFiber(tag) {
|
|
|
16467
16501
|
var mode;
|
|
16468
16502
|
|
|
16469
16503
|
if (tag === ConcurrentRoot) {
|
|
16470
|
-
mode = ConcurrentMode |
|
|
16471
|
-
} else if (tag ===
|
|
16472
|
-
mode =
|
|
16504
|
+
mode = ConcurrentMode | BlockingMode | StrictMode;
|
|
16505
|
+
} else if (tag === BlockingRoot) {
|
|
16506
|
+
mode = BlockingMode | StrictMode;
|
|
16473
16507
|
} else {
|
|
16474
16508
|
mode = NoMode;
|
|
16475
16509
|
}
|
|
@@ -16511,7 +16545,7 @@ key, pendingProps, owner, mode, expirationTime) {
|
|
|
16511
16545
|
|
|
16512
16546
|
case REACT_CONCURRENT_MODE_TYPE:
|
|
16513
16547
|
fiberTag = Mode;
|
|
16514
|
-
mode |= ConcurrentMode |
|
|
16548
|
+
mode |= ConcurrentMode | BlockingMode | StrictMode;
|
|
16515
16549
|
break;
|
|
16516
16550
|
|
|
16517
16551
|
case REACT_STRICT_MODE_TYPE:
|
|
@@ -16588,13 +16622,11 @@ key, pendingProps, owner, mode, expirationTime) {
|
|
|
16588
16622
|
}
|
|
16589
16623
|
}
|
|
16590
16624
|
|
|
16591
|
-
|
|
16625
|
+
{
|
|
16592
16626
|
{
|
|
16593
|
-
|
|
16594
|
-
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));
|
|
16595
|
-
}
|
|
16627
|
+
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);
|
|
16596
16628
|
}
|
|
16597
|
-
}
|
|
16629
|
+
}
|
|
16598
16630
|
}
|
|
16599
16631
|
}
|
|
16600
16632
|
}
|
|
@@ -16778,7 +16810,6 @@ function FiberRootNode(containerInfo, tag, hydrate) {
|
|
|
16778
16810
|
this.context = null;
|
|
16779
16811
|
this.pendingContext = null;
|
|
16780
16812
|
this.hydrate = hydrate;
|
|
16781
|
-
this.firstBatch = null;
|
|
16782
16813
|
this.callbackNode = null;
|
|
16783
16814
|
this.callbackPriority = NoPriority;
|
|
16784
16815
|
this.firstPendingTime = NoWork;
|
|
@@ -16934,79 +16965,22 @@ function getContextForSubtree(parentComponent) {
|
|
|
16934
16965
|
return parentContext;
|
|
16935
16966
|
}
|
|
16936
16967
|
|
|
16937
|
-
function scheduleRootUpdate(current$$1, element, expirationTime, suspenseConfig, callback) {
|
|
16938
|
-
{
|
|
16939
|
-
if (phase === 'render' && current !== null && !didWarnAboutNestedUpdates) {
|
|
16940
|
-
didWarnAboutNestedUpdates = true;
|
|
16941
|
-
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');
|
|
16942
|
-
}
|
|
16943
|
-
}
|
|
16944
|
-
|
|
16945
|
-
var update = createUpdate(expirationTime, suspenseConfig); // Caution: React DevTools currently depends on this property
|
|
16946
|
-
// being called "element".
|
|
16947
|
-
|
|
16948
|
-
update.payload = {
|
|
16949
|
-
element: element
|
|
16950
|
-
};
|
|
16951
|
-
callback = callback === undefined ? null : callback;
|
|
16952
|
-
|
|
16953
|
-
if (callback !== null) {
|
|
16954
|
-
!(typeof callback === 'function') ? warningWithoutStack$1(false, 'render(...): Expected the last optional `callback` argument to be a ' + 'function. Instead received: %s.', callback) : void 0;
|
|
16955
|
-
update.callback = callback;
|
|
16956
|
-
}
|
|
16957
|
-
|
|
16958
|
-
enqueueUpdate(current$$1, update);
|
|
16959
|
-
scheduleWork(current$$1, expirationTime);
|
|
16960
|
-
return expirationTime;
|
|
16961
|
-
}
|
|
16962
|
-
|
|
16963
|
-
function updateContainerAtExpirationTime(element, container, parentComponent, expirationTime, suspenseConfig, callback) {
|
|
16964
|
-
// TODO: If this is a nested container, this won't be the root.
|
|
16965
|
-
var current$$1 = container.current;
|
|
16966
|
-
|
|
16967
|
-
{
|
|
16968
|
-
if (ReactFiberInstrumentation_1.debugTool) {
|
|
16969
|
-
if (current$$1.alternate === null) {
|
|
16970
|
-
ReactFiberInstrumentation_1.debugTool.onMountContainer(container);
|
|
16971
|
-
} else if (element === null) {
|
|
16972
|
-
ReactFiberInstrumentation_1.debugTool.onUnmountContainer(container);
|
|
16973
|
-
} else {
|
|
16974
|
-
ReactFiberInstrumentation_1.debugTool.onUpdateContainer(container);
|
|
16975
|
-
}
|
|
16976
|
-
}
|
|
16977
|
-
}
|
|
16978
|
-
|
|
16979
|
-
var context = getContextForSubtree(parentComponent);
|
|
16980
|
-
|
|
16981
|
-
if (container.context === null) {
|
|
16982
|
-
container.context = context;
|
|
16983
|
-
} else {
|
|
16984
|
-
container.pendingContext = context;
|
|
16985
|
-
}
|
|
16986
|
-
|
|
16987
|
-
return scheduleRootUpdate(current$$1, element, expirationTime, suspenseConfig, callback);
|
|
16988
|
-
}
|
|
16989
|
-
|
|
16990
16968
|
function findHostInstance(component) {
|
|
16991
16969
|
var fiber = get(component);
|
|
16992
16970
|
|
|
16993
16971
|
if (fiber === undefined) {
|
|
16994
16972
|
if (typeof component.render === 'function') {
|
|
16995
|
-
|
|
16973
|
+
{
|
|
16996
16974
|
{
|
|
16997
|
-
|
|
16998
|
-
throw ReactError(Error("Unable to find node on an unmounted component."));
|
|
16999
|
-
}
|
|
16975
|
+
throw Error("Unable to find node on an unmounted component.");
|
|
17000
16976
|
}
|
|
17001
|
-
}
|
|
16977
|
+
}
|
|
17002
16978
|
} else {
|
|
17003
|
-
|
|
16979
|
+
{
|
|
17004
16980
|
{
|
|
17005
|
-
|
|
17006
|
-
throw ReactError(Error("Argument appears to not be a ReactComponent. Keys: " + Object.keys(component)));
|
|
17007
|
-
}
|
|
16981
|
+
throw Error("Argument appears to not be a ReactComponent. Keys: " + Object.keys(component));
|
|
17008
16982
|
}
|
|
17009
|
-
}
|
|
16983
|
+
}
|
|
17010
16984
|
}
|
|
17011
16985
|
}
|
|
17012
16986
|
|
|
@@ -17025,21 +16999,17 @@ function findHostInstanceWithWarning(component, methodName) {
|
|
|
17025
16999
|
|
|
17026
17000
|
if (fiber === undefined) {
|
|
17027
17001
|
if (typeof component.render === 'function') {
|
|
17028
|
-
|
|
17002
|
+
{
|
|
17029
17003
|
{
|
|
17030
|
-
|
|
17031
|
-
throw ReactError(Error("Unable to find node on an unmounted component."));
|
|
17032
|
-
}
|
|
17004
|
+
throw Error("Unable to find node on an unmounted component.");
|
|
17033
17005
|
}
|
|
17034
|
-
}
|
|
17006
|
+
}
|
|
17035
17007
|
} else {
|
|
17036
|
-
|
|
17008
|
+
{
|
|
17037
17009
|
{
|
|
17038
|
-
|
|
17039
|
-
throw ReactError(Error("Argument appears to not be a ReactComponent. Keys: " + Object.keys(component)));
|
|
17040
|
-
}
|
|
17010
|
+
throw Error("Argument appears to not be a ReactComponent. Keys: " + Object.keys(component));
|
|
17041
17011
|
}
|
|
17042
|
-
}
|
|
17012
|
+
}
|
|
17043
17013
|
}
|
|
17044
17014
|
}
|
|
17045
17015
|
|
|
@@ -17074,7 +17044,7 @@ function createContainer(containerInfo, tag, hydrate, hydrationCallbacks) {
|
|
|
17074
17044
|
}
|
|
17075
17045
|
function updateContainer(element, container, parentComponent, callback) {
|
|
17076
17046
|
var current$$1 = container.current;
|
|
17077
|
-
var currentTime =
|
|
17047
|
+
var currentTime = requestCurrentTimeForUpdate();
|
|
17078
17048
|
|
|
17079
17049
|
{
|
|
17080
17050
|
// $FlowExpectedError - jest isn't a global, and isn't recognized outside of tests
|
|
@@ -17086,7 +17056,50 @@ function updateContainer(element, container, parentComponent, callback) {
|
|
|
17086
17056
|
|
|
17087
17057
|
var suspenseConfig = requestCurrentSuspenseConfig();
|
|
17088
17058
|
var expirationTime = computeExpirationForFiber(currentTime, current$$1, suspenseConfig);
|
|
17089
|
-
|
|
17059
|
+
|
|
17060
|
+
{
|
|
17061
|
+
if (ReactFiberInstrumentation_1.debugTool) {
|
|
17062
|
+
if (current$$1.alternate === null) {
|
|
17063
|
+
ReactFiberInstrumentation_1.debugTool.onMountContainer(container);
|
|
17064
|
+
} else if (element === null) {
|
|
17065
|
+
ReactFiberInstrumentation_1.debugTool.onUnmountContainer(container);
|
|
17066
|
+
} else {
|
|
17067
|
+
ReactFiberInstrumentation_1.debugTool.onUpdateContainer(container);
|
|
17068
|
+
}
|
|
17069
|
+
}
|
|
17070
|
+
}
|
|
17071
|
+
|
|
17072
|
+
var context = getContextForSubtree(parentComponent);
|
|
17073
|
+
|
|
17074
|
+
if (container.context === null) {
|
|
17075
|
+
container.context = context;
|
|
17076
|
+
} else {
|
|
17077
|
+
container.pendingContext = context;
|
|
17078
|
+
}
|
|
17079
|
+
|
|
17080
|
+
{
|
|
17081
|
+
if (phase === 'render' && current !== null && !didWarnAboutNestedUpdates) {
|
|
17082
|
+
didWarnAboutNestedUpdates = true;
|
|
17083
|
+
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');
|
|
17084
|
+
}
|
|
17085
|
+
}
|
|
17086
|
+
|
|
17087
|
+
var update = createUpdate(expirationTime, suspenseConfig); // Caution: React DevTools currently depends on this property
|
|
17088
|
+
// being called "element".
|
|
17089
|
+
|
|
17090
|
+
update.payload = {
|
|
17091
|
+
element: element
|
|
17092
|
+
};
|
|
17093
|
+
callback = callback === undefined ? null : callback;
|
|
17094
|
+
|
|
17095
|
+
if (callback !== null) {
|
|
17096
|
+
!(typeof callback === 'function') ? warningWithoutStack$1(false, 'render(...): Expected the last optional `callback` argument to be a ' + 'function. Instead received: %s.', callback) : void 0;
|
|
17097
|
+
update.callback = callback;
|
|
17098
|
+
}
|
|
17099
|
+
|
|
17100
|
+
enqueueUpdate(current$$1, update);
|
|
17101
|
+
scheduleWork(current$$1, expirationTime);
|
|
17102
|
+
return expirationTime;
|
|
17090
17103
|
}
|
|
17091
17104
|
function getPublicRootInstance(container) {
|
|
17092
17105
|
var containerFiber = container.current;
|
|
@@ -17118,10 +17131,74 @@ function attemptSynchronousHydration(fiber) {
|
|
|
17118
17131
|
case SuspenseComponent:
|
|
17119
17132
|
flushSync(function () {
|
|
17120
17133
|
return scheduleWork(fiber, Sync);
|
|
17121
|
-
});
|
|
17134
|
+
}); // If we're still blocked after this, we need to increase
|
|
17135
|
+
// the priority of any promises resolving within this
|
|
17136
|
+
// boundary so that they next attempt also has higher pri.
|
|
17137
|
+
|
|
17138
|
+
var retryExpTime = computeInteractiveExpiration(requestCurrentTimeForUpdate());
|
|
17139
|
+
markRetryTimeIfNotHydrated(fiber, retryExpTime);
|
|
17122
17140
|
break;
|
|
17123
17141
|
}
|
|
17124
17142
|
}
|
|
17143
|
+
|
|
17144
|
+
function markRetryTimeImpl(fiber, retryTime) {
|
|
17145
|
+
var suspenseState = fiber.memoizedState;
|
|
17146
|
+
|
|
17147
|
+
if (suspenseState !== null && suspenseState.dehydrated !== null) {
|
|
17148
|
+
if (suspenseState.retryTime < retryTime) {
|
|
17149
|
+
suspenseState.retryTime = retryTime;
|
|
17150
|
+
}
|
|
17151
|
+
}
|
|
17152
|
+
} // Increases the priority of thennables when they resolve within this boundary.
|
|
17153
|
+
|
|
17154
|
+
|
|
17155
|
+
function markRetryTimeIfNotHydrated(fiber, retryTime) {
|
|
17156
|
+
markRetryTimeImpl(fiber, retryTime);
|
|
17157
|
+
var alternate = fiber.alternate;
|
|
17158
|
+
|
|
17159
|
+
if (alternate) {
|
|
17160
|
+
markRetryTimeImpl(alternate, retryTime);
|
|
17161
|
+
}
|
|
17162
|
+
}
|
|
17163
|
+
|
|
17164
|
+
function attemptUserBlockingHydration(fiber) {
|
|
17165
|
+
if (fiber.tag !== SuspenseComponent) {
|
|
17166
|
+
// We ignore HostRoots here because we can't increase
|
|
17167
|
+
// their priority and they should not suspend on I/O,
|
|
17168
|
+
// since you have to wrap anything that might suspend in
|
|
17169
|
+
// Suspense.
|
|
17170
|
+
return;
|
|
17171
|
+
}
|
|
17172
|
+
|
|
17173
|
+
var expTime = computeInteractiveExpiration(requestCurrentTimeForUpdate());
|
|
17174
|
+
scheduleWork(fiber, expTime);
|
|
17175
|
+
markRetryTimeIfNotHydrated(fiber, expTime);
|
|
17176
|
+
}
|
|
17177
|
+
function attemptContinuousHydration(fiber) {
|
|
17178
|
+
if (fiber.tag !== SuspenseComponent) {
|
|
17179
|
+
// We ignore HostRoots here because we can't increase
|
|
17180
|
+
// their priority and they should not suspend on I/O,
|
|
17181
|
+
// since you have to wrap anything that might suspend in
|
|
17182
|
+
// Suspense.
|
|
17183
|
+
return;
|
|
17184
|
+
}
|
|
17185
|
+
|
|
17186
|
+
var expTime = computeContinuousHydrationExpiration(requestCurrentTimeForUpdate());
|
|
17187
|
+
scheduleWork(fiber, expTime);
|
|
17188
|
+
markRetryTimeIfNotHydrated(fiber, expTime);
|
|
17189
|
+
}
|
|
17190
|
+
function attemptHydrationAtCurrentPriority(fiber) {
|
|
17191
|
+
if (fiber.tag !== SuspenseComponent) {
|
|
17192
|
+
// We ignore HostRoots here because we can't increase
|
|
17193
|
+
// their priority other than synchronously flush it.
|
|
17194
|
+
return;
|
|
17195
|
+
}
|
|
17196
|
+
|
|
17197
|
+
var currentTime = requestCurrentTimeForUpdate();
|
|
17198
|
+
var expTime = computeExpirationForFiber(currentTime, fiber, null);
|
|
17199
|
+
scheduleWork(fiber, expTime);
|
|
17200
|
+
markRetryTimeIfNotHydrated(fiber, expTime);
|
|
17201
|
+
}
|
|
17125
17202
|
function findHostInstanceWithNoPortals(fiber) {
|
|
17126
17203
|
var hostFiber = findCurrentHostFiberWithNoPortals(fiber);
|
|
17127
17204
|
|
|
@@ -17249,11 +17326,8 @@ function injectIntoDevTools(devToolsConfig) {
|
|
|
17249
17326
|
}
|
|
17250
17327
|
|
|
17251
17328
|
var ReactFiberReconciler = Object.freeze({
|
|
17252
|
-
updateContainerAtExpirationTime: updateContainerAtExpirationTime,
|
|
17253
17329
|
createContainer: createContainer,
|
|
17254
17330
|
updateContainer: updateContainer,
|
|
17255
|
-
flushRoot: flushRoot,
|
|
17256
|
-
computeUniqueAsyncExpiration: computeUniqueAsyncExpiration,
|
|
17257
17331
|
batchedEventUpdates: batchedEventUpdates,
|
|
17258
17332
|
batchedUpdates: batchedUpdates,
|
|
17259
17333
|
unbatchedUpdates: unbatchedUpdates,
|
|
@@ -17267,6 +17341,9 @@ var ReactFiberReconciler = Object.freeze({
|
|
|
17267
17341
|
IsThisRendererActing: IsThisRendererActing,
|
|
17268
17342
|
getPublicRootInstance: getPublicRootInstance,
|
|
17269
17343
|
attemptSynchronousHydration: attemptSynchronousHydration,
|
|
17344
|
+
attemptUserBlockingHydration: attemptUserBlockingHydration,
|
|
17345
|
+
attemptContinuousHydration: attemptContinuousHydration,
|
|
17346
|
+
attemptHydrationAtCurrentPriority: attemptHydrationAtCurrentPriority,
|
|
17270
17347
|
findHostInstance: findHostInstance,
|
|
17271
17348
|
findHostInstanceWithWarning: findHostInstanceWithWarning,
|
|
17272
17349
|
findHostInstanceWithNoPortals: findHostInstanceWithNoPortals,
|