react-test-renderer 16.10.0 → 16.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build-info.json +4 -4
- package/cjs/react-test-renderer-shallow.development.js +73 -77
- package/cjs/react-test-renderer-shallow.production.min.js +25 -25
- package/cjs/react-test-renderer.development.js +739 -687
- package/cjs/react-test-renderer.production.min.js +148 -145
- package/package.json +2 -2
- package/umd/react-test-renderer-shallow.development.js +75 -79
- package/umd/react-test-renderer-shallow.production.min.js +24 -24
- package/umd/react-test-renderer.development.js +743 -691
- package/umd/react-test-renderer.production.min.js +145 -143
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license React v16.
|
|
1
|
+
/** @license React v16.12.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++) {
|
|
@@ -426,7 +418,6 @@ var ShouldCapture =
|
|
|
426
418
|
/* */
|
|
427
419
|
4096;
|
|
428
420
|
|
|
429
|
-
var debugRenderPhaseSideEffects = false;
|
|
430
421
|
var debugRenderPhaseSideEffectsForStrictMode = false;
|
|
431
422
|
var enableUserTimingAPI = true;
|
|
432
423
|
var warnAboutDeprecatedLifecycles = true;
|
|
@@ -440,19 +431,18 @@ var enableSuspenseServerRenderer = false;
|
|
|
440
431
|
|
|
441
432
|
|
|
442
433
|
|
|
443
|
-
|
|
444
434
|
var enableFlareAPI = false;
|
|
445
435
|
var enableFundamentalAPI = false;
|
|
446
436
|
var enableScopeAPI = false;
|
|
447
437
|
|
|
448
438
|
var warnAboutUnmockedScheduler = false;
|
|
449
439
|
var flushSuspenseFallbacksInTests = true;
|
|
450
|
-
|
|
451
440
|
var enableSuspenseCallback = false;
|
|
452
441
|
var warnAboutDefaultPropsOnFunctionComponents = false;
|
|
453
442
|
var warnAboutStringRefs = false;
|
|
454
443
|
var disableLegacyContext = false;
|
|
455
444
|
var disableSchedulerTimeoutBasedOnReactExpirationTime = false;
|
|
445
|
+
|
|
456
446
|
// Only used in www builds.
|
|
457
447
|
|
|
458
448
|
// Flow magic to verify the exports of this file match the original version.
|
|
@@ -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,18 +2000,16 @@ 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
|
|
|
2030
2011
|
var LegacyRoot = 0;
|
|
2031
|
-
var
|
|
2012
|
+
var BlockingRoot = 1;
|
|
2032
2013
|
var ConcurrentRoot = 2;
|
|
2033
2014
|
|
|
2034
2015
|
var ReactInternals$1 = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
@@ -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
|
}
|
|
@@ -2230,10 +2205,10 @@ function flushSyncCallbackQueueImpl() {
|
|
|
2230
2205
|
}
|
|
2231
2206
|
|
|
2232
2207
|
var NoMode = 0;
|
|
2233
|
-
var StrictMode = 1; // TODO: Remove
|
|
2208
|
+
var StrictMode = 1; // TODO: Remove BlockingMode and ConcurrentMode by reading from the root
|
|
2234
2209
|
// tag instead
|
|
2235
2210
|
|
|
2236
|
-
var
|
|
2211
|
+
var BlockingMode = 2;
|
|
2237
2212
|
var ConcurrentMode = 4;
|
|
2238
2213
|
var ProfileMode = 8;
|
|
2239
2214
|
|
|
@@ -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;
|
|
@@ -3651,7 +3625,7 @@ function getStateFromUpdate(workInProgress, queue, update, prevState, nextProps,
|
|
|
3651
3625
|
{
|
|
3652
3626
|
enterDisallowedContextReadInDEV();
|
|
3653
3627
|
|
|
3654
|
-
if (
|
|
3628
|
+
if (debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
|
|
3655
3629
|
payload.call(instance, prevState, nextProps);
|
|
3656
3630
|
}
|
|
3657
3631
|
}
|
|
@@ -3685,7 +3659,7 @@ function getStateFromUpdate(workInProgress, queue, update, prevState, nextProps,
|
|
|
3685
3659
|
{
|
|
3686
3660
|
enterDisallowedContextReadInDEV();
|
|
3687
3661
|
|
|
3688
|
-
if (
|
|
3662
|
+
if (debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
|
|
3689
3663
|
_payload.call(instance, prevState, nextProps);
|
|
3690
3664
|
}
|
|
3691
3665
|
}
|
|
@@ -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);
|
|
@@ -4002,7 +3972,7 @@ function applyDerivedStateFromProps(workInProgress, ctor, getDerivedStateFromPro
|
|
|
4002
3972
|
var prevState = workInProgress.memoizedState;
|
|
4003
3973
|
|
|
4004
3974
|
{
|
|
4005
|
-
if (
|
|
3975
|
+
if (debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
|
|
4006
3976
|
// Invoke the function an extra time to help detect side-effects.
|
|
4007
3977
|
getDerivedStateFromProps(nextProps, prevState);
|
|
4008
3978
|
}
|
|
@@ -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);
|
|
@@ -4249,7 +4219,7 @@ function constructClassInstance(workInProgress, ctor, props, renderExpirationTim
|
|
|
4249
4219
|
|
|
4250
4220
|
|
|
4251
4221
|
{
|
|
4252
|
-
if (
|
|
4222
|
+
if (debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
|
|
4253
4223
|
new ctor(props, context); // eslint-disable-line no-new
|
|
4254
4224
|
}
|
|
4255
4225
|
}
|
|
@@ -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,50 +7968,42 @@ 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
|
-
|
|
7936
|
-
|
|
7937
|
-
|
|
7938
|
-
throw ReactError(Error("Expected to have a hydrated suspense instance. This error is likely caused by a bug in React. Please file an issue."));
|
|
7939
|
-
}
|
|
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.");
|
|
7940
8005
|
}
|
|
7941
|
-
}
|
|
8006
|
+
}
|
|
7942
8007
|
|
|
7943
8008
|
return getNextHydratableInstanceAfterSuspenseInstance(suspenseInstance);
|
|
7944
8009
|
}
|
|
@@ -8097,7 +8162,7 @@ function updateForwardRef(current$$1, workInProgress, Component, nextProps, rend
|
|
|
8097
8162
|
setCurrentPhase('render');
|
|
8098
8163
|
nextChildren = renderWithHooks(current$$1, workInProgress, render, nextProps, ref, renderExpirationTime);
|
|
8099
8164
|
|
|
8100
|
-
if (
|
|
8165
|
+
if (debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
|
|
8101
8166
|
// Only double-render components with Hooks
|
|
8102
8167
|
if (workInProgress.memoizedState !== null) {
|
|
8103
8168
|
nextChildren = renderWithHooks(current$$1, workInProgress, render, nextProps, ref, renderExpirationTime);
|
|
@@ -8301,7 +8366,7 @@ function updateFunctionComponent(current$$1, workInProgress, Component, nextProp
|
|
|
8301
8366
|
setCurrentPhase('render');
|
|
8302
8367
|
nextChildren = renderWithHooks(current$$1, workInProgress, Component, nextProps, context, renderExpirationTime);
|
|
8303
8368
|
|
|
8304
|
-
if (
|
|
8369
|
+
if (debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
|
|
8305
8370
|
// Only double-render components with Hooks
|
|
8306
8371
|
if (workInProgress.memoizedState !== null) {
|
|
8307
8372
|
nextChildren = renderWithHooks(current$$1, workInProgress, Component, nextProps, context, renderExpirationTime);
|
|
@@ -8424,7 +8489,7 @@ function finishClassComponent(current$$1, workInProgress, Component, shouldUpdat
|
|
|
8424
8489
|
setCurrentPhase('render');
|
|
8425
8490
|
nextChildren = instance.render();
|
|
8426
8491
|
|
|
8427
|
-
if (
|
|
8492
|
+
if (debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
|
|
8428
8493
|
instance.render();
|
|
8429
8494
|
}
|
|
8430
8495
|
|
|
@@ -8473,13 +8538,11 @@ function updateHostRoot(current$$1, workInProgress, renderExpirationTime) {
|
|
|
8473
8538
|
pushHostRootContext(workInProgress);
|
|
8474
8539
|
var updateQueue = workInProgress.updateQueue;
|
|
8475
8540
|
|
|
8476
|
-
(
|
|
8477
|
-
|
|
8478
|
-
|
|
8479
|
-
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."));
|
|
8480
|
-
}
|
|
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.");
|
|
8481
8544
|
}
|
|
8482
|
-
}
|
|
8545
|
+
}
|
|
8483
8546
|
|
|
8484
8547
|
var nextProps = workInProgress.pendingProps;
|
|
8485
8548
|
var prevState = workInProgress.memoizedState;
|
|
@@ -8666,13 +8729,11 @@ function mountLazyComponent(_current, workInProgress, elementType, updateExpirat
|
|
|
8666
8729
|
// implementation detail.
|
|
8667
8730
|
|
|
8668
8731
|
|
|
8669
|
-
|
|
8732
|
+
{
|
|
8670
8733
|
{
|
|
8671
|
-
|
|
8672
|
-
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));
|
|
8673
|
-
}
|
|
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);
|
|
8674
8735
|
}
|
|
8675
|
-
}
|
|
8736
|
+
}
|
|
8676
8737
|
}
|
|
8677
8738
|
}
|
|
8678
8739
|
|
|
@@ -8801,7 +8862,7 @@ function mountIndeterminateComponent(_current, workInProgress, Component, render
|
|
|
8801
8862
|
warningWithoutStack$1(false, '%s uses the legacy contextTypes API which is no longer supported. ' + 'Use React.createContext() with React.useContext() instead.', getComponentName(Component) || 'Unknown');
|
|
8802
8863
|
}
|
|
8803
8864
|
|
|
8804
|
-
if (
|
|
8865
|
+
if (debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
|
|
8805
8866
|
// Only double-render components with Hooks
|
|
8806
8867
|
if (workInProgress.memoizedState !== null) {
|
|
8807
8868
|
value = renderWithHooks(null, workInProgress, Component, props, context, renderExpirationTime);
|
|
@@ -8875,7 +8936,7 @@ function validateFunctionComponentInDev(workInProgress, Component) {
|
|
|
8875
8936
|
|
|
8876
8937
|
var SUSPENDED_MARKER = {
|
|
8877
8938
|
dehydrated: null,
|
|
8878
|
-
retryTime:
|
|
8939
|
+
retryTime: NoWork
|
|
8879
8940
|
};
|
|
8880
8941
|
|
|
8881
8942
|
function shouldRemainOnFallback(suspenseContext, current$$1, workInProgress) {
|
|
@@ -8951,12 +9012,12 @@ function updateSuspenseComponent(current$$1, workInProgress, renderExpirationTim
|
|
|
8951
9012
|
|
|
8952
9013
|
|
|
8953
9014
|
if (current$$1 === null) {
|
|
8954
|
-
|
|
8955
|
-
|
|
8956
|
-
|
|
8957
|
-
|
|
8958
|
-
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.
|
|
8959
9019
|
|
|
9020
|
+
if (enableSuspenseServerRenderer) {
|
|
8960
9021
|
var suspenseState = workInProgress.memoizedState;
|
|
8961
9022
|
|
|
8962
9023
|
if (suspenseState !== null) {
|
|
@@ -8977,8 +9038,8 @@ function updateSuspenseComponent(current$$1, workInProgress, renderExpirationTim
|
|
|
8977
9038
|
var primaryChildFragment = createFiberFromFragment(null, mode, NoWork, null);
|
|
8978
9039
|
primaryChildFragment.return = workInProgress;
|
|
8979
9040
|
|
|
8980
|
-
if ((workInProgress.mode &
|
|
8981
|
-
// Outside of
|
|
9041
|
+
if ((workInProgress.mode & BlockingMode) === NoMode) {
|
|
9042
|
+
// Outside of blocking mode, we commit the effects from the
|
|
8982
9043
|
// partially completed, timed-out tree, too.
|
|
8983
9044
|
var progressedState = workInProgress.memoizedState;
|
|
8984
9045
|
var progressedPrimaryChild = progressedState !== null ? workInProgress.child.child : workInProgress.child;
|
|
@@ -9041,8 +9102,8 @@ function updateSuspenseComponent(current$$1, workInProgress, renderExpirationTim
|
|
|
9041
9102
|
|
|
9042
9103
|
_primaryChildFragment.child = null;
|
|
9043
9104
|
|
|
9044
|
-
if ((workInProgress.mode &
|
|
9045
|
-
// Outside of
|
|
9105
|
+
if ((workInProgress.mode & BlockingMode) === NoMode) {
|
|
9106
|
+
// Outside of blocking mode, we commit the effects from the
|
|
9046
9107
|
// partially completed, timed-out tree, too.
|
|
9047
9108
|
var _progressedChild = _primaryChildFragment.child = workInProgress.child;
|
|
9048
9109
|
|
|
@@ -9101,8 +9162,8 @@ function updateSuspenseComponent(current$$1, workInProgress, renderExpirationTim
|
|
|
9101
9162
|
|
|
9102
9163
|
_primaryChildFragment2.return = workInProgress;
|
|
9103
9164
|
|
|
9104
|
-
if ((workInProgress.mode &
|
|
9105
|
-
// Outside of
|
|
9165
|
+
if ((workInProgress.mode & BlockingMode) === NoMode) {
|
|
9166
|
+
// Outside of blocking mode, we commit the effects from the
|
|
9106
9167
|
// partially completed, timed-out tree, too.
|
|
9107
9168
|
var _progressedState = workInProgress.memoizedState;
|
|
9108
9169
|
|
|
@@ -9186,8 +9247,8 @@ function updateSuspenseComponent(current$$1, workInProgress, renderExpirationTim
|
|
|
9186
9247
|
// primaryChildFragment.effectTag |= Placement;
|
|
9187
9248
|
|
|
9188
9249
|
|
|
9189
|
-
if ((workInProgress.mode &
|
|
9190
|
-
// Outside of
|
|
9250
|
+
if ((workInProgress.mode & BlockingMode) === NoMode) {
|
|
9251
|
+
// Outside of blocking mode, we commit the effects from the
|
|
9191
9252
|
// partially completed, timed-out tree, too.
|
|
9192
9253
|
var _progressedState2 = workInProgress.memoizedState;
|
|
9193
9254
|
|
|
@@ -9256,9 +9317,9 @@ function retrySuspenseComponentWithoutHydrating(current$$1, workInProgress, rend
|
|
|
9256
9317
|
function mountDehydratedSuspenseComponent(workInProgress, suspenseInstance, renderExpirationTime) {
|
|
9257
9318
|
// During the first pass, we'll bail out and not drill into the children.
|
|
9258
9319
|
// Instead, we'll leave the content in place and try to hydrate it later.
|
|
9259
|
-
if ((workInProgress.mode &
|
|
9320
|
+
if ((workInProgress.mode & BlockingMode) === NoMode) {
|
|
9260
9321
|
{
|
|
9261
|
-
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.createBlockingRoot(container, { hydrate: true })' + '.render(element) or remove the Suspense components from ' + 'the server rendered components.');
|
|
9262
9323
|
}
|
|
9263
9324
|
|
|
9264
9325
|
workInProgress.expirationTime = Sync;
|
|
@@ -9273,7 +9334,7 @@ function mountDehydratedSuspenseComponent(workInProgress, suspenseInstance, rend
|
|
|
9273
9334
|
// a protocol to transfer that time, we'll just estimate it by using the current
|
|
9274
9335
|
// time. This will mean that Suspense timeouts are slightly shifted to later than
|
|
9275
9336
|
// they should be.
|
|
9276
|
-
var serverDisplayTime =
|
|
9337
|
+
var serverDisplayTime = requestCurrentTimeForUpdate(); // Schedule a normal pri update to render this content.
|
|
9277
9338
|
|
|
9278
9339
|
var newExpirationTime = computeAsyncExpiration(serverDisplayTime);
|
|
9279
9340
|
|
|
@@ -9300,7 +9361,7 @@ function updateDehydratedSuspenseComponent(current$$1, workInProgress, suspenseI
|
|
|
9300
9361
|
// but after we've already committed once.
|
|
9301
9362
|
warnIfHydrating();
|
|
9302
9363
|
|
|
9303
|
-
if ((workInProgress.mode &
|
|
9364
|
+
if ((workInProgress.mode & BlockingMode) === NoMode) {
|
|
9304
9365
|
return retrySuspenseComponentWithoutHydrating(current$$1, workInProgress, renderExpirationTime);
|
|
9305
9366
|
}
|
|
9306
9367
|
|
|
@@ -9382,10 +9443,24 @@ function updateDehydratedSuspenseComponent(current$$1, workInProgress, suspenseI
|
|
|
9382
9443
|
}
|
|
9383
9444
|
}
|
|
9384
9445
|
|
|
9385
|
-
function
|
|
9386
|
-
|
|
9387
|
-
|
|
9388
|
-
|
|
9446
|
+
function scheduleWorkOnFiber(fiber, renderExpirationTime) {
|
|
9447
|
+
if (fiber.expirationTime < renderExpirationTime) {
|
|
9448
|
+
fiber.expirationTime = renderExpirationTime;
|
|
9449
|
+
}
|
|
9450
|
+
|
|
9451
|
+
var alternate = fiber.alternate;
|
|
9452
|
+
|
|
9453
|
+
if (alternate !== null && alternate.expirationTime < renderExpirationTime) {
|
|
9454
|
+
alternate.expirationTime = renderExpirationTime;
|
|
9455
|
+
}
|
|
9456
|
+
|
|
9457
|
+
scheduleWorkOnParentPath(fiber.return, renderExpirationTime);
|
|
9458
|
+
}
|
|
9459
|
+
|
|
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.
|
|
9389
9464
|
var node = firstChild;
|
|
9390
9465
|
|
|
9391
9466
|
while (node !== null) {
|
|
@@ -9393,18 +9468,15 @@ function propagateSuspenseContextChange(workInProgress, firstChild, renderExpira
|
|
|
9393
9468
|
var state = node.memoizedState;
|
|
9394
9469
|
|
|
9395
9470
|
if (state !== null) {
|
|
9396
|
-
|
|
9397
|
-
|
|
9398
|
-
|
|
9399
|
-
|
|
9400
|
-
|
|
9401
|
-
|
|
9402
|
-
|
|
9403
|
-
|
|
9404
|
-
|
|
9405
|
-
|
|
9406
|
-
scheduleWorkOnParentPath(node.return, renderExpirationTime);
|
|
9407
|
-
}
|
|
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);
|
|
9408
9480
|
} else if (node.child !== null) {
|
|
9409
9481
|
node.child.return = node;
|
|
9410
9482
|
node = node.child;
|
|
@@ -9549,7 +9621,7 @@ function validateSuspenseListChildren(children, revealOrder) {
|
|
|
9549
9621
|
}
|
|
9550
9622
|
}
|
|
9551
9623
|
|
|
9552
|
-
function initSuspenseListRenderState(workInProgress, isBackwards, tail, lastContentRow, tailMode) {
|
|
9624
|
+
function initSuspenseListRenderState(workInProgress, isBackwards, tail, lastContentRow, tailMode, lastEffectBeforeRendering) {
|
|
9553
9625
|
var renderState = workInProgress.memoizedState;
|
|
9554
9626
|
|
|
9555
9627
|
if (renderState === null) {
|
|
@@ -9559,7 +9631,8 @@ function initSuspenseListRenderState(workInProgress, isBackwards, tail, lastCont
|
|
|
9559
9631
|
last: lastContentRow,
|
|
9560
9632
|
tail: tail,
|
|
9561
9633
|
tailExpiration: 0,
|
|
9562
|
-
tailMode: tailMode
|
|
9634
|
+
tailMode: tailMode,
|
|
9635
|
+
lastEffect: lastEffectBeforeRendering
|
|
9563
9636
|
};
|
|
9564
9637
|
} else {
|
|
9565
9638
|
// We can reuse the existing object from previous renders.
|
|
@@ -9569,6 +9642,7 @@ function initSuspenseListRenderState(workInProgress, isBackwards, tail, lastCont
|
|
|
9569
9642
|
renderState.tail = tail;
|
|
9570
9643
|
renderState.tailExpiration = 0;
|
|
9571
9644
|
renderState.tailMode = tailMode;
|
|
9645
|
+
renderState.lastEffect = lastEffectBeforeRendering;
|
|
9572
9646
|
}
|
|
9573
9647
|
} // This can end up rendering this component multiple passes.
|
|
9574
9648
|
// The first pass splits the children fibers into two sets. A head and tail.
|
|
@@ -9609,8 +9683,8 @@ function updateSuspenseListComponent(current$$1, workInProgress, renderExpiratio
|
|
|
9609
9683
|
|
|
9610
9684
|
pushSuspenseContext(workInProgress, suspenseContext);
|
|
9611
9685
|
|
|
9612
|
-
if ((workInProgress.mode &
|
|
9613
|
-
// Outside of
|
|
9686
|
+
if ((workInProgress.mode & BlockingMode) === NoMode) {
|
|
9687
|
+
// Outside of blocking mode, SuspenseList doesn't work so we just
|
|
9614
9688
|
// use make it a noop by treating it as the default revealOrder.
|
|
9615
9689
|
workInProgress.memoizedState = null;
|
|
9616
9690
|
} else {
|
|
@@ -9633,7 +9707,7 @@ function updateSuspenseListComponent(current$$1, workInProgress, renderExpiratio
|
|
|
9633
9707
|
}
|
|
9634
9708
|
|
|
9635
9709
|
initSuspenseListRenderState(workInProgress, false, // isBackwards
|
|
9636
|
-
tail, lastContentRow, tailMode);
|
|
9710
|
+
tail, lastContentRow, tailMode, workInProgress.lastEffect);
|
|
9637
9711
|
break;
|
|
9638
9712
|
}
|
|
9639
9713
|
|
|
@@ -9665,7 +9739,7 @@ function updateSuspenseListComponent(current$$1, workInProgress, renderExpiratio
|
|
|
9665
9739
|
|
|
9666
9740
|
initSuspenseListRenderState(workInProgress, true, // isBackwards
|
|
9667
9741
|
_tail, null, // last
|
|
9668
|
-
tailMode);
|
|
9742
|
+
tailMode, workInProgress.lastEffect);
|
|
9669
9743
|
break;
|
|
9670
9744
|
}
|
|
9671
9745
|
|
|
@@ -9674,7 +9748,7 @@ function updateSuspenseListComponent(current$$1, workInProgress, renderExpiratio
|
|
|
9674
9748
|
initSuspenseListRenderState(workInProgress, false, // isBackwards
|
|
9675
9749
|
null, // tail
|
|
9676
9750
|
null, // last
|
|
9677
|
-
undefined);
|
|
9751
|
+
undefined, workInProgress.lastEffect);
|
|
9678
9752
|
break;
|
|
9679
9753
|
}
|
|
9680
9754
|
|
|
@@ -9982,7 +10056,12 @@ function beginWork$1(current$$1, workInProgress, renderExpirationTime) {
|
|
|
9982
10056
|
|
|
9983
10057
|
case Profiler:
|
|
9984
10058
|
if (enableProfilerTimer) {
|
|
9985
|
-
|
|
10059
|
+
// Profiler should only call onRender when one of its descendants actually rendered.
|
|
10060
|
+
var hasChildWork = workInProgress.childExpirationTime >= renderExpirationTime;
|
|
10061
|
+
|
|
10062
|
+
if (hasChildWork) {
|
|
10063
|
+
workInProgress.effectTag |= Update;
|
|
10064
|
+
}
|
|
9986
10065
|
}
|
|
9987
10066
|
|
|
9988
10067
|
break;
|
|
@@ -10038,10 +10117,11 @@ function beginWork$1(current$$1, workInProgress, renderExpirationTime) {
|
|
|
10038
10117
|
case SuspenseListComponent:
|
|
10039
10118
|
{
|
|
10040
10119
|
var didSuspendBefore = (current$$1.effectTag & DidCapture) !== NoEffect;
|
|
10041
|
-
|
|
10120
|
+
|
|
10121
|
+
var _hasChildWork = workInProgress.childExpirationTime >= renderExpirationTime;
|
|
10042
10122
|
|
|
10043
10123
|
if (didSuspendBefore) {
|
|
10044
|
-
if (
|
|
10124
|
+
if (_hasChildWork) {
|
|
10045
10125
|
// If something was in fallback state last time, and we have all the
|
|
10046
10126
|
// same children then we're still in progressive loading state.
|
|
10047
10127
|
// Something might get unblocked by state updates or retries in the
|
|
@@ -10070,7 +10150,7 @@ function beginWork$1(current$$1, workInProgress, renderExpirationTime) {
|
|
|
10070
10150
|
|
|
10071
10151
|
pushSuspenseContext(workInProgress, suspenseStackCursor.current);
|
|
10072
10152
|
|
|
10073
|
-
if (
|
|
10153
|
+
if (_hasChildWork) {
|
|
10074
10154
|
break;
|
|
10075
10155
|
} else {
|
|
10076
10156
|
// If none of the children had any work, that means that none of
|
|
@@ -10227,13 +10307,11 @@ function beginWork$1(current$$1, workInProgress, renderExpirationTime) {
|
|
|
10227
10307
|
}
|
|
10228
10308
|
}
|
|
10229
10309
|
|
|
10230
|
-
|
|
10310
|
+
{
|
|
10231
10311
|
{
|
|
10232
|
-
|
|
10233
|
-
throw ReactError(Error("Unknown unit of work tag (" + workInProgress.tag + "). This error is likely caused by a bug in React. Please file an issue."));
|
|
10234
|
-
}
|
|
10312
|
+
throw Error("Unknown unit of work tag (" + workInProgress.tag + "). This error is likely caused by a bug in React. Please file an issue.");
|
|
10235
10313
|
}
|
|
10236
|
-
}
|
|
10314
|
+
}
|
|
10237
10315
|
}
|
|
10238
10316
|
|
|
10239
10317
|
function createFundamentalStateInstance(currentFiber, props, impl, state) {
|
|
@@ -10255,14 +10333,19 @@ function getSuspenseFallbackChild(fiber) {
|
|
|
10255
10333
|
return fiber.child.sibling.child;
|
|
10256
10334
|
}
|
|
10257
10335
|
|
|
10336
|
+
var emptyObject$1 = {};
|
|
10337
|
+
|
|
10258
10338
|
function collectScopedNodes(node, fn, scopedNodes) {
|
|
10259
10339
|
if (enableScopeAPI) {
|
|
10260
10340
|
if (node.tag === HostComponent) {
|
|
10261
10341
|
var _type = node.type,
|
|
10262
|
-
memoizedProps = node.memoizedProps
|
|
10342
|
+
memoizedProps = node.memoizedProps,
|
|
10343
|
+
stateNode = node.stateNode;
|
|
10344
|
+
|
|
10345
|
+
var _instance = getPublicInstance(stateNode);
|
|
10263
10346
|
|
|
10264
|
-
if (fn(_type, memoizedProps) === true) {
|
|
10265
|
-
scopedNodes.push(
|
|
10347
|
+
if (_instance !== null && fn(_type, memoizedProps || emptyObject$1, _instance) === true) {
|
|
10348
|
+
scopedNodes.push(_instance);
|
|
10266
10349
|
}
|
|
10267
10350
|
}
|
|
10268
10351
|
|
|
@@ -10278,6 +10361,34 @@ function collectScopedNodes(node, fn, scopedNodes) {
|
|
|
10278
10361
|
}
|
|
10279
10362
|
}
|
|
10280
10363
|
|
|
10364
|
+
function collectFirstScopedNode(node, fn) {
|
|
10365
|
+
if (enableScopeAPI) {
|
|
10366
|
+
if (node.tag === HostComponent) {
|
|
10367
|
+
var _type2 = node.type,
|
|
10368
|
+
memoizedProps = node.memoizedProps,
|
|
10369
|
+
stateNode = node.stateNode;
|
|
10370
|
+
|
|
10371
|
+
var _instance2 = getPublicInstance(stateNode);
|
|
10372
|
+
|
|
10373
|
+
if (_instance2 !== null && fn(_type2, memoizedProps, _instance2) === true) {
|
|
10374
|
+
return _instance2;
|
|
10375
|
+
}
|
|
10376
|
+
}
|
|
10377
|
+
|
|
10378
|
+
var child = node.child;
|
|
10379
|
+
|
|
10380
|
+
if (isFiberSuspenseAndTimedOut(node)) {
|
|
10381
|
+
child = getSuspenseFallbackChild(node);
|
|
10382
|
+
}
|
|
10383
|
+
|
|
10384
|
+
if (child !== null) {
|
|
10385
|
+
return collectFirstScopedNodeFromChildren(child, fn);
|
|
10386
|
+
}
|
|
10387
|
+
}
|
|
10388
|
+
|
|
10389
|
+
return null;
|
|
10390
|
+
}
|
|
10391
|
+
|
|
10281
10392
|
function collectScopedNodesFromChildren(startingChild, fn, scopedNodes) {
|
|
10282
10393
|
var child = startingChild;
|
|
10283
10394
|
|
|
@@ -10287,6 +10398,22 @@ function collectScopedNodesFromChildren(startingChild, fn, scopedNodes) {
|
|
|
10287
10398
|
}
|
|
10288
10399
|
}
|
|
10289
10400
|
|
|
10401
|
+
function collectFirstScopedNodeFromChildren(startingChild, fn) {
|
|
10402
|
+
var child = startingChild;
|
|
10403
|
+
|
|
10404
|
+
while (child !== null) {
|
|
10405
|
+
var scopedNode = collectFirstScopedNode(child, fn);
|
|
10406
|
+
|
|
10407
|
+
if (scopedNode !== null) {
|
|
10408
|
+
return scopedNode;
|
|
10409
|
+
}
|
|
10410
|
+
|
|
10411
|
+
child = child.sibling;
|
|
10412
|
+
}
|
|
10413
|
+
|
|
10414
|
+
return null;
|
|
10415
|
+
}
|
|
10416
|
+
|
|
10290
10417
|
function collectNearestScopeMethods(node, scope, childrenScopes) {
|
|
10291
10418
|
if (isValidScopeNode(node, scope)) {
|
|
10292
10419
|
childrenScopes.push(node.stateNode.methods);
|
|
@@ -10313,11 +10440,10 @@ function collectNearestChildScopeMethods(startingChild, scope, childrenScopes) {
|
|
|
10313
10440
|
}
|
|
10314
10441
|
|
|
10315
10442
|
function isValidScopeNode(node, scope) {
|
|
10316
|
-
return node.tag === ScopeComponent && node.type === scope;
|
|
10443
|
+
return node.tag === ScopeComponent && node.type === scope && node.stateNode !== null;
|
|
10317
10444
|
}
|
|
10318
10445
|
|
|
10319
10446
|
function createScopeMethods(scope, instance) {
|
|
10320
|
-
var fn = scope.fn;
|
|
10321
10447
|
return {
|
|
10322
10448
|
getChildren: function () {
|
|
10323
10449
|
var currentFiber = instance.fiber;
|
|
@@ -10369,7 +10495,7 @@ function createScopeMethods(scope, instance) {
|
|
|
10369
10495
|
var currentFiber = instance.fiber;
|
|
10370
10496
|
return currentFiber.memoizedProps;
|
|
10371
10497
|
},
|
|
10372
|
-
|
|
10498
|
+
queryAllNodes: function (fn) {
|
|
10373
10499
|
var currentFiber = instance.fiber;
|
|
10374
10500
|
var child = currentFiber.child;
|
|
10375
10501
|
var scopedNodes = [];
|
|
@@ -10379,6 +10505,29 @@ function createScopeMethods(scope, instance) {
|
|
|
10379
10505
|
}
|
|
10380
10506
|
|
|
10381
10507
|
return scopedNodes.length === 0 ? null : scopedNodes;
|
|
10508
|
+
},
|
|
10509
|
+
queryFirstNode: function (fn) {
|
|
10510
|
+
var currentFiber = instance.fiber;
|
|
10511
|
+
var child = currentFiber.child;
|
|
10512
|
+
|
|
10513
|
+
if (child !== null) {
|
|
10514
|
+
return collectFirstScopedNodeFromChildren(child, fn);
|
|
10515
|
+
}
|
|
10516
|
+
|
|
10517
|
+
return null;
|
|
10518
|
+
},
|
|
10519
|
+
containsNode: function (node) {
|
|
10520
|
+
var fiber = getInstanceFromNode(node);
|
|
10521
|
+
|
|
10522
|
+
while (fiber !== null) {
|
|
10523
|
+
if (fiber.tag === ScopeComponent && fiber.type === scope && fiber.stateNode === instance) {
|
|
10524
|
+
return true;
|
|
10525
|
+
}
|
|
10526
|
+
|
|
10527
|
+
fiber = fiber.return;
|
|
10528
|
+
}
|
|
10529
|
+
|
|
10530
|
+
return false;
|
|
10382
10531
|
}
|
|
10383
10532
|
};
|
|
10384
10533
|
}
|
|
@@ -10913,13 +11062,11 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
10913
11062
|
}
|
|
10914
11063
|
} else {
|
|
10915
11064
|
if (!newProps) {
|
|
10916
|
-
(
|
|
10917
|
-
|
|
10918
|
-
|
|
10919
|
-
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."));
|
|
10920
|
-
}
|
|
11065
|
+
if (!(workInProgress.stateNode !== null)) {
|
|
11066
|
+
{
|
|
11067
|
+
throw Error("We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue.");
|
|
10921
11068
|
}
|
|
10922
|
-
}
|
|
11069
|
+
} // This can happen when we abort work.
|
|
10923
11070
|
|
|
10924
11071
|
|
|
10925
11072
|
break;
|
|
@@ -10990,13 +11137,11 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
10990
11137
|
updateHostText$1(current, workInProgress, oldText, newText);
|
|
10991
11138
|
} else {
|
|
10992
11139
|
if (typeof newText !== 'string') {
|
|
10993
|
-
(
|
|
10994
|
-
|
|
10995
|
-
|
|
10996
|
-
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."));
|
|
10997
|
-
}
|
|
11140
|
+
if (!(workInProgress.stateNode !== null)) {
|
|
11141
|
+
{
|
|
11142
|
+
throw Error("We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue.");
|
|
10998
11143
|
}
|
|
10999
|
-
}
|
|
11144
|
+
} // This can happen when we abort work.
|
|
11000
11145
|
|
|
11001
11146
|
}
|
|
11002
11147
|
|
|
@@ -11031,13 +11176,11 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
11031
11176
|
if (current === null) {
|
|
11032
11177
|
var _wasHydrated3 = popHydrationState(workInProgress);
|
|
11033
11178
|
|
|
11034
|
-
|
|
11035
|
-
|
|
11036
|
-
|
|
11037
|
-
throw ReactError(Error("A dehydrated suspense component was completed without a hydrated node. This is probably a bug in React."));
|
|
11038
|
-
}
|
|
11179
|
+
if (!_wasHydrated3) {
|
|
11180
|
+
{
|
|
11181
|
+
throw Error("A dehydrated suspense component was completed without a hydrated node. This is probably a bug in React.");
|
|
11039
11182
|
}
|
|
11040
|
-
}
|
|
11183
|
+
}
|
|
11041
11184
|
|
|
11042
11185
|
prepareToHydrateHostSuspenseInstance(workInProgress);
|
|
11043
11186
|
|
|
@@ -11080,10 +11223,9 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
11080
11223
|
var prevDidTimeout = false;
|
|
11081
11224
|
|
|
11082
11225
|
if (current === null) {
|
|
11083
|
-
|
|
11084
|
-
|
|
11085
|
-
|
|
11086
|
-
popHydrationState(workInProgress);
|
|
11226
|
+
if (workInProgress.memoizedProps.fallback !== undefined) {
|
|
11227
|
+
popHydrationState(workInProgress);
|
|
11228
|
+
}
|
|
11087
11229
|
} else {
|
|
11088
11230
|
var prevState = current.memoizedState;
|
|
11089
11231
|
prevDidTimeout = prevState !== null;
|
|
@@ -11113,12 +11255,12 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
11113
11255
|
}
|
|
11114
11256
|
|
|
11115
11257
|
if (nextDidTimeout && !prevDidTimeout) {
|
|
11116
|
-
// If this subtreee is running in
|
|
11258
|
+
// If this subtreee is running in blocking mode we can suspend,
|
|
11117
11259
|
// otherwise we won't suspend.
|
|
11118
11260
|
// TODO: This will still suspend a synchronous tree if anything
|
|
11119
11261
|
// in the concurrent tree already suspended during this render.
|
|
11120
11262
|
// This is a known bug.
|
|
11121
|
-
if ((workInProgress.mode &
|
|
11263
|
+
if ((workInProgress.mode & BlockingMode) !== NoMode) {
|
|
11122
11264
|
// TODO: Move this back to throwException because this is too late
|
|
11123
11265
|
// if this is a large tree which is common for initial loads. We
|
|
11124
11266
|
// don't know if we should restart a render or not until we get
|
|
@@ -11268,7 +11410,11 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
11268
11410
|
// Reset the effect list before doing the second pass since that's now invalid.
|
|
11269
11411
|
|
|
11270
11412
|
|
|
11271
|
-
|
|
11413
|
+
if (renderState.lastEffect === null) {
|
|
11414
|
+
workInProgress.firstEffect = null;
|
|
11415
|
+
}
|
|
11416
|
+
|
|
11417
|
+
workInProgress.lastEffect = renderState.lastEffect; // Reset the child fibers to their original state.
|
|
11272
11418
|
|
|
11273
11419
|
resetChildFibers(workInProgress, renderExpirationTime); // Set up the Suspense Context to force suspense and immediately
|
|
11274
11420
|
// rerender the children.
|
|
@@ -11291,21 +11437,22 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
11291
11437
|
|
|
11292
11438
|
if (_suspended !== null) {
|
|
11293
11439
|
workInProgress.effectTag |= DidCapture;
|
|
11294
|
-
didSuspendAlready = true;
|
|
11295
|
-
|
|
11440
|
+
didSuspendAlready = true; // Ensure we transfer the update queue to the parent so that it doesn't
|
|
11441
|
+
// get lost if this row ends up dropped during a second pass.
|
|
11296
11442
|
|
|
11297
|
-
|
|
11298
|
-
// We need to delete the row we just rendered.
|
|
11299
|
-
// Ensure we transfer the update queue to the parent.
|
|
11300
|
-
var _newThennables = _suspended.updateQueue;
|
|
11443
|
+
var _newThennables = _suspended.updateQueue;
|
|
11301
11444
|
|
|
11302
|
-
|
|
11303
|
-
|
|
11304
|
-
|
|
11305
|
-
|
|
11306
|
-
// child. The nested children have already appended themselves.
|
|
11445
|
+
if (_newThennables !== null) {
|
|
11446
|
+
workInProgress.updateQueue = _newThennables;
|
|
11447
|
+
workInProgress.effectTag |= Update;
|
|
11448
|
+
}
|
|
11307
11449
|
|
|
11450
|
+
cutOffTailIfNeeded(renderState, true); // This might have been modified.
|
|
11308
11451
|
|
|
11452
|
+
if (renderState.tail === null && renderState.tailMode === 'hidden' && !renderedTail.alternate) {
|
|
11453
|
+
// We need to delete the row we just rendered.
|
|
11454
|
+
// Reset the effect list to what it was before we rendered this
|
|
11455
|
+
// child. The nested children have already appended themselves.
|
|
11309
11456
|
var lastEffect = workInProgress.lastEffect = renderState.lastEffect; // Remove any effects that were appended after this point.
|
|
11310
11457
|
|
|
11311
11458
|
if (lastEffect !== null) {
|
|
@@ -11492,13 +11639,11 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
11492
11639
|
}
|
|
11493
11640
|
|
|
11494
11641
|
default:
|
|
11495
|
-
|
|
11642
|
+
{
|
|
11496
11643
|
{
|
|
11497
|
-
|
|
11498
|
-
throw ReactError(Error("Unknown unit of work tag (" + workInProgress.tag + "). This error is likely caused by a bug in React. Please file an issue."));
|
|
11499
|
-
}
|
|
11644
|
+
throw Error("Unknown unit of work tag (" + workInProgress.tag + "). This error is likely caused by a bug in React. Please file an issue.");
|
|
11500
11645
|
}
|
|
11501
|
-
}
|
|
11646
|
+
}
|
|
11502
11647
|
|
|
11503
11648
|
}
|
|
11504
11649
|
|
|
@@ -11531,13 +11676,11 @@ function unwindWork(workInProgress, renderExpirationTime) {
|
|
|
11531
11676
|
popTopLevelContextObject(workInProgress);
|
|
11532
11677
|
var _effectTag = workInProgress.effectTag;
|
|
11533
11678
|
|
|
11534
|
-
(
|
|
11535
|
-
|
|
11536
|
-
|
|
11537
|
-
throw ReactError(Error("The root failed to unmount after an error. This is likely a bug in React. Please file an issue."));
|
|
11538
|
-
}
|
|
11679
|
+
if (!((_effectTag & DidCapture) === NoEffect)) {
|
|
11680
|
+
{
|
|
11681
|
+
throw Error("The root failed to unmount after an error. This is likely a bug in React. Please file an issue.");
|
|
11539
11682
|
}
|
|
11540
|
-
}
|
|
11683
|
+
}
|
|
11541
11684
|
|
|
11542
11685
|
workInProgress.effectTag = _effectTag & ~ShouldCapture | DidCapture;
|
|
11543
11686
|
return workInProgress;
|
|
@@ -11558,13 +11701,11 @@ function unwindWork(workInProgress, renderExpirationTime) {
|
|
|
11558
11701
|
var suspenseState = workInProgress.memoizedState;
|
|
11559
11702
|
|
|
11560
11703
|
if (suspenseState !== null && suspenseState.dehydrated !== null) {
|
|
11561
|
-
(
|
|
11562
|
-
|
|
11563
|
-
|
|
11564
|
-
throw ReactError(Error("Threw in newly mounted dehydrated component. This is likely a bug in React. Please file an issue."));
|
|
11565
|
-
}
|
|
11704
|
+
if (!(workInProgress.alternate !== null)) {
|
|
11705
|
+
{
|
|
11706
|
+
throw Error("Threw in newly mounted dehydrated component. This is likely a bug in React. Please file an issue.");
|
|
11566
11707
|
}
|
|
11567
|
-
}
|
|
11708
|
+
}
|
|
11568
11709
|
|
|
11569
11710
|
resetHydrationState();
|
|
11570
11711
|
}
|
|
@@ -11698,13 +11839,11 @@ var invokeGuardedCallbackImpl = function (name, func, context, a, b, c, d, e, f)
|
|
|
11698
11839
|
// when we call document.createEvent(). However this can cause confusing
|
|
11699
11840
|
// errors: https://github.com/facebookincubator/create-react-app/issues/3482
|
|
11700
11841
|
// So we preemptively throw with a better message instead.
|
|
11701
|
-
(
|
|
11702
|
-
|
|
11703
|
-
|
|
11704
|
-
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."));
|
|
11705
|
-
}
|
|
11842
|
+
if (!(typeof document !== 'undefined')) {
|
|
11843
|
+
{
|
|
11844
|
+
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.");
|
|
11706
11845
|
}
|
|
11707
|
-
}
|
|
11846
|
+
}
|
|
11708
11847
|
|
|
11709
11848
|
var evt = document.createEvent('Event'); // Keeps track of whether the user-provided callback threw an error. We
|
|
11710
11849
|
// set this to true at the beginning, then set it to false right after
|
|
@@ -11872,13 +12011,11 @@ function clearCaughtError() {
|
|
|
11872
12011
|
caughtError = null;
|
|
11873
12012
|
return error;
|
|
11874
12013
|
} else {
|
|
11875
|
-
|
|
12014
|
+
{
|
|
11876
12015
|
{
|
|
11877
|
-
|
|
11878
|
-
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."));
|
|
11879
|
-
}
|
|
12016
|
+
throw Error("clearCaughtError was called but no error was captured. This error is likely caused by a bug in React. Please file an issue.");
|
|
11880
12017
|
}
|
|
11881
|
-
}
|
|
12018
|
+
}
|
|
11882
12019
|
}
|
|
11883
12020
|
}
|
|
11884
12021
|
|
|
@@ -12098,13 +12235,11 @@ function commitBeforeMutationLifeCycles(current$$1, finishedWork) {
|
|
|
12098
12235
|
|
|
12099
12236
|
default:
|
|
12100
12237
|
{
|
|
12101
|
-
|
|
12238
|
+
{
|
|
12102
12239
|
{
|
|
12103
|
-
|
|
12104
|
-
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."));
|
|
12105
|
-
}
|
|
12240
|
+
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.");
|
|
12106
12241
|
}
|
|
12107
|
-
}
|
|
12242
|
+
}
|
|
12108
12243
|
}
|
|
12109
12244
|
}
|
|
12110
12245
|
}
|
|
@@ -12326,13 +12461,11 @@ function commitLifeCycles(finishedRoot, current$$1, finishedWork, committedExpir
|
|
|
12326
12461
|
|
|
12327
12462
|
default:
|
|
12328
12463
|
{
|
|
12329
|
-
|
|
12464
|
+
{
|
|
12330
12465
|
{
|
|
12331
|
-
|
|
12332
|
-
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."));
|
|
12333
|
-
}
|
|
12466
|
+
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.");
|
|
12334
12467
|
}
|
|
12335
|
-
}
|
|
12468
|
+
}
|
|
12336
12469
|
}
|
|
12337
12470
|
}
|
|
12338
12471
|
}
|
|
@@ -12677,13 +12810,11 @@ function commitContainer(finishedWork) {
|
|
|
12677
12810
|
|
|
12678
12811
|
default:
|
|
12679
12812
|
{
|
|
12680
|
-
|
|
12813
|
+
{
|
|
12681
12814
|
{
|
|
12682
|
-
|
|
12683
|
-
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."));
|
|
12684
|
-
}
|
|
12815
|
+
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.");
|
|
12685
12816
|
}
|
|
12686
|
-
}
|
|
12817
|
+
}
|
|
12687
12818
|
}
|
|
12688
12819
|
}
|
|
12689
12820
|
}
|
|
@@ -12699,13 +12830,11 @@ function getHostParentFiber(fiber) {
|
|
|
12699
12830
|
parent = parent.return;
|
|
12700
12831
|
}
|
|
12701
12832
|
|
|
12702
|
-
|
|
12833
|
+
{
|
|
12703
12834
|
{
|
|
12704
|
-
|
|
12705
|
-
throw ReactError(Error("Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue."));
|
|
12706
|
-
}
|
|
12835
|
+
throw Error("Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue.");
|
|
12707
12836
|
}
|
|
12708
|
-
}
|
|
12837
|
+
}
|
|
12709
12838
|
}
|
|
12710
12839
|
|
|
12711
12840
|
function isHostParent(fiber) {
|
|
@@ -12797,13 +12926,11 @@ function commitPlacement(finishedWork) {
|
|
|
12797
12926
|
// eslint-disable-next-line-no-fallthrough
|
|
12798
12927
|
|
|
12799
12928
|
default:
|
|
12800
|
-
|
|
12929
|
+
{
|
|
12801
12930
|
{
|
|
12802
|
-
|
|
12803
|
-
throw ReactError(Error("Invalid host parent fiber. This error is likely caused by a bug in React. Please file an issue."));
|
|
12804
|
-
}
|
|
12931
|
+
throw Error("Invalid host parent fiber. This error is likely caused by a bug in React. Please file an issue.");
|
|
12805
12932
|
}
|
|
12806
|
-
}
|
|
12933
|
+
}
|
|
12807
12934
|
|
|
12808
12935
|
}
|
|
12809
12936
|
|
|
@@ -12878,13 +13005,11 @@ function unmountHostComponents(finishedRoot, current$$1, renderPriorityLevel) {
|
|
|
12878
13005
|
var parent = node.return;
|
|
12879
13006
|
|
|
12880
13007
|
findParent: while (true) {
|
|
12881
|
-
(
|
|
12882
|
-
|
|
12883
|
-
|
|
12884
|
-
throw ReactError(Error("Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue."));
|
|
12885
|
-
}
|
|
13008
|
+
if (!(parent !== null)) {
|
|
13009
|
+
{
|
|
13010
|
+
throw Error("Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue.");
|
|
12886
13011
|
}
|
|
12887
|
-
}
|
|
13012
|
+
}
|
|
12888
13013
|
|
|
12889
13014
|
var parentStateNode = parent.stateNode;
|
|
12890
13015
|
|
|
@@ -13118,13 +13243,11 @@ function commitWork(current$$1, finishedWork) {
|
|
|
13118
13243
|
|
|
13119
13244
|
case HostText:
|
|
13120
13245
|
{
|
|
13121
|
-
(
|
|
13122
|
-
|
|
13123
|
-
|
|
13124
|
-
throw ReactError(Error("This should have a text node initialized. This error is likely caused by a bug in React. Please file an issue."));
|
|
13125
|
-
}
|
|
13246
|
+
if (!(finishedWork.stateNode !== null)) {
|
|
13247
|
+
{
|
|
13248
|
+
throw Error("This should have a text node initialized. This error is likely caused by a bug in React. Please file an issue.");
|
|
13126
13249
|
}
|
|
13127
|
-
}
|
|
13250
|
+
}
|
|
13128
13251
|
|
|
13129
13252
|
var textInstance = finishedWork.stateNode;
|
|
13130
13253
|
var newText = finishedWork.memoizedProps; // For hydration we reuse the update path but we treat the oldProps
|
|
@@ -13209,13 +13332,11 @@ function commitWork(current$$1, finishedWork) {
|
|
|
13209
13332
|
|
|
13210
13333
|
default:
|
|
13211
13334
|
{
|
|
13212
|
-
|
|
13335
|
+
{
|
|
13213
13336
|
{
|
|
13214
|
-
|
|
13215
|
-
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."));
|
|
13216
|
-
}
|
|
13337
|
+
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.");
|
|
13217
13338
|
}
|
|
13218
|
-
}
|
|
13339
|
+
}
|
|
13219
13340
|
}
|
|
13220
13341
|
}
|
|
13221
13342
|
}
|
|
@@ -13463,17 +13584,17 @@ function throwException(root, returnFiber, sourceFiber, value, renderExpirationT
|
|
|
13463
13584
|
_workInProgress.updateQueue = updateQueue;
|
|
13464
13585
|
} else {
|
|
13465
13586
|
thenables.add(thenable);
|
|
13466
|
-
} // If the boundary is outside of
|
|
13587
|
+
} // If the boundary is outside of blocking mode, we should *not*
|
|
13467
13588
|
// suspend the commit. Pretend as if the suspended component rendered
|
|
13468
13589
|
// null and keep rendering. In the commit phase, we'll schedule a
|
|
13469
13590
|
// subsequent synchronous update to re-render the Suspense.
|
|
13470
13591
|
//
|
|
13471
13592
|
// Note: It doesn't matter whether the component that suspended was
|
|
13472
|
-
// inside a
|
|
13593
|
+
// inside a blocking mode tree. If the Suspense is outside of it, we
|
|
13473
13594
|
// should *not* suspend the commit.
|
|
13474
13595
|
|
|
13475
13596
|
|
|
13476
|
-
if ((_workInProgress.mode &
|
|
13597
|
+
if ((_workInProgress.mode & BlockingMode) === NoMode) {
|
|
13477
13598
|
_workInProgress.effectTag |= DidCapture; // We're going to commit this fiber even though it didn't complete.
|
|
13478
13599
|
// But we shouldn't call any lifecycle methods or callbacks. Remove
|
|
13479
13600
|
// all lifecycle effect tags.
|
|
@@ -13636,7 +13757,6 @@ var RootErrored = 2;
|
|
|
13636
13757
|
var RootSuspended = 3;
|
|
13637
13758
|
var RootSuspendedWithDelay = 4;
|
|
13638
13759
|
var RootCompleted = 5;
|
|
13639
|
-
var RootLocked = 6;
|
|
13640
13760
|
// Describes where we are in the React execution stack
|
|
13641
13761
|
var executionContext = NoContext; // The root we're working on
|
|
13642
13762
|
|
|
@@ -13696,7 +13816,7 @@ var spawnedWorkDuringRender = null; // Expiration times are computed by adding t
|
|
|
13696
13816
|
// receive the same expiration time. Otherwise we get tearing.
|
|
13697
13817
|
|
|
13698
13818
|
var currentEventTime = NoWork;
|
|
13699
|
-
function
|
|
13819
|
+
function requestCurrentTimeForUpdate() {
|
|
13700
13820
|
if ((executionContext & (RenderContext | CommitContext)) !== NoContext) {
|
|
13701
13821
|
// We're inside React, so it's fine to read the actual time.
|
|
13702
13822
|
return msToExpirationTime(now());
|
|
@@ -13712,10 +13832,13 @@ function requestCurrentTime() {
|
|
|
13712
13832
|
currentEventTime = msToExpirationTime(now());
|
|
13713
13833
|
return currentEventTime;
|
|
13714
13834
|
}
|
|
13835
|
+
function getCurrentTime() {
|
|
13836
|
+
return msToExpirationTime(now());
|
|
13837
|
+
}
|
|
13715
13838
|
function computeExpirationForFiber(currentTime, fiber, suspenseConfig) {
|
|
13716
13839
|
var mode = fiber.mode;
|
|
13717
13840
|
|
|
13718
|
-
if ((mode &
|
|
13841
|
+
if ((mode & BlockingMode) === NoMode) {
|
|
13719
13842
|
return Sync;
|
|
13720
13843
|
}
|
|
13721
13844
|
|
|
@@ -13760,13 +13883,11 @@ function computeExpirationForFiber(currentTime, fiber, suspenseConfig) {
|
|
|
13760
13883
|
break;
|
|
13761
13884
|
|
|
13762
13885
|
default:
|
|
13763
|
-
|
|
13886
|
+
{
|
|
13764
13887
|
{
|
|
13765
|
-
|
|
13766
|
-
throw ReactError(Error("Expected a valid priority level"));
|
|
13767
|
-
}
|
|
13888
|
+
throw Error("Expected a valid priority level");
|
|
13768
13889
|
}
|
|
13769
|
-
}
|
|
13890
|
+
}
|
|
13770
13891
|
|
|
13771
13892
|
}
|
|
13772
13893
|
} // If we're in the middle of rendering a tree, do not update at the same
|
|
@@ -13783,7 +13904,6 @@ function computeExpirationForFiber(currentTime, fiber, suspenseConfig) {
|
|
|
13783
13904
|
|
|
13784
13905
|
return expirationTime;
|
|
13785
13906
|
}
|
|
13786
|
-
|
|
13787
13907
|
function scheduleUpdateOnFiber(fiber, expirationTime) {
|
|
13788
13908
|
checkForNestedUpdates();
|
|
13789
13909
|
warnAboutInvalidUpdatesOnClassComponentsInDEV(fiber);
|
|
@@ -13819,7 +13939,7 @@ function scheduleUpdateOnFiber(fiber, expirationTime) {
|
|
|
13819
13939
|
// a batch. This is intentionally inside scheduleUpdateOnFiber instead of
|
|
13820
13940
|
// scheduleCallbackForFiber to preserve the ability to schedule a callback
|
|
13821
13941
|
// without immediately flushing it. We only do this for user-initiated
|
|
13822
|
-
// updates, to preserve historical behavior of
|
|
13942
|
+
// updates, to preserve historical behavior of legacy mode.
|
|
13823
13943
|
flushSyncCallbackQueue();
|
|
13824
13944
|
}
|
|
13825
13945
|
}
|
|
@@ -13980,7 +14100,7 @@ function ensureRootIsScheduled(root) {
|
|
|
13980
14100
|
// time as an argument.
|
|
13981
14101
|
|
|
13982
14102
|
|
|
13983
|
-
var currentTime =
|
|
14103
|
+
var currentTime = requestCurrentTimeForUpdate();
|
|
13984
14104
|
var priorityLevel = inferPriorityFromExpirationTime(currentTime, expirationTime); // If there's an existing render task, confirm it has the correct priority and
|
|
13985
14105
|
// expiration time. Otherwise, we'll cancel it and schedule a new one.
|
|
13986
14106
|
|
|
@@ -14031,7 +14151,7 @@ function performConcurrentWorkOnRoot(root, didTimeout) {
|
|
|
14031
14151
|
if (didTimeout) {
|
|
14032
14152
|
// The render task took too long to complete. Mark the current time as
|
|
14033
14153
|
// expired to synchronously render all expired work in a single batch.
|
|
14034
|
-
var currentTime =
|
|
14154
|
+
var currentTime = requestCurrentTimeForUpdate();
|
|
14035
14155
|
markRootExpiredAtTime(root, currentTime); // This will schedule a synchronous callback.
|
|
14036
14156
|
|
|
14037
14157
|
ensureRootIsScheduled(root);
|
|
@@ -14045,13 +14165,11 @@ function performConcurrentWorkOnRoot(root, didTimeout) {
|
|
|
14045
14165
|
if (expirationTime !== NoWork) {
|
|
14046
14166
|
var originalCallbackNode = root.callbackNode;
|
|
14047
14167
|
|
|
14048
|
-
(
|
|
14049
|
-
|
|
14050
|
-
|
|
14051
|
-
throw ReactError(Error("Should not already be working."));
|
|
14052
|
-
}
|
|
14168
|
+
if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) {
|
|
14169
|
+
{
|
|
14170
|
+
throw Error("Should not already be working.");
|
|
14053
14171
|
}
|
|
14054
|
-
}
|
|
14172
|
+
}
|
|
14055
14173
|
|
|
14056
14174
|
flushPassiveEffects(); // If the root or expiration time have changed, throw out the existing stack
|
|
14057
14175
|
// and prepare a fresh one. Otherwise we'll continue where we left off.
|
|
@@ -14105,7 +14223,6 @@ function performConcurrentWorkOnRoot(root, didTimeout) {
|
|
|
14105
14223
|
stopFinishedWorkLoopTimer();
|
|
14106
14224
|
var finishedWork = root.finishedWork = root.current.alternate;
|
|
14107
14225
|
root.finishedExpirationTime = expirationTime;
|
|
14108
|
-
resolveLocksOnRoot(root, expirationTime);
|
|
14109
14226
|
finishConcurrentRender(root, finishedWork, workInProgressRootExitStatus, expirationTime);
|
|
14110
14227
|
}
|
|
14111
14228
|
|
|
@@ -14130,13 +14247,11 @@ function finishConcurrentRender(root, finishedWork, exitStatus, expirationTime)
|
|
|
14130
14247
|
case RootIncomplete:
|
|
14131
14248
|
case RootFatalErrored:
|
|
14132
14249
|
{
|
|
14133
|
-
|
|
14250
|
+
{
|
|
14134
14251
|
{
|
|
14135
|
-
|
|
14136
|
-
throw ReactError(Error("Root did not complete. This is a bug in React."));
|
|
14137
|
-
}
|
|
14252
|
+
throw Error("Root did not complete. This is a bug in React.");
|
|
14138
14253
|
}
|
|
14139
|
-
}
|
|
14254
|
+
}
|
|
14140
14255
|
}
|
|
14141
14256
|
// Flow knows about invariant, so it complains if I add a break
|
|
14142
14257
|
// statement, but eslint doesn't know about invariant, so it complains
|
|
@@ -14144,18 +14259,16 @@ function finishConcurrentRender(root, finishedWork, exitStatus, expirationTime)
|
|
|
14144
14259
|
|
|
14145
14260
|
case RootErrored:
|
|
14146
14261
|
{
|
|
14147
|
-
|
|
14148
|
-
|
|
14149
|
-
|
|
14150
|
-
|
|
14151
|
-
|
|
14152
|
-
|
|
14153
|
-
|
|
14154
|
-
|
|
14155
|
-
|
|
14156
|
-
|
|
14262
|
+
// If this was an async render, the error may have happened due to
|
|
14263
|
+
// a mutation in a concurrent event. Try rendering one more time,
|
|
14264
|
+
// synchronously, to see if the error goes away. If there are
|
|
14265
|
+
// lower priority updates, let's include those, too, in case they
|
|
14266
|
+
// fix the inconsistency. Render at Idle to include all updates.
|
|
14267
|
+
// If it was Idle or Never or some not-yet-invented time, render
|
|
14268
|
+
// at that time.
|
|
14269
|
+
markRootExpiredAtTime(root, expirationTime > Idle ? Idle : expirationTime); // We assume that this second render pass will be synchronous
|
|
14270
|
+
// and therefore not hit this path again.
|
|
14157
14271
|
|
|
14158
|
-
commitRoot(root);
|
|
14159
14272
|
break;
|
|
14160
14273
|
}
|
|
14161
14274
|
|
|
@@ -14339,24 +14452,13 @@ function finishConcurrentRender(root, finishedWork, exitStatus, expirationTime)
|
|
|
14339
14452
|
break;
|
|
14340
14453
|
}
|
|
14341
14454
|
|
|
14342
|
-
case RootLocked:
|
|
14343
|
-
{
|
|
14344
|
-
// This root has a lock that prevents it from committing. Exit. If
|
|
14345
|
-
// we begin work on the root again, without any intervening updates,
|
|
14346
|
-
// it will finish without doing additional work.
|
|
14347
|
-
markRootSuspendedAtTime(root, expirationTime);
|
|
14348
|
-
break;
|
|
14349
|
-
}
|
|
14350
|
-
|
|
14351
14455
|
default:
|
|
14352
14456
|
{
|
|
14353
|
-
|
|
14457
|
+
{
|
|
14354
14458
|
{
|
|
14355
|
-
|
|
14356
|
-
throw ReactError(Error("Unknown root exit status."));
|
|
14357
|
-
}
|
|
14459
|
+
throw Error("Unknown root exit status.");
|
|
14358
14460
|
}
|
|
14359
|
-
}
|
|
14461
|
+
}
|
|
14360
14462
|
}
|
|
14361
14463
|
}
|
|
14362
14464
|
} // This is the entry point for synchronous tasks that don't go
|
|
@@ -14374,13 +14476,11 @@ function performSyncWorkOnRoot(root) {
|
|
|
14374
14476
|
// batch.commit() API.
|
|
14375
14477
|
commitRoot(root);
|
|
14376
14478
|
} else {
|
|
14377
|
-
(
|
|
14378
|
-
|
|
14379
|
-
|
|
14380
|
-
throw ReactError(Error("Should not already be working."));
|
|
14381
|
-
}
|
|
14479
|
+
if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) {
|
|
14480
|
+
{
|
|
14481
|
+
throw Error("Should not already be working.");
|
|
14382
14482
|
}
|
|
14383
|
-
}
|
|
14483
|
+
}
|
|
14384
14484
|
|
|
14385
14485
|
flushPassiveEffects(); // If the root or expiration time have changed, throw out the existing stack
|
|
14386
14486
|
// and prepare a fresh one. Otherwise we'll continue where we left off.
|
|
@@ -14427,21 +14527,17 @@ function performSyncWorkOnRoot(root) {
|
|
|
14427
14527
|
|
|
14428
14528
|
if (workInProgress !== null) {
|
|
14429
14529
|
// This is a sync render, so we should have finished the whole tree.
|
|
14430
|
-
|
|
14530
|
+
{
|
|
14431
14531
|
{
|
|
14432
|
-
|
|
14433
|
-
throw ReactError(Error("Cannot commit an incomplete root. This error is likely caused by a bug in React. Please file an issue."));
|
|
14434
|
-
}
|
|
14532
|
+
throw Error("Cannot commit an incomplete root. This error is likely caused by a bug in React. Please file an issue.");
|
|
14435
14533
|
}
|
|
14436
|
-
}
|
|
14534
|
+
}
|
|
14437
14535
|
} else {
|
|
14438
14536
|
// We now have a consistent tree. Because this is a sync render, we
|
|
14439
|
-
// will commit it even if something suspended.
|
|
14440
|
-
// if the root is locked (using the unstable_createBatch API).
|
|
14537
|
+
// will commit it even if something suspended.
|
|
14441
14538
|
stopFinishedWorkLoopTimer();
|
|
14442
14539
|
root.finishedWork = root.current.alternate;
|
|
14443
14540
|
root.finishedExpirationTime = expirationTime;
|
|
14444
|
-
resolveLocksOnRoot(root, expirationTime);
|
|
14445
14541
|
finishSyncRender(root, workInProgressRootExitStatus, expirationTime);
|
|
14446
14542
|
} // Before exiting, make sure there's a callback scheduled for the next
|
|
14447
14543
|
// pending level.
|
|
@@ -14455,44 +14551,25 @@ function performSyncWorkOnRoot(root) {
|
|
|
14455
14551
|
}
|
|
14456
14552
|
|
|
14457
14553
|
function finishSyncRender(root, exitStatus, expirationTime) {
|
|
14458
|
-
|
|
14459
|
-
|
|
14460
|
-
// begin work on the root again, without any intervening updates, it
|
|
14461
|
-
// will finish without doing additional work.
|
|
14462
|
-
markRootSuspendedAtTime(root, expirationTime);
|
|
14463
|
-
} else {
|
|
14464
|
-
// Set this to null to indicate there's no in-progress render.
|
|
14465
|
-
workInProgressRoot = null;
|
|
14554
|
+
// Set this to null to indicate there's no in-progress render.
|
|
14555
|
+
workInProgressRoot = null;
|
|
14466
14556
|
|
|
14467
|
-
|
|
14468
|
-
|
|
14469
|
-
|
|
14470
|
-
}
|
|
14557
|
+
{
|
|
14558
|
+
if (exitStatus === RootSuspended || exitStatus === RootSuspendedWithDelay) {
|
|
14559
|
+
flushSuspensePriorityWarningInDEV();
|
|
14471
14560
|
}
|
|
14472
|
-
|
|
14473
|
-
commitRoot(root);
|
|
14474
14561
|
}
|
|
14475
|
-
}
|
|
14476
|
-
|
|
14477
14562
|
|
|
14563
|
+
commitRoot(root);
|
|
14564
|
+
}
|
|
14478
14565
|
|
|
14479
14566
|
|
|
14480
|
-
function resolveLocksOnRoot(root, expirationTime) {
|
|
14481
|
-
var firstBatch = root.firstBatch;
|
|
14482
14567
|
|
|
14483
|
-
if (firstBatch !== null && firstBatch._defer && firstBatch._expirationTime >= expirationTime) {
|
|
14484
|
-
scheduleCallback(NormalPriority, function () {
|
|
14485
|
-
firstBatch._onComplete();
|
|
14486
14568
|
|
|
14487
|
-
|
|
14488
|
-
|
|
14489
|
-
workInProgressRootExitStatus = RootLocked;
|
|
14490
|
-
}
|
|
14569
|
+
function syncUpdates(fn, a, b, c) {
|
|
14570
|
+
return runWithPriority(ImmediatePriority, fn.bind(null, a, b, c));
|
|
14491
14571
|
}
|
|
14492
14572
|
|
|
14493
|
-
|
|
14494
|
-
|
|
14495
|
-
|
|
14496
14573
|
function batchedUpdates(fn, a) {
|
|
14497
14574
|
var prevExecutionContext = executionContext;
|
|
14498
14575
|
executionContext |= BatchedContext;
|
|
@@ -14513,13 +14590,11 @@ function batchedUpdates(fn, a) {
|
|
|
14513
14590
|
|
|
14514
14591
|
function flushSync(fn, a) {
|
|
14515
14592
|
if ((executionContext & (RenderContext | CommitContext)) !== NoContext) {
|
|
14516
|
-
|
|
14593
|
+
{
|
|
14517
14594
|
{
|
|
14518
|
-
|
|
14519
|
-
throw ReactError(Error("flushSync was called from inside a lifecycle method. It cannot be called when React is already rendering."));
|
|
14520
|
-
}
|
|
14595
|
+
throw Error("flushSync was called from inside a lifecycle method. It cannot be called when React is already rendering.");
|
|
14521
14596
|
}
|
|
14522
|
-
}
|
|
14597
|
+
}
|
|
14523
14598
|
}
|
|
14524
14599
|
|
|
14525
14600
|
var prevExecutionContext = executionContext;
|
|
@@ -14586,6 +14661,7 @@ function handleError(root, thrownValue) {
|
|
|
14586
14661
|
// Reset module-level state that was set during the render phase.
|
|
14587
14662
|
resetContextDependencies();
|
|
14588
14663
|
resetHooks();
|
|
14664
|
+
resetCurrentFiber();
|
|
14589
14665
|
|
|
14590
14666
|
if (workInProgress === null || workInProgress.return === null) {
|
|
14591
14667
|
// Expected to be working on a non-root fiber. This is a fatal error
|
|
@@ -14982,16 +15058,23 @@ function commitRoot(root) {
|
|
|
14982
15058
|
}
|
|
14983
15059
|
|
|
14984
15060
|
function commitRootImpl(root, renderPriorityLevel) {
|
|
14985
|
-
|
|
15061
|
+
do {
|
|
15062
|
+
// `flushPassiveEffects` will call `flushSyncUpdateQueue` at the end, which
|
|
15063
|
+
// means `flushPassiveEffects` will sometimes result in additional
|
|
15064
|
+
// passive effects. So we need to keep flushing in a loop until there are
|
|
15065
|
+
// no more pending effects.
|
|
15066
|
+
// TODO: Might be better if `flushPassiveEffects` did not automatically
|
|
15067
|
+
// flush synchronous work at the end, to avoid factoring hazards like this.
|
|
15068
|
+
flushPassiveEffects();
|
|
15069
|
+
} while (rootWithPendingPassiveEffects !== null);
|
|
15070
|
+
|
|
14986
15071
|
flushRenderPhaseStrictModeWarningsInDEV();
|
|
14987
15072
|
|
|
14988
|
-
(
|
|
14989
|
-
|
|
14990
|
-
|
|
14991
|
-
throw ReactError(Error("Should not already be working."));
|
|
14992
|
-
}
|
|
15073
|
+
if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) {
|
|
15074
|
+
{
|
|
15075
|
+
throw Error("Should not already be working.");
|
|
14993
15076
|
}
|
|
14994
|
-
}
|
|
15077
|
+
}
|
|
14995
15078
|
|
|
14996
15079
|
var finishedWork = root.finishedWork;
|
|
14997
15080
|
var expirationTime = root.finishedExpirationTime;
|
|
@@ -15003,13 +15086,11 @@ function commitRootImpl(root, renderPriorityLevel) {
|
|
|
15003
15086
|
root.finishedWork = null;
|
|
15004
15087
|
root.finishedExpirationTime = NoWork;
|
|
15005
15088
|
|
|
15006
|
-
(
|
|
15007
|
-
|
|
15008
|
-
|
|
15009
|
-
throw ReactError(Error("Cannot commit the same tree as before. This error is likely caused by a bug in React. Please file an issue."));
|
|
15010
|
-
}
|
|
15089
|
+
if (!(finishedWork !== root.current)) {
|
|
15090
|
+
{
|
|
15091
|
+
throw Error("Cannot commit the same tree as before. This error is likely caused by a bug in React. Please file an issue.");
|
|
15011
15092
|
}
|
|
15012
|
-
}
|
|
15093
|
+
} // commitRoot never returns a continuation; it always finishes synchronously.
|
|
15013
15094
|
// So we can clear these now to allow a new callback to be scheduled.
|
|
15014
15095
|
|
|
15015
15096
|
|
|
@@ -15073,13 +15154,11 @@ function commitRootImpl(root, renderPriorityLevel) {
|
|
|
15073
15154
|
invokeGuardedCallback(null, commitBeforeMutationEffects, null);
|
|
15074
15155
|
|
|
15075
15156
|
if (hasCaughtError()) {
|
|
15076
|
-
(
|
|
15077
|
-
|
|
15078
|
-
|
|
15079
|
-
throw ReactError(Error("Should be working on an effect."));
|
|
15080
|
-
}
|
|
15157
|
+
if (!(nextEffect !== null)) {
|
|
15158
|
+
{
|
|
15159
|
+
throw Error("Should be working on an effect.");
|
|
15081
15160
|
}
|
|
15082
|
-
}
|
|
15161
|
+
}
|
|
15083
15162
|
|
|
15084
15163
|
var error = clearCaughtError();
|
|
15085
15164
|
captureCommitPhaseError(nextEffect, error);
|
|
@@ -15105,13 +15184,11 @@ function commitRootImpl(root, renderPriorityLevel) {
|
|
|
15105
15184
|
invokeGuardedCallback(null, commitMutationEffects, null, root, renderPriorityLevel);
|
|
15106
15185
|
|
|
15107
15186
|
if (hasCaughtError()) {
|
|
15108
|
-
(
|
|
15109
|
-
|
|
15110
|
-
|
|
15111
|
-
throw ReactError(Error("Should be working on an effect."));
|
|
15112
|
-
}
|
|
15187
|
+
if (!(nextEffect !== null)) {
|
|
15188
|
+
{
|
|
15189
|
+
throw Error("Should be working on an effect.");
|
|
15113
15190
|
}
|
|
15114
|
-
}
|
|
15191
|
+
}
|
|
15115
15192
|
|
|
15116
15193
|
var _error = clearCaughtError();
|
|
15117
15194
|
|
|
@@ -15139,13 +15216,11 @@ function commitRootImpl(root, renderPriorityLevel) {
|
|
|
15139
15216
|
invokeGuardedCallback(null, commitLayoutEffects, null, root, expirationTime);
|
|
15140
15217
|
|
|
15141
15218
|
if (hasCaughtError()) {
|
|
15142
|
-
(
|
|
15143
|
-
|
|
15144
|
-
|
|
15145
|
-
throw ReactError(Error("Should be working on an effect."));
|
|
15146
|
-
}
|
|
15219
|
+
if (!(nextEffect !== null)) {
|
|
15220
|
+
{
|
|
15221
|
+
throw Error("Should be working on an effect.");
|
|
15147
15222
|
}
|
|
15148
|
-
}
|
|
15223
|
+
}
|
|
15149
15224
|
|
|
15150
15225
|
var _error2 = clearCaughtError();
|
|
15151
15226
|
|
|
@@ -15431,13 +15506,11 @@ function flushPassiveEffectsImpl() {
|
|
|
15431
15506
|
rootWithPendingPassiveEffects = null;
|
|
15432
15507
|
pendingPassiveEffectsExpirationTime = NoWork;
|
|
15433
15508
|
|
|
15434
|
-
(
|
|
15435
|
-
|
|
15436
|
-
|
|
15437
|
-
throw ReactError(Error("Cannot flush passive effects while already rendering."));
|
|
15438
|
-
}
|
|
15509
|
+
if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) {
|
|
15510
|
+
{
|
|
15511
|
+
throw Error("Cannot flush passive effects while already rendering.");
|
|
15439
15512
|
}
|
|
15440
|
-
}
|
|
15513
|
+
}
|
|
15441
15514
|
|
|
15442
15515
|
var prevExecutionContext = executionContext;
|
|
15443
15516
|
executionContext |= CommitContext;
|
|
@@ -15453,13 +15526,11 @@ function flushPassiveEffectsImpl() {
|
|
|
15453
15526
|
invokeGuardedCallback(null, commitPassiveHookEffects, null, effect);
|
|
15454
15527
|
|
|
15455
15528
|
if (hasCaughtError()) {
|
|
15456
|
-
(
|
|
15457
|
-
|
|
15458
|
-
|
|
15459
|
-
throw ReactError(Error("Should be working on an effect."));
|
|
15460
|
-
}
|
|
15529
|
+
if (!(effect !== null)) {
|
|
15530
|
+
{
|
|
15531
|
+
throw Error("Should be working on an effect.");
|
|
15461
15532
|
}
|
|
15462
|
-
}
|
|
15533
|
+
}
|
|
15463
15534
|
|
|
15464
15535
|
var error = clearCaughtError();
|
|
15465
15536
|
captureCommitPhaseError(effect, error);
|
|
@@ -15620,10 +15691,10 @@ function retryTimedOutBoundary(boundaryFiber, retryTime) {
|
|
|
15620
15691
|
// previously was rendered in its fallback state. One of the promises that
|
|
15621
15692
|
// suspended it has resolved, which means at least part of the tree was
|
|
15622
15693
|
// likely unblocked. Try rendering again, at a new expiration time.
|
|
15623
|
-
if (retryTime ===
|
|
15694
|
+
if (retryTime === NoWork) {
|
|
15624
15695
|
var suspenseConfig = null; // Retries don't carry over the already committed update.
|
|
15625
15696
|
|
|
15626
|
-
var currentTime =
|
|
15697
|
+
var currentTime = requestCurrentTimeForUpdate();
|
|
15627
15698
|
retryTime = computeExpirationForFiber(currentTime, boundaryFiber, suspenseConfig);
|
|
15628
15699
|
} // TODO: Special case idle priority?
|
|
15629
15700
|
|
|
@@ -15638,7 +15709,7 @@ function retryTimedOutBoundary(boundaryFiber, retryTime) {
|
|
|
15638
15709
|
|
|
15639
15710
|
function retryDehydratedSuspenseBoundary(boundaryFiber) {
|
|
15640
15711
|
var suspenseState = boundaryFiber.memoizedState;
|
|
15641
|
-
var retryTime =
|
|
15712
|
+
var retryTime = NoWork;
|
|
15642
15713
|
|
|
15643
15714
|
if (suspenseState !== null) {
|
|
15644
15715
|
retryTime = suspenseState.retryTime;
|
|
@@ -15647,7 +15718,7 @@ function retryDehydratedSuspenseBoundary(boundaryFiber) {
|
|
|
15647
15718
|
retryTimedOutBoundary(boundaryFiber, retryTime);
|
|
15648
15719
|
}
|
|
15649
15720
|
function resolveRetryThenable(boundaryFiber, thenable) {
|
|
15650
|
-
var retryTime =
|
|
15721
|
+
var retryTime = NoWork; // Default
|
|
15651
15722
|
|
|
15652
15723
|
var retryCache;
|
|
15653
15724
|
|
|
@@ -15668,13 +15739,11 @@ function resolveRetryThenable(boundaryFiber, thenable) {
|
|
|
15668
15739
|
break;
|
|
15669
15740
|
|
|
15670
15741
|
default:
|
|
15671
|
-
|
|
15742
|
+
{
|
|
15672
15743
|
{
|
|
15673
|
-
|
|
15674
|
-
throw ReactError(Error("Pinged unknown suspense boundary type. This is probably a bug in React."));
|
|
15675
|
-
}
|
|
15744
|
+
throw Error("Pinged unknown suspense boundary type. This is probably a bug in React.");
|
|
15676
15745
|
}
|
|
15677
|
-
}
|
|
15746
|
+
}
|
|
15678
15747
|
|
|
15679
15748
|
}
|
|
15680
15749
|
} else {
|
|
@@ -15731,13 +15800,11 @@ function checkForNestedUpdates() {
|
|
|
15731
15800
|
nestedUpdateCount = 0;
|
|
15732
15801
|
rootWithNestedUpdates = null;
|
|
15733
15802
|
|
|
15734
|
-
|
|
15803
|
+
{
|
|
15735
15804
|
{
|
|
15736
|
-
|
|
15737
|
-
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."));
|
|
15738
|
-
}
|
|
15805
|
+
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.");
|
|
15739
15806
|
}
|
|
15740
|
-
}
|
|
15807
|
+
}
|
|
15741
15808
|
}
|
|
15742
15809
|
|
|
15743
15810
|
{
|
|
@@ -15825,12 +15892,14 @@ if (true && replayFailedUnitOfWorkWithInvokeGuardedCallback) {
|
|
|
15825
15892
|
if (originalError !== null && typeof originalError === 'object' && typeof originalError.then === 'function') {
|
|
15826
15893
|
// Don't replay promises. Treat everything else like an error.
|
|
15827
15894
|
throw originalError;
|
|
15828
|
-
} // Keep this code in sync with
|
|
15895
|
+
} // Keep this code in sync with handleError; any changes here must have
|
|
15829
15896
|
// corresponding changes there.
|
|
15830
15897
|
|
|
15831
15898
|
|
|
15832
15899
|
resetContextDependencies();
|
|
15833
|
-
resetHooks(); //
|
|
15900
|
+
resetHooks(); // Don't reset current debug fiber, since we're about to work on the
|
|
15901
|
+
// same fiber again.
|
|
15902
|
+
// Unwind the failed stack frame
|
|
15834
15903
|
|
|
15835
15904
|
unwindInterruptedWork(unitOfWork); // Restore the original properties of the fiber.
|
|
15836
15905
|
|
|
@@ -15925,7 +15994,7 @@ var didWarnAboutUnmockedScheduler = false; // TODO Before we release concurrent
|
|
|
15925
15994
|
function warnIfUnmockedScheduler(fiber) {
|
|
15926
15995
|
{
|
|
15927
15996
|
if (didWarnAboutUnmockedScheduler === false && Scheduler$1.unstable_flushAllWithoutAsserting === undefined) {
|
|
15928
|
-
if (fiber.mode &
|
|
15997
|
+
if (fiber.mode & BlockingMode || fiber.mode & ConcurrentMode) {
|
|
15929
15998
|
didWarnAboutUnmockedScheduler = true;
|
|
15930
15999
|
warningWithoutStack$1(false, 'In Concurrent or Sync modes, the "scheduler" module needs to be mocked ' + 'to guarantee consistent behaviour across tests and browsers. ' + 'For example, with jest: \n' + "jest.mock('scheduler', () => require('scheduler/unstable_mock'));\n\n" + 'For more info, visit https://fb.me/react-mock-scheduler');
|
|
15931
16000
|
} else if (warnAboutUnmockedScheduler === true) {
|
|
@@ -16029,7 +16098,7 @@ function flushSuspensePriorityWarningInDEV() {
|
|
|
16029
16098
|
componentsThatTriggeredHighPriSuspend = null;
|
|
16030
16099
|
|
|
16031
16100
|
if (componentNames.length > 0) {
|
|
16032
|
-
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
|
|
16101
|
+
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
|
|
16033
16102
|
componentNames.sort().join(', '));
|
|
16034
16103
|
}
|
|
16035
16104
|
}
|
|
@@ -16116,10 +16185,10 @@ function startWorkOnPendingInteractions(root, expirationTime) {
|
|
|
16116
16185
|
});
|
|
16117
16186
|
}
|
|
16118
16187
|
}); // Store the current set of interactions on the FiberRoot for a few reasons:
|
|
16119
|
-
// We can re-use it in hot functions like
|
|
16120
|
-
// recalculate it. We will also use it in commitWork() to
|
|
16121
|
-
// onRender() hooks. This also provides DevTools with a
|
|
16122
|
-
// the onCommitRoot() hook is called.
|
|
16188
|
+
// We can re-use it in hot functions like performConcurrentWorkOnRoot()
|
|
16189
|
+
// without having to recalculate it. We will also use it in commitWork() to
|
|
16190
|
+
// pass to any Profiler onRender() hooks. This also provides DevTools with a
|
|
16191
|
+
// way to access it when the onCommitRoot() hook is called.
|
|
16123
16192
|
|
|
16124
16193
|
root.memoizedInteractions = interactions;
|
|
16125
16194
|
|
|
@@ -16227,7 +16296,7 @@ function injectInternals(internals) {
|
|
|
16227
16296
|
var didError = (root.current.effectTag & DidCapture) === DidCapture;
|
|
16228
16297
|
|
|
16229
16298
|
if (enableProfilerTimer) {
|
|
16230
|
-
var currentTime =
|
|
16299
|
+
var currentTime = getCurrentTime();
|
|
16231
16300
|
var priorityLevel = inferPriorityFromExpirationTime(currentTime, expirationTime);
|
|
16232
16301
|
hook.onCommitFiberRoot(rendererID, root, priorityLevel, didError);
|
|
16233
16302
|
} else {
|
|
@@ -16568,9 +16637,9 @@ function createHostRootFiber(tag) {
|
|
|
16568
16637
|
var mode;
|
|
16569
16638
|
|
|
16570
16639
|
if (tag === ConcurrentRoot) {
|
|
16571
|
-
mode = ConcurrentMode |
|
|
16572
|
-
} else if (tag ===
|
|
16573
|
-
mode =
|
|
16640
|
+
mode = ConcurrentMode | BlockingMode | StrictMode;
|
|
16641
|
+
} else if (tag === BlockingRoot) {
|
|
16642
|
+
mode = BlockingMode | StrictMode;
|
|
16574
16643
|
} else {
|
|
16575
16644
|
mode = NoMode;
|
|
16576
16645
|
}
|
|
@@ -16612,7 +16681,7 @@ key, pendingProps, owner, mode, expirationTime) {
|
|
|
16612
16681
|
|
|
16613
16682
|
case REACT_CONCURRENT_MODE_TYPE:
|
|
16614
16683
|
fiberTag = Mode;
|
|
16615
|
-
mode |= ConcurrentMode |
|
|
16684
|
+
mode |= ConcurrentMode | BlockingMode | StrictMode;
|
|
16616
16685
|
break;
|
|
16617
16686
|
|
|
16618
16687
|
case REACT_STRICT_MODE_TYPE:
|
|
@@ -16689,13 +16758,11 @@ key, pendingProps, owner, mode, expirationTime) {
|
|
|
16689
16758
|
}
|
|
16690
16759
|
}
|
|
16691
16760
|
|
|
16692
|
-
|
|
16761
|
+
{
|
|
16693
16762
|
{
|
|
16694
|
-
|
|
16695
|
-
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));
|
|
16696
|
-
}
|
|
16763
|
+
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);
|
|
16697
16764
|
}
|
|
16698
|
-
}
|
|
16765
|
+
}
|
|
16699
16766
|
}
|
|
16700
16767
|
}
|
|
16701
16768
|
}
|
|
@@ -16879,7 +16946,6 @@ function FiberRootNode(containerInfo, tag, hydrate) {
|
|
|
16879
16946
|
this.context = null;
|
|
16880
16947
|
this.pendingContext = null;
|
|
16881
16948
|
this.hydrate = hydrate;
|
|
16882
|
-
this.firstBatch = null;
|
|
16883
16949
|
this.callbackNode = null;
|
|
16884
16950
|
this.callbackPriority = NoPriority;
|
|
16885
16951
|
this.firstPendingTime = NoWork;
|
|
@@ -17033,35 +17099,23 @@ function getContextForSubtree(parentComponent) {
|
|
|
17033
17099
|
return parentContext;
|
|
17034
17100
|
}
|
|
17035
17101
|
|
|
17036
|
-
function
|
|
17102
|
+
function createContainer(containerInfo, tag, hydrate, hydrationCallbacks) {
|
|
17103
|
+
return createFiberRoot(containerInfo, tag, hydrate, hydrationCallbacks);
|
|
17104
|
+
}
|
|
17105
|
+
function updateContainer(element, container, parentComponent, callback) {
|
|
17106
|
+
var current$$1 = container.current;
|
|
17107
|
+
var currentTime = requestCurrentTimeForUpdate();
|
|
17108
|
+
|
|
17037
17109
|
{
|
|
17038
|
-
|
|
17039
|
-
|
|
17040
|
-
|
|
17110
|
+
// $FlowExpectedError - jest isn't a global, and isn't recognized outside of tests
|
|
17111
|
+
if ('undefined' !== typeof jest) {
|
|
17112
|
+
warnIfUnmockedScheduler(current$$1);
|
|
17113
|
+
warnIfNotScopedWithMatchingAct(current$$1);
|
|
17041
17114
|
}
|
|
17042
17115
|
}
|
|
17043
17116
|
|
|
17044
|
-
var
|
|
17045
|
-
|
|
17046
|
-
|
|
17047
|
-
update.payload = {
|
|
17048
|
-
element: element
|
|
17049
|
-
};
|
|
17050
|
-
callback = callback === undefined ? null : callback;
|
|
17051
|
-
|
|
17052
|
-
if (callback !== null) {
|
|
17053
|
-
!(typeof callback === 'function') ? warningWithoutStack$1(false, 'render(...): Expected the last optional `callback` argument to be a ' + 'function. Instead received: %s.', callback) : void 0;
|
|
17054
|
-
update.callback = callback;
|
|
17055
|
-
}
|
|
17056
|
-
|
|
17057
|
-
enqueueUpdate(current$$1, update);
|
|
17058
|
-
scheduleWork(current$$1, expirationTime);
|
|
17059
|
-
return expirationTime;
|
|
17060
|
-
}
|
|
17061
|
-
|
|
17062
|
-
function updateContainerAtExpirationTime(element, container, parentComponent, expirationTime, suspenseConfig, callback) {
|
|
17063
|
-
// TODO: If this is a nested container, this won't be the root.
|
|
17064
|
-
var current$$1 = container.current;
|
|
17117
|
+
var suspenseConfig = requestCurrentSuspenseConfig();
|
|
17118
|
+
var expirationTime = computeExpirationForFiber(currentTime, current$$1, suspenseConfig);
|
|
17065
17119
|
|
|
17066
17120
|
{
|
|
17067
17121
|
if (ReactFiberInstrumentation_1.debugTool) {
|
|
@@ -17083,27 +17137,29 @@ function updateContainerAtExpirationTime(element, container, parentComponent, ex
|
|
|
17083
17137
|
container.pendingContext = context;
|
|
17084
17138
|
}
|
|
17085
17139
|
|
|
17086
|
-
return scheduleRootUpdate(current$$1, element, expirationTime, suspenseConfig, callback);
|
|
17087
|
-
}
|
|
17088
|
-
|
|
17089
|
-
function createContainer(containerInfo, tag, hydrate, hydrationCallbacks) {
|
|
17090
|
-
return createFiberRoot(containerInfo, tag, hydrate, hydrationCallbacks);
|
|
17091
|
-
}
|
|
17092
|
-
function updateContainer(element, container, parentComponent, callback) {
|
|
17093
|
-
var current$$1 = container.current;
|
|
17094
|
-
var currentTime = requestCurrentTime();
|
|
17095
|
-
|
|
17096
17140
|
{
|
|
17097
|
-
|
|
17098
|
-
|
|
17099
|
-
|
|
17100
|
-
warnIfNotScopedWithMatchingAct(current$$1);
|
|
17141
|
+
if (phase === 'render' && current !== null && !didWarnAboutNestedUpdates) {
|
|
17142
|
+
didWarnAboutNestedUpdates = true;
|
|
17143
|
+
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');
|
|
17101
17144
|
}
|
|
17102
17145
|
}
|
|
17103
17146
|
|
|
17104
|
-
var
|
|
17105
|
-
|
|
17106
|
-
|
|
17147
|
+
var update = createUpdate(expirationTime, suspenseConfig); // Caution: React DevTools currently depends on this property
|
|
17148
|
+
// being called "element".
|
|
17149
|
+
|
|
17150
|
+
update.payload = {
|
|
17151
|
+
element: element
|
|
17152
|
+
};
|
|
17153
|
+
callback = callback === undefined ? null : callback;
|
|
17154
|
+
|
|
17155
|
+
if (callback !== null) {
|
|
17156
|
+
!(typeof callback === 'function') ? warningWithoutStack$1(false, 'render(...): Expected the last optional `callback` argument to be a ' + 'function. Instead received: %s.', callback) : void 0;
|
|
17157
|
+
update.callback = callback;
|
|
17158
|
+
}
|
|
17159
|
+
|
|
17160
|
+
enqueueUpdate(current$$1, update);
|
|
17161
|
+
scheduleWork(current$$1, expirationTime);
|
|
17162
|
+
return expirationTime;
|
|
17107
17163
|
}
|
|
17108
17164
|
function getPublicRootInstance(container) {
|
|
17109
17165
|
var containerFiber = container.current;
|
|
@@ -17123,6 +17179,10 @@ function getPublicRootInstance(container) {
|
|
|
17123
17179
|
|
|
17124
17180
|
|
|
17125
17181
|
|
|
17182
|
+
|
|
17183
|
+
|
|
17184
|
+
|
|
17185
|
+
|
|
17126
17186
|
var shouldSuspendImpl = function (fiber) {
|
|
17127
17187
|
return false;
|
|
17128
17188
|
};
|
|
@@ -17240,7 +17300,7 @@ function injectIntoDevTools(devToolsConfig) {
|
|
|
17240
17300
|
|
|
17241
17301
|
// TODO: this is special because it gets imported during build.
|
|
17242
17302
|
|
|
17243
|
-
var ReactVersion = '16.
|
|
17303
|
+
var ReactVersion = '16.12.0';
|
|
17244
17304
|
|
|
17245
17305
|
var didWarnAboutMessageChannel = false;
|
|
17246
17306
|
var enqueueTask;
|
|
@@ -17594,13 +17654,11 @@ function toTree(node) {
|
|
|
17594
17654
|
return childrenToTree(node.child);
|
|
17595
17655
|
|
|
17596
17656
|
default:
|
|
17597
|
-
|
|
17657
|
+
{
|
|
17598
17658
|
{
|
|
17599
|
-
|
|
17600
|
-
throw ReactError(Error("toTree() does not yet know how to handle nodes with tag=" + node.tag));
|
|
17601
|
-
}
|
|
17659
|
+
throw Error("toTree() does not yet know how to handle nodes with tag=" + node.tag);
|
|
17602
17660
|
}
|
|
17603
|
-
}
|
|
17661
|
+
}
|
|
17604
17662
|
|
|
17605
17663
|
}
|
|
17606
17664
|
}
|
|
@@ -17661,25 +17719,21 @@ function () {
|
|
|
17661
17719
|
// Throws if this component has been unmounted.
|
|
17662
17720
|
var fiber = findCurrentFiberUsingSlowPath(this._fiber);
|
|
17663
17721
|
|
|
17664
|
-
(
|
|
17665
|
-
|
|
17666
|
-
|
|
17667
|
-
throw ReactError(Error("Can't read from currently-mounting component. This error is likely caused by a bug in React. Please file an issue."));
|
|
17668
|
-
}
|
|
17722
|
+
if (!(fiber !== null)) {
|
|
17723
|
+
{
|
|
17724
|
+
throw Error("Can't read from currently-mounting component. This error is likely caused by a bug in React. Please file an issue.");
|
|
17669
17725
|
}
|
|
17670
|
-
}
|
|
17726
|
+
}
|
|
17671
17727
|
|
|
17672
17728
|
return fiber;
|
|
17673
17729
|
};
|
|
17674
17730
|
|
|
17675
17731
|
function ReactTestInstance(fiber) {
|
|
17676
|
-
|
|
17677
|
-
|
|
17678
|
-
|
|
17679
|
-
throw ReactError(Error("Unexpected object passed to ReactTestInstance constructor (tag: " + fiber.tag + "). This is probably a bug in React."));
|
|
17680
|
-
}
|
|
17732
|
+
if (!validWrapperTypes.has(fiber.tag)) {
|
|
17733
|
+
{
|
|
17734
|
+
throw Error("Unexpected object passed to ReactTestInstance constructor (tag: " + fiber.tag + "). This is probably a bug in React.");
|
|
17681
17735
|
}
|
|
17682
|
-
}
|
|
17736
|
+
}
|
|
17683
17737
|
|
|
17684
17738
|
this._fiber = fiber;
|
|
17685
17739
|
}
|
|
@@ -17838,13 +17892,11 @@ var ReactTestRendererFiber = {
|
|
|
17838
17892
|
};
|
|
17839
17893
|
var root = createContainer(container, isConcurrent ? ConcurrentRoot : LegacyRoot, false, null);
|
|
17840
17894
|
|
|
17841
|
-
(
|
|
17842
|
-
|
|
17843
|
-
|
|
17844
|
-
throw ReactError(Error("something went wrong"));
|
|
17845
|
-
}
|
|
17895
|
+
if (!(root != null)) {
|
|
17896
|
+
{
|
|
17897
|
+
throw Error("something went wrong");
|
|
17846
17898
|
}
|
|
17847
|
-
}
|
|
17899
|
+
}
|
|
17848
17900
|
|
|
17849
17901
|
updateContainer(element, root, null, null);
|
|
17850
17902
|
var entry = {
|