react-reconciler 0.22.2 → 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build-info.json +5 -5
- package/cjs/react-reconciler-persistent.development.js +737 -671
- package/cjs/react-reconciler-persistent.production.min.js +164 -164
- package/cjs/react-reconciler-reflection.development.js +27 -55
- package/cjs/react-reconciler-reflection.production.min.js +5 -5
- package/cjs/react-reconciler.development.js +739 -679
- package/cjs/react-reconciler.production.min.js +164 -164
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license React v0.
|
|
1
|
+
/** @license React v0.23.0
|
|
2
2
|
* react-reconciler.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;
|
|
@@ -412,10 +404,9 @@ var warnAboutDeprecatedLifecycles = true; // Gather advanced timing metrics for
|
|
|
412
404
|
|
|
413
405
|
var enableProfilerTimer = true; // Trace which interactions trigger each commit.
|
|
414
406
|
|
|
415
|
-
var enableSchedulerTracing = true; //
|
|
416
|
-
|
|
417
|
-
var enableSuspenseServerRenderer = false; // TODO: true? Here it might just be false.
|
|
407
|
+
var enableSchedulerTracing = true; // SSR experiments
|
|
418
408
|
|
|
409
|
+
var enableSuspenseServerRenderer = false;
|
|
419
410
|
// Only used in www builds.
|
|
420
411
|
|
|
421
412
|
// Only used in www builds.
|
|
@@ -429,9 +420,6 @@ var enableSuspenseServerRenderer = false; // TODO: true? Here it might just be f
|
|
|
429
420
|
// Control this behavior with a flag to support 16.6 minor releases in the meanwhile.
|
|
430
421
|
|
|
431
422
|
|
|
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
423
|
// Experimental React Flare event system and event components support.
|
|
436
424
|
|
|
437
425
|
var enableFlareAPI = false; // Experimental Host Component support.
|
|
@@ -446,11 +434,7 @@ var enableScopeAPI = false; // New API for JSX transforms to target - https://gi
|
|
|
446
434
|
var warnAboutUnmockedScheduler = false; // For tests, we flush suspense fallbacks in an act scope;
|
|
447
435
|
// *except* in some of our own tests, where we test incremental loading states.
|
|
448
436
|
|
|
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
|
|
437
|
+
var flushSuspenseFallbacksInTests = true; // Add a callback property to suspense to notify which promises are currently
|
|
454
438
|
// in the update queue. This allows reporting and tracing of what is causing
|
|
455
439
|
// the user to see a loading state.
|
|
456
440
|
// Also allows hydration callbacks to fire when a dehydrated boundary gets
|
|
@@ -530,13 +514,11 @@ function isMounted(component) {
|
|
|
530
514
|
}
|
|
531
515
|
|
|
532
516
|
function assertIsMounted(fiber) {
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
throw ReactError(Error("Unable to find node on an unmounted component."));
|
|
537
|
-
}
|
|
517
|
+
if (!(getNearestMountedFiber(fiber) === fiber)) {
|
|
518
|
+
{
|
|
519
|
+
throw Error("Unable to find node on an unmounted component.");
|
|
538
520
|
}
|
|
539
|
-
}
|
|
521
|
+
}
|
|
540
522
|
}
|
|
541
523
|
|
|
542
524
|
function findCurrentFiberUsingSlowPath(fiber) {
|
|
@@ -546,13 +528,11 @@ function findCurrentFiberUsingSlowPath(fiber) {
|
|
|
546
528
|
// If there is no alternate, then we only need to check if it is mounted.
|
|
547
529
|
var nearestMounted = getNearestMountedFiber(fiber);
|
|
548
530
|
|
|
549
|
-
(
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
throw ReactError(Error("Unable to find node on an unmounted component."));
|
|
553
|
-
}
|
|
531
|
+
if (!(nearestMounted !== null)) {
|
|
532
|
+
{
|
|
533
|
+
throw Error("Unable to find node on an unmounted component.");
|
|
554
534
|
}
|
|
555
|
-
}
|
|
535
|
+
}
|
|
556
536
|
|
|
557
537
|
if (nearestMounted !== fiber) {
|
|
558
538
|
return null;
|
|
@@ -617,13 +597,11 @@ function findCurrentFiberUsingSlowPath(fiber) {
|
|
|
617
597
|
// way this could possibly happen is if this was unmounted, if at all.
|
|
618
598
|
|
|
619
599
|
|
|
620
|
-
|
|
600
|
+
{
|
|
621
601
|
{
|
|
622
|
-
|
|
623
|
-
throw ReactError(Error("Unable to find node on an unmounted component."));
|
|
624
|
-
}
|
|
602
|
+
throw Error("Unable to find node on an unmounted component.");
|
|
625
603
|
}
|
|
626
|
-
}
|
|
604
|
+
}
|
|
627
605
|
}
|
|
628
606
|
|
|
629
607
|
if (a.return !== b.return) {
|
|
@@ -682,34 +660,28 @@ function findCurrentFiberUsingSlowPath(fiber) {
|
|
|
682
660
|
_child = _child.sibling;
|
|
683
661
|
}
|
|
684
662
|
|
|
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
|
-
}
|
|
663
|
+
if (!didFindChild) {
|
|
664
|
+
{
|
|
665
|
+
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
666
|
}
|
|
691
|
-
}
|
|
667
|
+
}
|
|
692
668
|
}
|
|
693
669
|
}
|
|
694
670
|
|
|
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
|
-
}
|
|
671
|
+
if (!(a.alternate === b)) {
|
|
672
|
+
{
|
|
673
|
+
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
674
|
}
|
|
701
|
-
}
|
|
675
|
+
}
|
|
702
676
|
} // If the root is not a host container, we're in a disconnected tree. I.e.
|
|
703
677
|
// unmounted.
|
|
704
678
|
|
|
705
679
|
|
|
706
|
-
(
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
throw ReactError(Error("Unable to find node on an unmounted component."));
|
|
710
|
-
}
|
|
680
|
+
if (!(a.tag === HostRoot)) {
|
|
681
|
+
{
|
|
682
|
+
throw Error("Unable to find node on an unmounted component.");
|
|
711
683
|
}
|
|
712
|
-
}
|
|
684
|
+
}
|
|
713
685
|
|
|
714
686
|
if (a.stateNode.current === a) {
|
|
715
687
|
// We've determined that A is the current branch.
|
|
@@ -851,7 +823,8 @@ var mountResponderInstance = $$$hostConfig.mountResponderInstance;
|
|
|
851
823
|
var unmountResponderInstance = $$$hostConfig.unmountResponderInstance;
|
|
852
824
|
var getFundamentalComponentInstance = $$$hostConfig.getFundamentalComponentInstance;
|
|
853
825
|
var mountFundamentalComponent = $$$hostConfig.mountFundamentalComponent;
|
|
854
|
-
var shouldUpdateFundamentalComponent = $$$hostConfig.shouldUpdateFundamentalComponent;
|
|
826
|
+
var shouldUpdateFundamentalComponent = $$$hostConfig.shouldUpdateFundamentalComponent;
|
|
827
|
+
var getInstanceFromNode = $$$hostConfig.getInstanceFromNode; // -------------------
|
|
855
828
|
// Mutation
|
|
856
829
|
// (optional)
|
|
857
830
|
// -------------------
|
|
@@ -1635,13 +1608,11 @@ function pushTopLevelContextObject(fiber, context, didChange) {
|
|
|
1635
1608
|
if (disableLegacyContext) {
|
|
1636
1609
|
return;
|
|
1637
1610
|
} 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
|
-
}
|
|
1611
|
+
if (!(contextStackCursor.current === emptyContextObject)) {
|
|
1612
|
+
{
|
|
1613
|
+
throw Error("Unexpected context found on stack. This error is likely caused by a bug in React. Please file an issue.");
|
|
1643
1614
|
}
|
|
1644
|
-
}
|
|
1615
|
+
}
|
|
1645
1616
|
|
|
1646
1617
|
push(contextStackCursor, context, fiber);
|
|
1647
1618
|
push(didPerformWorkStackCursor, didChange, fiber);
|
|
@@ -1684,13 +1655,11 @@ function processChildContext(fiber, type, parentContext) {
|
|
|
1684
1655
|
}
|
|
1685
1656
|
|
|
1686
1657
|
for (var contextKey in childContext) {
|
|
1687
|
-
(
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
throw ReactError(Error((getComponentName(type) || 'Unknown') + ".getChildContext(): key \"" + contextKey + "\" is not defined in childContextTypes."));
|
|
1691
|
-
}
|
|
1658
|
+
if (!(contextKey in childContextTypes)) {
|
|
1659
|
+
{
|
|
1660
|
+
throw Error((getComponentName(type) || 'Unknown') + ".getChildContext(): key \"" + contextKey + "\" is not defined in childContextTypes.");
|
|
1692
1661
|
}
|
|
1693
|
-
}
|
|
1662
|
+
}
|
|
1694
1663
|
}
|
|
1695
1664
|
|
|
1696
1665
|
{
|
|
@@ -1731,13 +1700,11 @@ function invalidateContextProvider(workInProgress, type, didChange) {
|
|
|
1731
1700
|
} else {
|
|
1732
1701
|
var instance = workInProgress.stateNode;
|
|
1733
1702
|
|
|
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
|
-
}
|
|
1703
|
+
if (!instance) {
|
|
1704
|
+
{
|
|
1705
|
+
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
1706
|
}
|
|
1740
|
-
}
|
|
1707
|
+
}
|
|
1741
1708
|
|
|
1742
1709
|
if (didChange) {
|
|
1743
1710
|
// Merge parent and own context.
|
|
@@ -1765,13 +1732,11 @@ function findCurrentUnmaskedContext(fiber) {
|
|
|
1765
1732
|
} else {
|
|
1766
1733
|
// Currently this is only used with renderSubtreeIntoContainer; not sure if it
|
|
1767
1734
|
// 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
|
-
}
|
|
1735
|
+
if (!(isFiberMounted(fiber) && fiber.tag === ClassComponent)) {
|
|
1736
|
+
{
|
|
1737
|
+
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
1738
|
}
|
|
1774
|
-
}
|
|
1739
|
+
}
|
|
1775
1740
|
|
|
1776
1741
|
var node = fiber;
|
|
1777
1742
|
|
|
@@ -1795,13 +1760,11 @@ function findCurrentUnmaskedContext(fiber) {
|
|
|
1795
1760
|
node = node.return;
|
|
1796
1761
|
} while (node !== null);
|
|
1797
1762
|
|
|
1798
|
-
|
|
1763
|
+
{
|
|
1799
1764
|
{
|
|
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
|
-
}
|
|
1765
|
+
throw Error("Found unexpected detached subtree parent. This error is likely caused by a bug in React. Please file an issue.");
|
|
1803
1766
|
}
|
|
1804
|
-
}
|
|
1767
|
+
}
|
|
1805
1768
|
}
|
|
1806
1769
|
}
|
|
1807
1770
|
|
|
@@ -1827,13 +1790,11 @@ if (enableSchedulerTracing) {
|
|
|
1827
1790
|
// Provide explicit error message when production+profiling bundle of e.g.
|
|
1828
1791
|
// react-dom is used with production (non-profiling) bundle of
|
|
1829
1792
|
// 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
|
-
}
|
|
1793
|
+
if (!(tracing.__interactionsRef != null && tracing.__interactionsRef.current != null)) {
|
|
1794
|
+
{
|
|
1795
|
+
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
1796
|
}
|
|
1836
|
-
}
|
|
1797
|
+
}
|
|
1837
1798
|
}
|
|
1838
1799
|
|
|
1839
1800
|
var fakeCallbackNode = {}; // Except for NoPriority, these correspond to Scheduler priorities. We use
|
|
@@ -1882,13 +1843,11 @@ function getCurrentPriorityLevel() {
|
|
|
1882
1843
|
return IdlePriority;
|
|
1883
1844
|
|
|
1884
1845
|
default:
|
|
1885
|
-
|
|
1846
|
+
{
|
|
1886
1847
|
{
|
|
1887
|
-
|
|
1888
|
-
throw ReactError(Error("Unknown priority level."));
|
|
1889
|
-
}
|
|
1848
|
+
throw Error("Unknown priority level.");
|
|
1890
1849
|
}
|
|
1891
|
-
}
|
|
1850
|
+
}
|
|
1892
1851
|
|
|
1893
1852
|
}
|
|
1894
1853
|
}
|
|
@@ -1911,13 +1870,11 @@ function reactPriorityToSchedulerPriority(reactPriorityLevel) {
|
|
|
1911
1870
|
return Scheduler_IdlePriority;
|
|
1912
1871
|
|
|
1913
1872
|
default:
|
|
1914
|
-
|
|
1873
|
+
{
|
|
1915
1874
|
{
|
|
1916
|
-
|
|
1917
|
-
throw ReactError(Error("Unknown priority level."));
|
|
1918
|
-
}
|
|
1875
|
+
throw Error("Unknown priority level.");
|
|
1919
1876
|
}
|
|
1920
|
-
}
|
|
1877
|
+
}
|
|
1921
1878
|
|
|
1922
1879
|
}
|
|
1923
1880
|
}
|
|
@@ -2018,7 +1975,11 @@ var NoWork = 0; // TODO: Think of a better name for Never. The key difference wi
|
|
|
2018
1975
|
var Never = 1; // Idle is slightly higher priority than Never. It must completely finish in
|
|
2019
1976
|
// order to be consistent.
|
|
2020
1977
|
|
|
2021
|
-
var Idle = 2;
|
|
1978
|
+
var Idle = 2; // Continuous Hydration is a moving priority. It is slightly higher than Idle
|
|
1979
|
+
// and is used to increase priority of hover targets. It is increasing with
|
|
1980
|
+
// each usage so that last always wins.
|
|
1981
|
+
|
|
1982
|
+
var ContinuousHydration = 3;
|
|
2022
1983
|
var Sync = MAX_SIGNED_31_BIT_INT;
|
|
2023
1984
|
var Batched = Sync - 1;
|
|
2024
1985
|
var UNIT_SIZE = 10;
|
|
@@ -2067,6 +2028,12 @@ var HIGH_PRIORITY_BATCH_SIZE = 100;
|
|
|
2067
2028
|
function computeInteractiveExpiration(currentTime) {
|
|
2068
2029
|
return computeExpirationBucket(currentTime, HIGH_PRIORITY_EXPIRATION, HIGH_PRIORITY_BATCH_SIZE);
|
|
2069
2030
|
}
|
|
2031
|
+
function computeContinuousHydrationExpiration(currentTime) {
|
|
2032
|
+
// Each time we ask for a new one of these we increase the priority.
|
|
2033
|
+
// This ensures that the last one always wins since we can't deprioritize
|
|
2034
|
+
// once we've scheduled work already.
|
|
2035
|
+
return ContinuousHydration++;
|
|
2036
|
+
}
|
|
2070
2037
|
function inferPriorityFromExpirationTime(currentTime, expirationTime) {
|
|
2071
2038
|
if (expirationTime === Sync) {
|
|
2072
2039
|
return ImmediatePriority;
|
|
@@ -2614,7 +2581,9 @@ var scheduleRoot = function (root, element) {
|
|
|
2614
2581
|
}
|
|
2615
2582
|
|
|
2616
2583
|
flushPassiveEffects();
|
|
2617
|
-
|
|
2584
|
+
syncUpdates(function () {
|
|
2585
|
+
updateContainer(element, root, null, null);
|
|
2586
|
+
});
|
|
2618
2587
|
}
|
|
2619
2588
|
};
|
|
2620
2589
|
|
|
@@ -3016,13 +2985,11 @@ function propagateContextChange(workInProgress, context, changedBits, renderExpi
|
|
|
3016
2985
|
// mark it as having updates.
|
|
3017
2986
|
var parentSuspense = fiber.return;
|
|
3018
2987
|
|
|
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
|
-
}
|
|
2988
|
+
if (!(parentSuspense !== null)) {
|
|
2989
|
+
{
|
|
2990
|
+
throw Error("We just came from a parent so we must have had a parent. This is a bug in React.");
|
|
3024
2991
|
}
|
|
3025
|
-
}
|
|
2992
|
+
}
|
|
3026
2993
|
|
|
3027
2994
|
if (parentSuspense.expirationTime < renderExpirationTime) {
|
|
3028
2995
|
parentSuspense.expirationTime = renderExpirationTime;
|
|
@@ -3123,13 +3090,11 @@ function readContext(context, observedBits) {
|
|
|
3123
3090
|
};
|
|
3124
3091
|
|
|
3125
3092
|
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
|
-
}
|
|
3093
|
+
if (!(currentlyRenderingFiber !== null)) {
|
|
3094
|
+
{
|
|
3095
|
+
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
3096
|
}
|
|
3132
|
-
}
|
|
3097
|
+
} // This is the first dependency for this component. Create a new list.
|
|
3133
3098
|
|
|
3134
3099
|
|
|
3135
3100
|
lastContextDependency = contextItem;
|
|
@@ -3634,13 +3599,11 @@ function processUpdateQueue(workInProgress, queue, props, instance, renderExpira
|
|
|
3634
3599
|
}
|
|
3635
3600
|
|
|
3636
3601
|
function callCallback(callback, context) {
|
|
3637
|
-
(function
|
|
3638
|
-
|
|
3639
|
-
|
|
3640
|
-
throw ReactError(Error("Invalid argument passed as callback. Expected a function. Instead received: " + callback));
|
|
3641
|
-
}
|
|
3602
|
+
if (!(typeof callback === 'function')) {
|
|
3603
|
+
{
|
|
3604
|
+
throw Error("Invalid argument passed as callback. Expected a function. Instead received: " + callback);
|
|
3642
3605
|
}
|
|
3643
|
-
}
|
|
3606
|
+
}
|
|
3644
3607
|
|
|
3645
3608
|
callback.call(context);
|
|
3646
3609
|
}
|
|
@@ -3751,13 +3714,11 @@ var didWarnAboutInvalidateContextType;
|
|
|
3751
3714
|
Object.defineProperty(fakeInternalInstance, '_processChildContext', {
|
|
3752
3715
|
enumerable: false,
|
|
3753
3716
|
value: function () {
|
|
3754
|
-
|
|
3717
|
+
{
|
|
3755
3718
|
{
|
|
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
|
-
}
|
|
3719
|
+
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
3720
|
}
|
|
3760
|
-
}
|
|
3721
|
+
}
|
|
3761
3722
|
}
|
|
3762
3723
|
});
|
|
3763
3724
|
Object.freeze(fakeInternalInstance);
|
|
@@ -3794,7 +3755,7 @@ var classComponentUpdater = {
|
|
|
3794
3755
|
isMounted: isMounted,
|
|
3795
3756
|
enqueueSetState: function (inst, payload, callback) {
|
|
3796
3757
|
var fiber = get(inst);
|
|
3797
|
-
var currentTime =
|
|
3758
|
+
var currentTime = requestCurrentTimeForUpdate();
|
|
3798
3759
|
var suspenseConfig = requestCurrentSuspenseConfig();
|
|
3799
3760
|
var expirationTime = computeExpirationForFiber(currentTime, fiber, suspenseConfig);
|
|
3800
3761
|
var update = createUpdate(expirationTime, suspenseConfig);
|
|
@@ -3813,7 +3774,7 @@ var classComponentUpdater = {
|
|
|
3813
3774
|
},
|
|
3814
3775
|
enqueueReplaceState: function (inst, payload, callback) {
|
|
3815
3776
|
var fiber = get(inst);
|
|
3816
|
-
var currentTime =
|
|
3777
|
+
var currentTime = requestCurrentTimeForUpdate();
|
|
3817
3778
|
var suspenseConfig = requestCurrentSuspenseConfig();
|
|
3818
3779
|
var expirationTime = computeExpirationForFiber(currentTime, fiber, suspenseConfig);
|
|
3819
3780
|
var update = createUpdate(expirationTime, suspenseConfig);
|
|
@@ -3833,7 +3794,7 @@ var classComponentUpdater = {
|
|
|
3833
3794
|
},
|
|
3834
3795
|
enqueueForceUpdate: function (inst, callback) {
|
|
3835
3796
|
var fiber = get(inst);
|
|
3836
|
-
var currentTime =
|
|
3797
|
+
var currentTime = requestCurrentTimeForUpdate();
|
|
3837
3798
|
var suspenseConfig = requestCurrentSuspenseConfig();
|
|
3838
3799
|
var expirationTime = computeExpirationForFiber(currentTime, fiber, suspenseConfig);
|
|
3839
3800
|
var update = createUpdate(expirationTime, suspenseConfig);
|
|
@@ -4448,13 +4409,11 @@ var warnForMissingKey = function (child) {};
|
|
|
4448
4409
|
return;
|
|
4449
4410
|
}
|
|
4450
4411
|
|
|
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
|
-
}
|
|
4412
|
+
if (!(typeof child._store === 'object')) {
|
|
4413
|
+
{
|
|
4414
|
+
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
4415
|
}
|
|
4457
|
-
}
|
|
4416
|
+
}
|
|
4458
4417
|
|
|
4459
4418
|
child._store.validated = true;
|
|
4460
4419
|
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 +4458,20 @@ function coerceRef(returnFiber, current$$1, element) {
|
|
|
4499
4458
|
if (owner) {
|
|
4500
4459
|
var ownerFiber = owner;
|
|
4501
4460
|
|
|
4502
|
-
(
|
|
4503
|
-
|
|
4504
|
-
|
|
4505
|
-
throw ReactError(Error("Function components cannot have refs. Did you mean to use React.forwardRef()?"));
|
|
4506
|
-
}
|
|
4461
|
+
if (!(ownerFiber.tag === ClassComponent)) {
|
|
4462
|
+
{
|
|
4463
|
+
throw Error("Function components cannot have refs. Did you mean to use React.forwardRef()?");
|
|
4507
4464
|
}
|
|
4508
|
-
}
|
|
4465
|
+
}
|
|
4509
4466
|
|
|
4510
4467
|
inst = ownerFiber.stateNode;
|
|
4511
4468
|
}
|
|
4512
4469
|
|
|
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
|
-
}
|
|
4470
|
+
if (!inst) {
|
|
4471
|
+
{
|
|
4472
|
+
throw Error("Missing owner for string ref " + mixedRef + ". This error is likely caused by a bug in React. Please file an issue.");
|
|
4518
4473
|
}
|
|
4519
|
-
}
|
|
4474
|
+
}
|
|
4520
4475
|
|
|
4521
4476
|
var stringRef = '' + mixedRef; // Check if previous string ref matches new string ref
|
|
4522
4477
|
|
|
@@ -4542,21 +4497,17 @@ function coerceRef(returnFiber, current$$1, element) {
|
|
|
4542
4497
|
ref._stringRef = stringRef;
|
|
4543
4498
|
return ref;
|
|
4544
4499
|
} 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
|
-
}
|
|
4500
|
+
if (!(typeof mixedRef === 'string')) {
|
|
4501
|
+
{
|
|
4502
|
+
throw Error("Expected ref to be a function, a string, an object returned by React.createRef(), or null.");
|
|
4550
4503
|
}
|
|
4551
|
-
}
|
|
4504
|
+
}
|
|
4552
4505
|
|
|
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
|
-
}
|
|
4506
|
+
if (!element._owner) {
|
|
4507
|
+
{
|
|
4508
|
+
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
4509
|
}
|
|
4559
|
-
}
|
|
4510
|
+
}
|
|
4560
4511
|
}
|
|
4561
4512
|
}
|
|
4562
4513
|
|
|
@@ -4571,13 +4522,11 @@ function throwOnInvalidObjectType(returnFiber, newChild) {
|
|
|
4571
4522
|
addendum = ' If you meant to render a collection of children, use an array ' + 'instead.' + getCurrentFiberStackInDev();
|
|
4572
4523
|
}
|
|
4573
4524
|
|
|
4574
|
-
|
|
4525
|
+
{
|
|
4575
4526
|
{
|
|
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
|
-
}
|
|
4527
|
+
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
4528
|
}
|
|
4580
|
-
}
|
|
4529
|
+
}
|
|
4581
4530
|
}
|
|
4582
4531
|
}
|
|
4583
4532
|
|
|
@@ -5125,13 +5074,11 @@ function ChildReconciler(shouldTrackSideEffects) {
|
|
|
5125
5074
|
// but using the iterator instead.
|
|
5126
5075
|
var iteratorFn = getIteratorFn(newChildrenIterable);
|
|
5127
5076
|
|
|
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
|
-
}
|
|
5077
|
+
if (!(typeof iteratorFn === 'function')) {
|
|
5078
|
+
{
|
|
5079
|
+
throw Error("An object is not an iterable. This error is likely caused by a bug in React. Please file an issue.");
|
|
5133
5080
|
}
|
|
5134
|
-
}
|
|
5081
|
+
}
|
|
5135
5082
|
|
|
5136
5083
|
{
|
|
5137
5084
|
// We don't support rendering Generators because it's a mutation.
|
|
@@ -5166,13 +5113,11 @@ function ChildReconciler(shouldTrackSideEffects) {
|
|
|
5166
5113
|
|
|
5167
5114
|
var newChildren = iteratorFn.call(newChildrenIterable);
|
|
5168
5115
|
|
|
5169
|
-
(
|
|
5170
|
-
|
|
5171
|
-
|
|
5172
|
-
throw ReactError(Error("An iterable object provided no iterator."));
|
|
5173
|
-
}
|
|
5116
|
+
if (!(newChildren != null)) {
|
|
5117
|
+
{
|
|
5118
|
+
throw Error("An iterable object provided no iterator.");
|
|
5174
5119
|
}
|
|
5175
|
-
}
|
|
5120
|
+
}
|
|
5176
5121
|
|
|
5177
5122
|
var resultingFirstChild = null;
|
|
5178
5123
|
var previousNewFiber = null;
|
|
@@ -5470,13 +5415,11 @@ function ChildReconciler(shouldTrackSideEffects) {
|
|
|
5470
5415
|
{
|
|
5471
5416
|
var Component = returnFiber.type;
|
|
5472
5417
|
|
|
5473
|
-
|
|
5418
|
+
{
|
|
5474
5419
|
{
|
|
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
|
-
}
|
|
5420
|
+
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
5421
|
}
|
|
5479
|
-
}
|
|
5422
|
+
}
|
|
5480
5423
|
}
|
|
5481
5424
|
}
|
|
5482
5425
|
} // Remaining cases are all treated as empty.
|
|
@@ -5491,13 +5434,11 @@ function ChildReconciler(shouldTrackSideEffects) {
|
|
|
5491
5434
|
var reconcileChildFibers = ChildReconciler(true);
|
|
5492
5435
|
var mountChildFibers = ChildReconciler(false);
|
|
5493
5436
|
function cloneChildFibers(current$$1, workInProgress) {
|
|
5494
|
-
(
|
|
5495
|
-
|
|
5496
|
-
|
|
5497
|
-
throw ReactError(Error("Resuming work not yet implemented."));
|
|
5498
|
-
}
|
|
5437
|
+
if (!(current$$1 === null || workInProgress.child === current$$1.child)) {
|
|
5438
|
+
{
|
|
5439
|
+
throw Error("Resuming work not yet implemented.");
|
|
5499
5440
|
}
|
|
5500
|
-
}
|
|
5441
|
+
}
|
|
5501
5442
|
|
|
5502
5443
|
if (workInProgress.child === null) {
|
|
5503
5444
|
return;
|
|
@@ -5532,13 +5473,11 @@ var contextFiberStackCursor = createCursor(NO_CONTEXT);
|
|
|
5532
5473
|
var rootInstanceStackCursor = createCursor(NO_CONTEXT);
|
|
5533
5474
|
|
|
5534
5475
|
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
|
-
}
|
|
5476
|
+
if (!(c !== NO_CONTEXT)) {
|
|
5477
|
+
{
|
|
5478
|
+
throw Error("Expected host context to exist. This error is likely caused by a bug in React. Please file an issue.");
|
|
5540
5479
|
}
|
|
5541
|
-
}
|
|
5480
|
+
}
|
|
5542
5481
|
|
|
5543
5482
|
return c;
|
|
5544
5483
|
}
|
|
@@ -5776,13 +5715,11 @@ function updateEventListener(listener, fiber, visistedResponders, respondersMap,
|
|
|
5776
5715
|
props = listener.props;
|
|
5777
5716
|
}
|
|
5778
5717
|
|
|
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
|
-
}
|
|
5718
|
+
if (!(responder && responder.$$typeof === REACT_RESPONDER_TYPE)) {
|
|
5719
|
+
{
|
|
5720
|
+
throw Error("An invalid value was used as an event listener. Expect one or many event listeners created via React.unstable_useResponder().");
|
|
5784
5721
|
}
|
|
5785
|
-
}
|
|
5722
|
+
}
|
|
5786
5723
|
|
|
5787
5724
|
var listenerProps = props;
|
|
5788
5725
|
|
|
@@ -5897,6 +5834,7 @@ var UnmountPassive =
|
|
|
5897
5834
|
128;
|
|
5898
5835
|
|
|
5899
5836
|
var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher;
|
|
5837
|
+
var ReactCurrentBatchConfig$1 = ReactSharedInternals.ReactCurrentBatchConfig;
|
|
5900
5838
|
var didWarnAboutMismatchedHooksForComponent;
|
|
5901
5839
|
|
|
5902
5840
|
{
|
|
@@ -6014,13 +5952,11 @@ function warnOnHookMismatchInDev(currentHookName) {
|
|
|
6014
5952
|
}
|
|
6015
5953
|
|
|
6016
5954
|
function throwInvalidHookError() {
|
|
6017
|
-
|
|
5955
|
+
{
|
|
6018
5956
|
{
|
|
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
|
-
}
|
|
5957
|
+
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
5958
|
}
|
|
6023
|
-
}
|
|
5959
|
+
}
|
|
6024
5960
|
}
|
|
6025
5961
|
|
|
6026
5962
|
function areHookInputsEqual(nextDeps, prevDeps) {
|
|
@@ -6170,13 +6106,11 @@ function renderWithHooks(current, workInProgress, Component, props, refOrContext
|
|
|
6170
6106
|
// renderPhaseUpdates = null;
|
|
6171
6107
|
// numberOfReRenders = 0;
|
|
6172
6108
|
|
|
6173
|
-
|
|
6174
|
-
|
|
6175
|
-
|
|
6176
|
-
throw ReactError(Error("Rendered fewer hooks than expected. This may be caused by an accidental early return statement."));
|
|
6177
|
-
}
|
|
6109
|
+
if (!!didRenderTooFewHooks) {
|
|
6110
|
+
{
|
|
6111
|
+
throw Error("Rendered fewer hooks than expected. This may be caused by an accidental early return statement.");
|
|
6178
6112
|
}
|
|
6179
|
-
}
|
|
6113
|
+
}
|
|
6180
6114
|
|
|
6181
6115
|
return children;
|
|
6182
6116
|
}
|
|
@@ -6251,13 +6185,11 @@ function updateWorkInProgressHook() {
|
|
|
6251
6185
|
nextCurrentHook = currentHook !== null ? currentHook.next : null;
|
|
6252
6186
|
} else {
|
|
6253
6187
|
// Clone from the current hook.
|
|
6254
|
-
(
|
|
6255
|
-
|
|
6256
|
-
|
|
6257
|
-
throw ReactError(Error("Rendered more hooks than during the previous render."));
|
|
6258
|
-
}
|
|
6188
|
+
if (!(nextCurrentHook !== null)) {
|
|
6189
|
+
{
|
|
6190
|
+
throw Error("Rendered more hooks than during the previous render.");
|
|
6259
6191
|
}
|
|
6260
|
-
}
|
|
6192
|
+
}
|
|
6261
6193
|
|
|
6262
6194
|
currentHook = nextCurrentHook;
|
|
6263
6195
|
var newHook = {
|
|
@@ -6318,13 +6250,11 @@ function updateReducer(reducer, initialArg, init) {
|
|
|
6318
6250
|
var hook = updateWorkInProgressHook();
|
|
6319
6251
|
var queue = hook.queue;
|
|
6320
6252
|
|
|
6321
|
-
(
|
|
6322
|
-
|
|
6323
|
-
|
|
6324
|
-
throw ReactError(Error("Should have a queue. This is likely a bug in React. Please file an issue."));
|
|
6325
|
-
}
|
|
6253
|
+
if (!(queue !== null)) {
|
|
6254
|
+
{
|
|
6255
|
+
throw Error("Should have a queue. This is likely a bug in React. Please file an issue.");
|
|
6326
6256
|
}
|
|
6327
|
-
}
|
|
6257
|
+
}
|
|
6328
6258
|
|
|
6329
6259
|
queue.lastRenderedReducer = reducer;
|
|
6330
6260
|
|
|
@@ -6705,14 +6635,96 @@ function updateMemo(nextCreate, deps) {
|
|
|
6705
6635
|
return nextValue;
|
|
6706
6636
|
}
|
|
6707
6637
|
|
|
6708
|
-
function
|
|
6709
|
-
|
|
6710
|
-
|
|
6711
|
-
|
|
6712
|
-
|
|
6638
|
+
function mountDeferredValue(value, config) {
|
|
6639
|
+
var _mountState = mountState(value),
|
|
6640
|
+
prevValue = _mountState[0],
|
|
6641
|
+
setValue = _mountState[1];
|
|
6642
|
+
|
|
6643
|
+
mountEffect(function () {
|
|
6644
|
+
Scheduler.unstable_next(function () {
|
|
6645
|
+
var previousConfig = ReactCurrentBatchConfig$1.suspense;
|
|
6646
|
+
ReactCurrentBatchConfig$1.suspense = config === undefined ? null : config;
|
|
6647
|
+
|
|
6648
|
+
try {
|
|
6649
|
+
setValue(value);
|
|
6650
|
+
} finally {
|
|
6651
|
+
ReactCurrentBatchConfig$1.suspense = previousConfig;
|
|
6652
|
+
}
|
|
6653
|
+
});
|
|
6654
|
+
}, [value, config]);
|
|
6655
|
+
return prevValue;
|
|
6656
|
+
}
|
|
6657
|
+
|
|
6658
|
+
function updateDeferredValue(value, config) {
|
|
6659
|
+
var _updateState = updateState(value),
|
|
6660
|
+
prevValue = _updateState[0],
|
|
6661
|
+
setValue = _updateState[1];
|
|
6662
|
+
|
|
6663
|
+
updateEffect(function () {
|
|
6664
|
+
Scheduler.unstable_next(function () {
|
|
6665
|
+
var previousConfig = ReactCurrentBatchConfig$1.suspense;
|
|
6666
|
+
ReactCurrentBatchConfig$1.suspense = config === undefined ? null : config;
|
|
6667
|
+
|
|
6668
|
+
try {
|
|
6669
|
+
setValue(value);
|
|
6670
|
+
} finally {
|
|
6671
|
+
ReactCurrentBatchConfig$1.suspense = previousConfig;
|
|
6672
|
+
}
|
|
6673
|
+
});
|
|
6674
|
+
}, [value, config]);
|
|
6675
|
+
return prevValue;
|
|
6676
|
+
}
|
|
6677
|
+
|
|
6678
|
+
function mountTransition(config) {
|
|
6679
|
+
var _mountState2 = mountState(false),
|
|
6680
|
+
isPending = _mountState2[0],
|
|
6681
|
+
setPending = _mountState2[1];
|
|
6682
|
+
|
|
6683
|
+
var startTransition = mountCallback(function (callback) {
|
|
6684
|
+
setPending(true);
|
|
6685
|
+
Scheduler.unstable_next(function () {
|
|
6686
|
+
var previousConfig = ReactCurrentBatchConfig$1.suspense;
|
|
6687
|
+
ReactCurrentBatchConfig$1.suspense = config === undefined ? null : config;
|
|
6688
|
+
|
|
6689
|
+
try {
|
|
6690
|
+
setPending(false);
|
|
6691
|
+
callback();
|
|
6692
|
+
} finally {
|
|
6693
|
+
ReactCurrentBatchConfig$1.suspense = previousConfig;
|
|
6694
|
+
}
|
|
6695
|
+
});
|
|
6696
|
+
}, [config, isPending]);
|
|
6697
|
+
return [startTransition, isPending];
|
|
6698
|
+
}
|
|
6699
|
+
|
|
6700
|
+
function updateTransition(config) {
|
|
6701
|
+
var _updateState2 = updateState(false),
|
|
6702
|
+
isPending = _updateState2[0],
|
|
6703
|
+
setPending = _updateState2[1];
|
|
6704
|
+
|
|
6705
|
+
var startTransition = updateCallback(function (callback) {
|
|
6706
|
+
setPending(true);
|
|
6707
|
+
Scheduler.unstable_next(function () {
|
|
6708
|
+
var previousConfig = ReactCurrentBatchConfig$1.suspense;
|
|
6709
|
+
ReactCurrentBatchConfig$1.suspense = config === undefined ? null : config;
|
|
6710
|
+
|
|
6711
|
+
try {
|
|
6712
|
+
setPending(false);
|
|
6713
|
+
callback();
|
|
6714
|
+
} finally {
|
|
6715
|
+
ReactCurrentBatchConfig$1.suspense = previousConfig;
|
|
6713
6716
|
}
|
|
6717
|
+
});
|
|
6718
|
+
}, [config, isPending]);
|
|
6719
|
+
return [startTransition, isPending];
|
|
6720
|
+
}
|
|
6721
|
+
|
|
6722
|
+
function dispatchAction(fiber, queue, action) {
|
|
6723
|
+
if (!(numberOfReRenders < RE_RENDER_LIMIT)) {
|
|
6724
|
+
{
|
|
6725
|
+
throw Error("Too many re-renders. React limits the number of renders to prevent an infinite loop.");
|
|
6714
6726
|
}
|
|
6715
|
-
}
|
|
6727
|
+
}
|
|
6716
6728
|
|
|
6717
6729
|
{
|
|
6718
6730
|
!(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 +6769,7 @@ function dispatchAction(fiber, queue, action) {
|
|
|
6757
6769
|
lastRenderPhaseUpdate.next = update;
|
|
6758
6770
|
}
|
|
6759
6771
|
} else {
|
|
6760
|
-
var currentTime =
|
|
6772
|
+
var currentTime = requestCurrentTimeForUpdate();
|
|
6761
6773
|
var suspenseConfig = requestCurrentSuspenseConfig();
|
|
6762
6774
|
var expirationTime = computeExpirationForFiber(currentTime, fiber, suspenseConfig);
|
|
6763
6775
|
var _update2 = {
|
|
@@ -6856,7 +6868,9 @@ var ContextOnlyDispatcher = {
|
|
|
6856
6868
|
useRef: throwInvalidHookError,
|
|
6857
6869
|
useState: throwInvalidHookError,
|
|
6858
6870
|
useDebugValue: throwInvalidHookError,
|
|
6859
|
-
useResponder: throwInvalidHookError
|
|
6871
|
+
useResponder: throwInvalidHookError,
|
|
6872
|
+
useDeferredValue: throwInvalidHookError,
|
|
6873
|
+
useTransition: throwInvalidHookError
|
|
6860
6874
|
};
|
|
6861
6875
|
var HooksDispatcherOnMountInDEV = null;
|
|
6862
6876
|
var HooksDispatcherOnMountWithHookTypesInDEV = null;
|
|
@@ -6957,6 +6971,16 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
|
6957
6971
|
currentHookNameInDev = 'useResponder';
|
|
6958
6972
|
mountHookTypesDev();
|
|
6959
6973
|
return createResponderListener(responder, props);
|
|
6974
|
+
},
|
|
6975
|
+
useDeferredValue: function (value, config) {
|
|
6976
|
+
currentHookNameInDev = 'useDeferredValue';
|
|
6977
|
+
mountHookTypesDev();
|
|
6978
|
+
return mountDeferredValue(value, config);
|
|
6979
|
+
},
|
|
6980
|
+
useTransition: function (config) {
|
|
6981
|
+
currentHookNameInDev = 'useTransition';
|
|
6982
|
+
mountHookTypesDev();
|
|
6983
|
+
return mountTransition(config);
|
|
6960
6984
|
}
|
|
6961
6985
|
};
|
|
6962
6986
|
HooksDispatcherOnMountWithHookTypesInDEV = {
|
|
@@ -7038,6 +7062,16 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
|
7038
7062
|
currentHookNameInDev = 'useResponder';
|
|
7039
7063
|
updateHookTypesDev();
|
|
7040
7064
|
return createResponderListener(responder, props);
|
|
7065
|
+
},
|
|
7066
|
+
useDeferredValue: function (value, config) {
|
|
7067
|
+
currentHookNameInDev = 'useDeferredValue';
|
|
7068
|
+
updateHookTypesDev();
|
|
7069
|
+
return mountDeferredValue(value, config);
|
|
7070
|
+
},
|
|
7071
|
+
useTransition: function (config) {
|
|
7072
|
+
currentHookNameInDev = 'useTransition';
|
|
7073
|
+
updateHookTypesDev();
|
|
7074
|
+
return mountTransition(config);
|
|
7041
7075
|
}
|
|
7042
7076
|
};
|
|
7043
7077
|
HooksDispatcherOnUpdateInDEV = {
|
|
@@ -7119,6 +7153,16 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
|
7119
7153
|
currentHookNameInDev = 'useResponder';
|
|
7120
7154
|
updateHookTypesDev();
|
|
7121
7155
|
return createResponderListener(responder, props);
|
|
7156
|
+
},
|
|
7157
|
+
useDeferredValue: function (value, config) {
|
|
7158
|
+
currentHookNameInDev = 'useDeferredValue';
|
|
7159
|
+
updateHookTypesDev();
|
|
7160
|
+
return updateDeferredValue(value, config);
|
|
7161
|
+
},
|
|
7162
|
+
useTransition: function (config) {
|
|
7163
|
+
currentHookNameInDev = 'useTransition';
|
|
7164
|
+
updateHookTypesDev();
|
|
7165
|
+
return updateTransition(config);
|
|
7122
7166
|
}
|
|
7123
7167
|
};
|
|
7124
7168
|
InvalidNestedHooksDispatcherOnMountInDEV = {
|
|
@@ -7212,6 +7256,18 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
|
7212
7256
|
warnInvalidHookAccess();
|
|
7213
7257
|
mountHookTypesDev();
|
|
7214
7258
|
return createResponderListener(responder, props);
|
|
7259
|
+
},
|
|
7260
|
+
useDeferredValue: function (value, config) {
|
|
7261
|
+
currentHookNameInDev = 'useDeferredValue';
|
|
7262
|
+
warnInvalidHookAccess();
|
|
7263
|
+
mountHookTypesDev();
|
|
7264
|
+
return mountDeferredValue(value, config);
|
|
7265
|
+
},
|
|
7266
|
+
useTransition: function (config) {
|
|
7267
|
+
currentHookNameInDev = 'useTransition';
|
|
7268
|
+
warnInvalidHookAccess();
|
|
7269
|
+
mountHookTypesDev();
|
|
7270
|
+
return mountTransition(config);
|
|
7215
7271
|
}
|
|
7216
7272
|
};
|
|
7217
7273
|
InvalidNestedHooksDispatcherOnUpdateInDEV = {
|
|
@@ -7305,6 +7361,18 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
|
7305
7361
|
warnInvalidHookAccess();
|
|
7306
7362
|
updateHookTypesDev();
|
|
7307
7363
|
return createResponderListener(responder, props);
|
|
7364
|
+
},
|
|
7365
|
+
useDeferredValue: function (value, config) {
|
|
7366
|
+
currentHookNameInDev = 'useDeferredValue';
|
|
7367
|
+
warnInvalidHookAccess();
|
|
7368
|
+
updateHookTypesDev();
|
|
7369
|
+
return updateDeferredValue(value, config);
|
|
7370
|
+
},
|
|
7371
|
+
useTransition: function (config) {
|
|
7372
|
+
currentHookNameInDev = 'useTransition';
|
|
7373
|
+
warnInvalidHookAccess();
|
|
7374
|
+
updateHookTypesDev();
|
|
7375
|
+
return updateTransition(config);
|
|
7308
7376
|
}
|
|
7309
7377
|
};
|
|
7310
7378
|
}
|
|
@@ -7593,13 +7661,11 @@ function tryToClaimNextHydratableInstance(fiber) {
|
|
|
7593
7661
|
|
|
7594
7662
|
function prepareToHydrateHostInstance(fiber, rootContainerInstance, hostContext) {
|
|
7595
7663
|
if (!supportsHydration) {
|
|
7596
|
-
|
|
7664
|
+
{
|
|
7597
7665
|
{
|
|
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
|
-
}
|
|
7666
|
+
throw Error("Expected prepareToHydrateHostInstance() to never be called. This error is likely caused by a bug in React. Please file an issue.");
|
|
7601
7667
|
}
|
|
7602
|
-
}
|
|
7668
|
+
}
|
|
7603
7669
|
}
|
|
7604
7670
|
|
|
7605
7671
|
var instance = fiber.stateNode;
|
|
@@ -7617,13 +7683,11 @@ function prepareToHydrateHostInstance(fiber, rootContainerInstance, hostContext)
|
|
|
7617
7683
|
|
|
7618
7684
|
function prepareToHydrateHostTextInstance(fiber) {
|
|
7619
7685
|
if (!supportsHydration) {
|
|
7620
|
-
|
|
7686
|
+
{
|
|
7621
7687
|
{
|
|
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
|
-
}
|
|
7688
|
+
throw Error("Expected prepareToHydrateHostTextInstance() to never be called. This error is likely caused by a bug in React. Please file an issue.");
|
|
7625
7689
|
}
|
|
7626
|
-
}
|
|
7690
|
+
}
|
|
7627
7691
|
}
|
|
7628
7692
|
|
|
7629
7693
|
var textInstance = fiber.stateNode;
|
|
@@ -7663,46 +7727,41 @@ function prepareToHydrateHostTextInstance(fiber) {
|
|
|
7663
7727
|
|
|
7664
7728
|
function prepareToHydrateHostSuspenseInstance(fiber) {
|
|
7665
7729
|
if (!supportsHydration) {
|
|
7666
|
-
|
|
7730
|
+
{
|
|
7667
7731
|
{
|
|
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
|
-
}
|
|
7732
|
+
throw Error("Expected prepareToHydrateHostSuspenseInstance() to never be called. This error is likely caused by a bug in React. Please file an issue.");
|
|
7671
7733
|
}
|
|
7672
|
-
}
|
|
7734
|
+
}
|
|
7673
7735
|
}
|
|
7674
7736
|
|
|
7675
7737
|
var suspenseState = fiber.memoizedState;
|
|
7676
7738
|
var suspenseInstance = suspenseState !== null ? suspenseState.dehydrated : null;
|
|
7677
7739
|
|
|
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
|
-
}
|
|
7740
|
+
if (!suspenseInstance) {
|
|
7741
|
+
{
|
|
7742
|
+
throw Error("Expected to have a hydrated suspense instance. This error is likely caused by a bug in React. Please file an issue.");
|
|
7683
7743
|
}
|
|
7684
|
-
}
|
|
7744
|
+
}
|
|
7685
7745
|
|
|
7686
7746
|
hydrateSuspenseInstance(suspenseInstance, fiber);
|
|
7687
7747
|
}
|
|
7688
7748
|
|
|
7689
7749
|
function skipPastDehydratedSuspenseInstance(fiber) {
|
|
7690
7750
|
if (!supportsHydration) {
|
|
7691
|
-
|
|
7751
|
+
{
|
|
7692
7752
|
{
|
|
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
|
-
}
|
|
7753
|
+
throw Error("Expected skipPastDehydratedSuspenseInstance() to never be called. This error is likely caused by a bug in React. Please file an issue.");
|
|
7696
7754
|
}
|
|
7697
|
-
}
|
|
7755
|
+
}
|
|
7698
7756
|
}
|
|
7699
7757
|
|
|
7700
7758
|
var suspenseState = fiber.memoizedState;
|
|
7701
7759
|
var suspenseInstance = suspenseState !== null ? suspenseState.dehydrated : null;
|
|
7702
7760
|
|
|
7703
|
-
if (suspenseInstance
|
|
7704
|
-
|
|
7705
|
-
|
|
7761
|
+
if (!suspenseInstance) {
|
|
7762
|
+
{
|
|
7763
|
+
throw Error("Expected to have a hydrated suspense instance. This error is likely caused by a bug in React. Please file an issue.");
|
|
7764
|
+
}
|
|
7706
7765
|
}
|
|
7707
7766
|
|
|
7708
7767
|
return getNextHydratableInstanceAfterSuspenseInstance(suspenseInstance);
|
|
@@ -8238,13 +8297,11 @@ function updateHostRoot(current$$1, workInProgress, renderExpirationTime) {
|
|
|
8238
8297
|
pushHostRootContext(workInProgress);
|
|
8239
8298
|
var updateQueue = workInProgress.updateQueue;
|
|
8240
8299
|
|
|
8241
|
-
(
|
|
8242
|
-
|
|
8243
|
-
|
|
8244
|
-
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."));
|
|
8245
|
-
}
|
|
8300
|
+
if (!(updateQueue !== null)) {
|
|
8301
|
+
{
|
|
8302
|
+
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.");
|
|
8246
8303
|
}
|
|
8247
|
-
}
|
|
8304
|
+
}
|
|
8248
8305
|
|
|
8249
8306
|
var nextProps = workInProgress.pendingProps;
|
|
8250
8307
|
var prevState = workInProgress.memoizedState;
|
|
@@ -8431,13 +8488,11 @@ function mountLazyComponent(_current, workInProgress, elementType, updateExpirat
|
|
|
8431
8488
|
// implementation detail.
|
|
8432
8489
|
|
|
8433
8490
|
|
|
8434
|
-
|
|
8491
|
+
{
|
|
8435
8492
|
{
|
|
8436
|
-
|
|
8437
|
-
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));
|
|
8438
|
-
}
|
|
8493
|
+
throw Error("Element type is invalid. Received a promise that resolves to: " + Component + ". Lazy element type must resolve to a class or function." + hint);
|
|
8439
8494
|
}
|
|
8440
|
-
}
|
|
8495
|
+
}
|
|
8441
8496
|
}
|
|
8442
8497
|
}
|
|
8443
8498
|
|
|
@@ -8640,7 +8695,7 @@ function validateFunctionComponentInDev(workInProgress, Component) {
|
|
|
8640
8695
|
|
|
8641
8696
|
var SUSPENDED_MARKER = {
|
|
8642
8697
|
dehydrated: null,
|
|
8643
|
-
retryTime:
|
|
8698
|
+
retryTime: NoWork
|
|
8644
8699
|
};
|
|
8645
8700
|
|
|
8646
8701
|
function shouldRemainOnFallback(suspenseContext, current$$1, workInProgress) {
|
|
@@ -8716,12 +8771,12 @@ function updateSuspenseComponent(current$$1, workInProgress, renderExpirationTim
|
|
|
8716
8771
|
|
|
8717
8772
|
|
|
8718
8773
|
if (current$$1 === null) {
|
|
8719
|
-
|
|
8720
|
-
|
|
8721
|
-
|
|
8722
|
-
|
|
8723
|
-
tryToClaimNextHydratableInstance(workInProgress); // This could've been a dehydrated suspense component.
|
|
8774
|
+
// If we're currently hydrating, try to hydrate this boundary.
|
|
8775
|
+
// But only if this has a fallback.
|
|
8776
|
+
if (nextProps.fallback !== undefined) {
|
|
8777
|
+
tryToClaimNextHydratableInstance(workInProgress); // This could've been a dehydrated suspense component.
|
|
8724
8778
|
|
|
8779
|
+
if (enableSuspenseServerRenderer) {
|
|
8725
8780
|
var suspenseState = workInProgress.memoizedState;
|
|
8726
8781
|
|
|
8727
8782
|
if (suspenseState !== null) {
|
|
@@ -9023,7 +9078,7 @@ function mountDehydratedSuspenseComponent(workInProgress, suspenseInstance, rend
|
|
|
9023
9078
|
// Instead, we'll leave the content in place and try to hydrate it later.
|
|
9024
9079
|
if ((workInProgress.mode & BatchedMode) === NoMode) {
|
|
9025
9080
|
{
|
|
9026
|
-
warning$1(false, 'Cannot hydrate Suspense in legacy mode. Switch from ' + 'ReactDOM.hydrate(element, container) to ' + 'ReactDOM.
|
|
9081
|
+
warning$1(false, 'Cannot hydrate Suspense in legacy mode. Switch from ' + 'ReactDOM.hydrate(element, container) to ' + 'ReactDOM.createSyncRoot(container, { hydrate: true })' + '.render(element) or remove the Suspense components from ' + 'the server rendered components.');
|
|
9027
9082
|
}
|
|
9028
9083
|
|
|
9029
9084
|
workInProgress.expirationTime = Sync;
|
|
@@ -9038,7 +9093,7 @@ function mountDehydratedSuspenseComponent(workInProgress, suspenseInstance, rend
|
|
|
9038
9093
|
// a protocol to transfer that time, we'll just estimate it by using the current
|
|
9039
9094
|
// time. This will mean that Suspense timeouts are slightly shifted to later than
|
|
9040
9095
|
// they should be.
|
|
9041
|
-
var serverDisplayTime =
|
|
9096
|
+
var serverDisplayTime = requestCurrentTimeForUpdate(); // Schedule a normal pri update to render this content.
|
|
9042
9097
|
|
|
9043
9098
|
var newExpirationTime = computeAsyncExpiration(serverDisplayTime);
|
|
9044
9099
|
|
|
@@ -9147,6 +9202,20 @@ function updateDehydratedSuspenseComponent(current$$1, workInProgress, suspenseI
|
|
|
9147
9202
|
}
|
|
9148
9203
|
}
|
|
9149
9204
|
|
|
9205
|
+
function scheduleWorkOnFiber(fiber, renderExpirationTime) {
|
|
9206
|
+
if (fiber.expirationTime < renderExpirationTime) {
|
|
9207
|
+
fiber.expirationTime = renderExpirationTime;
|
|
9208
|
+
}
|
|
9209
|
+
|
|
9210
|
+
var alternate = fiber.alternate;
|
|
9211
|
+
|
|
9212
|
+
if (alternate !== null && alternate.expirationTime < renderExpirationTime) {
|
|
9213
|
+
alternate.expirationTime = renderExpirationTime;
|
|
9214
|
+
}
|
|
9215
|
+
|
|
9216
|
+
scheduleWorkOnParentPath(fiber.return, renderExpirationTime);
|
|
9217
|
+
}
|
|
9218
|
+
|
|
9150
9219
|
function propagateSuspenseContextChange(workInProgress, firstChild, renderExpirationTime) {
|
|
9151
9220
|
// Mark any Suspense boundaries with fallbacks as having work to do.
|
|
9152
9221
|
// If they were previously forced into fallbacks, they may now be able
|
|
@@ -9158,18 +9227,15 @@ function propagateSuspenseContextChange(workInProgress, firstChild, renderExpira
|
|
|
9158
9227
|
var state = node.memoizedState;
|
|
9159
9228
|
|
|
9160
9229
|
if (state !== null) {
|
|
9161
|
-
|
|
9162
|
-
|
|
9163
|
-
|
|
9164
|
-
|
|
9165
|
-
|
|
9166
|
-
|
|
9167
|
-
|
|
9168
|
-
|
|
9169
|
-
|
|
9170
|
-
|
|
9171
|
-
scheduleWorkOnParentPath(node.return, renderExpirationTime);
|
|
9172
|
-
}
|
|
9230
|
+
scheduleWorkOnFiber(node, renderExpirationTime);
|
|
9231
|
+
}
|
|
9232
|
+
} else if (node.tag === SuspenseListComponent) {
|
|
9233
|
+
// If the tail is hidden there might not be an Suspense boundaries
|
|
9234
|
+
// to schedule work on. In this case we have to schedule it on the
|
|
9235
|
+
// list itself.
|
|
9236
|
+
// We don't have to traverse to the children of the list since
|
|
9237
|
+
// the list will propagate the change when it rerenders.
|
|
9238
|
+
scheduleWorkOnFiber(node, renderExpirationTime);
|
|
9173
9239
|
} else if (node.child !== null) {
|
|
9174
9240
|
node.child.return = node;
|
|
9175
9241
|
node = node.child;
|
|
@@ -9314,7 +9380,7 @@ function validateSuspenseListChildren(children, revealOrder) {
|
|
|
9314
9380
|
}
|
|
9315
9381
|
}
|
|
9316
9382
|
|
|
9317
|
-
function initSuspenseListRenderState(workInProgress, isBackwards, tail, lastContentRow, tailMode) {
|
|
9383
|
+
function initSuspenseListRenderState(workInProgress, isBackwards, tail, lastContentRow, tailMode, lastEffectBeforeRendering) {
|
|
9318
9384
|
var renderState = workInProgress.memoizedState;
|
|
9319
9385
|
|
|
9320
9386
|
if (renderState === null) {
|
|
@@ -9324,7 +9390,8 @@ function initSuspenseListRenderState(workInProgress, isBackwards, tail, lastCont
|
|
|
9324
9390
|
last: lastContentRow,
|
|
9325
9391
|
tail: tail,
|
|
9326
9392
|
tailExpiration: 0,
|
|
9327
|
-
tailMode: tailMode
|
|
9393
|
+
tailMode: tailMode,
|
|
9394
|
+
lastEffect: lastEffectBeforeRendering
|
|
9328
9395
|
};
|
|
9329
9396
|
} else {
|
|
9330
9397
|
// We can reuse the existing object from previous renders.
|
|
@@ -9334,6 +9401,7 @@ function initSuspenseListRenderState(workInProgress, isBackwards, tail, lastCont
|
|
|
9334
9401
|
renderState.tail = tail;
|
|
9335
9402
|
renderState.tailExpiration = 0;
|
|
9336
9403
|
renderState.tailMode = tailMode;
|
|
9404
|
+
renderState.lastEffect = lastEffectBeforeRendering;
|
|
9337
9405
|
}
|
|
9338
9406
|
} // This can end up rendering this component multiple passes.
|
|
9339
9407
|
// The first pass splits the children fibers into two sets. A head and tail.
|
|
@@ -9398,7 +9466,7 @@ function updateSuspenseListComponent(current$$1, workInProgress, renderExpiratio
|
|
|
9398
9466
|
}
|
|
9399
9467
|
|
|
9400
9468
|
initSuspenseListRenderState(workInProgress, false, // isBackwards
|
|
9401
|
-
tail, lastContentRow, tailMode);
|
|
9469
|
+
tail, lastContentRow, tailMode, workInProgress.lastEffect);
|
|
9402
9470
|
break;
|
|
9403
9471
|
}
|
|
9404
9472
|
|
|
@@ -9430,7 +9498,7 @@ function updateSuspenseListComponent(current$$1, workInProgress, renderExpiratio
|
|
|
9430
9498
|
|
|
9431
9499
|
initSuspenseListRenderState(workInProgress, true, // isBackwards
|
|
9432
9500
|
_tail, null, // last
|
|
9433
|
-
tailMode);
|
|
9501
|
+
tailMode, workInProgress.lastEffect);
|
|
9434
9502
|
break;
|
|
9435
9503
|
}
|
|
9436
9504
|
|
|
@@ -9439,7 +9507,7 @@ function updateSuspenseListComponent(current$$1, workInProgress, renderExpiratio
|
|
|
9439
9507
|
initSuspenseListRenderState(workInProgress, false, // isBackwards
|
|
9440
9508
|
null, // tail
|
|
9441
9509
|
null, // last
|
|
9442
|
-
undefined);
|
|
9510
|
+
undefined, workInProgress.lastEffect);
|
|
9443
9511
|
break;
|
|
9444
9512
|
}
|
|
9445
9513
|
|
|
@@ -9992,13 +10060,11 @@ function beginWork$1(current$$1, workInProgress, renderExpirationTime) {
|
|
|
9992
10060
|
}
|
|
9993
10061
|
}
|
|
9994
10062
|
|
|
9995
|
-
|
|
10063
|
+
{
|
|
9996
10064
|
{
|
|
9997
|
-
|
|
9998
|
-
throw ReactError(Error("Unknown unit of work tag (" + workInProgress.tag + "). This error is likely caused by a bug in React. Please file an issue."));
|
|
9999
|
-
}
|
|
10065
|
+
throw Error("Unknown unit of work tag (" + workInProgress.tag + "). This error is likely caused by a bug in React. Please file an issue.");
|
|
10000
10066
|
}
|
|
10001
|
-
}
|
|
10067
|
+
}
|
|
10002
10068
|
}
|
|
10003
10069
|
|
|
10004
10070
|
function createFundamentalStateInstance(currentFiber, props, impl, state) {
|
|
@@ -10043,15 +10109,56 @@ function collectScopedNodes(node, fn, scopedNodes) {
|
|
|
10043
10109
|
}
|
|
10044
10110
|
}
|
|
10045
10111
|
|
|
10046
|
-
function
|
|
10047
|
-
|
|
10048
|
-
|
|
10112
|
+
function collectFirstScopedNode(node, fn) {
|
|
10113
|
+
if (enableScopeAPI) {
|
|
10114
|
+
if (node.tag === HostComponent) {
|
|
10115
|
+
var _type2 = node.type,
|
|
10116
|
+
memoizedProps = node.memoizedProps;
|
|
10117
|
+
|
|
10118
|
+
if (fn(_type2, memoizedProps) === true) {
|
|
10119
|
+
return getPublicInstance(node.stateNode);
|
|
10120
|
+
}
|
|
10121
|
+
}
|
|
10122
|
+
|
|
10123
|
+
var child = node.child;
|
|
10124
|
+
|
|
10125
|
+
if (isFiberSuspenseAndTimedOut(node)) {
|
|
10126
|
+
child = getSuspenseFallbackChild(node);
|
|
10127
|
+
}
|
|
10128
|
+
|
|
10129
|
+
if (child !== null) {
|
|
10130
|
+
return collectFirstScopedNodeFromChildren(child, fn);
|
|
10131
|
+
}
|
|
10132
|
+
}
|
|
10133
|
+
|
|
10134
|
+
return null;
|
|
10135
|
+
}
|
|
10136
|
+
|
|
10137
|
+
function collectScopedNodesFromChildren(startingChild, fn, scopedNodes) {
|
|
10138
|
+
var child = startingChild;
|
|
10139
|
+
|
|
10049
10140
|
while (child !== null) {
|
|
10050
10141
|
collectScopedNodes(child, fn, scopedNodes);
|
|
10051
10142
|
child = child.sibling;
|
|
10052
10143
|
}
|
|
10053
10144
|
}
|
|
10054
10145
|
|
|
10146
|
+
function collectFirstScopedNodeFromChildren(startingChild, fn) {
|
|
10147
|
+
var child = startingChild;
|
|
10148
|
+
|
|
10149
|
+
while (child !== null) {
|
|
10150
|
+
var scopedNode = collectFirstScopedNode(child, fn);
|
|
10151
|
+
|
|
10152
|
+
if (scopedNode !== null) {
|
|
10153
|
+
return scopedNode;
|
|
10154
|
+
}
|
|
10155
|
+
|
|
10156
|
+
child = child.sibling;
|
|
10157
|
+
}
|
|
10158
|
+
|
|
10159
|
+
return null;
|
|
10160
|
+
}
|
|
10161
|
+
|
|
10055
10162
|
function collectNearestScopeMethods(node, scope, childrenScopes) {
|
|
10056
10163
|
if (isValidScopeNode(node, scope)) {
|
|
10057
10164
|
childrenScopes.push(node.stateNode.methods);
|
|
@@ -10078,11 +10185,10 @@ function collectNearestChildScopeMethods(startingChild, scope, childrenScopes) {
|
|
|
10078
10185
|
}
|
|
10079
10186
|
|
|
10080
10187
|
function isValidScopeNode(node, scope) {
|
|
10081
|
-
return node.tag === ScopeComponent && node.type === scope;
|
|
10188
|
+
return node.tag === ScopeComponent && node.type === scope && node.stateNode !== null;
|
|
10082
10189
|
}
|
|
10083
10190
|
|
|
10084
10191
|
function createScopeMethods(scope, instance) {
|
|
10085
|
-
var fn = scope.fn;
|
|
10086
10192
|
return {
|
|
10087
10193
|
getChildren: function () {
|
|
10088
10194
|
var currentFiber = instance.fiber;
|
|
@@ -10134,7 +10240,7 @@ function createScopeMethods(scope, instance) {
|
|
|
10134
10240
|
var currentFiber = instance.fiber;
|
|
10135
10241
|
return currentFiber.memoizedProps;
|
|
10136
10242
|
},
|
|
10137
|
-
|
|
10243
|
+
queryAllNodes: function (fn) {
|
|
10138
10244
|
var currentFiber = instance.fiber;
|
|
10139
10245
|
var child = currentFiber.child;
|
|
10140
10246
|
var scopedNodes = [];
|
|
@@ -10144,6 +10250,29 @@ function createScopeMethods(scope, instance) {
|
|
|
10144
10250
|
}
|
|
10145
10251
|
|
|
10146
10252
|
return scopedNodes.length === 0 ? null : scopedNodes;
|
|
10253
|
+
},
|
|
10254
|
+
queryFirstNode: function (fn) {
|
|
10255
|
+
var currentFiber = instance.fiber;
|
|
10256
|
+
var child = currentFiber.child;
|
|
10257
|
+
|
|
10258
|
+
if (child !== null) {
|
|
10259
|
+
return collectFirstScopedNodeFromChildren(child, fn);
|
|
10260
|
+
}
|
|
10261
|
+
|
|
10262
|
+
return null;
|
|
10263
|
+
},
|
|
10264
|
+
containsNode: function (node) {
|
|
10265
|
+
var fiber = getInstanceFromNode(node);
|
|
10266
|
+
|
|
10267
|
+
while (fiber !== null) {
|
|
10268
|
+
if (fiber.tag === ScopeComponent && fiber.type === scope && fiber.stateNode === instance) {
|
|
10269
|
+
return true;
|
|
10270
|
+
}
|
|
10271
|
+
|
|
10272
|
+
fiber = fiber.return;
|
|
10273
|
+
}
|
|
10274
|
+
|
|
10275
|
+
return false;
|
|
10147
10276
|
}
|
|
10148
10277
|
};
|
|
10149
10278
|
}
|
|
@@ -10678,13 +10807,11 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
10678
10807
|
}
|
|
10679
10808
|
} else {
|
|
10680
10809
|
if (!newProps) {
|
|
10681
|
-
(
|
|
10682
|
-
|
|
10683
|
-
|
|
10684
|
-
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."));
|
|
10685
|
-
}
|
|
10810
|
+
if (!(workInProgress.stateNode !== null)) {
|
|
10811
|
+
{
|
|
10812
|
+
throw Error("We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue.");
|
|
10686
10813
|
}
|
|
10687
|
-
}
|
|
10814
|
+
} // This can happen when we abort work.
|
|
10688
10815
|
|
|
10689
10816
|
|
|
10690
10817
|
break;
|
|
@@ -10755,13 +10882,11 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
10755
10882
|
updateHostText$1(current, workInProgress, oldText, newText);
|
|
10756
10883
|
} else {
|
|
10757
10884
|
if (typeof newText !== 'string') {
|
|
10758
|
-
(
|
|
10759
|
-
|
|
10760
|
-
|
|
10761
|
-
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."));
|
|
10762
|
-
}
|
|
10885
|
+
if (!(workInProgress.stateNode !== null)) {
|
|
10886
|
+
{
|
|
10887
|
+
throw Error("We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue.");
|
|
10763
10888
|
}
|
|
10764
|
-
}
|
|
10889
|
+
} // This can happen when we abort work.
|
|
10765
10890
|
|
|
10766
10891
|
}
|
|
10767
10892
|
|
|
@@ -10796,13 +10921,11 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
10796
10921
|
if (current === null) {
|
|
10797
10922
|
var _wasHydrated3 = popHydrationState(workInProgress);
|
|
10798
10923
|
|
|
10799
|
-
|
|
10800
|
-
|
|
10801
|
-
|
|
10802
|
-
throw ReactError(Error("A dehydrated suspense component was completed without a hydrated node. This is probably a bug in React."));
|
|
10803
|
-
}
|
|
10924
|
+
if (!_wasHydrated3) {
|
|
10925
|
+
{
|
|
10926
|
+
throw Error("A dehydrated suspense component was completed without a hydrated node. This is probably a bug in React.");
|
|
10804
10927
|
}
|
|
10805
|
-
}
|
|
10928
|
+
}
|
|
10806
10929
|
|
|
10807
10930
|
prepareToHydrateHostSuspenseInstance(workInProgress);
|
|
10808
10931
|
|
|
@@ -10845,10 +10968,9 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
10845
10968
|
var prevDidTimeout = false;
|
|
10846
10969
|
|
|
10847
10970
|
if (current === null) {
|
|
10848
|
-
|
|
10849
|
-
|
|
10850
|
-
|
|
10851
|
-
popHydrationState(workInProgress);
|
|
10971
|
+
if (workInProgress.memoizedProps.fallback !== undefined) {
|
|
10972
|
+
popHydrationState(workInProgress);
|
|
10973
|
+
}
|
|
10852
10974
|
} else {
|
|
10853
10975
|
var prevState = current.memoizedState;
|
|
10854
10976
|
prevDidTimeout = prevState !== null;
|
|
@@ -11033,7 +11155,11 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
11033
11155
|
// Reset the effect list before doing the second pass since that's now invalid.
|
|
11034
11156
|
|
|
11035
11157
|
|
|
11036
|
-
|
|
11158
|
+
if (renderState.lastEffect === null) {
|
|
11159
|
+
workInProgress.firstEffect = null;
|
|
11160
|
+
}
|
|
11161
|
+
|
|
11162
|
+
workInProgress.lastEffect = renderState.lastEffect; // Reset the child fibers to their original state.
|
|
11037
11163
|
|
|
11038
11164
|
resetChildFibers(workInProgress, renderExpirationTime); // Set up the Suspense Context to force suspense and immediately
|
|
11039
11165
|
// rerender the children.
|
|
@@ -11056,21 +11182,22 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
11056
11182
|
|
|
11057
11183
|
if (_suspended !== null) {
|
|
11058
11184
|
workInProgress.effectTag |= DidCapture;
|
|
11059
|
-
didSuspendAlready = true;
|
|
11185
|
+
didSuspendAlready = true; // Ensure we transfer the update queue to the parent so that it doesn't
|
|
11186
|
+
// get lost if this row ends up dropped during a second pass.
|
|
11187
|
+
|
|
11188
|
+
var _newThennables = _suspended.updateQueue;
|
|
11189
|
+
|
|
11190
|
+
if (_newThennables !== null) {
|
|
11191
|
+
workInProgress.updateQueue = _newThennables;
|
|
11192
|
+
workInProgress.effectTag |= Update;
|
|
11193
|
+
}
|
|
11194
|
+
|
|
11060
11195
|
cutOffTailIfNeeded(renderState, true); // This might have been modified.
|
|
11061
11196
|
|
|
11062
11197
|
if (renderState.tail === null && renderState.tailMode === 'hidden') {
|
|
11063
11198
|
// We need to delete the row we just rendered.
|
|
11064
|
-
//
|
|
11065
|
-
var _newThennables = _suspended.updateQueue;
|
|
11066
|
-
|
|
11067
|
-
if (_newThennables !== null) {
|
|
11068
|
-
workInProgress.updateQueue = _newThennables;
|
|
11069
|
-
workInProgress.effectTag |= Update;
|
|
11070
|
-
} // Reset the effect list to what it w as before we rendered this
|
|
11199
|
+
// Reset the effect list to what it w as before we rendered this
|
|
11071
11200
|
// child. The nested children have already appended themselves.
|
|
11072
|
-
|
|
11073
|
-
|
|
11074
11201
|
var lastEffect = workInProgress.lastEffect = renderState.lastEffect; // Remove any effects that were appended after this point.
|
|
11075
11202
|
|
|
11076
11203
|
if (lastEffect !== null) {
|
|
@@ -11257,13 +11384,11 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
11257
11384
|
}
|
|
11258
11385
|
|
|
11259
11386
|
default:
|
|
11260
|
-
|
|
11387
|
+
{
|
|
11261
11388
|
{
|
|
11262
|
-
|
|
11263
|
-
throw ReactError(Error("Unknown unit of work tag (" + workInProgress.tag + "). This error is likely caused by a bug in React. Please file an issue."));
|
|
11264
|
-
}
|
|
11389
|
+
throw Error("Unknown unit of work tag (" + workInProgress.tag + "). This error is likely caused by a bug in React. Please file an issue.");
|
|
11265
11390
|
}
|
|
11266
|
-
}
|
|
11391
|
+
}
|
|
11267
11392
|
|
|
11268
11393
|
}
|
|
11269
11394
|
|
|
@@ -11296,13 +11421,11 @@ function unwindWork(workInProgress, renderExpirationTime) {
|
|
|
11296
11421
|
popTopLevelContextObject(workInProgress);
|
|
11297
11422
|
var _effectTag = workInProgress.effectTag;
|
|
11298
11423
|
|
|
11299
|
-
(
|
|
11300
|
-
|
|
11301
|
-
|
|
11302
|
-
throw ReactError(Error("The root failed to unmount after an error. This is likely a bug in React. Please file an issue."));
|
|
11303
|
-
}
|
|
11424
|
+
if (!((_effectTag & DidCapture) === NoEffect)) {
|
|
11425
|
+
{
|
|
11426
|
+
throw Error("The root failed to unmount after an error. This is likely a bug in React. Please file an issue.");
|
|
11304
11427
|
}
|
|
11305
|
-
}
|
|
11428
|
+
}
|
|
11306
11429
|
|
|
11307
11430
|
workInProgress.effectTag = _effectTag & ~ShouldCapture | DidCapture;
|
|
11308
11431
|
return workInProgress;
|
|
@@ -11323,13 +11446,11 @@ function unwindWork(workInProgress, renderExpirationTime) {
|
|
|
11323
11446
|
var suspenseState = workInProgress.memoizedState;
|
|
11324
11447
|
|
|
11325
11448
|
if (suspenseState !== null && suspenseState.dehydrated !== null) {
|
|
11326
|
-
(
|
|
11327
|
-
|
|
11328
|
-
|
|
11329
|
-
throw ReactError(Error("Threw in newly mounted dehydrated component. This is likely a bug in React. Please file an issue."));
|
|
11330
|
-
}
|
|
11449
|
+
if (!(workInProgress.alternate !== null)) {
|
|
11450
|
+
{
|
|
11451
|
+
throw Error("Threw in newly mounted dehydrated component. This is likely a bug in React. Please file an issue.");
|
|
11331
11452
|
}
|
|
11332
|
-
}
|
|
11453
|
+
}
|
|
11333
11454
|
|
|
11334
11455
|
resetHydrationState();
|
|
11335
11456
|
}
|
|
@@ -11463,13 +11584,11 @@ var invokeGuardedCallbackImpl = function (name, func, context, a, b, c, d, e, f)
|
|
|
11463
11584
|
// when we call document.createEvent(). However this can cause confusing
|
|
11464
11585
|
// errors: https://github.com/facebookincubator/create-react-app/issues/3482
|
|
11465
11586
|
// So we preemptively throw with a better message instead.
|
|
11466
|
-
(
|
|
11467
|
-
|
|
11468
|
-
|
|
11469
|
-
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."));
|
|
11470
|
-
}
|
|
11587
|
+
if (!(typeof document !== 'undefined')) {
|
|
11588
|
+
{
|
|
11589
|
+
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.");
|
|
11471
11590
|
}
|
|
11472
|
-
}
|
|
11591
|
+
}
|
|
11473
11592
|
|
|
11474
11593
|
var evt = document.createEvent('Event'); // Keeps track of whether the user-provided callback threw an error. We
|
|
11475
11594
|
// set this to true at the beginning, then set it to false right after
|
|
@@ -11637,13 +11756,11 @@ function clearCaughtError() {
|
|
|
11637
11756
|
caughtError = null;
|
|
11638
11757
|
return error;
|
|
11639
11758
|
} else {
|
|
11640
|
-
|
|
11759
|
+
{
|
|
11641
11760
|
{
|
|
11642
|
-
|
|
11643
|
-
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."));
|
|
11644
|
-
}
|
|
11761
|
+
throw Error("clearCaughtError was called but no error was captured. This error is likely caused by a bug in React. Please file an issue.");
|
|
11645
11762
|
}
|
|
11646
|
-
}
|
|
11763
|
+
}
|
|
11647
11764
|
}
|
|
11648
11765
|
}
|
|
11649
11766
|
|
|
@@ -11863,13 +11980,11 @@ function commitBeforeMutationLifeCycles(current$$1, finishedWork) {
|
|
|
11863
11980
|
|
|
11864
11981
|
default:
|
|
11865
11982
|
{
|
|
11866
|
-
|
|
11983
|
+
{
|
|
11867
11984
|
{
|
|
11868
|
-
|
|
11869
|
-
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."));
|
|
11870
|
-
}
|
|
11985
|
+
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.");
|
|
11871
11986
|
}
|
|
11872
|
-
}
|
|
11987
|
+
}
|
|
11873
11988
|
}
|
|
11874
11989
|
}
|
|
11875
11990
|
}
|
|
@@ -12091,13 +12206,11 @@ function commitLifeCycles(finishedRoot, current$$1, finishedWork, committedExpir
|
|
|
12091
12206
|
|
|
12092
12207
|
default:
|
|
12093
12208
|
{
|
|
12094
|
-
|
|
12209
|
+
{
|
|
12095
12210
|
{
|
|
12096
|
-
|
|
12097
|
-
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."));
|
|
12098
|
-
}
|
|
12211
|
+
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.");
|
|
12099
12212
|
}
|
|
12100
|
-
}
|
|
12213
|
+
}
|
|
12101
12214
|
}
|
|
12102
12215
|
}
|
|
12103
12216
|
}
|
|
@@ -12442,13 +12555,11 @@ function commitContainer(finishedWork) {
|
|
|
12442
12555
|
|
|
12443
12556
|
default:
|
|
12444
12557
|
{
|
|
12445
|
-
|
|
12558
|
+
{
|
|
12446
12559
|
{
|
|
12447
|
-
|
|
12448
|
-
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."));
|
|
12449
|
-
}
|
|
12560
|
+
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.");
|
|
12450
12561
|
}
|
|
12451
|
-
}
|
|
12562
|
+
}
|
|
12452
12563
|
}
|
|
12453
12564
|
}
|
|
12454
12565
|
}
|
|
@@ -12464,13 +12575,11 @@ function getHostParentFiber(fiber) {
|
|
|
12464
12575
|
parent = parent.return;
|
|
12465
12576
|
}
|
|
12466
12577
|
|
|
12467
|
-
|
|
12578
|
+
{
|
|
12468
12579
|
{
|
|
12469
|
-
|
|
12470
|
-
throw ReactError(Error("Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue."));
|
|
12471
|
-
}
|
|
12580
|
+
throw Error("Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue.");
|
|
12472
12581
|
}
|
|
12473
|
-
}
|
|
12582
|
+
}
|
|
12474
12583
|
}
|
|
12475
12584
|
|
|
12476
12585
|
function isHostParent(fiber) {
|
|
@@ -12562,13 +12671,11 @@ function commitPlacement(finishedWork) {
|
|
|
12562
12671
|
// eslint-disable-next-line-no-fallthrough
|
|
12563
12672
|
|
|
12564
12673
|
default:
|
|
12565
|
-
|
|
12674
|
+
{
|
|
12566
12675
|
{
|
|
12567
|
-
|
|
12568
|
-
throw ReactError(Error("Invalid host parent fiber. This error is likely caused by a bug in React. Please file an issue."));
|
|
12569
|
-
}
|
|
12676
|
+
throw Error("Invalid host parent fiber. This error is likely caused by a bug in React. Please file an issue.");
|
|
12570
12677
|
}
|
|
12571
|
-
}
|
|
12678
|
+
}
|
|
12572
12679
|
|
|
12573
12680
|
}
|
|
12574
12681
|
|
|
@@ -12645,13 +12752,11 @@ function unmountHostComponents(finishedRoot, current$$1, renderPriorityLevel) {
|
|
|
12645
12752
|
var parent = node.return;
|
|
12646
12753
|
|
|
12647
12754
|
findParent: while (true) {
|
|
12648
|
-
(
|
|
12649
|
-
|
|
12650
|
-
|
|
12651
|
-
throw ReactError(Error("Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue."));
|
|
12652
|
-
}
|
|
12755
|
+
if (!(parent !== null)) {
|
|
12756
|
+
{
|
|
12757
|
+
throw Error("Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue.");
|
|
12653
12758
|
}
|
|
12654
|
-
}
|
|
12759
|
+
}
|
|
12655
12760
|
|
|
12656
12761
|
var parentStateNode = parent.stateNode;
|
|
12657
12762
|
|
|
@@ -12885,13 +12990,11 @@ function commitWork(current$$1, finishedWork) {
|
|
|
12885
12990
|
|
|
12886
12991
|
case HostText:
|
|
12887
12992
|
{
|
|
12888
|
-
(
|
|
12889
|
-
|
|
12890
|
-
|
|
12891
|
-
throw ReactError(Error("This should have a text node initialized. This error is likely caused by a bug in React. Please file an issue."));
|
|
12892
|
-
}
|
|
12993
|
+
if (!(finishedWork.stateNode !== null)) {
|
|
12994
|
+
{
|
|
12995
|
+
throw Error("This should have a text node initialized. This error is likely caused by a bug in React. Please file an issue.");
|
|
12893
12996
|
}
|
|
12894
|
-
}
|
|
12997
|
+
}
|
|
12895
12998
|
|
|
12896
12999
|
var textInstance = finishedWork.stateNode;
|
|
12897
13000
|
var newText = finishedWork.memoizedProps; // For hydration we reuse the update path but we treat the oldProps
|
|
@@ -12976,13 +13079,11 @@ function commitWork(current$$1, finishedWork) {
|
|
|
12976
13079
|
|
|
12977
13080
|
default:
|
|
12978
13081
|
{
|
|
12979
|
-
|
|
13082
|
+
{
|
|
12980
13083
|
{
|
|
12981
|
-
|
|
12982
|
-
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."));
|
|
12983
|
-
}
|
|
13084
|
+
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.");
|
|
12984
13085
|
}
|
|
12985
|
-
}
|
|
13086
|
+
}
|
|
12986
13087
|
}
|
|
12987
13088
|
}
|
|
12988
13089
|
}
|
|
@@ -13406,7 +13507,6 @@ var RootErrored = 2;
|
|
|
13406
13507
|
var RootSuspended = 3;
|
|
13407
13508
|
var RootSuspendedWithDelay = 4;
|
|
13408
13509
|
var RootCompleted = 5;
|
|
13409
|
-
var RootLocked = 6;
|
|
13410
13510
|
// Describes where we are in the React execution stack
|
|
13411
13511
|
var executionContext = NoContext; // The root we're working on
|
|
13412
13512
|
|
|
@@ -13466,7 +13566,7 @@ var spawnedWorkDuringRender = null; // Expiration times are computed by adding t
|
|
|
13466
13566
|
// receive the same expiration time. Otherwise we get tearing.
|
|
13467
13567
|
|
|
13468
13568
|
var currentEventTime = NoWork;
|
|
13469
|
-
function
|
|
13569
|
+
function requestCurrentTimeForUpdate() {
|
|
13470
13570
|
if ((executionContext & (RenderContext | CommitContext)) !== NoContext) {
|
|
13471
13571
|
// We're inside React, so it's fine to read the actual time.
|
|
13472
13572
|
return msToExpirationTime(now$1());
|
|
@@ -13482,6 +13582,9 @@ function requestCurrentTime() {
|
|
|
13482
13582
|
currentEventTime = msToExpirationTime(now$1());
|
|
13483
13583
|
return currentEventTime;
|
|
13484
13584
|
}
|
|
13585
|
+
function getCurrentTime() {
|
|
13586
|
+
return msToExpirationTime(now$1());
|
|
13587
|
+
}
|
|
13485
13588
|
function computeExpirationForFiber(currentTime, fiber, suspenseConfig) {
|
|
13486
13589
|
var mode = fiber.mode;
|
|
13487
13590
|
|
|
@@ -13530,13 +13633,11 @@ function computeExpirationForFiber(currentTime, fiber, suspenseConfig) {
|
|
|
13530
13633
|
break;
|
|
13531
13634
|
|
|
13532
13635
|
default:
|
|
13533
|
-
|
|
13636
|
+
{
|
|
13534
13637
|
{
|
|
13535
|
-
|
|
13536
|
-
throw ReactError(Error("Expected a valid priority level"));
|
|
13537
|
-
}
|
|
13638
|
+
throw Error("Expected a valid priority level");
|
|
13538
13639
|
}
|
|
13539
|
-
}
|
|
13640
|
+
}
|
|
13540
13641
|
|
|
13541
13642
|
}
|
|
13542
13643
|
} // If we're in the middle of rendering a tree, do not update at the same
|
|
@@ -13553,21 +13654,6 @@ function computeExpirationForFiber(currentTime, fiber, suspenseConfig) {
|
|
|
13553
13654
|
|
|
13554
13655
|
return expirationTime;
|
|
13555
13656
|
}
|
|
13556
|
-
var lastUniqueAsyncExpiration = NoWork;
|
|
13557
|
-
function computeUniqueAsyncExpiration() {
|
|
13558
|
-
var currentTime = requestCurrentTime();
|
|
13559
|
-
var result = computeAsyncExpiration(currentTime);
|
|
13560
|
-
|
|
13561
|
-
if (result <= lastUniqueAsyncExpiration) {
|
|
13562
|
-
// Since we assume the current time monotonically increases, we only hit
|
|
13563
|
-
// this branch when computeUniqueAsyncExpiration is fired multiple times
|
|
13564
|
-
// within a 200ms window (or whatever the async bucket size is).
|
|
13565
|
-
result -= 1;
|
|
13566
|
-
}
|
|
13567
|
-
|
|
13568
|
-
lastUniqueAsyncExpiration = result;
|
|
13569
|
-
return result;
|
|
13570
|
-
}
|
|
13571
13657
|
function scheduleUpdateOnFiber(fiber, expirationTime) {
|
|
13572
13658
|
checkForNestedUpdates();
|
|
13573
13659
|
warnAboutInvalidUpdatesOnClassComponentsInDEV(fiber);
|
|
@@ -13764,7 +13850,7 @@ function ensureRootIsScheduled(root) {
|
|
|
13764
13850
|
// time as an argument.
|
|
13765
13851
|
|
|
13766
13852
|
|
|
13767
|
-
var currentTime =
|
|
13853
|
+
var currentTime = requestCurrentTimeForUpdate();
|
|
13768
13854
|
var priorityLevel = inferPriorityFromExpirationTime(currentTime, expirationTime); // If there's an existing render task, confirm it has the correct priority and
|
|
13769
13855
|
// expiration time. Otherwise, we'll cancel it and schedule a new one.
|
|
13770
13856
|
|
|
@@ -13815,7 +13901,7 @@ function performConcurrentWorkOnRoot(root, didTimeout) {
|
|
|
13815
13901
|
if (didTimeout) {
|
|
13816
13902
|
// The render task took too long to complete. Mark the current time as
|
|
13817
13903
|
// expired to synchronously render all expired work in a single batch.
|
|
13818
|
-
var currentTime =
|
|
13904
|
+
var currentTime = requestCurrentTimeForUpdate();
|
|
13819
13905
|
markRootExpiredAtTime(root, currentTime); // This will schedule a synchronous callback.
|
|
13820
13906
|
|
|
13821
13907
|
ensureRootIsScheduled(root);
|
|
@@ -13829,13 +13915,11 @@ function performConcurrentWorkOnRoot(root, didTimeout) {
|
|
|
13829
13915
|
if (expirationTime !== NoWork) {
|
|
13830
13916
|
var originalCallbackNode = root.callbackNode;
|
|
13831
13917
|
|
|
13832
|
-
(
|
|
13833
|
-
|
|
13834
|
-
|
|
13835
|
-
throw ReactError(Error("Should not already be working."));
|
|
13836
|
-
}
|
|
13918
|
+
if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) {
|
|
13919
|
+
{
|
|
13920
|
+
throw Error("Should not already be working.");
|
|
13837
13921
|
}
|
|
13838
|
-
}
|
|
13922
|
+
}
|
|
13839
13923
|
|
|
13840
13924
|
flushPassiveEffects(); // If the root or expiration time have changed, throw out the existing stack
|
|
13841
13925
|
// and prepare a fresh one. Otherwise we'll continue where we left off.
|
|
@@ -13889,7 +13973,6 @@ function performConcurrentWorkOnRoot(root, didTimeout) {
|
|
|
13889
13973
|
stopFinishedWorkLoopTimer();
|
|
13890
13974
|
var finishedWork = root.finishedWork = root.current.alternate;
|
|
13891
13975
|
root.finishedExpirationTime = expirationTime;
|
|
13892
|
-
resolveLocksOnRoot(root, expirationTime);
|
|
13893
13976
|
finishConcurrentRender(root, finishedWork, workInProgressRootExitStatus, expirationTime);
|
|
13894
13977
|
}
|
|
13895
13978
|
|
|
@@ -13914,13 +13997,11 @@ function finishConcurrentRender(root, finishedWork, exitStatus, expirationTime)
|
|
|
13914
13997
|
case RootIncomplete:
|
|
13915
13998
|
case RootFatalErrored:
|
|
13916
13999
|
{
|
|
13917
|
-
|
|
14000
|
+
{
|
|
13918
14001
|
{
|
|
13919
|
-
|
|
13920
|
-
throw ReactError(Error("Root did not complete. This is a bug in React."));
|
|
13921
|
-
}
|
|
14002
|
+
throw Error("Root did not complete. This is a bug in React.");
|
|
13922
14003
|
}
|
|
13923
|
-
}
|
|
14004
|
+
}
|
|
13924
14005
|
}
|
|
13925
14006
|
// Flow knows about invariant, so it complains if I add a break
|
|
13926
14007
|
// statement, but eslint doesn't know about invariant, so it complains
|
|
@@ -13928,18 +14009,16 @@ function finishConcurrentRender(root, finishedWork, exitStatus, expirationTime)
|
|
|
13928
14009
|
|
|
13929
14010
|
case RootErrored:
|
|
13930
14011
|
{
|
|
13931
|
-
|
|
13932
|
-
|
|
13933
|
-
|
|
13934
|
-
|
|
13935
|
-
|
|
13936
|
-
|
|
13937
|
-
|
|
13938
|
-
|
|
13939
|
-
|
|
13940
|
-
|
|
14012
|
+
// If this was an async render, the error may have happened due to
|
|
14013
|
+
// a mutation in a concurrent event. Try rendering one more time,
|
|
14014
|
+
// synchronously, to see if the error goes away. If there are
|
|
14015
|
+
// lower priority updates, let's include those, too, in case they
|
|
14016
|
+
// fix the inconsistency. Render at Idle to include all updates.
|
|
14017
|
+
// If it was Idle or Never or some not-yet-invented time, render
|
|
14018
|
+
// at that time.
|
|
14019
|
+
markRootExpiredAtTime(root, expirationTime > Idle ? Idle : expirationTime); // We assume that this second render pass will be synchronous
|
|
14020
|
+
// and therefore not hit this path again.
|
|
13941
14021
|
|
|
13942
|
-
commitRoot(root);
|
|
13943
14022
|
break;
|
|
13944
14023
|
}
|
|
13945
14024
|
|
|
@@ -14123,24 +14202,13 @@ function finishConcurrentRender(root, finishedWork, exitStatus, expirationTime)
|
|
|
14123
14202
|
break;
|
|
14124
14203
|
}
|
|
14125
14204
|
|
|
14126
|
-
case RootLocked:
|
|
14127
|
-
{
|
|
14128
|
-
// This root has a lock that prevents it from committing. Exit. If
|
|
14129
|
-
// we begin work on the root again, without any intervening updates,
|
|
14130
|
-
// it will finish without doing additional work.
|
|
14131
|
-
markRootSuspendedAtTime(root, expirationTime);
|
|
14132
|
-
break;
|
|
14133
|
-
}
|
|
14134
|
-
|
|
14135
14205
|
default:
|
|
14136
14206
|
{
|
|
14137
|
-
|
|
14207
|
+
{
|
|
14138
14208
|
{
|
|
14139
|
-
|
|
14140
|
-
throw ReactError(Error("Unknown root exit status."));
|
|
14141
|
-
}
|
|
14209
|
+
throw Error("Unknown root exit status.");
|
|
14142
14210
|
}
|
|
14143
|
-
}
|
|
14211
|
+
}
|
|
14144
14212
|
}
|
|
14145
14213
|
}
|
|
14146
14214
|
} // This is the entry point for synchronous tasks that don't go
|
|
@@ -14158,13 +14226,11 @@ function performSyncWorkOnRoot(root) {
|
|
|
14158
14226
|
// batch.commit() API.
|
|
14159
14227
|
commitRoot(root);
|
|
14160
14228
|
} else {
|
|
14161
|
-
(
|
|
14162
|
-
|
|
14163
|
-
|
|
14164
|
-
throw ReactError(Error("Should not already be working."));
|
|
14165
|
-
}
|
|
14229
|
+
if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) {
|
|
14230
|
+
{
|
|
14231
|
+
throw Error("Should not already be working.");
|
|
14166
14232
|
}
|
|
14167
|
-
}
|
|
14233
|
+
}
|
|
14168
14234
|
|
|
14169
14235
|
flushPassiveEffects(); // If the root or expiration time have changed, throw out the existing stack
|
|
14170
14236
|
// and prepare a fresh one. Otherwise we'll continue where we left off.
|
|
@@ -14211,21 +14277,17 @@ function performSyncWorkOnRoot(root) {
|
|
|
14211
14277
|
|
|
14212
14278
|
if (workInProgress !== null) {
|
|
14213
14279
|
// This is a sync render, so we should have finished the whole tree.
|
|
14214
|
-
|
|
14280
|
+
{
|
|
14215
14281
|
{
|
|
14216
|
-
|
|
14217
|
-
throw ReactError(Error("Cannot commit an incomplete root. This error is likely caused by a bug in React. Please file an issue."));
|
|
14218
|
-
}
|
|
14282
|
+
throw Error("Cannot commit an incomplete root. This error is likely caused by a bug in React. Please file an issue.");
|
|
14219
14283
|
}
|
|
14220
|
-
}
|
|
14284
|
+
}
|
|
14221
14285
|
} else {
|
|
14222
14286
|
// We now have a consistent tree. Because this is a sync render, we
|
|
14223
|
-
// will commit it even if something suspended.
|
|
14224
|
-
// if the root is locked (using the unstable_createBatch API).
|
|
14287
|
+
// will commit it even if something suspended.
|
|
14225
14288
|
stopFinishedWorkLoopTimer();
|
|
14226
14289
|
root.finishedWork = root.current.alternate;
|
|
14227
14290
|
root.finishedExpirationTime = expirationTime;
|
|
14228
|
-
resolveLocksOnRoot(root, expirationTime);
|
|
14229
14291
|
finishSyncRender(root, workInProgressRootExitStatus, expirationTime);
|
|
14230
14292
|
} // Before exiting, make sure there's a callback scheduled for the next
|
|
14231
14293
|
// pending level.
|
|
@@ -14239,39 +14301,25 @@ function performSyncWorkOnRoot(root) {
|
|
|
14239
14301
|
}
|
|
14240
14302
|
|
|
14241
14303
|
function finishSyncRender(root, exitStatus, expirationTime) {
|
|
14242
|
-
|
|
14243
|
-
|
|
14244
|
-
// begin work on the root again, without any intervening updates, it
|
|
14245
|
-
// will finish without doing additional work.
|
|
14246
|
-
markRootSuspendedAtTime(root, expirationTime);
|
|
14247
|
-
} else {
|
|
14248
|
-
// Set this to null to indicate there's no in-progress render.
|
|
14249
|
-
workInProgressRoot = null;
|
|
14304
|
+
// Set this to null to indicate there's no in-progress render.
|
|
14305
|
+
workInProgressRoot = null;
|
|
14250
14306
|
|
|
14251
|
-
|
|
14252
|
-
|
|
14253
|
-
|
|
14254
|
-
}
|
|
14307
|
+
{
|
|
14308
|
+
if (exitStatus === RootSuspended || exitStatus === RootSuspendedWithDelay) {
|
|
14309
|
+
flushSuspensePriorityWarningInDEV();
|
|
14255
14310
|
}
|
|
14256
|
-
|
|
14257
|
-
commitRoot(root);
|
|
14258
14311
|
}
|
|
14312
|
+
|
|
14313
|
+
commitRoot(root);
|
|
14259
14314
|
}
|
|
14260
14315
|
|
|
14261
14316
|
function flushRoot(root, expirationTime) {
|
|
14262
|
-
if ((executionContext & (RenderContext | CommitContext)) !== NoContext) {
|
|
14263
|
-
(function () {
|
|
14264
|
-
{
|
|
14265
|
-
{
|
|
14266
|
-
throw ReactError(Error("work.commit(): Cannot commit while already rendering. This likely means you attempted to commit from inside a lifecycle method."));
|
|
14267
|
-
}
|
|
14268
|
-
}
|
|
14269
|
-
})();
|
|
14270
|
-
}
|
|
14271
|
-
|
|
14272
14317
|
markRootExpiredAtTime(root, expirationTime);
|
|
14273
14318
|
ensureRootIsScheduled(root);
|
|
14274
|
-
|
|
14319
|
+
|
|
14320
|
+
if ((executionContext & (RenderContext | CommitContext)) === NoContext) {
|
|
14321
|
+
flushSyncCallbackQueue();
|
|
14322
|
+
}
|
|
14275
14323
|
}
|
|
14276
14324
|
function flushDiscreteUpdates() {
|
|
14277
14325
|
// TODO: Should be able to flush inside batchedUpdates, but not inside `act`.
|
|
@@ -14294,20 +14342,6 @@ function flushDiscreteUpdates() {
|
|
|
14294
14342
|
|
|
14295
14343
|
flushPassiveEffects();
|
|
14296
14344
|
}
|
|
14297
|
-
|
|
14298
|
-
function resolveLocksOnRoot(root, expirationTime) {
|
|
14299
|
-
var firstBatch = root.firstBatch;
|
|
14300
|
-
|
|
14301
|
-
if (firstBatch !== null && firstBatch._defer && firstBatch._expirationTime >= expirationTime) {
|
|
14302
|
-
scheduleCallback(NormalPriority, function () {
|
|
14303
|
-
firstBatch._onComplete();
|
|
14304
|
-
|
|
14305
|
-
return null;
|
|
14306
|
-
});
|
|
14307
|
-
workInProgressRootExitStatus = RootLocked;
|
|
14308
|
-
}
|
|
14309
|
-
}
|
|
14310
|
-
|
|
14311
14345
|
function deferredUpdates(fn) {
|
|
14312
14346
|
// TODO: Remove in favor of Scheduler.next
|
|
14313
14347
|
return runWithPriority(NormalPriority, fn);
|
|
@@ -14395,13 +14429,11 @@ function unbatchedUpdates(fn, a) {
|
|
|
14395
14429
|
}
|
|
14396
14430
|
function flushSync(fn, a) {
|
|
14397
14431
|
if ((executionContext & (RenderContext | CommitContext)) !== NoContext) {
|
|
14398
|
-
|
|
14432
|
+
{
|
|
14399
14433
|
{
|
|
14400
|
-
|
|
14401
|
-
throw ReactError(Error("flushSync was called from inside a lifecycle method. It cannot be called when React is already rendering."));
|
|
14402
|
-
}
|
|
14434
|
+
throw Error("flushSync was called from inside a lifecycle method. It cannot be called when React is already rendering.");
|
|
14403
14435
|
}
|
|
14404
|
-
}
|
|
14436
|
+
}
|
|
14405
14437
|
}
|
|
14406
14438
|
|
|
14407
14439
|
var prevExecutionContext = executionContext;
|
|
@@ -14482,6 +14514,7 @@ function handleError(root, thrownValue) {
|
|
|
14482
14514
|
// Reset module-level state that was set during the render phase.
|
|
14483
14515
|
resetContextDependencies();
|
|
14484
14516
|
resetHooks();
|
|
14517
|
+
resetCurrentFiber();
|
|
14485
14518
|
|
|
14486
14519
|
if (workInProgress === null || workInProgress.return === null) {
|
|
14487
14520
|
// Expected to be working on a non-root fiber. This is a fatal error
|
|
@@ -14881,13 +14914,11 @@ function commitRootImpl(root, renderPriorityLevel) {
|
|
|
14881
14914
|
flushPassiveEffects();
|
|
14882
14915
|
flushRenderPhaseStrictModeWarningsInDEV();
|
|
14883
14916
|
|
|
14884
|
-
(
|
|
14885
|
-
|
|
14886
|
-
|
|
14887
|
-
throw ReactError(Error("Should not already be working."));
|
|
14888
|
-
}
|
|
14917
|
+
if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) {
|
|
14918
|
+
{
|
|
14919
|
+
throw Error("Should not already be working.");
|
|
14889
14920
|
}
|
|
14890
|
-
}
|
|
14921
|
+
}
|
|
14891
14922
|
|
|
14892
14923
|
var finishedWork = root.finishedWork;
|
|
14893
14924
|
var expirationTime = root.finishedExpirationTime;
|
|
@@ -14899,13 +14930,11 @@ function commitRootImpl(root, renderPriorityLevel) {
|
|
|
14899
14930
|
root.finishedWork = null;
|
|
14900
14931
|
root.finishedExpirationTime = NoWork;
|
|
14901
14932
|
|
|
14902
|
-
(
|
|
14903
|
-
|
|
14904
|
-
|
|
14905
|
-
throw ReactError(Error("Cannot commit the same tree as before. This error is likely caused by a bug in React. Please file an issue."));
|
|
14906
|
-
}
|
|
14933
|
+
if (!(finishedWork !== root.current)) {
|
|
14934
|
+
{
|
|
14935
|
+
throw Error("Cannot commit the same tree as before. This error is likely caused by a bug in React. Please file an issue.");
|
|
14907
14936
|
}
|
|
14908
|
-
}
|
|
14937
|
+
} // commitRoot never returns a continuation; it always finishes synchronously.
|
|
14909
14938
|
// So we can clear these now to allow a new callback to be scheduled.
|
|
14910
14939
|
|
|
14911
14940
|
|
|
@@ -14969,13 +14998,11 @@ function commitRootImpl(root, renderPriorityLevel) {
|
|
|
14969
14998
|
invokeGuardedCallback(null, commitBeforeMutationEffects, null);
|
|
14970
14999
|
|
|
14971
15000
|
if (hasCaughtError()) {
|
|
14972
|
-
(
|
|
14973
|
-
|
|
14974
|
-
|
|
14975
|
-
throw ReactError(Error("Should be working on an effect."));
|
|
14976
|
-
}
|
|
15001
|
+
if (!(nextEffect !== null)) {
|
|
15002
|
+
{
|
|
15003
|
+
throw Error("Should be working on an effect.");
|
|
14977
15004
|
}
|
|
14978
|
-
}
|
|
15005
|
+
}
|
|
14979
15006
|
|
|
14980
15007
|
var error = clearCaughtError();
|
|
14981
15008
|
captureCommitPhaseError(nextEffect, error);
|
|
@@ -15001,13 +15028,11 @@ function commitRootImpl(root, renderPriorityLevel) {
|
|
|
15001
15028
|
invokeGuardedCallback(null, commitMutationEffects, null, root, renderPriorityLevel);
|
|
15002
15029
|
|
|
15003
15030
|
if (hasCaughtError()) {
|
|
15004
|
-
(
|
|
15005
|
-
|
|
15006
|
-
|
|
15007
|
-
throw ReactError(Error("Should be working on an effect."));
|
|
15008
|
-
}
|
|
15031
|
+
if (!(nextEffect !== null)) {
|
|
15032
|
+
{
|
|
15033
|
+
throw Error("Should be working on an effect.");
|
|
15009
15034
|
}
|
|
15010
|
-
}
|
|
15035
|
+
}
|
|
15011
15036
|
|
|
15012
15037
|
var _error = clearCaughtError();
|
|
15013
15038
|
|
|
@@ -15035,13 +15060,11 @@ function commitRootImpl(root, renderPriorityLevel) {
|
|
|
15035
15060
|
invokeGuardedCallback(null, commitLayoutEffects, null, root, expirationTime);
|
|
15036
15061
|
|
|
15037
15062
|
if (hasCaughtError()) {
|
|
15038
|
-
(
|
|
15039
|
-
|
|
15040
|
-
|
|
15041
|
-
throw ReactError(Error("Should be working on an effect."));
|
|
15042
|
-
}
|
|
15063
|
+
if (!(nextEffect !== null)) {
|
|
15064
|
+
{
|
|
15065
|
+
throw Error("Should be working on an effect.");
|
|
15043
15066
|
}
|
|
15044
|
-
}
|
|
15067
|
+
}
|
|
15045
15068
|
|
|
15046
15069
|
var _error2 = clearCaughtError();
|
|
15047
15070
|
|
|
@@ -15327,13 +15350,11 @@ function flushPassiveEffectsImpl() {
|
|
|
15327
15350
|
rootWithPendingPassiveEffects = null;
|
|
15328
15351
|
pendingPassiveEffectsExpirationTime = NoWork;
|
|
15329
15352
|
|
|
15330
|
-
(
|
|
15331
|
-
|
|
15332
|
-
|
|
15333
|
-
throw ReactError(Error("Cannot flush passive effects while already rendering."));
|
|
15334
|
-
}
|
|
15353
|
+
if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) {
|
|
15354
|
+
{
|
|
15355
|
+
throw Error("Cannot flush passive effects while already rendering.");
|
|
15335
15356
|
}
|
|
15336
|
-
}
|
|
15357
|
+
}
|
|
15337
15358
|
|
|
15338
15359
|
var prevExecutionContext = executionContext;
|
|
15339
15360
|
executionContext |= CommitContext;
|
|
@@ -15349,13 +15370,11 @@ function flushPassiveEffectsImpl() {
|
|
|
15349
15370
|
invokeGuardedCallback(null, commitPassiveHookEffects, null, effect);
|
|
15350
15371
|
|
|
15351
15372
|
if (hasCaughtError()) {
|
|
15352
|
-
(
|
|
15353
|
-
|
|
15354
|
-
|
|
15355
|
-
throw ReactError(Error("Should be working on an effect."));
|
|
15356
|
-
}
|
|
15373
|
+
if (!(effect !== null)) {
|
|
15374
|
+
{
|
|
15375
|
+
throw Error("Should be working on an effect.");
|
|
15357
15376
|
}
|
|
15358
|
-
}
|
|
15377
|
+
}
|
|
15359
15378
|
|
|
15360
15379
|
var error = clearCaughtError();
|
|
15361
15380
|
captureCommitPhaseError(effect, error);
|
|
@@ -15516,10 +15535,10 @@ function retryTimedOutBoundary(boundaryFiber, retryTime) {
|
|
|
15516
15535
|
// previously was rendered in its fallback state. One of the promises that
|
|
15517
15536
|
// suspended it has resolved, which means at least part of the tree was
|
|
15518
15537
|
// likely unblocked. Try rendering again, at a new expiration time.
|
|
15519
|
-
if (retryTime ===
|
|
15538
|
+
if (retryTime === NoWork) {
|
|
15520
15539
|
var suspenseConfig = null; // Retries don't carry over the already committed update.
|
|
15521
15540
|
|
|
15522
|
-
var currentTime =
|
|
15541
|
+
var currentTime = requestCurrentTimeForUpdate();
|
|
15523
15542
|
retryTime = computeExpirationForFiber(currentTime, boundaryFiber, suspenseConfig);
|
|
15524
15543
|
} // TODO: Special case idle priority?
|
|
15525
15544
|
|
|
@@ -15534,7 +15553,7 @@ function retryTimedOutBoundary(boundaryFiber, retryTime) {
|
|
|
15534
15553
|
|
|
15535
15554
|
function retryDehydratedSuspenseBoundary(boundaryFiber) {
|
|
15536
15555
|
var suspenseState = boundaryFiber.memoizedState;
|
|
15537
|
-
var retryTime =
|
|
15556
|
+
var retryTime = NoWork;
|
|
15538
15557
|
|
|
15539
15558
|
if (suspenseState !== null) {
|
|
15540
15559
|
retryTime = suspenseState.retryTime;
|
|
@@ -15543,7 +15562,7 @@ function retryDehydratedSuspenseBoundary(boundaryFiber) {
|
|
|
15543
15562
|
retryTimedOutBoundary(boundaryFiber, retryTime);
|
|
15544
15563
|
}
|
|
15545
15564
|
function resolveRetryThenable(boundaryFiber, thenable) {
|
|
15546
|
-
var retryTime =
|
|
15565
|
+
var retryTime = NoWork; // Default
|
|
15547
15566
|
|
|
15548
15567
|
var retryCache;
|
|
15549
15568
|
|
|
@@ -15564,13 +15583,11 @@ function resolveRetryThenable(boundaryFiber, thenable) {
|
|
|
15564
15583
|
break;
|
|
15565
15584
|
|
|
15566
15585
|
default:
|
|
15567
|
-
|
|
15586
|
+
{
|
|
15568
15587
|
{
|
|
15569
|
-
|
|
15570
|
-
throw ReactError(Error("Pinged unknown suspense boundary type. This is probably a bug in React."));
|
|
15571
|
-
}
|
|
15588
|
+
throw Error("Pinged unknown suspense boundary type. This is probably a bug in React.");
|
|
15572
15589
|
}
|
|
15573
|
-
}
|
|
15590
|
+
}
|
|
15574
15591
|
|
|
15575
15592
|
}
|
|
15576
15593
|
} else {
|
|
@@ -15627,13 +15644,11 @@ function checkForNestedUpdates() {
|
|
|
15627
15644
|
nestedUpdateCount = 0;
|
|
15628
15645
|
rootWithNestedUpdates = null;
|
|
15629
15646
|
|
|
15630
|
-
|
|
15647
|
+
{
|
|
15631
15648
|
{
|
|
15632
|
-
|
|
15633
|
-
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."));
|
|
15634
|
-
}
|
|
15649
|
+
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.");
|
|
15635
15650
|
}
|
|
15636
|
-
}
|
|
15651
|
+
}
|
|
15637
15652
|
}
|
|
15638
15653
|
|
|
15639
15654
|
{
|
|
@@ -15721,12 +15736,14 @@ if (true && replayFailedUnitOfWorkWithInvokeGuardedCallback) {
|
|
|
15721
15736
|
if (originalError !== null && typeof originalError === 'object' && typeof originalError.then === 'function') {
|
|
15722
15737
|
// Don't replay promises. Treat everything else like an error.
|
|
15723
15738
|
throw originalError;
|
|
15724
|
-
} // Keep this code in sync with
|
|
15739
|
+
} // Keep this code in sync with handleError; any changes here must have
|
|
15725
15740
|
// corresponding changes there.
|
|
15726
15741
|
|
|
15727
15742
|
|
|
15728
15743
|
resetContextDependencies();
|
|
15729
|
-
resetHooks(); //
|
|
15744
|
+
resetHooks(); // Don't reset current debug fiber, since we're about to work on the
|
|
15745
|
+
// same fiber again.
|
|
15746
|
+
// Unwind the failed stack frame
|
|
15730
15747
|
|
|
15731
15748
|
unwindInterruptedWork(unitOfWork); // Restore the original properties of the fiber.
|
|
15732
15749
|
|
|
@@ -15925,7 +15942,7 @@ function flushSuspensePriorityWarningInDEV() {
|
|
|
15925
15942
|
componentsThatTriggeredHighPriSuspend = null;
|
|
15926
15943
|
|
|
15927
15944
|
if (componentNames.length > 0) {
|
|
15928
|
-
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
|
|
15945
|
+
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
|
|
15929
15946
|
componentNames.sort().join(', '));
|
|
15930
15947
|
}
|
|
15931
15948
|
}
|
|
@@ -16012,10 +16029,10 @@ function startWorkOnPendingInteractions(root, expirationTime) {
|
|
|
16012
16029
|
});
|
|
16013
16030
|
}
|
|
16014
16031
|
}); // Store the current set of interactions on the FiberRoot for a few reasons:
|
|
16015
|
-
// We can re-use it in hot functions like
|
|
16016
|
-
// recalculate it. We will also use it in commitWork() to
|
|
16017
|
-
// onRender() hooks. This also provides DevTools with a
|
|
16018
|
-
// the onCommitRoot() hook is called.
|
|
16032
|
+
// We can re-use it in hot functions like performConcurrentWorkOnRoot()
|
|
16033
|
+
// without having to recalculate it. We will also use it in commitWork() to
|
|
16034
|
+
// pass to any Profiler onRender() hooks. This also provides DevTools with a
|
|
16035
|
+
// way to access it when the onCommitRoot() hook is called.
|
|
16019
16036
|
|
|
16020
16037
|
root.memoizedInteractions = interactions;
|
|
16021
16038
|
|
|
@@ -16123,7 +16140,7 @@ function injectInternals(internals) {
|
|
|
16123
16140
|
var didError = (root.current.effectTag & DidCapture) === DidCapture;
|
|
16124
16141
|
|
|
16125
16142
|
if (enableProfilerTimer) {
|
|
16126
|
-
var currentTime =
|
|
16143
|
+
var currentTime = getCurrentTime();
|
|
16127
16144
|
var priorityLevel = inferPriorityFromExpirationTime(currentTime, expirationTime);
|
|
16128
16145
|
hook.onCommitFiberRoot(rendererID, root, priorityLevel, didError);
|
|
16129
16146
|
} else {
|
|
@@ -16585,13 +16602,11 @@ key, pendingProps, owner, mode, expirationTime) {
|
|
|
16585
16602
|
}
|
|
16586
16603
|
}
|
|
16587
16604
|
|
|
16588
|
-
|
|
16605
|
+
{
|
|
16589
16606
|
{
|
|
16590
|
-
|
|
16591
|
-
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));
|
|
16592
|
-
}
|
|
16607
|
+
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);
|
|
16593
16608
|
}
|
|
16594
|
-
}
|
|
16609
|
+
}
|
|
16595
16610
|
}
|
|
16596
16611
|
}
|
|
16597
16612
|
}
|
|
@@ -16775,7 +16790,6 @@ function FiberRootNode(containerInfo, tag, hydrate) {
|
|
|
16775
16790
|
this.context = null;
|
|
16776
16791
|
this.pendingContext = null;
|
|
16777
16792
|
this.hydrate = hydrate;
|
|
16778
|
-
this.firstBatch = null;
|
|
16779
16793
|
this.callbackNode = null;
|
|
16780
16794
|
this.callbackPriority = NoPriority;
|
|
16781
16795
|
this.firstPendingTime = NoWork;
|
|
@@ -16931,79 +16945,22 @@ function getContextForSubtree(parentComponent) {
|
|
|
16931
16945
|
return parentContext;
|
|
16932
16946
|
}
|
|
16933
16947
|
|
|
16934
|
-
function scheduleRootUpdate(current$$1, element, expirationTime, suspenseConfig, callback) {
|
|
16935
|
-
{
|
|
16936
|
-
if (phase === 'render' && current !== null && !didWarnAboutNestedUpdates) {
|
|
16937
|
-
didWarnAboutNestedUpdates = true;
|
|
16938
|
-
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');
|
|
16939
|
-
}
|
|
16940
|
-
}
|
|
16941
|
-
|
|
16942
|
-
var update = createUpdate(expirationTime, suspenseConfig); // Caution: React DevTools currently depends on this property
|
|
16943
|
-
// being called "element".
|
|
16944
|
-
|
|
16945
|
-
update.payload = {
|
|
16946
|
-
element: element
|
|
16947
|
-
};
|
|
16948
|
-
callback = callback === undefined ? null : callback;
|
|
16949
|
-
|
|
16950
|
-
if (callback !== null) {
|
|
16951
|
-
!(typeof callback === 'function') ? warningWithoutStack$1(false, 'render(...): Expected the last optional `callback` argument to be a ' + 'function. Instead received: %s.', callback) : void 0;
|
|
16952
|
-
update.callback = callback;
|
|
16953
|
-
}
|
|
16954
|
-
|
|
16955
|
-
enqueueUpdate(current$$1, update);
|
|
16956
|
-
scheduleWork(current$$1, expirationTime);
|
|
16957
|
-
return expirationTime;
|
|
16958
|
-
}
|
|
16959
|
-
|
|
16960
|
-
function updateContainerAtExpirationTime(element, container, parentComponent, expirationTime, suspenseConfig, callback) {
|
|
16961
|
-
// TODO: If this is a nested container, this won't be the root.
|
|
16962
|
-
var current$$1 = container.current;
|
|
16963
|
-
|
|
16964
|
-
{
|
|
16965
|
-
if (ReactFiberInstrumentation_1.debugTool) {
|
|
16966
|
-
if (current$$1.alternate === null) {
|
|
16967
|
-
ReactFiberInstrumentation_1.debugTool.onMountContainer(container);
|
|
16968
|
-
} else if (element === null) {
|
|
16969
|
-
ReactFiberInstrumentation_1.debugTool.onUnmountContainer(container);
|
|
16970
|
-
} else {
|
|
16971
|
-
ReactFiberInstrumentation_1.debugTool.onUpdateContainer(container);
|
|
16972
|
-
}
|
|
16973
|
-
}
|
|
16974
|
-
}
|
|
16975
|
-
|
|
16976
|
-
var context = getContextForSubtree(parentComponent);
|
|
16977
|
-
|
|
16978
|
-
if (container.context === null) {
|
|
16979
|
-
container.context = context;
|
|
16980
|
-
} else {
|
|
16981
|
-
container.pendingContext = context;
|
|
16982
|
-
}
|
|
16983
|
-
|
|
16984
|
-
return scheduleRootUpdate(current$$1, element, expirationTime, suspenseConfig, callback);
|
|
16985
|
-
}
|
|
16986
|
-
|
|
16987
16948
|
function findHostInstance(component) {
|
|
16988
16949
|
var fiber = get(component);
|
|
16989
16950
|
|
|
16990
16951
|
if (fiber === undefined) {
|
|
16991
16952
|
if (typeof component.render === 'function') {
|
|
16992
|
-
|
|
16953
|
+
{
|
|
16993
16954
|
{
|
|
16994
|
-
|
|
16995
|
-
throw ReactError(Error("Unable to find node on an unmounted component."));
|
|
16996
|
-
}
|
|
16955
|
+
throw Error("Unable to find node on an unmounted component.");
|
|
16997
16956
|
}
|
|
16998
|
-
}
|
|
16957
|
+
}
|
|
16999
16958
|
} else {
|
|
17000
|
-
|
|
16959
|
+
{
|
|
17001
16960
|
{
|
|
17002
|
-
|
|
17003
|
-
throw ReactError(Error("Argument appears to not be a ReactComponent. Keys: " + Object.keys(component)));
|
|
17004
|
-
}
|
|
16961
|
+
throw Error("Argument appears to not be a ReactComponent. Keys: " + Object.keys(component));
|
|
17005
16962
|
}
|
|
17006
|
-
}
|
|
16963
|
+
}
|
|
17007
16964
|
}
|
|
17008
16965
|
}
|
|
17009
16966
|
|
|
@@ -17022,21 +16979,17 @@ function findHostInstanceWithWarning(component, methodName) {
|
|
|
17022
16979
|
|
|
17023
16980
|
if (fiber === undefined) {
|
|
17024
16981
|
if (typeof component.render === 'function') {
|
|
17025
|
-
|
|
16982
|
+
{
|
|
17026
16983
|
{
|
|
17027
|
-
|
|
17028
|
-
throw ReactError(Error("Unable to find node on an unmounted component."));
|
|
17029
|
-
}
|
|
16984
|
+
throw Error("Unable to find node on an unmounted component.");
|
|
17030
16985
|
}
|
|
17031
|
-
}
|
|
16986
|
+
}
|
|
17032
16987
|
} else {
|
|
17033
|
-
|
|
16988
|
+
{
|
|
17034
16989
|
{
|
|
17035
|
-
|
|
17036
|
-
throw ReactError(Error("Argument appears to not be a ReactComponent. Keys: " + Object.keys(component)));
|
|
17037
|
-
}
|
|
16990
|
+
throw Error("Argument appears to not be a ReactComponent. Keys: " + Object.keys(component));
|
|
17038
16991
|
}
|
|
17039
|
-
}
|
|
16992
|
+
}
|
|
17040
16993
|
}
|
|
17041
16994
|
}
|
|
17042
16995
|
|
|
@@ -17071,7 +17024,7 @@ function createContainer(containerInfo, tag, hydrate, hydrationCallbacks) {
|
|
|
17071
17024
|
}
|
|
17072
17025
|
function updateContainer(element, container, parentComponent, callback) {
|
|
17073
17026
|
var current$$1 = container.current;
|
|
17074
|
-
var currentTime =
|
|
17027
|
+
var currentTime = requestCurrentTimeForUpdate();
|
|
17075
17028
|
|
|
17076
17029
|
{
|
|
17077
17030
|
// $FlowExpectedError - jest isn't a global, and isn't recognized outside of tests
|
|
@@ -17083,7 +17036,50 @@ function updateContainer(element, container, parentComponent, callback) {
|
|
|
17083
17036
|
|
|
17084
17037
|
var suspenseConfig = requestCurrentSuspenseConfig();
|
|
17085
17038
|
var expirationTime = computeExpirationForFiber(currentTime, current$$1, suspenseConfig);
|
|
17086
|
-
|
|
17039
|
+
|
|
17040
|
+
{
|
|
17041
|
+
if (ReactFiberInstrumentation_1.debugTool) {
|
|
17042
|
+
if (current$$1.alternate === null) {
|
|
17043
|
+
ReactFiberInstrumentation_1.debugTool.onMountContainer(container);
|
|
17044
|
+
} else if (element === null) {
|
|
17045
|
+
ReactFiberInstrumentation_1.debugTool.onUnmountContainer(container);
|
|
17046
|
+
} else {
|
|
17047
|
+
ReactFiberInstrumentation_1.debugTool.onUpdateContainer(container);
|
|
17048
|
+
}
|
|
17049
|
+
}
|
|
17050
|
+
}
|
|
17051
|
+
|
|
17052
|
+
var context = getContextForSubtree(parentComponent);
|
|
17053
|
+
|
|
17054
|
+
if (container.context === null) {
|
|
17055
|
+
container.context = context;
|
|
17056
|
+
} else {
|
|
17057
|
+
container.pendingContext = context;
|
|
17058
|
+
}
|
|
17059
|
+
|
|
17060
|
+
{
|
|
17061
|
+
if (phase === 'render' && current !== null && !didWarnAboutNestedUpdates) {
|
|
17062
|
+
didWarnAboutNestedUpdates = true;
|
|
17063
|
+
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');
|
|
17064
|
+
}
|
|
17065
|
+
}
|
|
17066
|
+
|
|
17067
|
+
var update = createUpdate(expirationTime, suspenseConfig); // Caution: React DevTools currently depends on this property
|
|
17068
|
+
// being called "element".
|
|
17069
|
+
|
|
17070
|
+
update.payload = {
|
|
17071
|
+
element: element
|
|
17072
|
+
};
|
|
17073
|
+
callback = callback === undefined ? null : callback;
|
|
17074
|
+
|
|
17075
|
+
if (callback !== null) {
|
|
17076
|
+
!(typeof callback === 'function') ? warningWithoutStack$1(false, 'render(...): Expected the last optional `callback` argument to be a ' + 'function. Instead received: %s.', callback) : void 0;
|
|
17077
|
+
update.callback = callback;
|
|
17078
|
+
}
|
|
17079
|
+
|
|
17080
|
+
enqueueUpdate(current$$1, update);
|
|
17081
|
+
scheduleWork(current$$1, expirationTime);
|
|
17082
|
+
return expirationTime;
|
|
17087
17083
|
}
|
|
17088
17084
|
function getPublicRootInstance(container) {
|
|
17089
17085
|
var containerFiber = container.current;
|
|
@@ -17115,10 +17111,74 @@ function attemptSynchronousHydration(fiber) {
|
|
|
17115
17111
|
case SuspenseComponent:
|
|
17116
17112
|
flushSync(function () {
|
|
17117
17113
|
return scheduleWork(fiber, Sync);
|
|
17118
|
-
});
|
|
17114
|
+
}); // If we're still blocked after this, we need to increase
|
|
17115
|
+
// the priority of any promises resolving within this
|
|
17116
|
+
// boundary so that they next attempt also has higher pri.
|
|
17117
|
+
|
|
17118
|
+
var retryExpTime = computeInteractiveExpiration(requestCurrentTimeForUpdate());
|
|
17119
|
+
markRetryTimeIfNotHydrated(fiber, retryExpTime);
|
|
17119
17120
|
break;
|
|
17120
17121
|
}
|
|
17121
17122
|
}
|
|
17123
|
+
|
|
17124
|
+
function markRetryTimeImpl(fiber, retryTime) {
|
|
17125
|
+
var suspenseState = fiber.memoizedState;
|
|
17126
|
+
|
|
17127
|
+
if (suspenseState !== null && suspenseState.dehydrated !== null) {
|
|
17128
|
+
if (suspenseState.retryTime < retryTime) {
|
|
17129
|
+
suspenseState.retryTime = retryTime;
|
|
17130
|
+
}
|
|
17131
|
+
}
|
|
17132
|
+
} // Increases the priority of thennables when they resolve within this boundary.
|
|
17133
|
+
|
|
17134
|
+
|
|
17135
|
+
function markRetryTimeIfNotHydrated(fiber, retryTime) {
|
|
17136
|
+
markRetryTimeImpl(fiber, retryTime);
|
|
17137
|
+
var alternate = fiber.alternate;
|
|
17138
|
+
|
|
17139
|
+
if (alternate) {
|
|
17140
|
+
markRetryTimeImpl(alternate, retryTime);
|
|
17141
|
+
}
|
|
17142
|
+
}
|
|
17143
|
+
|
|
17144
|
+
function attemptUserBlockingHydration(fiber) {
|
|
17145
|
+
if (fiber.tag !== SuspenseComponent) {
|
|
17146
|
+
// We ignore HostRoots here because we can't increase
|
|
17147
|
+
// their priority and they should not suspend on I/O,
|
|
17148
|
+
// since you have to wrap anything that might suspend in
|
|
17149
|
+
// Suspense.
|
|
17150
|
+
return;
|
|
17151
|
+
}
|
|
17152
|
+
|
|
17153
|
+
var expTime = computeInteractiveExpiration(requestCurrentTimeForUpdate());
|
|
17154
|
+
scheduleWork(fiber, expTime);
|
|
17155
|
+
markRetryTimeIfNotHydrated(fiber, expTime);
|
|
17156
|
+
}
|
|
17157
|
+
function attemptContinuousHydration(fiber) {
|
|
17158
|
+
if (fiber.tag !== SuspenseComponent) {
|
|
17159
|
+
// We ignore HostRoots here because we can't increase
|
|
17160
|
+
// their priority and they should not suspend on I/O,
|
|
17161
|
+
// since you have to wrap anything that might suspend in
|
|
17162
|
+
// Suspense.
|
|
17163
|
+
return;
|
|
17164
|
+
}
|
|
17165
|
+
|
|
17166
|
+
var expTime = computeContinuousHydrationExpiration(requestCurrentTimeForUpdate());
|
|
17167
|
+
scheduleWork(fiber, expTime);
|
|
17168
|
+
markRetryTimeIfNotHydrated(fiber, expTime);
|
|
17169
|
+
}
|
|
17170
|
+
function attemptHydrationAtCurrentPriority(fiber) {
|
|
17171
|
+
if (fiber.tag !== SuspenseComponent) {
|
|
17172
|
+
// We ignore HostRoots here because we can't increase
|
|
17173
|
+
// their priority other than synchronously flush it.
|
|
17174
|
+
return;
|
|
17175
|
+
}
|
|
17176
|
+
|
|
17177
|
+
var currentTime = requestCurrentTimeForUpdate();
|
|
17178
|
+
var expTime = computeExpirationForFiber(currentTime, fiber, null);
|
|
17179
|
+
scheduleWork(fiber, expTime);
|
|
17180
|
+
markRetryTimeIfNotHydrated(fiber, expTime);
|
|
17181
|
+
}
|
|
17122
17182
|
function findHostInstanceWithNoPortals(fiber) {
|
|
17123
17183
|
var hostFiber = findCurrentHostFiberWithNoPortals(fiber);
|
|
17124
17184
|
|
|
@@ -17246,11 +17306,8 @@ function injectIntoDevTools(devToolsConfig) {
|
|
|
17246
17306
|
}
|
|
17247
17307
|
|
|
17248
17308
|
var ReactFiberReconciler = Object.freeze({
|
|
17249
|
-
updateContainerAtExpirationTime: updateContainerAtExpirationTime,
|
|
17250
17309
|
createContainer: createContainer,
|
|
17251
17310
|
updateContainer: updateContainer,
|
|
17252
|
-
flushRoot: flushRoot,
|
|
17253
|
-
computeUniqueAsyncExpiration: computeUniqueAsyncExpiration,
|
|
17254
17311
|
batchedEventUpdates: batchedEventUpdates,
|
|
17255
17312
|
batchedUpdates: batchedUpdates,
|
|
17256
17313
|
unbatchedUpdates: unbatchedUpdates,
|
|
@@ -17264,6 +17321,9 @@ var ReactFiberReconciler = Object.freeze({
|
|
|
17264
17321
|
IsThisRendererActing: IsThisRendererActing,
|
|
17265
17322
|
getPublicRootInstance: getPublicRootInstance,
|
|
17266
17323
|
attemptSynchronousHydration: attemptSynchronousHydration,
|
|
17324
|
+
attemptUserBlockingHydration: attemptUserBlockingHydration,
|
|
17325
|
+
attemptContinuousHydration: attemptContinuousHydration,
|
|
17326
|
+
attemptHydrationAtCurrentPriority: attemptHydrationAtCurrentPriority,
|
|
17267
17327
|
findHostInstance: findHostInstance,
|
|
17268
17328
|
findHostInstanceWithWarning: findHostInstanceWithWarning,
|
|
17269
17329
|
findHostInstanceWithNoPortals: findHostInstanceWithNoPortals,
|