react-test-renderer 16.10.2 → 16.11.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-test-renderer-shallow.development.js +69 -73
- package/cjs/react-test-renderer-shallow.production.min.js +25 -25
- package/cjs/react-test-renderer.development.js +671 -639
- package/cjs/react-test-renderer.production.min.js +148 -145
- package/package.json +2 -2
- package/umd/react-test-renderer-shallow.development.js +69 -73
- package/umd/react-test-renderer-shallow.production.min.js +23 -23
- package/umd/react-test-renderer.development.js +677 -645
- package/umd/react-test-renderer.production.min.js +145 -143
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license React v16.
|
|
1
|
+
/** @license React v16.11.0
|
|
2
2
|
* react-test-renderer.development.js
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
@@ -16,16 +16,8 @@
|
|
|
16
16
|
}(this, (function (React,Scheduler,Scheduler$1) { 'use strict';
|
|
17
17
|
|
|
18
18
|
// Do not require this module directly! Use normal `invariant` calls with
|
|
19
|
-
// template literal strings. The messages will be
|
|
20
|
-
// build
|
|
21
|
-
|
|
22
|
-
// Do not require this module directly! Use normal `invariant` calls with
|
|
23
|
-
// template literal strings. The messages will be converted to ReactError during
|
|
24
|
-
// build, and in production they will be minified.
|
|
25
|
-
function ReactError(error) {
|
|
26
|
-
error.name = 'Invariant Violation';
|
|
27
|
-
return error;
|
|
28
|
-
}
|
|
19
|
+
// template literal strings. The messages will be replaced with error codes
|
|
20
|
+
// during build.
|
|
29
21
|
|
|
30
22
|
function _defineProperties(target, props) {
|
|
31
23
|
for (var i = 0; i < props.length; i++) {
|
|
@@ -440,14 +432,12 @@ var enableSuspenseServerRenderer = false;
|
|
|
440
432
|
|
|
441
433
|
|
|
442
434
|
|
|
443
|
-
|
|
444
435
|
var enableFlareAPI = false;
|
|
445
436
|
var enableFundamentalAPI = false;
|
|
446
437
|
var enableScopeAPI = false;
|
|
447
438
|
|
|
448
439
|
var warnAboutUnmockedScheduler = false;
|
|
449
440
|
var flushSuspenseFallbacksInTests = true;
|
|
450
|
-
|
|
451
441
|
var enableSuspenseCallback = false;
|
|
452
442
|
var warnAboutDefaultPropsOnFunctionComponents = false;
|
|
453
443
|
var warnAboutStringRefs = false;
|
|
@@ -522,13 +512,11 @@ function isMounted(component) {
|
|
|
522
512
|
}
|
|
523
513
|
|
|
524
514
|
function assertIsMounted(fiber) {
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
throw ReactError(Error("Unable to find node on an unmounted component."));
|
|
529
|
-
}
|
|
515
|
+
if (!(getNearestMountedFiber(fiber) === fiber)) {
|
|
516
|
+
{
|
|
517
|
+
throw Error("Unable to find node on an unmounted component.");
|
|
530
518
|
}
|
|
531
|
-
}
|
|
519
|
+
}
|
|
532
520
|
}
|
|
533
521
|
|
|
534
522
|
function findCurrentFiberUsingSlowPath(fiber) {
|
|
@@ -538,13 +526,11 @@ function findCurrentFiberUsingSlowPath(fiber) {
|
|
|
538
526
|
// If there is no alternate, then we only need to check if it is mounted.
|
|
539
527
|
var nearestMounted = getNearestMountedFiber(fiber);
|
|
540
528
|
|
|
541
|
-
(
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
throw ReactError(Error("Unable to find node on an unmounted component."));
|
|
545
|
-
}
|
|
529
|
+
if (!(nearestMounted !== null)) {
|
|
530
|
+
{
|
|
531
|
+
throw Error("Unable to find node on an unmounted component.");
|
|
546
532
|
}
|
|
547
|
-
}
|
|
533
|
+
}
|
|
548
534
|
|
|
549
535
|
if (nearestMounted !== fiber) {
|
|
550
536
|
return null;
|
|
@@ -609,13 +595,11 @@ function findCurrentFiberUsingSlowPath(fiber) {
|
|
|
609
595
|
// way this could possibly happen is if this was unmounted, if at all.
|
|
610
596
|
|
|
611
597
|
|
|
612
|
-
|
|
598
|
+
{
|
|
613
599
|
{
|
|
614
|
-
|
|
615
|
-
throw ReactError(Error("Unable to find node on an unmounted component."));
|
|
616
|
-
}
|
|
600
|
+
throw Error("Unable to find node on an unmounted component.");
|
|
617
601
|
}
|
|
618
|
-
}
|
|
602
|
+
}
|
|
619
603
|
}
|
|
620
604
|
|
|
621
605
|
if (a.return !== b.return) {
|
|
@@ -674,34 +658,28 @@ function findCurrentFiberUsingSlowPath(fiber) {
|
|
|
674
658
|
_child = _child.sibling;
|
|
675
659
|
}
|
|
676
660
|
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
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."));
|
|
681
|
-
}
|
|
661
|
+
if (!didFindChild) {
|
|
662
|
+
{
|
|
663
|
+
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.");
|
|
682
664
|
}
|
|
683
|
-
}
|
|
665
|
+
}
|
|
684
666
|
}
|
|
685
667
|
}
|
|
686
668
|
|
|
687
|
-
(
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
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."));
|
|
691
|
-
}
|
|
669
|
+
if (!(a.alternate === b)) {
|
|
670
|
+
{
|
|
671
|
+
throw Error("Return fibers should always be each others' alternates. This error is likely caused by a bug in React. Please file an issue.");
|
|
692
672
|
}
|
|
693
|
-
}
|
|
673
|
+
}
|
|
694
674
|
} // If the root is not a host container, we're in a disconnected tree. I.e.
|
|
695
675
|
// unmounted.
|
|
696
676
|
|
|
697
677
|
|
|
698
|
-
(
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
throw ReactError(Error("Unable to find node on an unmounted component."));
|
|
702
|
-
}
|
|
678
|
+
if (!(a.tag === HostRoot)) {
|
|
679
|
+
{
|
|
680
|
+
throw Error("Unable to find node on an unmounted component.");
|
|
703
681
|
}
|
|
704
|
-
}
|
|
682
|
+
}
|
|
705
683
|
|
|
706
684
|
if (a.stateNode.current === a) {
|
|
707
685
|
// We've determined that A is the current branch.
|
|
@@ -754,13 +732,11 @@ function findCurrentHostFiber(parent) {
|
|
|
754
732
|
// can re-export everything from this module.
|
|
755
733
|
|
|
756
734
|
function shim() {
|
|
757
|
-
|
|
735
|
+
{
|
|
758
736
|
{
|
|
759
|
-
|
|
760
|
-
throw ReactError(Error("The current renderer does not support persistence. This error is likely caused by a bug in React. Please file an issue."));
|
|
761
|
-
}
|
|
737
|
+
throw Error("The current renderer does not support persistence. This error is likely caused by a bug in React. Please file an issue.");
|
|
762
738
|
}
|
|
763
|
-
}
|
|
739
|
+
}
|
|
764
740
|
} // Persistence (when unsupported)
|
|
765
741
|
|
|
766
742
|
|
|
@@ -777,13 +753,11 @@ var cloneHiddenTextInstance = shim;
|
|
|
777
753
|
// can re-export everything from this module.
|
|
778
754
|
|
|
779
755
|
function shim$1() {
|
|
780
|
-
|
|
756
|
+
{
|
|
781
757
|
{
|
|
782
|
-
|
|
783
|
-
throw ReactError(Error("The current renderer does not support hydration. This error is likely caused by a bug in React. Please file an issue."));
|
|
784
|
-
}
|
|
758
|
+
throw Error("The current renderer does not support hydration. This error is likely caused by a bug in React. Please file an issue.");
|
|
785
759
|
}
|
|
786
|
-
}
|
|
760
|
+
}
|
|
787
761
|
} // Hydration (when unsupported)
|
|
788
762
|
|
|
789
763
|
|
|
@@ -818,6 +792,7 @@ var didNotFindHydratableSuspenseInstance = shim$1;
|
|
|
818
792
|
var EVENT_COMPONENT_CONTEXT = {};
|
|
819
793
|
var NO_CONTEXT = {};
|
|
820
794
|
var UPDATE_SIGNAL = {};
|
|
795
|
+
var nodeToInstanceMap = new WeakMap();
|
|
821
796
|
|
|
822
797
|
{
|
|
823
798
|
Object.freeze(NO_CONTEXT);
|
|
@@ -828,11 +803,17 @@ function getPublicInstance(inst) {
|
|
|
828
803
|
switch (inst.tag) {
|
|
829
804
|
case 'INSTANCE':
|
|
830
805
|
var createNodeMock = inst.rootContainerInstance.createNodeMock;
|
|
831
|
-
|
|
806
|
+
var mockNode = createNodeMock({
|
|
832
807
|
type: inst.type,
|
|
833
808
|
props: inst.props
|
|
834
809
|
});
|
|
835
810
|
|
|
811
|
+
if (typeof mockNode === 'object' && mockNode !== null) {
|
|
812
|
+
nodeToInstanceMap.set(mockNode, inst);
|
|
813
|
+
}
|
|
814
|
+
|
|
815
|
+
return mockNode;
|
|
816
|
+
|
|
836
817
|
default:
|
|
837
818
|
return inst;
|
|
838
819
|
}
|
|
@@ -895,6 +876,7 @@ function createInstance(type, props, rootContainerInstance, hostContext, interna
|
|
|
895
876
|
props: propsToUse,
|
|
896
877
|
isHidden: false,
|
|
897
878
|
children: [],
|
|
879
|
+
internalInstanceHandle: internalInstanceHandle,
|
|
898
880
|
rootContainerInstance: rootContainerInstance,
|
|
899
881
|
tag: 'INSTANCE'
|
|
900
882
|
};
|
|
@@ -1020,6 +1002,15 @@ function unmountFundamentalComponent(fundamentalInstance) {
|
|
|
1020
1002
|
onUnmount(null, instance, props, state);
|
|
1021
1003
|
}
|
|
1022
1004
|
}
|
|
1005
|
+
function getInstanceFromNode(mockNode) {
|
|
1006
|
+
var instance = nodeToInstanceMap.get(mockNode);
|
|
1007
|
+
|
|
1008
|
+
if (instance !== undefined) {
|
|
1009
|
+
return instance.internalInstanceHandle;
|
|
1010
|
+
}
|
|
1011
|
+
|
|
1012
|
+
return null;
|
|
1013
|
+
}
|
|
1023
1014
|
|
|
1024
1015
|
/**
|
|
1025
1016
|
* Copyright (c) 2013-present, Facebook, Inc.
|
|
@@ -1857,13 +1848,11 @@ function pushTopLevelContextObject(fiber, context, didChange) {
|
|
|
1857
1848
|
if (disableLegacyContext) {
|
|
1858
1849
|
return;
|
|
1859
1850
|
} else {
|
|
1860
|
-
(
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
throw ReactError(Error("Unexpected context found on stack. This error is likely caused by a bug in React. Please file an issue."));
|
|
1864
|
-
}
|
|
1851
|
+
if (!(contextStackCursor.current === emptyContextObject)) {
|
|
1852
|
+
{
|
|
1853
|
+
throw Error("Unexpected context found on stack. This error is likely caused by a bug in React. Please file an issue.");
|
|
1865
1854
|
}
|
|
1866
|
-
}
|
|
1855
|
+
}
|
|
1867
1856
|
|
|
1868
1857
|
push(contextStackCursor, context, fiber);
|
|
1869
1858
|
push(didPerformWorkStackCursor, didChange, fiber);
|
|
@@ -1906,13 +1895,11 @@ function processChildContext(fiber, type, parentContext) {
|
|
|
1906
1895
|
}
|
|
1907
1896
|
|
|
1908
1897
|
for (var contextKey in childContext) {
|
|
1909
|
-
(
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
throw ReactError(Error((getComponentName(type) || 'Unknown') + ".getChildContext(): key \"" + contextKey + "\" is not defined in childContextTypes."));
|
|
1913
|
-
}
|
|
1898
|
+
if (!(contextKey in childContextTypes)) {
|
|
1899
|
+
{
|
|
1900
|
+
throw Error((getComponentName(type) || 'Unknown') + ".getChildContext(): key \"" + contextKey + "\" is not defined in childContextTypes.");
|
|
1914
1901
|
}
|
|
1915
|
-
}
|
|
1902
|
+
}
|
|
1916
1903
|
}
|
|
1917
1904
|
|
|
1918
1905
|
{
|
|
@@ -1953,13 +1940,11 @@ function invalidateContextProvider(workInProgress, type, didChange) {
|
|
|
1953
1940
|
} else {
|
|
1954
1941
|
var instance = workInProgress.stateNode;
|
|
1955
1942
|
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
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."));
|
|
1960
|
-
}
|
|
1943
|
+
if (!instance) {
|
|
1944
|
+
{
|
|
1945
|
+
throw Error("Expected to have an instance by this point. This error is likely caused by a bug in React. Please file an issue.");
|
|
1961
1946
|
}
|
|
1962
|
-
}
|
|
1947
|
+
}
|
|
1963
1948
|
|
|
1964
1949
|
if (didChange) {
|
|
1965
1950
|
// Merge parent and own context.
|
|
@@ -1987,13 +1972,11 @@ function findCurrentUnmaskedContext(fiber) {
|
|
|
1987
1972
|
} else {
|
|
1988
1973
|
// Currently this is only used with renderSubtreeIntoContainer; not sure if it
|
|
1989
1974
|
// makes sense elsewhere
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
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."));
|
|
1994
|
-
}
|
|
1975
|
+
if (!(isFiberMounted(fiber) && fiber.tag === ClassComponent)) {
|
|
1976
|
+
{
|
|
1977
|
+
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.");
|
|
1995
1978
|
}
|
|
1996
|
-
}
|
|
1979
|
+
}
|
|
1997
1980
|
|
|
1998
1981
|
var node = fiber;
|
|
1999
1982
|
|
|
@@ -2017,13 +2000,11 @@ function findCurrentUnmaskedContext(fiber) {
|
|
|
2017
2000
|
node = node.return;
|
|
2018
2001
|
} while (node !== null);
|
|
2019
2002
|
|
|
2020
|
-
|
|
2003
|
+
{
|
|
2021
2004
|
{
|
|
2022
|
-
|
|
2023
|
-
throw ReactError(Error("Found unexpected detached subtree parent. This error is likely caused by a bug in React. Please file an issue."));
|
|
2024
|
-
}
|
|
2005
|
+
throw Error("Found unexpected detached subtree parent. This error is likely caused by a bug in React. Please file an issue.");
|
|
2025
2006
|
}
|
|
2026
|
-
}
|
|
2007
|
+
}
|
|
2027
2008
|
}
|
|
2028
2009
|
}
|
|
2029
2010
|
|
|
@@ -2062,13 +2043,11 @@ if (enableSchedulerTracing) {
|
|
|
2062
2043
|
// Provide explicit error message when production+profiling bundle of e.g.
|
|
2063
2044
|
// react-dom is used with production (non-profiling) bundle of
|
|
2064
2045
|
// scheduler/tracing
|
|
2065
|
-
(
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
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"));
|
|
2069
|
-
}
|
|
2046
|
+
if (!(__interactionsRef != null && __interactionsRef.current != null)) {
|
|
2047
|
+
{
|
|
2048
|
+
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");
|
|
2070
2049
|
}
|
|
2071
|
-
}
|
|
2050
|
+
}
|
|
2072
2051
|
}
|
|
2073
2052
|
|
|
2074
2053
|
var fakeCallbackNode = {}; // Except for NoPriority, these correspond to Scheduler priorities. We use
|
|
@@ -2117,13 +2096,11 @@ function getCurrentPriorityLevel() {
|
|
|
2117
2096
|
return IdlePriority;
|
|
2118
2097
|
|
|
2119
2098
|
default:
|
|
2120
|
-
|
|
2099
|
+
{
|
|
2121
2100
|
{
|
|
2122
|
-
|
|
2123
|
-
throw ReactError(Error("Unknown priority level."));
|
|
2124
|
-
}
|
|
2101
|
+
throw Error("Unknown priority level.");
|
|
2125
2102
|
}
|
|
2126
|
-
}
|
|
2103
|
+
}
|
|
2127
2104
|
|
|
2128
2105
|
}
|
|
2129
2106
|
}
|
|
@@ -2146,13 +2123,11 @@ function reactPriorityToSchedulerPriority(reactPriorityLevel) {
|
|
|
2146
2123
|
return Scheduler_IdlePriority;
|
|
2147
2124
|
|
|
2148
2125
|
default:
|
|
2149
|
-
|
|
2126
|
+
{
|
|
2150
2127
|
{
|
|
2151
|
-
|
|
2152
|
-
throw ReactError(Error("Unknown priority level."));
|
|
2153
|
-
}
|
|
2128
|
+
throw Error("Unknown priority level.");
|
|
2154
2129
|
}
|
|
2155
|
-
}
|
|
2130
|
+
}
|
|
2156
2131
|
|
|
2157
2132
|
}
|
|
2158
2133
|
}
|
|
@@ -2253,7 +2228,7 @@ var NoWork = 0; // TODO: Think of a better name for Never. The key difference wi
|
|
|
2253
2228
|
var Never = 1; // Idle is slightly higher priority than Never. It must completely finish in
|
|
2254
2229
|
// order to be consistent.
|
|
2255
2230
|
|
|
2256
|
-
var Idle = 2;
|
|
2231
|
+
var Idle = 2; // Continuous Hydration is a moving priority. It is slightly higher than Idle
|
|
2257
2232
|
var Sync = MAX_SIGNED_31_BIT_INT;
|
|
2258
2233
|
var Batched = Sync - 1;
|
|
2259
2234
|
var UNIT_SIZE = 10;
|
|
@@ -2302,6 +2277,7 @@ var HIGH_PRIORITY_BATCH_SIZE = 100;
|
|
|
2302
2277
|
function computeInteractiveExpiration(currentTime) {
|
|
2303
2278
|
return computeExpirationBucket(currentTime, HIGH_PRIORITY_EXPIRATION, HIGH_PRIORITY_BATCH_SIZE);
|
|
2304
2279
|
}
|
|
2280
|
+
|
|
2305
2281
|
function inferPriorityFromExpirationTime(currentTime, expirationTime) {
|
|
2306
2282
|
if (expirationTime === Sync) {
|
|
2307
2283
|
return ImmediatePriority;
|
|
@@ -2849,7 +2825,9 @@ var scheduleRoot = function (root, element) {
|
|
|
2849
2825
|
}
|
|
2850
2826
|
|
|
2851
2827
|
flushPassiveEffects();
|
|
2852
|
-
|
|
2828
|
+
syncUpdates(function () {
|
|
2829
|
+
updateContainer(element, root, null, null);
|
|
2830
|
+
});
|
|
2853
2831
|
}
|
|
2854
2832
|
};
|
|
2855
2833
|
|
|
@@ -3251,13 +3229,11 @@ function propagateContextChange(workInProgress, context, changedBits, renderExpi
|
|
|
3251
3229
|
// mark it as having updates.
|
|
3252
3230
|
var parentSuspense = fiber.return;
|
|
3253
3231
|
|
|
3254
|
-
(
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
throw ReactError(Error("We just came from a parent so we must have had a parent. This is a bug in React."));
|
|
3258
|
-
}
|
|
3232
|
+
if (!(parentSuspense !== null)) {
|
|
3233
|
+
{
|
|
3234
|
+
throw Error("We just came from a parent so we must have had a parent. This is a bug in React.");
|
|
3259
3235
|
}
|
|
3260
|
-
}
|
|
3236
|
+
}
|
|
3261
3237
|
|
|
3262
3238
|
if (parentSuspense.expirationTime < renderExpirationTime) {
|
|
3263
3239
|
parentSuspense.expirationTime = renderExpirationTime;
|
|
@@ -3358,13 +3334,11 @@ function readContext(context, observedBits) {
|
|
|
3358
3334
|
};
|
|
3359
3335
|
|
|
3360
3336
|
if (lastContextDependency === null) {
|
|
3361
|
-
(
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
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()."));
|
|
3365
|
-
}
|
|
3337
|
+
if (!(currentlyRenderingFiber !== null)) {
|
|
3338
|
+
{
|
|
3339
|
+
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().");
|
|
3366
3340
|
}
|
|
3367
|
-
}
|
|
3341
|
+
} // This is the first dependency for this component. Create a new list.
|
|
3368
3342
|
|
|
3369
3343
|
|
|
3370
3344
|
lastContextDependency = contextItem;
|
|
@@ -3869,13 +3843,11 @@ function processUpdateQueue(workInProgress, queue, props, instance, renderExpira
|
|
|
3869
3843
|
}
|
|
3870
3844
|
|
|
3871
3845
|
function callCallback(callback, context) {
|
|
3872
|
-
(function
|
|
3873
|
-
|
|
3874
|
-
|
|
3875
|
-
throw ReactError(Error("Invalid argument passed as callback. Expected a function. Instead received: " + callback));
|
|
3876
|
-
}
|
|
3846
|
+
if (!(typeof callback === 'function')) {
|
|
3847
|
+
{
|
|
3848
|
+
throw Error("Invalid argument passed as callback. Expected a function. Instead received: " + callback);
|
|
3877
3849
|
}
|
|
3878
|
-
}
|
|
3850
|
+
}
|
|
3879
3851
|
|
|
3880
3852
|
callback.call(context);
|
|
3881
3853
|
}
|
|
@@ -3986,13 +3958,11 @@ var didWarnAboutInvalidateContextType;
|
|
|
3986
3958
|
Object.defineProperty(fakeInternalInstance, '_processChildContext', {
|
|
3987
3959
|
enumerable: false,
|
|
3988
3960
|
value: function () {
|
|
3989
|
-
|
|
3961
|
+
{
|
|
3990
3962
|
{
|
|
3991
|
-
|
|
3992
|
-
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)."));
|
|
3993
|
-
}
|
|
3963
|
+
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).");
|
|
3994
3964
|
}
|
|
3995
|
-
}
|
|
3965
|
+
}
|
|
3996
3966
|
}
|
|
3997
3967
|
});
|
|
3998
3968
|
Object.freeze(fakeInternalInstance);
|
|
@@ -4029,7 +3999,7 @@ var classComponentUpdater = {
|
|
|
4029
3999
|
isMounted: isMounted,
|
|
4030
4000
|
enqueueSetState: function (inst, payload, callback) {
|
|
4031
4001
|
var fiber = get(inst);
|
|
4032
|
-
var currentTime =
|
|
4002
|
+
var currentTime = requestCurrentTimeForUpdate();
|
|
4033
4003
|
var suspenseConfig = requestCurrentSuspenseConfig();
|
|
4034
4004
|
var expirationTime = computeExpirationForFiber(currentTime, fiber, suspenseConfig);
|
|
4035
4005
|
var update = createUpdate(expirationTime, suspenseConfig);
|
|
@@ -4048,7 +4018,7 @@ var classComponentUpdater = {
|
|
|
4048
4018
|
},
|
|
4049
4019
|
enqueueReplaceState: function (inst, payload, callback) {
|
|
4050
4020
|
var fiber = get(inst);
|
|
4051
|
-
var currentTime =
|
|
4021
|
+
var currentTime = requestCurrentTimeForUpdate();
|
|
4052
4022
|
var suspenseConfig = requestCurrentSuspenseConfig();
|
|
4053
4023
|
var expirationTime = computeExpirationForFiber(currentTime, fiber, suspenseConfig);
|
|
4054
4024
|
var update = createUpdate(expirationTime, suspenseConfig);
|
|
@@ -4068,7 +4038,7 @@ var classComponentUpdater = {
|
|
|
4068
4038
|
},
|
|
4069
4039
|
enqueueForceUpdate: function (inst, callback) {
|
|
4070
4040
|
var fiber = get(inst);
|
|
4071
|
-
var currentTime =
|
|
4041
|
+
var currentTime = requestCurrentTimeForUpdate();
|
|
4072
4042
|
var suspenseConfig = requestCurrentSuspenseConfig();
|
|
4073
4043
|
var expirationTime = computeExpirationForFiber(currentTime, fiber, suspenseConfig);
|
|
4074
4044
|
var update = createUpdate(expirationTime, suspenseConfig);
|
|
@@ -4683,13 +4653,11 @@ var warnForMissingKey = function (child) {};
|
|
|
4683
4653
|
return;
|
|
4684
4654
|
}
|
|
4685
4655
|
|
|
4686
|
-
(
|
|
4687
|
-
|
|
4688
|
-
|
|
4689
|
-
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."));
|
|
4690
|
-
}
|
|
4656
|
+
if (!(typeof child._store === 'object')) {
|
|
4657
|
+
{
|
|
4658
|
+
throw Error("React Component in warnForMissingKey should have a _store. This error is likely caused by a bug in React. Please file an issue.");
|
|
4691
4659
|
}
|
|
4692
|
-
}
|
|
4660
|
+
}
|
|
4693
4661
|
|
|
4694
4662
|
child._store.validated = true;
|
|
4695
4663
|
var currentComponentErrorInfo = 'Each child in a list should have a unique ' + '"key" prop. See https://fb.me/react-warning-keys for ' + 'more information.' + getCurrentFiberStackInDev();
|
|
@@ -4734,24 +4702,20 @@ function coerceRef(returnFiber, current$$1, element) {
|
|
|
4734
4702
|
if (owner) {
|
|
4735
4703
|
var ownerFiber = owner;
|
|
4736
4704
|
|
|
4737
|
-
(
|
|
4738
|
-
|
|
4739
|
-
|
|
4740
|
-
throw ReactError(Error("Function components cannot have refs. Did you mean to use React.forwardRef()?"));
|
|
4741
|
-
}
|
|
4705
|
+
if (!(ownerFiber.tag === ClassComponent)) {
|
|
4706
|
+
{
|
|
4707
|
+
throw Error("Function components cannot have refs. Did you mean to use React.forwardRef()?");
|
|
4742
4708
|
}
|
|
4743
|
-
}
|
|
4709
|
+
}
|
|
4744
4710
|
|
|
4745
4711
|
inst = ownerFiber.stateNode;
|
|
4746
4712
|
}
|
|
4747
4713
|
|
|
4748
|
-
|
|
4749
|
-
|
|
4750
|
-
|
|
4751
|
-
throw ReactError(Error("Missing owner for string ref " + mixedRef + ". This error is likely caused by a bug in React. Please file an issue."));
|
|
4752
|
-
}
|
|
4714
|
+
if (!inst) {
|
|
4715
|
+
{
|
|
4716
|
+
throw Error("Missing owner for string ref " + mixedRef + ". This error is likely caused by a bug in React. Please file an issue.");
|
|
4753
4717
|
}
|
|
4754
|
-
}
|
|
4718
|
+
}
|
|
4755
4719
|
|
|
4756
4720
|
var stringRef = '' + mixedRef; // Check if previous string ref matches new string ref
|
|
4757
4721
|
|
|
@@ -4777,21 +4741,17 @@ function coerceRef(returnFiber, current$$1, element) {
|
|
|
4777
4741
|
ref._stringRef = stringRef;
|
|
4778
4742
|
return ref;
|
|
4779
4743
|
} else {
|
|
4780
|
-
(
|
|
4781
|
-
|
|
4782
|
-
|
|
4783
|
-
throw ReactError(Error("Expected ref to be a function, a string, an object returned by React.createRef(), or null."));
|
|
4784
|
-
}
|
|
4744
|
+
if (!(typeof mixedRef === 'string')) {
|
|
4745
|
+
{
|
|
4746
|
+
throw Error("Expected ref to be a function, a string, an object returned by React.createRef(), or null.");
|
|
4785
4747
|
}
|
|
4786
|
-
}
|
|
4748
|
+
}
|
|
4787
4749
|
|
|
4788
|
-
|
|
4789
|
-
|
|
4790
|
-
|
|
4791
|
-
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."));
|
|
4792
|
-
}
|
|
4750
|
+
if (!element._owner) {
|
|
4751
|
+
{
|
|
4752
|
+
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.");
|
|
4793
4753
|
}
|
|
4794
|
-
}
|
|
4754
|
+
}
|
|
4795
4755
|
}
|
|
4796
4756
|
}
|
|
4797
4757
|
|
|
@@ -4806,13 +4766,11 @@ function throwOnInvalidObjectType(returnFiber, newChild) {
|
|
|
4806
4766
|
addendum = ' If you meant to render a collection of children, use an array ' + 'instead.' + getCurrentFiberStackInDev();
|
|
4807
4767
|
}
|
|
4808
4768
|
|
|
4809
|
-
|
|
4769
|
+
{
|
|
4810
4770
|
{
|
|
4811
|
-
{
|
|
4812
|
-
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));
|
|
4813
|
-
}
|
|
4771
|
+
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);
|
|
4814
4772
|
}
|
|
4815
|
-
}
|
|
4773
|
+
}
|
|
4816
4774
|
}
|
|
4817
4775
|
}
|
|
4818
4776
|
|
|
@@ -5360,13 +5318,11 @@ function ChildReconciler(shouldTrackSideEffects) {
|
|
|
5360
5318
|
// but using the iterator instead.
|
|
5361
5319
|
var iteratorFn = getIteratorFn(newChildrenIterable);
|
|
5362
5320
|
|
|
5363
|
-
(function
|
|
5364
|
-
|
|
5365
|
-
|
|
5366
|
-
throw ReactError(Error("An object is not an iterable. This error is likely caused by a bug in React. Please file an issue."));
|
|
5367
|
-
}
|
|
5321
|
+
if (!(typeof iteratorFn === 'function')) {
|
|
5322
|
+
{
|
|
5323
|
+
throw Error("An object is not an iterable. This error is likely caused by a bug in React. Please file an issue.");
|
|
5368
5324
|
}
|
|
5369
|
-
}
|
|
5325
|
+
}
|
|
5370
5326
|
|
|
5371
5327
|
{
|
|
5372
5328
|
// We don't support rendering Generators because it's a mutation.
|
|
@@ -5401,13 +5357,11 @@ function ChildReconciler(shouldTrackSideEffects) {
|
|
|
5401
5357
|
|
|
5402
5358
|
var newChildren = iteratorFn.call(newChildrenIterable);
|
|
5403
5359
|
|
|
5404
|
-
(
|
|
5405
|
-
|
|
5406
|
-
|
|
5407
|
-
throw ReactError(Error("An iterable object provided no iterator."));
|
|
5408
|
-
}
|
|
5360
|
+
if (!(newChildren != null)) {
|
|
5361
|
+
{
|
|
5362
|
+
throw Error("An iterable object provided no iterator.");
|
|
5409
5363
|
}
|
|
5410
|
-
}
|
|
5364
|
+
}
|
|
5411
5365
|
|
|
5412
5366
|
var resultingFirstChild = null;
|
|
5413
5367
|
var previousNewFiber = null;
|
|
@@ -5705,13 +5659,11 @@ function ChildReconciler(shouldTrackSideEffects) {
|
|
|
5705
5659
|
{
|
|
5706
5660
|
var Component = returnFiber.type;
|
|
5707
5661
|
|
|
5708
|
-
|
|
5662
|
+
{
|
|
5709
5663
|
{
|
|
5710
|
-
|
|
5711
|
-
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."));
|
|
5712
|
-
}
|
|
5664
|
+
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.");
|
|
5713
5665
|
}
|
|
5714
|
-
}
|
|
5666
|
+
}
|
|
5715
5667
|
}
|
|
5716
5668
|
}
|
|
5717
5669
|
} // Remaining cases are all treated as empty.
|
|
@@ -5726,13 +5678,11 @@ function ChildReconciler(shouldTrackSideEffects) {
|
|
|
5726
5678
|
var reconcileChildFibers = ChildReconciler(true);
|
|
5727
5679
|
var mountChildFibers = ChildReconciler(false);
|
|
5728
5680
|
function cloneChildFibers(current$$1, workInProgress) {
|
|
5729
|
-
(
|
|
5730
|
-
|
|
5731
|
-
|
|
5732
|
-
throw ReactError(Error("Resuming work not yet implemented."));
|
|
5733
|
-
}
|
|
5681
|
+
if (!(current$$1 === null || workInProgress.child === current$$1.child)) {
|
|
5682
|
+
{
|
|
5683
|
+
throw Error("Resuming work not yet implemented.");
|
|
5734
5684
|
}
|
|
5735
|
-
}
|
|
5685
|
+
}
|
|
5736
5686
|
|
|
5737
5687
|
if (workInProgress.child === null) {
|
|
5738
5688
|
return;
|
|
@@ -5767,13 +5717,11 @@ var contextFiberStackCursor = createCursor(NO_CONTEXT$1);
|
|
|
5767
5717
|
var rootInstanceStackCursor = createCursor(NO_CONTEXT$1);
|
|
5768
5718
|
|
|
5769
5719
|
function requiredContext(c) {
|
|
5770
|
-
(
|
|
5771
|
-
|
|
5772
|
-
|
|
5773
|
-
throw ReactError(Error("Expected host context to exist. This error is likely caused by a bug in React. Please file an issue."));
|
|
5774
|
-
}
|
|
5720
|
+
if (!(c !== NO_CONTEXT$1)) {
|
|
5721
|
+
{
|
|
5722
|
+
throw Error("Expected host context to exist. This error is likely caused by a bug in React. Please file an issue.");
|
|
5775
5723
|
}
|
|
5776
|
-
}
|
|
5724
|
+
}
|
|
5777
5725
|
|
|
5778
5726
|
return c;
|
|
5779
5727
|
}
|
|
@@ -6010,13 +5958,11 @@ function updateEventListener(listener, fiber, visistedResponders, respondersMap,
|
|
|
6010
5958
|
props = listener.props;
|
|
6011
5959
|
}
|
|
6012
5960
|
|
|
6013
|
-
(
|
|
6014
|
-
|
|
6015
|
-
|
|
6016
|
-
throw ReactError(Error("An invalid value was used as an event listener. Expect one or many event listeners created via React.unstable_useResponder()."));
|
|
6017
|
-
}
|
|
5961
|
+
if (!(responder && responder.$$typeof === REACT_RESPONDER_TYPE)) {
|
|
5962
|
+
{
|
|
5963
|
+
throw Error("An invalid value was used as an event listener. Expect one or many event listeners created via React.unstable_useResponder().");
|
|
6018
5964
|
}
|
|
6019
|
-
}
|
|
5965
|
+
}
|
|
6020
5966
|
|
|
6021
5967
|
var listenerProps = props;
|
|
6022
5968
|
|
|
@@ -6129,6 +6075,7 @@ var UnmountPassive =
|
|
|
6129
6075
|
128;
|
|
6130
6076
|
|
|
6131
6077
|
var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher;
|
|
6078
|
+
var ReactCurrentBatchConfig$1 = ReactSharedInternals.ReactCurrentBatchConfig;
|
|
6132
6079
|
var didWarnAboutMismatchedHooksForComponent;
|
|
6133
6080
|
|
|
6134
6081
|
{
|
|
@@ -6246,13 +6193,11 @@ function warnOnHookMismatchInDev(currentHookName) {
|
|
|
6246
6193
|
}
|
|
6247
6194
|
|
|
6248
6195
|
function throwInvalidHookError() {
|
|
6249
|
-
|
|
6196
|
+
{
|
|
6250
6197
|
{
|
|
6251
|
-
|
|
6252
|
-
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."));
|
|
6253
|
-
}
|
|
6198
|
+
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.");
|
|
6254
6199
|
}
|
|
6255
|
-
}
|
|
6200
|
+
}
|
|
6256
6201
|
}
|
|
6257
6202
|
|
|
6258
6203
|
function areHookInputsEqual(nextDeps, prevDeps) {
|
|
@@ -6402,13 +6347,11 @@ function renderWithHooks(current, workInProgress, Component, props, refOrContext
|
|
|
6402
6347
|
// renderPhaseUpdates = null;
|
|
6403
6348
|
// numberOfReRenders = 0;
|
|
6404
6349
|
|
|
6405
|
-
|
|
6406
|
-
|
|
6407
|
-
|
|
6408
|
-
throw ReactError(Error("Rendered fewer hooks than expected. This may be caused by an accidental early return statement."));
|
|
6409
|
-
}
|
|
6350
|
+
if (!!didRenderTooFewHooks) {
|
|
6351
|
+
{
|
|
6352
|
+
throw Error("Rendered fewer hooks than expected. This may be caused by an accidental early return statement.");
|
|
6410
6353
|
}
|
|
6411
|
-
}
|
|
6354
|
+
}
|
|
6412
6355
|
|
|
6413
6356
|
return children;
|
|
6414
6357
|
}
|
|
@@ -6483,13 +6426,11 @@ function updateWorkInProgressHook() {
|
|
|
6483
6426
|
nextCurrentHook = currentHook !== null ? currentHook.next : null;
|
|
6484
6427
|
} else {
|
|
6485
6428
|
// Clone from the current hook.
|
|
6486
|
-
(
|
|
6487
|
-
|
|
6488
|
-
|
|
6489
|
-
throw ReactError(Error("Rendered more hooks than during the previous render."));
|
|
6490
|
-
}
|
|
6429
|
+
if (!(nextCurrentHook !== null)) {
|
|
6430
|
+
{
|
|
6431
|
+
throw Error("Rendered more hooks than during the previous render.");
|
|
6491
6432
|
}
|
|
6492
|
-
}
|
|
6433
|
+
}
|
|
6493
6434
|
|
|
6494
6435
|
currentHook = nextCurrentHook;
|
|
6495
6436
|
var newHook = {
|
|
@@ -6550,13 +6491,11 @@ function updateReducer(reducer, initialArg, init) {
|
|
|
6550
6491
|
var hook = updateWorkInProgressHook();
|
|
6551
6492
|
var queue = hook.queue;
|
|
6552
6493
|
|
|
6553
|
-
(
|
|
6554
|
-
|
|
6555
|
-
|
|
6556
|
-
throw ReactError(Error("Should have a queue. This is likely a bug in React. Please file an issue."));
|
|
6557
|
-
}
|
|
6494
|
+
if (!(queue !== null)) {
|
|
6495
|
+
{
|
|
6496
|
+
throw Error("Should have a queue. This is likely a bug in React. Please file an issue.");
|
|
6558
6497
|
}
|
|
6559
|
-
}
|
|
6498
|
+
}
|
|
6560
6499
|
|
|
6561
6500
|
queue.lastRenderedReducer = reducer;
|
|
6562
6501
|
|
|
@@ -6937,14 +6876,96 @@ function updateMemo(nextCreate, deps) {
|
|
|
6937
6876
|
return nextValue;
|
|
6938
6877
|
}
|
|
6939
6878
|
|
|
6940
|
-
function
|
|
6941
|
-
|
|
6942
|
-
|
|
6943
|
-
|
|
6944
|
-
|
|
6879
|
+
function mountDeferredValue(value, config) {
|
|
6880
|
+
var _mountState = mountState(value),
|
|
6881
|
+
prevValue = _mountState[0],
|
|
6882
|
+
setValue = _mountState[1];
|
|
6883
|
+
|
|
6884
|
+
mountEffect(function () {
|
|
6885
|
+
Scheduler$1.unstable_next(function () {
|
|
6886
|
+
var previousConfig = ReactCurrentBatchConfig$1.suspense;
|
|
6887
|
+
ReactCurrentBatchConfig$1.suspense = config === undefined ? null : config;
|
|
6888
|
+
|
|
6889
|
+
try {
|
|
6890
|
+
setValue(value);
|
|
6891
|
+
} finally {
|
|
6892
|
+
ReactCurrentBatchConfig$1.suspense = previousConfig;
|
|
6893
|
+
}
|
|
6894
|
+
});
|
|
6895
|
+
}, [value, config]);
|
|
6896
|
+
return prevValue;
|
|
6897
|
+
}
|
|
6898
|
+
|
|
6899
|
+
function updateDeferredValue(value, config) {
|
|
6900
|
+
var _updateState = updateState(value),
|
|
6901
|
+
prevValue = _updateState[0],
|
|
6902
|
+
setValue = _updateState[1];
|
|
6903
|
+
|
|
6904
|
+
updateEffect(function () {
|
|
6905
|
+
Scheduler$1.unstable_next(function () {
|
|
6906
|
+
var previousConfig = ReactCurrentBatchConfig$1.suspense;
|
|
6907
|
+
ReactCurrentBatchConfig$1.suspense = config === undefined ? null : config;
|
|
6908
|
+
|
|
6909
|
+
try {
|
|
6910
|
+
setValue(value);
|
|
6911
|
+
} finally {
|
|
6912
|
+
ReactCurrentBatchConfig$1.suspense = previousConfig;
|
|
6913
|
+
}
|
|
6914
|
+
});
|
|
6915
|
+
}, [value, config]);
|
|
6916
|
+
return prevValue;
|
|
6917
|
+
}
|
|
6918
|
+
|
|
6919
|
+
function mountTransition(config) {
|
|
6920
|
+
var _mountState2 = mountState(false),
|
|
6921
|
+
isPending = _mountState2[0],
|
|
6922
|
+
setPending = _mountState2[1];
|
|
6923
|
+
|
|
6924
|
+
var startTransition = mountCallback(function (callback) {
|
|
6925
|
+
setPending(true);
|
|
6926
|
+
Scheduler$1.unstable_next(function () {
|
|
6927
|
+
var previousConfig = ReactCurrentBatchConfig$1.suspense;
|
|
6928
|
+
ReactCurrentBatchConfig$1.suspense = config === undefined ? null : config;
|
|
6929
|
+
|
|
6930
|
+
try {
|
|
6931
|
+
setPending(false);
|
|
6932
|
+
callback();
|
|
6933
|
+
} finally {
|
|
6934
|
+
ReactCurrentBatchConfig$1.suspense = previousConfig;
|
|
6935
|
+
}
|
|
6936
|
+
});
|
|
6937
|
+
}, [config, isPending]);
|
|
6938
|
+
return [startTransition, isPending];
|
|
6939
|
+
}
|
|
6940
|
+
|
|
6941
|
+
function updateTransition(config) {
|
|
6942
|
+
var _updateState2 = updateState(false),
|
|
6943
|
+
isPending = _updateState2[0],
|
|
6944
|
+
setPending = _updateState2[1];
|
|
6945
|
+
|
|
6946
|
+
var startTransition = updateCallback(function (callback) {
|
|
6947
|
+
setPending(true);
|
|
6948
|
+
Scheduler$1.unstable_next(function () {
|
|
6949
|
+
var previousConfig = ReactCurrentBatchConfig$1.suspense;
|
|
6950
|
+
ReactCurrentBatchConfig$1.suspense = config === undefined ? null : config;
|
|
6951
|
+
|
|
6952
|
+
try {
|
|
6953
|
+
setPending(false);
|
|
6954
|
+
callback();
|
|
6955
|
+
} finally {
|
|
6956
|
+
ReactCurrentBatchConfig$1.suspense = previousConfig;
|
|
6945
6957
|
}
|
|
6958
|
+
});
|
|
6959
|
+
}, [config, isPending]);
|
|
6960
|
+
return [startTransition, isPending];
|
|
6961
|
+
}
|
|
6962
|
+
|
|
6963
|
+
function dispatchAction(fiber, queue, action) {
|
|
6964
|
+
if (!(numberOfReRenders < RE_RENDER_LIMIT)) {
|
|
6965
|
+
{
|
|
6966
|
+
throw Error("Too many re-renders. React limits the number of renders to prevent an infinite loop.");
|
|
6946
6967
|
}
|
|
6947
|
-
}
|
|
6968
|
+
}
|
|
6948
6969
|
|
|
6949
6970
|
{
|
|
6950
6971
|
!(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;
|
|
@@ -6989,7 +7010,7 @@ function dispatchAction(fiber, queue, action) {
|
|
|
6989
7010
|
lastRenderPhaseUpdate.next = update;
|
|
6990
7011
|
}
|
|
6991
7012
|
} else {
|
|
6992
|
-
var currentTime =
|
|
7013
|
+
var currentTime = requestCurrentTimeForUpdate();
|
|
6993
7014
|
var suspenseConfig = requestCurrentSuspenseConfig();
|
|
6994
7015
|
var expirationTime = computeExpirationForFiber(currentTime, fiber, suspenseConfig);
|
|
6995
7016
|
var _update2 = {
|
|
@@ -7088,7 +7109,9 @@ var ContextOnlyDispatcher = {
|
|
|
7088
7109
|
useRef: throwInvalidHookError,
|
|
7089
7110
|
useState: throwInvalidHookError,
|
|
7090
7111
|
useDebugValue: throwInvalidHookError,
|
|
7091
|
-
useResponder: throwInvalidHookError
|
|
7112
|
+
useResponder: throwInvalidHookError,
|
|
7113
|
+
useDeferredValue: throwInvalidHookError,
|
|
7114
|
+
useTransition: throwInvalidHookError
|
|
7092
7115
|
};
|
|
7093
7116
|
var HooksDispatcherOnMountInDEV = null;
|
|
7094
7117
|
var HooksDispatcherOnMountWithHookTypesInDEV = null;
|
|
@@ -7189,6 +7212,16 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
|
7189
7212
|
currentHookNameInDev = 'useResponder';
|
|
7190
7213
|
mountHookTypesDev();
|
|
7191
7214
|
return createResponderListener(responder, props);
|
|
7215
|
+
},
|
|
7216
|
+
useDeferredValue: function (value, config) {
|
|
7217
|
+
currentHookNameInDev = 'useDeferredValue';
|
|
7218
|
+
mountHookTypesDev();
|
|
7219
|
+
return mountDeferredValue(value, config);
|
|
7220
|
+
},
|
|
7221
|
+
useTransition: function (config) {
|
|
7222
|
+
currentHookNameInDev = 'useTransition';
|
|
7223
|
+
mountHookTypesDev();
|
|
7224
|
+
return mountTransition(config);
|
|
7192
7225
|
}
|
|
7193
7226
|
};
|
|
7194
7227
|
HooksDispatcherOnMountWithHookTypesInDEV = {
|
|
@@ -7270,6 +7303,16 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
|
7270
7303
|
currentHookNameInDev = 'useResponder';
|
|
7271
7304
|
updateHookTypesDev();
|
|
7272
7305
|
return createResponderListener(responder, props);
|
|
7306
|
+
},
|
|
7307
|
+
useDeferredValue: function (value, config) {
|
|
7308
|
+
currentHookNameInDev = 'useDeferredValue';
|
|
7309
|
+
updateHookTypesDev();
|
|
7310
|
+
return mountDeferredValue(value, config);
|
|
7311
|
+
},
|
|
7312
|
+
useTransition: function (config) {
|
|
7313
|
+
currentHookNameInDev = 'useTransition';
|
|
7314
|
+
updateHookTypesDev();
|
|
7315
|
+
return mountTransition(config);
|
|
7273
7316
|
}
|
|
7274
7317
|
};
|
|
7275
7318
|
HooksDispatcherOnUpdateInDEV = {
|
|
@@ -7351,6 +7394,16 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
|
7351
7394
|
currentHookNameInDev = 'useResponder';
|
|
7352
7395
|
updateHookTypesDev();
|
|
7353
7396
|
return createResponderListener(responder, props);
|
|
7397
|
+
},
|
|
7398
|
+
useDeferredValue: function (value, config) {
|
|
7399
|
+
currentHookNameInDev = 'useDeferredValue';
|
|
7400
|
+
updateHookTypesDev();
|
|
7401
|
+
return updateDeferredValue(value, config);
|
|
7402
|
+
},
|
|
7403
|
+
useTransition: function (config) {
|
|
7404
|
+
currentHookNameInDev = 'useTransition';
|
|
7405
|
+
updateHookTypesDev();
|
|
7406
|
+
return updateTransition(config);
|
|
7354
7407
|
}
|
|
7355
7408
|
};
|
|
7356
7409
|
InvalidNestedHooksDispatcherOnMountInDEV = {
|
|
@@ -7444,6 +7497,18 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
|
7444
7497
|
warnInvalidHookAccess();
|
|
7445
7498
|
mountHookTypesDev();
|
|
7446
7499
|
return createResponderListener(responder, props);
|
|
7500
|
+
},
|
|
7501
|
+
useDeferredValue: function (value, config) {
|
|
7502
|
+
currentHookNameInDev = 'useDeferredValue';
|
|
7503
|
+
warnInvalidHookAccess();
|
|
7504
|
+
mountHookTypesDev();
|
|
7505
|
+
return mountDeferredValue(value, config);
|
|
7506
|
+
},
|
|
7507
|
+
useTransition: function (config) {
|
|
7508
|
+
currentHookNameInDev = 'useTransition';
|
|
7509
|
+
warnInvalidHookAccess();
|
|
7510
|
+
mountHookTypesDev();
|
|
7511
|
+
return mountTransition(config);
|
|
7447
7512
|
}
|
|
7448
7513
|
};
|
|
7449
7514
|
InvalidNestedHooksDispatcherOnUpdateInDEV = {
|
|
@@ -7537,6 +7602,18 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
|
7537
7602
|
warnInvalidHookAccess();
|
|
7538
7603
|
updateHookTypesDev();
|
|
7539
7604
|
return createResponderListener(responder, props);
|
|
7605
|
+
},
|
|
7606
|
+
useDeferredValue: function (value, config) {
|
|
7607
|
+
currentHookNameInDev = 'useDeferredValue';
|
|
7608
|
+
warnInvalidHookAccess();
|
|
7609
|
+
updateHookTypesDev();
|
|
7610
|
+
return updateDeferredValue(value, config);
|
|
7611
|
+
},
|
|
7612
|
+
useTransition: function (config) {
|
|
7613
|
+
currentHookNameInDev = 'useTransition';
|
|
7614
|
+
warnInvalidHookAccess();
|
|
7615
|
+
updateHookTypesDev();
|
|
7616
|
+
return updateTransition(config);
|
|
7540
7617
|
}
|
|
7541
7618
|
};
|
|
7542
7619
|
}
|
|
@@ -7825,13 +7902,11 @@ function tryToClaimNextHydratableInstance(fiber) {
|
|
|
7825
7902
|
|
|
7826
7903
|
function prepareToHydrateHostInstance(fiber, rootContainerInstance, hostContext) {
|
|
7827
7904
|
if (!supportsHydration) {
|
|
7828
|
-
|
|
7905
|
+
{
|
|
7829
7906
|
{
|
|
7830
|
-
|
|
7831
|
-
throw ReactError(Error("Expected prepareToHydrateHostInstance() to never be called. This error is likely caused by a bug in React. Please file an issue."));
|
|
7832
|
-
}
|
|
7907
|
+
throw Error("Expected prepareToHydrateHostInstance() to never be called. This error is likely caused by a bug in React. Please file an issue.");
|
|
7833
7908
|
}
|
|
7834
|
-
}
|
|
7909
|
+
}
|
|
7835
7910
|
}
|
|
7836
7911
|
|
|
7837
7912
|
var instance = fiber.stateNode;
|
|
@@ -7849,13 +7924,11 @@ function prepareToHydrateHostInstance(fiber, rootContainerInstance, hostContext)
|
|
|
7849
7924
|
|
|
7850
7925
|
function prepareToHydrateHostTextInstance(fiber) {
|
|
7851
7926
|
if (!supportsHydration) {
|
|
7852
|
-
|
|
7927
|
+
{
|
|
7853
7928
|
{
|
|
7854
|
-
|
|
7855
|
-
throw ReactError(Error("Expected prepareToHydrateHostTextInstance() to never be called. This error is likely caused by a bug in React. Please file an issue."));
|
|
7856
|
-
}
|
|
7929
|
+
throw Error("Expected prepareToHydrateHostTextInstance() to never be called. This error is likely caused by a bug in React. Please file an issue.");
|
|
7857
7930
|
}
|
|
7858
|
-
}
|
|
7931
|
+
}
|
|
7859
7932
|
}
|
|
7860
7933
|
|
|
7861
7934
|
var textInstance = fiber.stateNode;
|
|
@@ -7895,46 +7968,41 @@ function prepareToHydrateHostTextInstance(fiber) {
|
|
|
7895
7968
|
|
|
7896
7969
|
function prepareToHydrateHostSuspenseInstance(fiber) {
|
|
7897
7970
|
if (!supportsHydration) {
|
|
7898
|
-
|
|
7971
|
+
{
|
|
7899
7972
|
{
|
|
7900
|
-
|
|
7901
|
-
throw ReactError(Error("Expected prepareToHydrateHostSuspenseInstance() to never be called. This error is likely caused by a bug in React. Please file an issue."));
|
|
7902
|
-
}
|
|
7973
|
+
throw Error("Expected prepareToHydrateHostSuspenseInstance() to never be called. This error is likely caused by a bug in React. Please file an issue.");
|
|
7903
7974
|
}
|
|
7904
|
-
}
|
|
7975
|
+
}
|
|
7905
7976
|
}
|
|
7906
7977
|
|
|
7907
7978
|
var suspenseState = fiber.memoizedState;
|
|
7908
7979
|
var suspenseInstance = suspenseState !== null ? suspenseState.dehydrated : null;
|
|
7909
7980
|
|
|
7910
|
-
|
|
7911
|
-
|
|
7912
|
-
|
|
7913
|
-
throw ReactError(Error("Expected to have a hydrated suspense instance. This error is likely caused by a bug in React. Please file an issue."));
|
|
7914
|
-
}
|
|
7981
|
+
if (!suspenseInstance) {
|
|
7982
|
+
{
|
|
7983
|
+
throw Error("Expected to have a hydrated suspense instance. This error is likely caused by a bug in React. Please file an issue.");
|
|
7915
7984
|
}
|
|
7916
|
-
}
|
|
7985
|
+
}
|
|
7917
7986
|
|
|
7918
7987
|
hydrateSuspenseInstance(suspenseInstance, fiber);
|
|
7919
7988
|
}
|
|
7920
7989
|
|
|
7921
7990
|
function skipPastDehydratedSuspenseInstance(fiber) {
|
|
7922
7991
|
if (!supportsHydration) {
|
|
7923
|
-
|
|
7992
|
+
{
|
|
7924
7993
|
{
|
|
7925
|
-
|
|
7926
|
-
throw ReactError(Error("Expected skipPastDehydratedSuspenseInstance() to never be called. This error is likely caused by a bug in React. Please file an issue."));
|
|
7927
|
-
}
|
|
7994
|
+
throw Error("Expected skipPastDehydratedSuspenseInstance() to never be called. This error is likely caused by a bug in React. Please file an issue.");
|
|
7928
7995
|
}
|
|
7929
|
-
}
|
|
7996
|
+
}
|
|
7930
7997
|
}
|
|
7931
7998
|
|
|
7932
7999
|
var suspenseState = fiber.memoizedState;
|
|
7933
8000
|
var suspenseInstance = suspenseState !== null ? suspenseState.dehydrated : null;
|
|
7934
8001
|
|
|
7935
|
-
if (suspenseInstance
|
|
7936
|
-
|
|
7937
|
-
|
|
8002
|
+
if (!suspenseInstance) {
|
|
8003
|
+
{
|
|
8004
|
+
throw Error("Expected to have a hydrated suspense instance. This error is likely caused by a bug in React. Please file an issue.");
|
|
8005
|
+
}
|
|
7938
8006
|
}
|
|
7939
8007
|
|
|
7940
8008
|
return getNextHydratableInstanceAfterSuspenseInstance(suspenseInstance);
|
|
@@ -8470,13 +8538,11 @@ function updateHostRoot(current$$1, workInProgress, renderExpirationTime) {
|
|
|
8470
8538
|
pushHostRootContext(workInProgress);
|
|
8471
8539
|
var updateQueue = workInProgress.updateQueue;
|
|
8472
8540
|
|
|
8473
|
-
(
|
|
8474
|
-
|
|
8475
|
-
|
|
8476
|
-
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."));
|
|
8477
|
-
}
|
|
8541
|
+
if (!(updateQueue !== null)) {
|
|
8542
|
+
{
|
|
8543
|
+
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.");
|
|
8478
8544
|
}
|
|
8479
|
-
}
|
|
8545
|
+
}
|
|
8480
8546
|
|
|
8481
8547
|
var nextProps = workInProgress.pendingProps;
|
|
8482
8548
|
var prevState = workInProgress.memoizedState;
|
|
@@ -8663,13 +8729,11 @@ function mountLazyComponent(_current, workInProgress, elementType, updateExpirat
|
|
|
8663
8729
|
// implementation detail.
|
|
8664
8730
|
|
|
8665
8731
|
|
|
8666
|
-
|
|
8732
|
+
{
|
|
8667
8733
|
{
|
|
8668
|
-
|
|
8669
|
-
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));
|
|
8670
|
-
}
|
|
8734
|
+
throw Error("Element type is invalid. Received a promise that resolves to: " + Component + ". Lazy element type must resolve to a class or function." + hint);
|
|
8671
8735
|
}
|
|
8672
|
-
}
|
|
8736
|
+
}
|
|
8673
8737
|
}
|
|
8674
8738
|
}
|
|
8675
8739
|
|
|
@@ -8872,7 +8936,7 @@ function validateFunctionComponentInDev(workInProgress, Component) {
|
|
|
8872
8936
|
|
|
8873
8937
|
var SUSPENDED_MARKER = {
|
|
8874
8938
|
dehydrated: null,
|
|
8875
|
-
retryTime:
|
|
8939
|
+
retryTime: NoWork
|
|
8876
8940
|
};
|
|
8877
8941
|
|
|
8878
8942
|
function shouldRemainOnFallback(suspenseContext, current$$1, workInProgress) {
|
|
@@ -8948,12 +9012,12 @@ function updateSuspenseComponent(current$$1, workInProgress, renderExpirationTim
|
|
|
8948
9012
|
|
|
8949
9013
|
|
|
8950
9014
|
if (current$$1 === null) {
|
|
8951
|
-
|
|
8952
|
-
|
|
8953
|
-
|
|
8954
|
-
|
|
8955
|
-
tryToClaimNextHydratableInstance(workInProgress); // This could've been a dehydrated suspense component.
|
|
9015
|
+
// If we're currently hydrating, try to hydrate this boundary.
|
|
9016
|
+
// But only if this has a fallback.
|
|
9017
|
+
if (nextProps.fallback !== undefined) {
|
|
9018
|
+
tryToClaimNextHydratableInstance(workInProgress); // This could've been a dehydrated suspense component.
|
|
8956
9019
|
|
|
9020
|
+
if (enableSuspenseServerRenderer) {
|
|
8957
9021
|
var suspenseState = workInProgress.memoizedState;
|
|
8958
9022
|
|
|
8959
9023
|
if (suspenseState !== null) {
|
|
@@ -9255,7 +9319,7 @@ function mountDehydratedSuspenseComponent(workInProgress, suspenseInstance, rend
|
|
|
9255
9319
|
// Instead, we'll leave the content in place and try to hydrate it later.
|
|
9256
9320
|
if ((workInProgress.mode & BatchedMode) === NoMode) {
|
|
9257
9321
|
{
|
|
9258
|
-
warning$1(false, 'Cannot hydrate Suspense in legacy mode. Switch from ' + 'ReactDOM.hydrate(element, container) to ' + 'ReactDOM.
|
|
9322
|
+
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.');
|
|
9259
9323
|
}
|
|
9260
9324
|
|
|
9261
9325
|
workInProgress.expirationTime = Sync;
|
|
@@ -9270,7 +9334,7 @@ function mountDehydratedSuspenseComponent(workInProgress, suspenseInstance, rend
|
|
|
9270
9334
|
// a protocol to transfer that time, we'll just estimate it by using the current
|
|
9271
9335
|
// time. This will mean that Suspense timeouts are slightly shifted to later than
|
|
9272
9336
|
// they should be.
|
|
9273
|
-
var serverDisplayTime =
|
|
9337
|
+
var serverDisplayTime = requestCurrentTimeForUpdate(); // Schedule a normal pri update to render this content.
|
|
9274
9338
|
|
|
9275
9339
|
var newExpirationTime = computeAsyncExpiration(serverDisplayTime);
|
|
9276
9340
|
|
|
@@ -9379,29 +9443,40 @@ function updateDehydratedSuspenseComponent(current$$1, workInProgress, suspenseI
|
|
|
9379
9443
|
}
|
|
9380
9444
|
}
|
|
9381
9445
|
|
|
9382
|
-
function
|
|
9383
|
-
|
|
9384
|
-
|
|
9385
|
-
|
|
9386
|
-
var node = firstChild;
|
|
9446
|
+
function scheduleWorkOnFiber(fiber, renderExpirationTime) {
|
|
9447
|
+
if (fiber.expirationTime < renderExpirationTime) {
|
|
9448
|
+
fiber.expirationTime = renderExpirationTime;
|
|
9449
|
+
}
|
|
9387
9450
|
|
|
9388
|
-
|
|
9389
|
-
if (node.tag === SuspenseComponent) {
|
|
9390
|
-
var state = node.memoizedState;
|
|
9451
|
+
var alternate = fiber.alternate;
|
|
9391
9452
|
|
|
9392
|
-
|
|
9393
|
-
|
|
9394
|
-
|
|
9395
|
-
}
|
|
9453
|
+
if (alternate !== null && alternate.expirationTime < renderExpirationTime) {
|
|
9454
|
+
alternate.expirationTime = renderExpirationTime;
|
|
9455
|
+
}
|
|
9396
9456
|
|
|
9397
|
-
|
|
9457
|
+
scheduleWorkOnParentPath(fiber.return, renderExpirationTime);
|
|
9458
|
+
}
|
|
9398
9459
|
|
|
9399
|
-
|
|
9400
|
-
|
|
9401
|
-
|
|
9460
|
+
function propagateSuspenseContextChange(workInProgress, firstChild, renderExpirationTime) {
|
|
9461
|
+
// Mark any Suspense boundaries with fallbacks as having work to do.
|
|
9462
|
+
// If they were previously forced into fallbacks, they may now be able
|
|
9463
|
+
// to unblock.
|
|
9464
|
+
var node = firstChild;
|
|
9402
9465
|
|
|
9403
|
-
|
|
9404
|
-
|
|
9466
|
+
while (node !== null) {
|
|
9467
|
+
if (node.tag === SuspenseComponent) {
|
|
9468
|
+
var state = node.memoizedState;
|
|
9469
|
+
|
|
9470
|
+
if (state !== null) {
|
|
9471
|
+
scheduleWorkOnFiber(node, renderExpirationTime);
|
|
9472
|
+
}
|
|
9473
|
+
} else if (node.tag === SuspenseListComponent) {
|
|
9474
|
+
// If the tail is hidden there might not be an Suspense boundaries
|
|
9475
|
+
// to schedule work on. In this case we have to schedule it on the
|
|
9476
|
+
// list itself.
|
|
9477
|
+
// We don't have to traverse to the children of the list since
|
|
9478
|
+
// the list will propagate the change when it rerenders.
|
|
9479
|
+
scheduleWorkOnFiber(node, renderExpirationTime);
|
|
9405
9480
|
} else if (node.child !== null) {
|
|
9406
9481
|
node.child.return = node;
|
|
9407
9482
|
node = node.child;
|
|
@@ -9546,7 +9621,7 @@ function validateSuspenseListChildren(children, revealOrder) {
|
|
|
9546
9621
|
}
|
|
9547
9622
|
}
|
|
9548
9623
|
|
|
9549
|
-
function initSuspenseListRenderState(workInProgress, isBackwards, tail, lastContentRow, tailMode) {
|
|
9624
|
+
function initSuspenseListRenderState(workInProgress, isBackwards, tail, lastContentRow, tailMode, lastEffectBeforeRendering) {
|
|
9550
9625
|
var renderState = workInProgress.memoizedState;
|
|
9551
9626
|
|
|
9552
9627
|
if (renderState === null) {
|
|
@@ -9556,7 +9631,8 @@ function initSuspenseListRenderState(workInProgress, isBackwards, tail, lastCont
|
|
|
9556
9631
|
last: lastContentRow,
|
|
9557
9632
|
tail: tail,
|
|
9558
9633
|
tailExpiration: 0,
|
|
9559
|
-
tailMode: tailMode
|
|
9634
|
+
tailMode: tailMode,
|
|
9635
|
+
lastEffect: lastEffectBeforeRendering
|
|
9560
9636
|
};
|
|
9561
9637
|
} else {
|
|
9562
9638
|
// We can reuse the existing object from previous renders.
|
|
@@ -9566,6 +9642,7 @@ function initSuspenseListRenderState(workInProgress, isBackwards, tail, lastCont
|
|
|
9566
9642
|
renderState.tail = tail;
|
|
9567
9643
|
renderState.tailExpiration = 0;
|
|
9568
9644
|
renderState.tailMode = tailMode;
|
|
9645
|
+
renderState.lastEffect = lastEffectBeforeRendering;
|
|
9569
9646
|
}
|
|
9570
9647
|
} // This can end up rendering this component multiple passes.
|
|
9571
9648
|
// The first pass splits the children fibers into two sets. A head and tail.
|
|
@@ -9630,7 +9707,7 @@ function updateSuspenseListComponent(current$$1, workInProgress, renderExpiratio
|
|
|
9630
9707
|
}
|
|
9631
9708
|
|
|
9632
9709
|
initSuspenseListRenderState(workInProgress, false, // isBackwards
|
|
9633
|
-
tail, lastContentRow, tailMode);
|
|
9710
|
+
tail, lastContentRow, tailMode, workInProgress.lastEffect);
|
|
9634
9711
|
break;
|
|
9635
9712
|
}
|
|
9636
9713
|
|
|
@@ -9662,7 +9739,7 @@ function updateSuspenseListComponent(current$$1, workInProgress, renderExpiratio
|
|
|
9662
9739
|
|
|
9663
9740
|
initSuspenseListRenderState(workInProgress, true, // isBackwards
|
|
9664
9741
|
_tail, null, // last
|
|
9665
|
-
tailMode);
|
|
9742
|
+
tailMode, workInProgress.lastEffect);
|
|
9666
9743
|
break;
|
|
9667
9744
|
}
|
|
9668
9745
|
|
|
@@ -9671,7 +9748,7 @@ function updateSuspenseListComponent(current$$1, workInProgress, renderExpiratio
|
|
|
9671
9748
|
initSuspenseListRenderState(workInProgress, false, // isBackwards
|
|
9672
9749
|
null, // tail
|
|
9673
9750
|
null, // last
|
|
9674
|
-
undefined);
|
|
9751
|
+
undefined, workInProgress.lastEffect);
|
|
9675
9752
|
break;
|
|
9676
9753
|
}
|
|
9677
9754
|
|
|
@@ -10224,13 +10301,11 @@ function beginWork$1(current$$1, workInProgress, renderExpirationTime) {
|
|
|
10224
10301
|
}
|
|
10225
10302
|
}
|
|
10226
10303
|
|
|
10227
|
-
|
|
10304
|
+
{
|
|
10228
10305
|
{
|
|
10229
|
-
|
|
10230
|
-
throw ReactError(Error("Unknown unit of work tag (" + workInProgress.tag + "). This error is likely caused by a bug in React. Please file an issue."));
|
|
10231
|
-
}
|
|
10306
|
+
throw Error("Unknown unit of work tag (" + workInProgress.tag + "). This error is likely caused by a bug in React. Please file an issue.");
|
|
10232
10307
|
}
|
|
10233
|
-
}
|
|
10308
|
+
}
|
|
10234
10309
|
}
|
|
10235
10310
|
|
|
10236
10311
|
function createFundamentalStateInstance(currentFiber, props, impl, state) {
|
|
@@ -10275,6 +10350,31 @@ function collectScopedNodes(node, fn, scopedNodes) {
|
|
|
10275
10350
|
}
|
|
10276
10351
|
}
|
|
10277
10352
|
|
|
10353
|
+
function collectFirstScopedNode(node, fn) {
|
|
10354
|
+
if (enableScopeAPI) {
|
|
10355
|
+
if (node.tag === HostComponent) {
|
|
10356
|
+
var _type2 = node.type,
|
|
10357
|
+
memoizedProps = node.memoizedProps;
|
|
10358
|
+
|
|
10359
|
+
if (fn(_type2, memoizedProps) === true) {
|
|
10360
|
+
return getPublicInstance(node.stateNode);
|
|
10361
|
+
}
|
|
10362
|
+
}
|
|
10363
|
+
|
|
10364
|
+
var child = node.child;
|
|
10365
|
+
|
|
10366
|
+
if (isFiberSuspenseAndTimedOut(node)) {
|
|
10367
|
+
child = getSuspenseFallbackChild(node);
|
|
10368
|
+
}
|
|
10369
|
+
|
|
10370
|
+
if (child !== null) {
|
|
10371
|
+
return collectFirstScopedNodeFromChildren(child, fn);
|
|
10372
|
+
}
|
|
10373
|
+
}
|
|
10374
|
+
|
|
10375
|
+
return null;
|
|
10376
|
+
}
|
|
10377
|
+
|
|
10278
10378
|
function collectScopedNodesFromChildren(startingChild, fn, scopedNodes) {
|
|
10279
10379
|
var child = startingChild;
|
|
10280
10380
|
|
|
@@ -10284,6 +10384,22 @@ function collectScopedNodesFromChildren(startingChild, fn, scopedNodes) {
|
|
|
10284
10384
|
}
|
|
10285
10385
|
}
|
|
10286
10386
|
|
|
10387
|
+
function collectFirstScopedNodeFromChildren(startingChild, fn) {
|
|
10388
|
+
var child = startingChild;
|
|
10389
|
+
|
|
10390
|
+
while (child !== null) {
|
|
10391
|
+
var scopedNode = collectFirstScopedNode(child, fn);
|
|
10392
|
+
|
|
10393
|
+
if (scopedNode !== null) {
|
|
10394
|
+
return scopedNode;
|
|
10395
|
+
}
|
|
10396
|
+
|
|
10397
|
+
child = child.sibling;
|
|
10398
|
+
}
|
|
10399
|
+
|
|
10400
|
+
return null;
|
|
10401
|
+
}
|
|
10402
|
+
|
|
10287
10403
|
function collectNearestScopeMethods(node, scope, childrenScopes) {
|
|
10288
10404
|
if (isValidScopeNode(node, scope)) {
|
|
10289
10405
|
childrenScopes.push(node.stateNode.methods);
|
|
@@ -10310,11 +10426,10 @@ function collectNearestChildScopeMethods(startingChild, scope, childrenScopes) {
|
|
|
10310
10426
|
}
|
|
10311
10427
|
|
|
10312
10428
|
function isValidScopeNode(node, scope) {
|
|
10313
|
-
return node.tag === ScopeComponent && node.type === scope;
|
|
10429
|
+
return node.tag === ScopeComponent && node.type === scope && node.stateNode !== null;
|
|
10314
10430
|
}
|
|
10315
10431
|
|
|
10316
10432
|
function createScopeMethods(scope, instance) {
|
|
10317
|
-
var fn = scope.fn;
|
|
10318
10433
|
return {
|
|
10319
10434
|
getChildren: function () {
|
|
10320
10435
|
var currentFiber = instance.fiber;
|
|
@@ -10366,7 +10481,7 @@ function createScopeMethods(scope, instance) {
|
|
|
10366
10481
|
var currentFiber = instance.fiber;
|
|
10367
10482
|
return currentFiber.memoizedProps;
|
|
10368
10483
|
},
|
|
10369
|
-
|
|
10484
|
+
queryAllNodes: function (fn) {
|
|
10370
10485
|
var currentFiber = instance.fiber;
|
|
10371
10486
|
var child = currentFiber.child;
|
|
10372
10487
|
var scopedNodes = [];
|
|
@@ -10376,6 +10491,29 @@ function createScopeMethods(scope, instance) {
|
|
|
10376
10491
|
}
|
|
10377
10492
|
|
|
10378
10493
|
return scopedNodes.length === 0 ? null : scopedNodes;
|
|
10494
|
+
},
|
|
10495
|
+
queryFirstNode: function (fn) {
|
|
10496
|
+
var currentFiber = instance.fiber;
|
|
10497
|
+
var child = currentFiber.child;
|
|
10498
|
+
|
|
10499
|
+
if (child !== null) {
|
|
10500
|
+
return collectFirstScopedNodeFromChildren(child, fn);
|
|
10501
|
+
}
|
|
10502
|
+
|
|
10503
|
+
return null;
|
|
10504
|
+
},
|
|
10505
|
+
containsNode: function (node) {
|
|
10506
|
+
var fiber = getInstanceFromNode(node);
|
|
10507
|
+
|
|
10508
|
+
while (fiber !== null) {
|
|
10509
|
+
if (fiber.tag === ScopeComponent && fiber.type === scope && fiber.stateNode === instance) {
|
|
10510
|
+
return true;
|
|
10511
|
+
}
|
|
10512
|
+
|
|
10513
|
+
fiber = fiber.return;
|
|
10514
|
+
}
|
|
10515
|
+
|
|
10516
|
+
return false;
|
|
10379
10517
|
}
|
|
10380
10518
|
};
|
|
10381
10519
|
}
|
|
@@ -10910,13 +11048,11 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
10910
11048
|
}
|
|
10911
11049
|
} else {
|
|
10912
11050
|
if (!newProps) {
|
|
10913
|
-
(
|
|
10914
|
-
|
|
10915
|
-
|
|
10916
|
-
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."));
|
|
10917
|
-
}
|
|
11051
|
+
if (!(workInProgress.stateNode !== null)) {
|
|
11052
|
+
{
|
|
11053
|
+
throw Error("We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue.");
|
|
10918
11054
|
}
|
|
10919
|
-
}
|
|
11055
|
+
} // This can happen when we abort work.
|
|
10920
11056
|
|
|
10921
11057
|
|
|
10922
11058
|
break;
|
|
@@ -10987,13 +11123,11 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
10987
11123
|
updateHostText$1(current, workInProgress, oldText, newText);
|
|
10988
11124
|
} else {
|
|
10989
11125
|
if (typeof newText !== 'string') {
|
|
10990
|
-
(
|
|
10991
|
-
|
|
10992
|
-
|
|
10993
|
-
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."));
|
|
10994
|
-
}
|
|
11126
|
+
if (!(workInProgress.stateNode !== null)) {
|
|
11127
|
+
{
|
|
11128
|
+
throw Error("We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue.");
|
|
10995
11129
|
}
|
|
10996
|
-
}
|
|
11130
|
+
} // This can happen when we abort work.
|
|
10997
11131
|
|
|
10998
11132
|
}
|
|
10999
11133
|
|
|
@@ -11028,13 +11162,11 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
11028
11162
|
if (current === null) {
|
|
11029
11163
|
var _wasHydrated3 = popHydrationState(workInProgress);
|
|
11030
11164
|
|
|
11031
|
-
|
|
11032
|
-
|
|
11033
|
-
|
|
11034
|
-
throw ReactError(Error("A dehydrated suspense component was completed without a hydrated node. This is probably a bug in React."));
|
|
11035
|
-
}
|
|
11165
|
+
if (!_wasHydrated3) {
|
|
11166
|
+
{
|
|
11167
|
+
throw Error("A dehydrated suspense component was completed without a hydrated node. This is probably a bug in React.");
|
|
11036
11168
|
}
|
|
11037
|
-
}
|
|
11169
|
+
}
|
|
11038
11170
|
|
|
11039
11171
|
prepareToHydrateHostSuspenseInstance(workInProgress);
|
|
11040
11172
|
|
|
@@ -11077,10 +11209,9 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
11077
11209
|
var prevDidTimeout = false;
|
|
11078
11210
|
|
|
11079
11211
|
if (current === null) {
|
|
11080
|
-
|
|
11081
|
-
|
|
11082
|
-
|
|
11083
|
-
popHydrationState(workInProgress);
|
|
11212
|
+
if (workInProgress.memoizedProps.fallback !== undefined) {
|
|
11213
|
+
popHydrationState(workInProgress);
|
|
11214
|
+
}
|
|
11084
11215
|
} else {
|
|
11085
11216
|
var prevState = current.memoizedState;
|
|
11086
11217
|
prevDidTimeout = prevState !== null;
|
|
@@ -11265,7 +11396,11 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
11265
11396
|
// Reset the effect list before doing the second pass since that's now invalid.
|
|
11266
11397
|
|
|
11267
11398
|
|
|
11268
|
-
|
|
11399
|
+
if (renderState.lastEffect === null) {
|
|
11400
|
+
workInProgress.firstEffect = null;
|
|
11401
|
+
}
|
|
11402
|
+
|
|
11403
|
+
workInProgress.lastEffect = renderState.lastEffect; // Reset the child fibers to their original state.
|
|
11269
11404
|
|
|
11270
11405
|
resetChildFibers(workInProgress, renderExpirationTime); // Set up the Suspense Context to force suspense and immediately
|
|
11271
11406
|
// rerender the children.
|
|
@@ -11288,21 +11423,22 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
11288
11423
|
|
|
11289
11424
|
if (_suspended !== null) {
|
|
11290
11425
|
workInProgress.effectTag |= DidCapture;
|
|
11291
|
-
didSuspendAlready = true;
|
|
11426
|
+
didSuspendAlready = true; // Ensure we transfer the update queue to the parent so that it doesn't
|
|
11427
|
+
// get lost if this row ends up dropped during a second pass.
|
|
11428
|
+
|
|
11429
|
+
var _newThennables = _suspended.updateQueue;
|
|
11430
|
+
|
|
11431
|
+
if (_newThennables !== null) {
|
|
11432
|
+
workInProgress.updateQueue = _newThennables;
|
|
11433
|
+
workInProgress.effectTag |= Update;
|
|
11434
|
+
}
|
|
11435
|
+
|
|
11292
11436
|
cutOffTailIfNeeded(renderState, true); // This might have been modified.
|
|
11293
11437
|
|
|
11294
11438
|
if (renderState.tail === null && renderState.tailMode === 'hidden') {
|
|
11295
11439
|
// We need to delete the row we just rendered.
|
|
11296
|
-
//
|
|
11297
|
-
var _newThennables = _suspended.updateQueue;
|
|
11298
|
-
|
|
11299
|
-
if (_newThennables !== null) {
|
|
11300
|
-
workInProgress.updateQueue = _newThennables;
|
|
11301
|
-
workInProgress.effectTag |= Update;
|
|
11302
|
-
} // Reset the effect list to what it w as before we rendered this
|
|
11440
|
+
// Reset the effect list to what it w as before we rendered this
|
|
11303
11441
|
// child. The nested children have already appended themselves.
|
|
11304
|
-
|
|
11305
|
-
|
|
11306
11442
|
var lastEffect = workInProgress.lastEffect = renderState.lastEffect; // Remove any effects that were appended after this point.
|
|
11307
11443
|
|
|
11308
11444
|
if (lastEffect !== null) {
|
|
@@ -11489,13 +11625,11 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
11489
11625
|
}
|
|
11490
11626
|
|
|
11491
11627
|
default:
|
|
11492
|
-
|
|
11628
|
+
{
|
|
11493
11629
|
{
|
|
11494
|
-
|
|
11495
|
-
throw ReactError(Error("Unknown unit of work tag (" + workInProgress.tag + "). This error is likely caused by a bug in React. Please file an issue."));
|
|
11496
|
-
}
|
|
11630
|
+
throw Error("Unknown unit of work tag (" + workInProgress.tag + "). This error is likely caused by a bug in React. Please file an issue.");
|
|
11497
11631
|
}
|
|
11498
|
-
}
|
|
11632
|
+
}
|
|
11499
11633
|
|
|
11500
11634
|
}
|
|
11501
11635
|
|
|
@@ -11528,13 +11662,11 @@ function unwindWork(workInProgress, renderExpirationTime) {
|
|
|
11528
11662
|
popTopLevelContextObject(workInProgress);
|
|
11529
11663
|
var _effectTag = workInProgress.effectTag;
|
|
11530
11664
|
|
|
11531
|
-
(
|
|
11532
|
-
|
|
11533
|
-
|
|
11534
|
-
throw ReactError(Error("The root failed to unmount after an error. This is likely a bug in React. Please file an issue."));
|
|
11535
|
-
}
|
|
11665
|
+
if (!((_effectTag & DidCapture) === NoEffect)) {
|
|
11666
|
+
{
|
|
11667
|
+
throw Error("The root failed to unmount after an error. This is likely a bug in React. Please file an issue.");
|
|
11536
11668
|
}
|
|
11537
|
-
}
|
|
11669
|
+
}
|
|
11538
11670
|
|
|
11539
11671
|
workInProgress.effectTag = _effectTag & ~ShouldCapture | DidCapture;
|
|
11540
11672
|
return workInProgress;
|
|
@@ -11555,13 +11687,11 @@ function unwindWork(workInProgress, renderExpirationTime) {
|
|
|
11555
11687
|
var suspenseState = workInProgress.memoizedState;
|
|
11556
11688
|
|
|
11557
11689
|
if (suspenseState !== null && suspenseState.dehydrated !== null) {
|
|
11558
|
-
(
|
|
11559
|
-
|
|
11560
|
-
|
|
11561
|
-
throw ReactError(Error("Threw in newly mounted dehydrated component. This is likely a bug in React. Please file an issue."));
|
|
11562
|
-
}
|
|
11690
|
+
if (!(workInProgress.alternate !== null)) {
|
|
11691
|
+
{
|
|
11692
|
+
throw Error("Threw in newly mounted dehydrated component. This is likely a bug in React. Please file an issue.");
|
|
11563
11693
|
}
|
|
11564
|
-
}
|
|
11694
|
+
}
|
|
11565
11695
|
|
|
11566
11696
|
resetHydrationState();
|
|
11567
11697
|
}
|
|
@@ -11695,13 +11825,11 @@ var invokeGuardedCallbackImpl = function (name, func, context, a, b, c, d, e, f)
|
|
|
11695
11825
|
// when we call document.createEvent(). However this can cause confusing
|
|
11696
11826
|
// errors: https://github.com/facebookincubator/create-react-app/issues/3482
|
|
11697
11827
|
// So we preemptively throw with a better message instead.
|
|
11698
|
-
(
|
|
11699
|
-
|
|
11700
|
-
|
|
11701
|
-
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."));
|
|
11702
|
-
}
|
|
11828
|
+
if (!(typeof document !== 'undefined')) {
|
|
11829
|
+
{
|
|
11830
|
+
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.");
|
|
11703
11831
|
}
|
|
11704
|
-
}
|
|
11832
|
+
}
|
|
11705
11833
|
|
|
11706
11834
|
var evt = document.createEvent('Event'); // Keeps track of whether the user-provided callback threw an error. We
|
|
11707
11835
|
// set this to true at the beginning, then set it to false right after
|
|
@@ -11869,13 +11997,11 @@ function clearCaughtError() {
|
|
|
11869
11997
|
caughtError = null;
|
|
11870
11998
|
return error;
|
|
11871
11999
|
} else {
|
|
11872
|
-
|
|
12000
|
+
{
|
|
11873
12001
|
{
|
|
11874
|
-
|
|
11875
|
-
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."));
|
|
11876
|
-
}
|
|
12002
|
+
throw Error("clearCaughtError was called but no error was captured. This error is likely caused by a bug in React. Please file an issue.");
|
|
11877
12003
|
}
|
|
11878
|
-
}
|
|
12004
|
+
}
|
|
11879
12005
|
}
|
|
11880
12006
|
}
|
|
11881
12007
|
|
|
@@ -12095,13 +12221,11 @@ function commitBeforeMutationLifeCycles(current$$1, finishedWork) {
|
|
|
12095
12221
|
|
|
12096
12222
|
default:
|
|
12097
12223
|
{
|
|
12098
|
-
|
|
12224
|
+
{
|
|
12099
12225
|
{
|
|
12100
|
-
|
|
12101
|
-
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."));
|
|
12102
|
-
}
|
|
12226
|
+
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.");
|
|
12103
12227
|
}
|
|
12104
|
-
}
|
|
12228
|
+
}
|
|
12105
12229
|
}
|
|
12106
12230
|
}
|
|
12107
12231
|
}
|
|
@@ -12323,13 +12447,11 @@ function commitLifeCycles(finishedRoot, current$$1, finishedWork, committedExpir
|
|
|
12323
12447
|
|
|
12324
12448
|
default:
|
|
12325
12449
|
{
|
|
12326
|
-
|
|
12450
|
+
{
|
|
12327
12451
|
{
|
|
12328
|
-
|
|
12329
|
-
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."));
|
|
12330
|
-
}
|
|
12452
|
+
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.");
|
|
12331
12453
|
}
|
|
12332
|
-
}
|
|
12454
|
+
}
|
|
12333
12455
|
}
|
|
12334
12456
|
}
|
|
12335
12457
|
}
|
|
@@ -12674,13 +12796,11 @@ function commitContainer(finishedWork) {
|
|
|
12674
12796
|
|
|
12675
12797
|
default:
|
|
12676
12798
|
{
|
|
12677
|
-
|
|
12799
|
+
{
|
|
12678
12800
|
{
|
|
12679
|
-
|
|
12680
|
-
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."));
|
|
12681
|
-
}
|
|
12801
|
+
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.");
|
|
12682
12802
|
}
|
|
12683
|
-
}
|
|
12803
|
+
}
|
|
12684
12804
|
}
|
|
12685
12805
|
}
|
|
12686
12806
|
}
|
|
@@ -12696,13 +12816,11 @@ function getHostParentFiber(fiber) {
|
|
|
12696
12816
|
parent = parent.return;
|
|
12697
12817
|
}
|
|
12698
12818
|
|
|
12699
|
-
|
|
12819
|
+
{
|
|
12700
12820
|
{
|
|
12701
|
-
|
|
12702
|
-
throw ReactError(Error("Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue."));
|
|
12703
|
-
}
|
|
12821
|
+
throw Error("Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue.");
|
|
12704
12822
|
}
|
|
12705
|
-
}
|
|
12823
|
+
}
|
|
12706
12824
|
}
|
|
12707
12825
|
|
|
12708
12826
|
function isHostParent(fiber) {
|
|
@@ -12794,13 +12912,11 @@ function commitPlacement(finishedWork) {
|
|
|
12794
12912
|
// eslint-disable-next-line-no-fallthrough
|
|
12795
12913
|
|
|
12796
12914
|
default:
|
|
12797
|
-
|
|
12915
|
+
{
|
|
12798
12916
|
{
|
|
12799
|
-
|
|
12800
|
-
throw ReactError(Error("Invalid host parent fiber. This error is likely caused by a bug in React. Please file an issue."));
|
|
12801
|
-
}
|
|
12917
|
+
throw Error("Invalid host parent fiber. This error is likely caused by a bug in React. Please file an issue.");
|
|
12802
12918
|
}
|
|
12803
|
-
}
|
|
12919
|
+
}
|
|
12804
12920
|
|
|
12805
12921
|
}
|
|
12806
12922
|
|
|
@@ -12875,13 +12991,11 @@ function unmountHostComponents(finishedRoot, current$$1, renderPriorityLevel) {
|
|
|
12875
12991
|
var parent = node.return;
|
|
12876
12992
|
|
|
12877
12993
|
findParent: while (true) {
|
|
12878
|
-
(
|
|
12879
|
-
|
|
12880
|
-
|
|
12881
|
-
throw ReactError(Error("Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue."));
|
|
12882
|
-
}
|
|
12994
|
+
if (!(parent !== null)) {
|
|
12995
|
+
{
|
|
12996
|
+
throw Error("Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue.");
|
|
12883
12997
|
}
|
|
12884
|
-
}
|
|
12998
|
+
}
|
|
12885
12999
|
|
|
12886
13000
|
var parentStateNode = parent.stateNode;
|
|
12887
13001
|
|
|
@@ -13115,13 +13229,11 @@ function commitWork(current$$1, finishedWork) {
|
|
|
13115
13229
|
|
|
13116
13230
|
case HostText:
|
|
13117
13231
|
{
|
|
13118
|
-
(
|
|
13119
|
-
|
|
13120
|
-
|
|
13121
|
-
throw ReactError(Error("This should have a text node initialized. This error is likely caused by a bug in React. Please file an issue."));
|
|
13122
|
-
}
|
|
13232
|
+
if (!(finishedWork.stateNode !== null)) {
|
|
13233
|
+
{
|
|
13234
|
+
throw Error("This should have a text node initialized. This error is likely caused by a bug in React. Please file an issue.");
|
|
13123
13235
|
}
|
|
13124
|
-
}
|
|
13236
|
+
}
|
|
13125
13237
|
|
|
13126
13238
|
var textInstance = finishedWork.stateNode;
|
|
13127
13239
|
var newText = finishedWork.memoizedProps; // For hydration we reuse the update path but we treat the oldProps
|
|
@@ -13206,13 +13318,11 @@ function commitWork(current$$1, finishedWork) {
|
|
|
13206
13318
|
|
|
13207
13319
|
default:
|
|
13208
13320
|
{
|
|
13209
|
-
|
|
13321
|
+
{
|
|
13210
13322
|
{
|
|
13211
|
-
|
|
13212
|
-
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."));
|
|
13213
|
-
}
|
|
13323
|
+
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.");
|
|
13214
13324
|
}
|
|
13215
|
-
}
|
|
13325
|
+
}
|
|
13216
13326
|
}
|
|
13217
13327
|
}
|
|
13218
13328
|
}
|
|
@@ -13633,7 +13743,6 @@ var RootErrored = 2;
|
|
|
13633
13743
|
var RootSuspended = 3;
|
|
13634
13744
|
var RootSuspendedWithDelay = 4;
|
|
13635
13745
|
var RootCompleted = 5;
|
|
13636
|
-
var RootLocked = 6;
|
|
13637
13746
|
// Describes where we are in the React execution stack
|
|
13638
13747
|
var executionContext = NoContext; // The root we're working on
|
|
13639
13748
|
|
|
@@ -13693,7 +13802,7 @@ var spawnedWorkDuringRender = null; // Expiration times are computed by adding t
|
|
|
13693
13802
|
// receive the same expiration time. Otherwise we get tearing.
|
|
13694
13803
|
|
|
13695
13804
|
var currentEventTime = NoWork;
|
|
13696
|
-
function
|
|
13805
|
+
function requestCurrentTimeForUpdate() {
|
|
13697
13806
|
if ((executionContext & (RenderContext | CommitContext)) !== NoContext) {
|
|
13698
13807
|
// We're inside React, so it's fine to read the actual time.
|
|
13699
13808
|
return msToExpirationTime(now());
|
|
@@ -13709,6 +13818,9 @@ function requestCurrentTime() {
|
|
|
13709
13818
|
currentEventTime = msToExpirationTime(now());
|
|
13710
13819
|
return currentEventTime;
|
|
13711
13820
|
}
|
|
13821
|
+
function getCurrentTime() {
|
|
13822
|
+
return msToExpirationTime(now());
|
|
13823
|
+
}
|
|
13712
13824
|
function computeExpirationForFiber(currentTime, fiber, suspenseConfig) {
|
|
13713
13825
|
var mode = fiber.mode;
|
|
13714
13826
|
|
|
@@ -13757,13 +13869,11 @@ function computeExpirationForFiber(currentTime, fiber, suspenseConfig) {
|
|
|
13757
13869
|
break;
|
|
13758
13870
|
|
|
13759
13871
|
default:
|
|
13760
|
-
|
|
13872
|
+
{
|
|
13761
13873
|
{
|
|
13762
|
-
|
|
13763
|
-
throw ReactError(Error("Expected a valid priority level"));
|
|
13764
|
-
}
|
|
13874
|
+
throw Error("Expected a valid priority level");
|
|
13765
13875
|
}
|
|
13766
|
-
}
|
|
13876
|
+
}
|
|
13767
13877
|
|
|
13768
13878
|
}
|
|
13769
13879
|
} // If we're in the middle of rendering a tree, do not update at the same
|
|
@@ -13780,7 +13890,6 @@ function computeExpirationForFiber(currentTime, fiber, suspenseConfig) {
|
|
|
13780
13890
|
|
|
13781
13891
|
return expirationTime;
|
|
13782
13892
|
}
|
|
13783
|
-
|
|
13784
13893
|
function scheduleUpdateOnFiber(fiber, expirationTime) {
|
|
13785
13894
|
checkForNestedUpdates();
|
|
13786
13895
|
warnAboutInvalidUpdatesOnClassComponentsInDEV(fiber);
|
|
@@ -13977,7 +14086,7 @@ function ensureRootIsScheduled(root) {
|
|
|
13977
14086
|
// time as an argument.
|
|
13978
14087
|
|
|
13979
14088
|
|
|
13980
|
-
var currentTime =
|
|
14089
|
+
var currentTime = requestCurrentTimeForUpdate();
|
|
13981
14090
|
var priorityLevel = inferPriorityFromExpirationTime(currentTime, expirationTime); // If there's an existing render task, confirm it has the correct priority and
|
|
13982
14091
|
// expiration time. Otherwise, we'll cancel it and schedule a new one.
|
|
13983
14092
|
|
|
@@ -14028,7 +14137,7 @@ function performConcurrentWorkOnRoot(root, didTimeout) {
|
|
|
14028
14137
|
if (didTimeout) {
|
|
14029
14138
|
// The render task took too long to complete. Mark the current time as
|
|
14030
14139
|
// expired to synchronously render all expired work in a single batch.
|
|
14031
|
-
var currentTime =
|
|
14140
|
+
var currentTime = requestCurrentTimeForUpdate();
|
|
14032
14141
|
markRootExpiredAtTime(root, currentTime); // This will schedule a synchronous callback.
|
|
14033
14142
|
|
|
14034
14143
|
ensureRootIsScheduled(root);
|
|
@@ -14042,13 +14151,11 @@ function performConcurrentWorkOnRoot(root, didTimeout) {
|
|
|
14042
14151
|
if (expirationTime !== NoWork) {
|
|
14043
14152
|
var originalCallbackNode = root.callbackNode;
|
|
14044
14153
|
|
|
14045
|
-
(
|
|
14046
|
-
|
|
14047
|
-
|
|
14048
|
-
throw ReactError(Error("Should not already be working."));
|
|
14049
|
-
}
|
|
14154
|
+
if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) {
|
|
14155
|
+
{
|
|
14156
|
+
throw Error("Should not already be working.");
|
|
14050
14157
|
}
|
|
14051
|
-
}
|
|
14158
|
+
}
|
|
14052
14159
|
|
|
14053
14160
|
flushPassiveEffects(); // If the root or expiration time have changed, throw out the existing stack
|
|
14054
14161
|
// and prepare a fresh one. Otherwise we'll continue where we left off.
|
|
@@ -14102,7 +14209,6 @@ function performConcurrentWorkOnRoot(root, didTimeout) {
|
|
|
14102
14209
|
stopFinishedWorkLoopTimer();
|
|
14103
14210
|
var finishedWork = root.finishedWork = root.current.alternate;
|
|
14104
14211
|
root.finishedExpirationTime = expirationTime;
|
|
14105
|
-
resolveLocksOnRoot(root, expirationTime);
|
|
14106
14212
|
finishConcurrentRender(root, finishedWork, workInProgressRootExitStatus, expirationTime);
|
|
14107
14213
|
}
|
|
14108
14214
|
|
|
@@ -14127,13 +14233,11 @@ function finishConcurrentRender(root, finishedWork, exitStatus, expirationTime)
|
|
|
14127
14233
|
case RootIncomplete:
|
|
14128
14234
|
case RootFatalErrored:
|
|
14129
14235
|
{
|
|
14130
|
-
|
|
14236
|
+
{
|
|
14131
14237
|
{
|
|
14132
|
-
|
|
14133
|
-
throw ReactError(Error("Root did not complete. This is a bug in React."));
|
|
14134
|
-
}
|
|
14238
|
+
throw Error("Root did not complete. This is a bug in React.");
|
|
14135
14239
|
}
|
|
14136
|
-
}
|
|
14240
|
+
}
|
|
14137
14241
|
}
|
|
14138
14242
|
// Flow knows about invariant, so it complains if I add a break
|
|
14139
14243
|
// statement, but eslint doesn't know about invariant, so it complains
|
|
@@ -14141,18 +14245,16 @@ function finishConcurrentRender(root, finishedWork, exitStatus, expirationTime)
|
|
|
14141
14245
|
|
|
14142
14246
|
case RootErrored:
|
|
14143
14247
|
{
|
|
14144
|
-
|
|
14145
|
-
|
|
14146
|
-
|
|
14147
|
-
|
|
14148
|
-
|
|
14149
|
-
|
|
14150
|
-
|
|
14151
|
-
|
|
14152
|
-
|
|
14248
|
+
// If this was an async render, the error may have happened due to
|
|
14249
|
+
// a mutation in a concurrent event. Try rendering one more time,
|
|
14250
|
+
// synchronously, to see if the error goes away. If there are
|
|
14251
|
+
// lower priority updates, let's include those, too, in case they
|
|
14252
|
+
// fix the inconsistency. Render at Idle to include all updates.
|
|
14253
|
+
// If it was Idle or Never or some not-yet-invented time, render
|
|
14254
|
+
// at that time.
|
|
14255
|
+
markRootExpiredAtTime(root, expirationTime > Idle ? Idle : expirationTime); // We assume that this second render pass will be synchronous
|
|
14256
|
+
// and therefore not hit this path again.
|
|
14153
14257
|
|
|
14154
|
-
|
|
14155
|
-
commitRoot(root);
|
|
14156
14258
|
break;
|
|
14157
14259
|
}
|
|
14158
14260
|
|
|
@@ -14336,24 +14438,13 @@ function finishConcurrentRender(root, finishedWork, exitStatus, expirationTime)
|
|
|
14336
14438
|
break;
|
|
14337
14439
|
}
|
|
14338
14440
|
|
|
14339
|
-
case RootLocked:
|
|
14340
|
-
{
|
|
14341
|
-
// This root has a lock that prevents it from committing. Exit. If
|
|
14342
|
-
// we begin work on the root again, without any intervening updates,
|
|
14343
|
-
// it will finish without doing additional work.
|
|
14344
|
-
markRootSuspendedAtTime(root, expirationTime);
|
|
14345
|
-
break;
|
|
14346
|
-
}
|
|
14347
|
-
|
|
14348
14441
|
default:
|
|
14349
14442
|
{
|
|
14350
|
-
|
|
14443
|
+
{
|
|
14351
14444
|
{
|
|
14352
|
-
|
|
14353
|
-
throw ReactError(Error("Unknown root exit status."));
|
|
14354
|
-
}
|
|
14445
|
+
throw Error("Unknown root exit status.");
|
|
14355
14446
|
}
|
|
14356
|
-
}
|
|
14447
|
+
}
|
|
14357
14448
|
}
|
|
14358
14449
|
}
|
|
14359
14450
|
} // This is the entry point for synchronous tasks that don't go
|
|
@@ -14371,13 +14462,11 @@ function performSyncWorkOnRoot(root) {
|
|
|
14371
14462
|
// batch.commit() API.
|
|
14372
14463
|
commitRoot(root);
|
|
14373
14464
|
} else {
|
|
14374
|
-
(
|
|
14375
|
-
|
|
14376
|
-
|
|
14377
|
-
throw ReactError(Error("Should not already be working."));
|
|
14378
|
-
}
|
|
14465
|
+
if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) {
|
|
14466
|
+
{
|
|
14467
|
+
throw Error("Should not already be working.");
|
|
14379
14468
|
}
|
|
14380
|
-
}
|
|
14469
|
+
}
|
|
14381
14470
|
|
|
14382
14471
|
flushPassiveEffects(); // If the root or expiration time have changed, throw out the existing stack
|
|
14383
14472
|
// and prepare a fresh one. Otherwise we'll continue where we left off.
|
|
@@ -14424,21 +14513,17 @@ function performSyncWorkOnRoot(root) {
|
|
|
14424
14513
|
|
|
14425
14514
|
if (workInProgress !== null) {
|
|
14426
14515
|
// This is a sync render, so we should have finished the whole tree.
|
|
14427
|
-
|
|
14516
|
+
{
|
|
14428
14517
|
{
|
|
14429
|
-
|
|
14430
|
-
throw ReactError(Error("Cannot commit an incomplete root. This error is likely caused by a bug in React. Please file an issue."));
|
|
14431
|
-
}
|
|
14518
|
+
throw Error("Cannot commit an incomplete root. This error is likely caused by a bug in React. Please file an issue.");
|
|
14432
14519
|
}
|
|
14433
|
-
}
|
|
14520
|
+
}
|
|
14434
14521
|
} else {
|
|
14435
14522
|
// We now have a consistent tree. Because this is a sync render, we
|
|
14436
|
-
// will commit it even if something suspended.
|
|
14437
|
-
// if the root is locked (using the unstable_createBatch API).
|
|
14523
|
+
// will commit it even if something suspended.
|
|
14438
14524
|
stopFinishedWorkLoopTimer();
|
|
14439
14525
|
root.finishedWork = root.current.alternate;
|
|
14440
14526
|
root.finishedExpirationTime = expirationTime;
|
|
14441
|
-
resolveLocksOnRoot(root, expirationTime);
|
|
14442
14527
|
finishSyncRender(root, workInProgressRootExitStatus, expirationTime);
|
|
14443
14528
|
} // Before exiting, make sure there's a callback scheduled for the next
|
|
14444
14529
|
// pending level.
|
|
@@ -14452,44 +14537,25 @@ function performSyncWorkOnRoot(root) {
|
|
|
14452
14537
|
}
|
|
14453
14538
|
|
|
14454
14539
|
function finishSyncRender(root, exitStatus, expirationTime) {
|
|
14455
|
-
|
|
14456
|
-
|
|
14457
|
-
// begin work on the root again, without any intervening updates, it
|
|
14458
|
-
// will finish without doing additional work.
|
|
14459
|
-
markRootSuspendedAtTime(root, expirationTime);
|
|
14460
|
-
} else {
|
|
14461
|
-
// Set this to null to indicate there's no in-progress render.
|
|
14462
|
-
workInProgressRoot = null;
|
|
14540
|
+
// Set this to null to indicate there's no in-progress render.
|
|
14541
|
+
workInProgressRoot = null;
|
|
14463
14542
|
|
|
14464
|
-
|
|
14465
|
-
|
|
14466
|
-
|
|
14467
|
-
}
|
|
14543
|
+
{
|
|
14544
|
+
if (exitStatus === RootSuspended || exitStatus === RootSuspendedWithDelay) {
|
|
14545
|
+
flushSuspensePriorityWarningInDEV();
|
|
14468
14546
|
}
|
|
14469
|
-
|
|
14470
|
-
commitRoot(root);
|
|
14471
14547
|
}
|
|
14472
|
-
}
|
|
14473
|
-
|
|
14474
14548
|
|
|
14549
|
+
commitRoot(root);
|
|
14550
|
+
}
|
|
14475
14551
|
|
|
14476
14552
|
|
|
14477
|
-
function resolveLocksOnRoot(root, expirationTime) {
|
|
14478
|
-
var firstBatch = root.firstBatch;
|
|
14479
14553
|
|
|
14480
|
-
if (firstBatch !== null && firstBatch._defer && firstBatch._expirationTime >= expirationTime) {
|
|
14481
|
-
scheduleCallback(NormalPriority, function () {
|
|
14482
|
-
firstBatch._onComplete();
|
|
14483
14554
|
|
|
14484
|
-
|
|
14485
|
-
|
|
14486
|
-
workInProgressRootExitStatus = RootLocked;
|
|
14487
|
-
}
|
|
14555
|
+
function syncUpdates(fn, a, b, c) {
|
|
14556
|
+
return runWithPriority(ImmediatePriority, fn.bind(null, a, b, c));
|
|
14488
14557
|
}
|
|
14489
14558
|
|
|
14490
|
-
|
|
14491
|
-
|
|
14492
|
-
|
|
14493
14559
|
function batchedUpdates(fn, a) {
|
|
14494
14560
|
var prevExecutionContext = executionContext;
|
|
14495
14561
|
executionContext |= BatchedContext;
|
|
@@ -14510,13 +14576,11 @@ function batchedUpdates(fn, a) {
|
|
|
14510
14576
|
|
|
14511
14577
|
function flushSync(fn, a) {
|
|
14512
14578
|
if ((executionContext & (RenderContext | CommitContext)) !== NoContext) {
|
|
14513
|
-
|
|
14579
|
+
{
|
|
14514
14580
|
{
|
|
14515
|
-
|
|
14516
|
-
throw ReactError(Error("flushSync was called from inside a lifecycle method. It cannot be called when React is already rendering."));
|
|
14517
|
-
}
|
|
14581
|
+
throw Error("flushSync was called from inside a lifecycle method. It cannot be called when React is already rendering.");
|
|
14518
14582
|
}
|
|
14519
|
-
}
|
|
14583
|
+
}
|
|
14520
14584
|
}
|
|
14521
14585
|
|
|
14522
14586
|
var prevExecutionContext = executionContext;
|
|
@@ -14583,6 +14647,7 @@ function handleError(root, thrownValue) {
|
|
|
14583
14647
|
// Reset module-level state that was set during the render phase.
|
|
14584
14648
|
resetContextDependencies();
|
|
14585
14649
|
resetHooks();
|
|
14650
|
+
resetCurrentFiber();
|
|
14586
14651
|
|
|
14587
14652
|
if (workInProgress === null || workInProgress.return === null) {
|
|
14588
14653
|
// Expected to be working on a non-root fiber. This is a fatal error
|
|
@@ -14982,13 +15047,11 @@ function commitRootImpl(root, renderPriorityLevel) {
|
|
|
14982
15047
|
flushPassiveEffects();
|
|
14983
15048
|
flushRenderPhaseStrictModeWarningsInDEV();
|
|
14984
15049
|
|
|
14985
|
-
(
|
|
14986
|
-
|
|
14987
|
-
|
|
14988
|
-
throw ReactError(Error("Should not already be working."));
|
|
14989
|
-
}
|
|
15050
|
+
if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) {
|
|
15051
|
+
{
|
|
15052
|
+
throw Error("Should not already be working.");
|
|
14990
15053
|
}
|
|
14991
|
-
}
|
|
15054
|
+
}
|
|
14992
15055
|
|
|
14993
15056
|
var finishedWork = root.finishedWork;
|
|
14994
15057
|
var expirationTime = root.finishedExpirationTime;
|
|
@@ -15000,13 +15063,11 @@ function commitRootImpl(root, renderPriorityLevel) {
|
|
|
15000
15063
|
root.finishedWork = null;
|
|
15001
15064
|
root.finishedExpirationTime = NoWork;
|
|
15002
15065
|
|
|
15003
|
-
(
|
|
15004
|
-
|
|
15005
|
-
|
|
15006
|
-
throw ReactError(Error("Cannot commit the same tree as before. This error is likely caused by a bug in React. Please file an issue."));
|
|
15007
|
-
}
|
|
15066
|
+
if (!(finishedWork !== root.current)) {
|
|
15067
|
+
{
|
|
15068
|
+
throw Error("Cannot commit the same tree as before. This error is likely caused by a bug in React. Please file an issue.");
|
|
15008
15069
|
}
|
|
15009
|
-
}
|
|
15070
|
+
} // commitRoot never returns a continuation; it always finishes synchronously.
|
|
15010
15071
|
// So we can clear these now to allow a new callback to be scheduled.
|
|
15011
15072
|
|
|
15012
15073
|
|
|
@@ -15070,13 +15131,11 @@ function commitRootImpl(root, renderPriorityLevel) {
|
|
|
15070
15131
|
invokeGuardedCallback(null, commitBeforeMutationEffects, null);
|
|
15071
15132
|
|
|
15072
15133
|
if (hasCaughtError()) {
|
|
15073
|
-
(
|
|
15074
|
-
|
|
15075
|
-
|
|
15076
|
-
throw ReactError(Error("Should be working on an effect."));
|
|
15077
|
-
}
|
|
15134
|
+
if (!(nextEffect !== null)) {
|
|
15135
|
+
{
|
|
15136
|
+
throw Error("Should be working on an effect.");
|
|
15078
15137
|
}
|
|
15079
|
-
}
|
|
15138
|
+
}
|
|
15080
15139
|
|
|
15081
15140
|
var error = clearCaughtError();
|
|
15082
15141
|
captureCommitPhaseError(nextEffect, error);
|
|
@@ -15102,13 +15161,11 @@ function commitRootImpl(root, renderPriorityLevel) {
|
|
|
15102
15161
|
invokeGuardedCallback(null, commitMutationEffects, null, root, renderPriorityLevel);
|
|
15103
15162
|
|
|
15104
15163
|
if (hasCaughtError()) {
|
|
15105
|
-
(
|
|
15106
|
-
|
|
15107
|
-
|
|
15108
|
-
throw ReactError(Error("Should be working on an effect."));
|
|
15109
|
-
}
|
|
15164
|
+
if (!(nextEffect !== null)) {
|
|
15165
|
+
{
|
|
15166
|
+
throw Error("Should be working on an effect.");
|
|
15110
15167
|
}
|
|
15111
|
-
}
|
|
15168
|
+
}
|
|
15112
15169
|
|
|
15113
15170
|
var _error = clearCaughtError();
|
|
15114
15171
|
|
|
@@ -15136,13 +15193,11 @@ function commitRootImpl(root, renderPriorityLevel) {
|
|
|
15136
15193
|
invokeGuardedCallback(null, commitLayoutEffects, null, root, expirationTime);
|
|
15137
15194
|
|
|
15138
15195
|
if (hasCaughtError()) {
|
|
15139
|
-
(
|
|
15140
|
-
|
|
15141
|
-
|
|
15142
|
-
throw ReactError(Error("Should be working on an effect."));
|
|
15143
|
-
}
|
|
15196
|
+
if (!(nextEffect !== null)) {
|
|
15197
|
+
{
|
|
15198
|
+
throw Error("Should be working on an effect.");
|
|
15144
15199
|
}
|
|
15145
|
-
}
|
|
15200
|
+
}
|
|
15146
15201
|
|
|
15147
15202
|
var _error2 = clearCaughtError();
|
|
15148
15203
|
|
|
@@ -15428,13 +15483,11 @@ function flushPassiveEffectsImpl() {
|
|
|
15428
15483
|
rootWithPendingPassiveEffects = null;
|
|
15429
15484
|
pendingPassiveEffectsExpirationTime = NoWork;
|
|
15430
15485
|
|
|
15431
|
-
(
|
|
15432
|
-
|
|
15433
|
-
|
|
15434
|
-
throw ReactError(Error("Cannot flush passive effects while already rendering."));
|
|
15435
|
-
}
|
|
15486
|
+
if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) {
|
|
15487
|
+
{
|
|
15488
|
+
throw Error("Cannot flush passive effects while already rendering.");
|
|
15436
15489
|
}
|
|
15437
|
-
}
|
|
15490
|
+
}
|
|
15438
15491
|
|
|
15439
15492
|
var prevExecutionContext = executionContext;
|
|
15440
15493
|
executionContext |= CommitContext;
|
|
@@ -15450,13 +15503,11 @@ function flushPassiveEffectsImpl() {
|
|
|
15450
15503
|
invokeGuardedCallback(null, commitPassiveHookEffects, null, effect);
|
|
15451
15504
|
|
|
15452
15505
|
if (hasCaughtError()) {
|
|
15453
|
-
(
|
|
15454
|
-
|
|
15455
|
-
|
|
15456
|
-
throw ReactError(Error("Should be working on an effect."));
|
|
15457
|
-
}
|
|
15506
|
+
if (!(effect !== null)) {
|
|
15507
|
+
{
|
|
15508
|
+
throw Error("Should be working on an effect.");
|
|
15458
15509
|
}
|
|
15459
|
-
}
|
|
15510
|
+
}
|
|
15460
15511
|
|
|
15461
15512
|
var error = clearCaughtError();
|
|
15462
15513
|
captureCommitPhaseError(effect, error);
|
|
@@ -15617,10 +15668,10 @@ function retryTimedOutBoundary(boundaryFiber, retryTime) {
|
|
|
15617
15668
|
// previously was rendered in its fallback state. One of the promises that
|
|
15618
15669
|
// suspended it has resolved, which means at least part of the tree was
|
|
15619
15670
|
// likely unblocked. Try rendering again, at a new expiration time.
|
|
15620
|
-
if (retryTime ===
|
|
15671
|
+
if (retryTime === NoWork) {
|
|
15621
15672
|
var suspenseConfig = null; // Retries don't carry over the already committed update.
|
|
15622
15673
|
|
|
15623
|
-
var currentTime =
|
|
15674
|
+
var currentTime = requestCurrentTimeForUpdate();
|
|
15624
15675
|
retryTime = computeExpirationForFiber(currentTime, boundaryFiber, suspenseConfig);
|
|
15625
15676
|
} // TODO: Special case idle priority?
|
|
15626
15677
|
|
|
@@ -15635,7 +15686,7 @@ function retryTimedOutBoundary(boundaryFiber, retryTime) {
|
|
|
15635
15686
|
|
|
15636
15687
|
function retryDehydratedSuspenseBoundary(boundaryFiber) {
|
|
15637
15688
|
var suspenseState = boundaryFiber.memoizedState;
|
|
15638
|
-
var retryTime =
|
|
15689
|
+
var retryTime = NoWork;
|
|
15639
15690
|
|
|
15640
15691
|
if (suspenseState !== null) {
|
|
15641
15692
|
retryTime = suspenseState.retryTime;
|
|
@@ -15644,7 +15695,7 @@ function retryDehydratedSuspenseBoundary(boundaryFiber) {
|
|
|
15644
15695
|
retryTimedOutBoundary(boundaryFiber, retryTime);
|
|
15645
15696
|
}
|
|
15646
15697
|
function resolveRetryThenable(boundaryFiber, thenable) {
|
|
15647
|
-
var retryTime =
|
|
15698
|
+
var retryTime = NoWork; // Default
|
|
15648
15699
|
|
|
15649
15700
|
var retryCache;
|
|
15650
15701
|
|
|
@@ -15665,13 +15716,11 @@ function resolveRetryThenable(boundaryFiber, thenable) {
|
|
|
15665
15716
|
break;
|
|
15666
15717
|
|
|
15667
15718
|
default:
|
|
15668
|
-
|
|
15719
|
+
{
|
|
15669
15720
|
{
|
|
15670
|
-
|
|
15671
|
-
throw ReactError(Error("Pinged unknown suspense boundary type. This is probably a bug in React."));
|
|
15672
|
-
}
|
|
15721
|
+
throw Error("Pinged unknown suspense boundary type. This is probably a bug in React.");
|
|
15673
15722
|
}
|
|
15674
|
-
}
|
|
15723
|
+
}
|
|
15675
15724
|
|
|
15676
15725
|
}
|
|
15677
15726
|
} else {
|
|
@@ -15728,13 +15777,11 @@ function checkForNestedUpdates() {
|
|
|
15728
15777
|
nestedUpdateCount = 0;
|
|
15729
15778
|
rootWithNestedUpdates = null;
|
|
15730
15779
|
|
|
15731
|
-
|
|
15780
|
+
{
|
|
15732
15781
|
{
|
|
15733
|
-
|
|
15734
|
-
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."));
|
|
15735
|
-
}
|
|
15782
|
+
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.");
|
|
15736
15783
|
}
|
|
15737
|
-
}
|
|
15784
|
+
}
|
|
15738
15785
|
}
|
|
15739
15786
|
|
|
15740
15787
|
{
|
|
@@ -15822,12 +15869,14 @@ if (true && replayFailedUnitOfWorkWithInvokeGuardedCallback) {
|
|
|
15822
15869
|
if (originalError !== null && typeof originalError === 'object' && typeof originalError.then === 'function') {
|
|
15823
15870
|
// Don't replay promises. Treat everything else like an error.
|
|
15824
15871
|
throw originalError;
|
|
15825
|
-
} // Keep this code in sync with
|
|
15872
|
+
} // Keep this code in sync with handleError; any changes here must have
|
|
15826
15873
|
// corresponding changes there.
|
|
15827
15874
|
|
|
15828
15875
|
|
|
15829
15876
|
resetContextDependencies();
|
|
15830
|
-
resetHooks(); //
|
|
15877
|
+
resetHooks(); // Don't reset current debug fiber, since we're about to work on the
|
|
15878
|
+
// same fiber again.
|
|
15879
|
+
// Unwind the failed stack frame
|
|
15831
15880
|
|
|
15832
15881
|
unwindInterruptedWork(unitOfWork); // Restore the original properties of the fiber.
|
|
15833
15882
|
|
|
@@ -16026,7 +16075,7 @@ function flushSuspensePriorityWarningInDEV() {
|
|
|
16026
16075
|
componentsThatTriggeredHighPriSuspend = null;
|
|
16027
16076
|
|
|
16028
16077
|
if (componentNames.length > 0) {
|
|
16029
|
-
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
|
|
16078
|
+
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
|
|
16030
16079
|
componentNames.sort().join(', '));
|
|
16031
16080
|
}
|
|
16032
16081
|
}
|
|
@@ -16113,10 +16162,10 @@ function startWorkOnPendingInteractions(root, expirationTime) {
|
|
|
16113
16162
|
});
|
|
16114
16163
|
}
|
|
16115
16164
|
}); // Store the current set of interactions on the FiberRoot for a few reasons:
|
|
16116
|
-
// We can re-use it in hot functions like
|
|
16117
|
-
// recalculate it. We will also use it in commitWork() to
|
|
16118
|
-
// onRender() hooks. This also provides DevTools with a
|
|
16119
|
-
// the onCommitRoot() hook is called.
|
|
16165
|
+
// We can re-use it in hot functions like performConcurrentWorkOnRoot()
|
|
16166
|
+
// without having to recalculate it. We will also use it in commitWork() to
|
|
16167
|
+
// pass to any Profiler onRender() hooks. This also provides DevTools with a
|
|
16168
|
+
// way to access it when the onCommitRoot() hook is called.
|
|
16120
16169
|
|
|
16121
16170
|
root.memoizedInteractions = interactions;
|
|
16122
16171
|
|
|
@@ -16224,7 +16273,7 @@ function injectInternals(internals) {
|
|
|
16224
16273
|
var didError = (root.current.effectTag & DidCapture) === DidCapture;
|
|
16225
16274
|
|
|
16226
16275
|
if (enableProfilerTimer) {
|
|
16227
|
-
var currentTime =
|
|
16276
|
+
var currentTime = getCurrentTime();
|
|
16228
16277
|
var priorityLevel = inferPriorityFromExpirationTime(currentTime, expirationTime);
|
|
16229
16278
|
hook.onCommitFiberRoot(rendererID, root, priorityLevel, didError);
|
|
16230
16279
|
} else {
|
|
@@ -16686,13 +16735,11 @@ key, pendingProps, owner, mode, expirationTime) {
|
|
|
16686
16735
|
}
|
|
16687
16736
|
}
|
|
16688
16737
|
|
|
16689
|
-
|
|
16738
|
+
{
|
|
16690
16739
|
{
|
|
16691
|
-
|
|
16692
|
-
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));
|
|
16693
|
-
}
|
|
16740
|
+
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);
|
|
16694
16741
|
}
|
|
16695
|
-
}
|
|
16742
|
+
}
|
|
16696
16743
|
}
|
|
16697
16744
|
}
|
|
16698
16745
|
}
|
|
@@ -16876,7 +16923,6 @@ function FiberRootNode(containerInfo, tag, hydrate) {
|
|
|
16876
16923
|
this.context = null;
|
|
16877
16924
|
this.pendingContext = null;
|
|
16878
16925
|
this.hydrate = hydrate;
|
|
16879
|
-
this.firstBatch = null;
|
|
16880
16926
|
this.callbackNode = null;
|
|
16881
16927
|
this.callbackPriority = NoPriority;
|
|
16882
16928
|
this.firstPendingTime = NoWork;
|
|
@@ -17030,35 +17076,23 @@ function getContextForSubtree(parentComponent) {
|
|
|
17030
17076
|
return parentContext;
|
|
17031
17077
|
}
|
|
17032
17078
|
|
|
17033
|
-
function
|
|
17079
|
+
function createContainer(containerInfo, tag, hydrate, hydrationCallbacks) {
|
|
17080
|
+
return createFiberRoot(containerInfo, tag, hydrate, hydrationCallbacks);
|
|
17081
|
+
}
|
|
17082
|
+
function updateContainer(element, container, parentComponent, callback) {
|
|
17083
|
+
var current$$1 = container.current;
|
|
17084
|
+
var currentTime = requestCurrentTimeForUpdate();
|
|
17085
|
+
|
|
17034
17086
|
{
|
|
17035
|
-
|
|
17036
|
-
|
|
17037
|
-
|
|
17087
|
+
// $FlowExpectedError - jest isn't a global, and isn't recognized outside of tests
|
|
17088
|
+
if ('undefined' !== typeof jest) {
|
|
17089
|
+
warnIfUnmockedScheduler(current$$1);
|
|
17090
|
+
warnIfNotScopedWithMatchingAct(current$$1);
|
|
17038
17091
|
}
|
|
17039
17092
|
}
|
|
17040
17093
|
|
|
17041
|
-
var
|
|
17042
|
-
|
|
17043
|
-
|
|
17044
|
-
update.payload = {
|
|
17045
|
-
element: element
|
|
17046
|
-
};
|
|
17047
|
-
callback = callback === undefined ? null : callback;
|
|
17048
|
-
|
|
17049
|
-
if (callback !== null) {
|
|
17050
|
-
!(typeof callback === 'function') ? warningWithoutStack$1(false, 'render(...): Expected the last optional `callback` argument to be a ' + 'function. Instead received: %s.', callback) : void 0;
|
|
17051
|
-
update.callback = callback;
|
|
17052
|
-
}
|
|
17053
|
-
|
|
17054
|
-
enqueueUpdate(current$$1, update);
|
|
17055
|
-
scheduleWork(current$$1, expirationTime);
|
|
17056
|
-
return expirationTime;
|
|
17057
|
-
}
|
|
17058
|
-
|
|
17059
|
-
function updateContainerAtExpirationTime(element, container, parentComponent, expirationTime, suspenseConfig, callback) {
|
|
17060
|
-
// TODO: If this is a nested container, this won't be the root.
|
|
17061
|
-
var current$$1 = container.current;
|
|
17094
|
+
var suspenseConfig = requestCurrentSuspenseConfig();
|
|
17095
|
+
var expirationTime = computeExpirationForFiber(currentTime, current$$1, suspenseConfig);
|
|
17062
17096
|
|
|
17063
17097
|
{
|
|
17064
17098
|
if (ReactFiberInstrumentation_1.debugTool) {
|
|
@@ -17080,27 +17114,29 @@ function updateContainerAtExpirationTime(element, container, parentComponent, ex
|
|
|
17080
17114
|
container.pendingContext = context;
|
|
17081
17115
|
}
|
|
17082
17116
|
|
|
17083
|
-
return scheduleRootUpdate(current$$1, element, expirationTime, suspenseConfig, callback);
|
|
17084
|
-
}
|
|
17085
|
-
|
|
17086
|
-
function createContainer(containerInfo, tag, hydrate, hydrationCallbacks) {
|
|
17087
|
-
return createFiberRoot(containerInfo, tag, hydrate, hydrationCallbacks);
|
|
17088
|
-
}
|
|
17089
|
-
function updateContainer(element, container, parentComponent, callback) {
|
|
17090
|
-
var current$$1 = container.current;
|
|
17091
|
-
var currentTime = requestCurrentTime();
|
|
17092
|
-
|
|
17093
17117
|
{
|
|
17094
|
-
|
|
17095
|
-
|
|
17096
|
-
|
|
17097
|
-
warnIfNotScopedWithMatchingAct(current$$1);
|
|
17118
|
+
if (phase === 'render' && current !== null && !didWarnAboutNestedUpdates) {
|
|
17119
|
+
didWarnAboutNestedUpdates = true;
|
|
17120
|
+
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');
|
|
17098
17121
|
}
|
|
17099
17122
|
}
|
|
17100
17123
|
|
|
17101
|
-
var
|
|
17102
|
-
|
|
17103
|
-
|
|
17124
|
+
var update = createUpdate(expirationTime, suspenseConfig); // Caution: React DevTools currently depends on this property
|
|
17125
|
+
// being called "element".
|
|
17126
|
+
|
|
17127
|
+
update.payload = {
|
|
17128
|
+
element: element
|
|
17129
|
+
};
|
|
17130
|
+
callback = callback === undefined ? null : callback;
|
|
17131
|
+
|
|
17132
|
+
if (callback !== null) {
|
|
17133
|
+
!(typeof callback === 'function') ? warningWithoutStack$1(false, 'render(...): Expected the last optional `callback` argument to be a ' + 'function. Instead received: %s.', callback) : void 0;
|
|
17134
|
+
update.callback = callback;
|
|
17135
|
+
}
|
|
17136
|
+
|
|
17137
|
+
enqueueUpdate(current$$1, update);
|
|
17138
|
+
scheduleWork(current$$1, expirationTime);
|
|
17139
|
+
return expirationTime;
|
|
17104
17140
|
}
|
|
17105
17141
|
function getPublicRootInstance(container) {
|
|
17106
17142
|
var containerFiber = container.current;
|
|
@@ -17120,6 +17156,10 @@ function getPublicRootInstance(container) {
|
|
|
17120
17156
|
|
|
17121
17157
|
|
|
17122
17158
|
|
|
17159
|
+
|
|
17160
|
+
|
|
17161
|
+
|
|
17162
|
+
|
|
17123
17163
|
var shouldSuspendImpl = function (fiber) {
|
|
17124
17164
|
return false;
|
|
17125
17165
|
};
|
|
@@ -17237,7 +17277,7 @@ function injectIntoDevTools(devToolsConfig) {
|
|
|
17237
17277
|
|
|
17238
17278
|
// TODO: this is special because it gets imported during build.
|
|
17239
17279
|
|
|
17240
|
-
var ReactVersion = '16.
|
|
17280
|
+
var ReactVersion = '16.11.0';
|
|
17241
17281
|
|
|
17242
17282
|
var didWarnAboutMessageChannel = false;
|
|
17243
17283
|
var enqueueTask;
|
|
@@ -17591,13 +17631,11 @@ function toTree(node) {
|
|
|
17591
17631
|
return childrenToTree(node.child);
|
|
17592
17632
|
|
|
17593
17633
|
default:
|
|
17594
|
-
|
|
17634
|
+
{
|
|
17595
17635
|
{
|
|
17596
|
-
|
|
17597
|
-
throw ReactError(Error("toTree() does not yet know how to handle nodes with tag=" + node.tag));
|
|
17598
|
-
}
|
|
17636
|
+
throw Error("toTree() does not yet know how to handle nodes with tag=" + node.tag);
|
|
17599
17637
|
}
|
|
17600
|
-
}
|
|
17638
|
+
}
|
|
17601
17639
|
|
|
17602
17640
|
}
|
|
17603
17641
|
}
|
|
@@ -17658,25 +17696,21 @@ function () {
|
|
|
17658
17696
|
// Throws if this component has been unmounted.
|
|
17659
17697
|
var fiber = findCurrentFiberUsingSlowPath(this._fiber);
|
|
17660
17698
|
|
|
17661
|
-
(
|
|
17662
|
-
|
|
17663
|
-
|
|
17664
|
-
throw ReactError(Error("Can't read from currently-mounting component. This error is likely caused by a bug in React. Please file an issue."));
|
|
17665
|
-
}
|
|
17699
|
+
if (!(fiber !== null)) {
|
|
17700
|
+
{
|
|
17701
|
+
throw Error("Can't read from currently-mounting component. This error is likely caused by a bug in React. Please file an issue.");
|
|
17666
17702
|
}
|
|
17667
|
-
}
|
|
17703
|
+
}
|
|
17668
17704
|
|
|
17669
17705
|
return fiber;
|
|
17670
17706
|
};
|
|
17671
17707
|
|
|
17672
17708
|
function ReactTestInstance(fiber) {
|
|
17673
|
-
|
|
17674
|
-
|
|
17675
|
-
|
|
17676
|
-
throw ReactError(Error("Unexpected object passed to ReactTestInstance constructor (tag: " + fiber.tag + "). This is probably a bug in React."));
|
|
17677
|
-
}
|
|
17709
|
+
if (!validWrapperTypes.has(fiber.tag)) {
|
|
17710
|
+
{
|
|
17711
|
+
throw Error("Unexpected object passed to ReactTestInstance constructor (tag: " + fiber.tag + "). This is probably a bug in React.");
|
|
17678
17712
|
}
|
|
17679
|
-
}
|
|
17713
|
+
}
|
|
17680
17714
|
|
|
17681
17715
|
this._fiber = fiber;
|
|
17682
17716
|
}
|
|
@@ -17835,13 +17869,11 @@ var ReactTestRendererFiber = {
|
|
|
17835
17869
|
};
|
|
17836
17870
|
var root = createContainer(container, isConcurrent ? ConcurrentRoot : LegacyRoot, false, null);
|
|
17837
17871
|
|
|
17838
|
-
(
|
|
17839
|
-
|
|
17840
|
-
|
|
17841
|
-
throw ReactError(Error("something went wrong"));
|
|
17842
|
-
}
|
|
17872
|
+
if (!(root != null)) {
|
|
17873
|
+
{
|
|
17874
|
+
throw Error("something went wrong");
|
|
17843
17875
|
}
|
|
17844
|
-
}
|
|
17876
|
+
}
|
|
17845
17877
|
|
|
17846
17878
|
updateContainer(element, root, null, null);
|
|
17847
17879
|
var entry = {
|