react 19.0.0-canary-e3ebcd54b-20240405 → 19.0.0-canary-adb717393-20240411
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/cjs/react-jsx-dev-runtime.development.js +53 -34
- package/cjs/react-jsx-runtime.development.js +53 -34
- package/cjs/react-jsx-runtime.production.js +27 -16
- package/cjs/react-jsx-runtime.production.min.js +1 -1
- package/cjs/react-jsx-runtime.production.min.js.map +1 -1
- package/cjs/react-jsx-runtime.profiling.js +27 -16
- package/cjs/react-jsx-runtime.profiling.min.js +1 -1
- package/cjs/react-jsx-runtime.profiling.min.js.map +1 -1
- package/cjs/react-jsx-runtime.react-server.development.js +58 -34
- package/cjs/react-jsx-runtime.react-server.production.js +31 -15
- package/cjs/react-jsx-runtime.react-server.production.min.js +2 -1
- package/cjs/react-jsx-runtime.react-server.production.min.js.map +1 -1
- package/cjs/react.development.js +118 -150
- package/cjs/react.production.js +13 -53
- package/cjs/react.production.min.js +17 -18
- package/cjs/react.production.min.js.map +1 -1
- package/cjs/react.react-server.development.js +83 -110
- package/cjs/react.react-server.production.js +14 -58
- package/cjs/react.react-server.production.min.js +17 -18
- package/cjs/react.react-server.production.min.js.map +1 -1
- package/package.json +1 -1
- package/umd/react.development.js +158 -159
- package/umd/react.production.min.js +23 -24
- package/umd/react.profiling.min.js +23 -24
package/cjs/react.development.js
CHANGED
@@ -23,7 +23,7 @@ if (
|
|
23
23
|
) {
|
24
24
|
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
|
25
25
|
}
|
26
|
-
var ReactVersion = '19.0.0-canary-
|
26
|
+
var ReactVersion = '19.0.0-canary-adb717393-20240411';
|
27
27
|
|
28
28
|
// ATTENTION
|
29
29
|
// When adding new symbols to this file,
|
@@ -60,69 +60,54 @@ function getIteratorFn(maybeIterable) {
|
|
60
60
|
return null;
|
61
61
|
}
|
62
62
|
|
63
|
-
|
64
|
-
* Keeps track of the current dispatcher.
|
65
|
-
*/
|
66
|
-
var ReactCurrentDispatcher$1 = {
|
67
|
-
current: null
|
68
|
-
};
|
63
|
+
// -----------------------------------------------------------------------------
|
69
64
|
|
70
|
-
|
71
|
-
|
72
|
-
*/
|
73
|
-
var ReactCurrentCache = {
|
74
|
-
current: null
|
75
|
-
};
|
65
|
+
var enableScopeAPI = false; // Experimental Create Event Handle API.
|
66
|
+
var enableTransitionTracing = false; // No known bugs, but needs performance testing
|
76
67
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
var ReactCurrentBatchConfig = {
|
82
|
-
transition: null
|
83
|
-
};
|
68
|
+
var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber
|
69
|
+
// as a normal prop instead of stripping it from the props object.
|
70
|
+
// Passes `ref` as a normal prop instead of stripping it from the props object
|
71
|
+
// during element creation.
|
84
72
|
|
85
|
-
var
|
86
|
-
|
87
|
-
|
88
|
-
isBatchingLegacy: false,
|
89
|
-
didScheduleLegacyUpdate: false,
|
90
|
-
// Tracks whether something called `use` during the current batch of work.
|
91
|
-
// Determines whether we should yield to microtasks to unwrap already resolved
|
92
|
-
// promises without suspending.
|
93
|
-
didUsePromise: false,
|
94
|
-
// Track first uncaught error within this act
|
95
|
-
thrownErrors: []
|
96
|
-
};
|
73
|
+
var enableRefAsProp = true;
|
74
|
+
// This allows us to land breaking changes to remove legacy mode APIs in experimental builds
|
75
|
+
// before removing them in stable in the next Major
|
97
76
|
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
var
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
77
|
+
var disableLegacyMode = true;
|
78
|
+
|
79
|
+
var enableRenderableContext = true; // -----------------------------------------------------------------------------
|
80
|
+
// stuff. Intended to enable React core members to more easily debug scheduling
|
81
|
+
// issues in DEV builds.
|
82
|
+
|
83
|
+
var enableDebugTracing = false;
|
84
|
+
|
85
|
+
var ReactSharedInternals = {
|
86
|
+
H: null,
|
87
|
+
C: null,
|
88
|
+
T: null
|
110
89
|
};
|
111
90
|
|
112
|
-
|
113
|
-
|
91
|
+
{
|
92
|
+
ReactSharedInternals.owner = null;
|
93
|
+
}
|
114
94
|
|
115
95
|
{
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
96
|
+
ReactSharedInternals.actQueue = null;
|
97
|
+
ReactSharedInternals.isBatchingLegacy = false;
|
98
|
+
ReactSharedInternals.didScheduleLegacyUpdate = false;
|
99
|
+
ReactSharedInternals.didUsePromise = false;
|
100
|
+
ReactSharedInternals.thrownErrors = [];
|
101
|
+
var currentExtraStackFrame = null;
|
102
|
+
|
103
|
+
ReactSharedInternals.setExtraStackFrame = function (stack) {
|
104
|
+
currentExtraStackFrame = stack;
|
120
105
|
}; // Stack implementation injected by the current renderer.
|
121
106
|
|
122
107
|
|
123
|
-
|
108
|
+
ReactSharedInternals.getCurrentStack = null;
|
124
109
|
|
125
|
-
|
110
|
+
ReactSharedInternals.getStackAddendum = function () {
|
126
111
|
var stack = ''; // Add an extra top frame while an element is being validated
|
127
112
|
|
128
113
|
if (currentExtraStackFrame) {
|
@@ -130,7 +115,7 @@ var currentExtraStackFrame = null;
|
|
130
115
|
} // Delegate to the injected renderer-specific implementation
|
131
116
|
|
132
117
|
|
133
|
-
var impl =
|
118
|
+
var impl = ReactSharedInternals.getCurrentStack;
|
134
119
|
|
135
120
|
if (impl) {
|
136
121
|
stack += impl() || '';
|
@@ -140,18 +125,6 @@ var currentExtraStackFrame = null;
|
|
140
125
|
};
|
141
126
|
}
|
142
127
|
|
143
|
-
var ReactSharedInternals = {
|
144
|
-
ReactCurrentDispatcher: ReactCurrentDispatcher$1,
|
145
|
-
ReactCurrentCache: ReactCurrentCache,
|
146
|
-
ReactCurrentBatchConfig: ReactCurrentBatchConfig,
|
147
|
-
ReactCurrentOwner: ReactCurrentOwner$1
|
148
|
-
};
|
149
|
-
|
150
|
-
{
|
151
|
-
ReactSharedInternals.ReactDebugCurrentFrame = ReactDebugCurrentFrame$1;
|
152
|
-
ReactSharedInternals.ReactCurrentActQueue = ReactCurrentActQueue;
|
153
|
-
}
|
154
|
-
|
155
128
|
// by calls to these methods by a Babel plugin.
|
156
129
|
//
|
157
130
|
// In PROD (or in packages without access to React internals),
|
@@ -184,8 +157,7 @@ function printWarning(level, format, args) {
|
|
184
157
|
// When changing this logic, you might want to also
|
185
158
|
// update consoleWithStackDev.www.js as well.
|
186
159
|
{
|
187
|
-
var
|
188
|
-
var stack = ReactDebugCurrentFrame.getStackAddendum();
|
160
|
+
var stack = ReactSharedInternals.getStackAddendum();
|
189
161
|
|
190
162
|
if (stack !== '') {
|
191
163
|
format += '%s';
|
@@ -505,28 +477,6 @@ function checkKeyStringCoercion(value) {
|
|
505
477
|
}
|
506
478
|
}
|
507
479
|
|
508
|
-
// -----------------------------------------------------------------------------
|
509
|
-
|
510
|
-
var enableScopeAPI = false; // Experimental Create Event Handle API.
|
511
|
-
var enableTransitionTracing = false; // No known bugs, but needs performance testing
|
512
|
-
|
513
|
-
var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber
|
514
|
-
// as a normal prop instead of stripping it from the props object.
|
515
|
-
// Passes `ref` as a normal prop instead of stripping it from the props object
|
516
|
-
// during element creation.
|
517
|
-
|
518
|
-
var enableRefAsProp = true;
|
519
|
-
// This allows us to land breaking changes to remove legacy mode APIs in experimental builds
|
520
|
-
// before removing them in stable in the next Major
|
521
|
-
|
522
|
-
var disableLegacyMode = true;
|
523
|
-
|
524
|
-
var enableRenderableContext = true; // -----------------------------------------------------------------------------
|
525
|
-
// stuff. Intended to enable React core members to more easily debug scheduling
|
526
|
-
// issues in DEV builds.
|
527
|
-
|
528
|
-
var enableDebugTracing = false;
|
529
|
-
|
530
480
|
function getWrappedName(outerType, innerType, wrapperName) {
|
531
481
|
var displayName = outerType.displayName;
|
532
482
|
|
@@ -762,9 +712,8 @@ function reenableLogs() {
|
|
762
712
|
}
|
763
713
|
}
|
764
714
|
|
765
|
-
var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
|
766
715
|
var prefix;
|
767
|
-
function describeBuiltInComponentFrame(name
|
716
|
+
function describeBuiltInComponentFrame(name) {
|
768
717
|
{
|
769
718
|
if (prefix === undefined) {
|
770
719
|
// Extract the VM specific prefix used by each line.
|
@@ -818,13 +767,13 @@ function describeNativeComponentFrame(fn, construct) {
|
|
818
767
|
var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe[incompatible-type] It does accept undefined.
|
819
768
|
|
820
769
|
Error.prepareStackTrace = undefined;
|
821
|
-
var previousDispatcher;
|
770
|
+
var previousDispatcher = null;
|
822
771
|
|
823
772
|
{
|
824
|
-
previousDispatcher =
|
773
|
+
previousDispatcher = ReactSharedInternals.H; // Set the dispatcher in DEV because this might be call in the render function
|
825
774
|
// for warnings.
|
826
775
|
|
827
|
-
|
776
|
+
ReactSharedInternals.H = null;
|
828
777
|
disableLogs();
|
829
778
|
}
|
830
779
|
/**
|
@@ -1009,7 +958,7 @@ function describeNativeComponentFrame(fn, construct) {
|
|
1009
958
|
reentry = false;
|
1010
959
|
|
1011
960
|
{
|
1012
|
-
|
961
|
+
ReactSharedInternals.H = previousDispatcher;
|
1013
962
|
reenableLogs();
|
1014
963
|
}
|
1015
964
|
|
@@ -1028,7 +977,7 @@ function describeNativeComponentFrame(fn, construct) {
|
|
1028
977
|
|
1029
978
|
return syntheticFrame;
|
1030
979
|
}
|
1031
|
-
function describeFunctionComponentFrame(fn
|
980
|
+
function describeFunctionComponentFrame(fn) {
|
1032
981
|
{
|
1033
982
|
return describeNativeComponentFrame(fn, false);
|
1034
983
|
}
|
@@ -1039,7 +988,7 @@ function shouldConstruct(Component) {
|
|
1039
988
|
return !!(prototype && prototype.isReactComponent);
|
1040
989
|
}
|
1041
990
|
|
1042
|
-
function describeUnknownElementTypeFrameInDEV(type
|
991
|
+
function describeUnknownElementTypeFrameInDEV(type) {
|
1043
992
|
|
1044
993
|
if (type == null) {
|
1045
994
|
return '';
|
@@ -1070,7 +1019,7 @@ function describeUnknownElementTypeFrameInDEV(type, ownerFn) {
|
|
1070
1019
|
|
1071
1020
|
case REACT_MEMO_TYPE:
|
1072
1021
|
// Memo may contain any component type so we recursively resolve it.
|
1073
|
-
return describeUnknownElementTypeFrameInDEV(type.type
|
1022
|
+
return describeUnknownElementTypeFrameInDEV(type.type);
|
1074
1023
|
|
1075
1024
|
case REACT_LAZY_TYPE:
|
1076
1025
|
{
|
@@ -1080,7 +1029,7 @@ function describeUnknownElementTypeFrameInDEV(type, ownerFn) {
|
|
1080
1029
|
|
1081
1030
|
try {
|
1082
1031
|
// Lazy may contain any component type so we recursively resolve it.
|
1083
|
-
return describeUnknownElementTypeFrameInDEV(init(payload)
|
1032
|
+
return describeUnknownElementTypeFrameInDEV(init(payload));
|
1084
1033
|
} catch (x) {}
|
1085
1034
|
}
|
1086
1035
|
}
|
@@ -1089,11 +1038,10 @@ function describeUnknownElementTypeFrameInDEV(type, ownerFn) {
|
|
1089
1038
|
return '';
|
1090
1039
|
}
|
1091
1040
|
|
1092
|
-
var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
|
1093
|
-
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
1094
1041
|
var REACT_CLIENT_REFERENCE = Symbol.for('react.client.reference');
|
1095
1042
|
var specialPropKeyWarningShown;
|
1096
1043
|
var didWarnAboutElementRef;
|
1044
|
+
var didWarnAboutOldJSXRuntime;
|
1097
1045
|
|
1098
1046
|
{
|
1099
1047
|
didWarnAboutElementRef = {};
|
@@ -1328,6 +1276,20 @@ function createElement(type, config, children) {
|
|
1328
1276
|
var ref = null;
|
1329
1277
|
|
1330
1278
|
if (config != null) {
|
1279
|
+
{
|
1280
|
+
if (!didWarnAboutOldJSXRuntime && '__self' in config && // Do not assume this is the result of an oudated JSX transform if key
|
1281
|
+
// is present, because the modern JSX transform sometimes outputs
|
1282
|
+
// createElement to preserve precedence between a static key and a
|
1283
|
+
// spread key. To avoid false positive warnings, we never warn if
|
1284
|
+
// there's a key.
|
1285
|
+
!('key' in config)) {
|
1286
|
+
didWarnAboutOldJSXRuntime = true;
|
1287
|
+
|
1288
|
+
warn('Your app (or one of its dependencies) is using an outdated JSX ' + 'transform. Update to the modern JSX transform for ' + 'faster performance: ' + // TODO: Create a short link for this
|
1289
|
+
'https://reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html');
|
1290
|
+
}
|
1291
|
+
}
|
1292
|
+
|
1331
1293
|
if (hasValidRef(config)) ;
|
1332
1294
|
|
1333
1295
|
if (hasValidKey(config)) {
|
@@ -1396,7 +1358,7 @@ function createElement(type, config, children) {
|
|
1396
1358
|
}
|
1397
1359
|
}
|
1398
1360
|
|
1399
|
-
var element = ReactElement(type, key, ref, undefined, undefined,
|
1361
|
+
var element = ReactElement(type, key, ref, undefined, undefined, ReactSharedInternals.owner, props);
|
1400
1362
|
|
1401
1363
|
if (type === REACT_FRAGMENT_TYPE) {
|
1402
1364
|
validateFragmentProps(element);
|
@@ -1430,8 +1392,7 @@ function cloneElement(element, config, children) {
|
|
1430
1392
|
|
1431
1393
|
if (config != null) {
|
1432
1394
|
if (hasValidRef(config)) {
|
1433
|
-
|
1434
|
-
owner = ReactCurrentOwner.current;
|
1395
|
+
owner = ReactSharedInternals.owner;
|
1435
1396
|
}
|
1436
1397
|
|
1437
1398
|
if (hasValidKey(config)) {
|
@@ -1490,8 +1451,8 @@ function cloneElement(element, config, children) {
|
|
1490
1451
|
|
1491
1452
|
function getDeclarationErrorAddendum() {
|
1492
1453
|
{
|
1493
|
-
if (
|
1494
|
-
var name = getComponentNameFromType(
|
1454
|
+
if (ReactSharedInternals.owner) {
|
1455
|
+
var name = getComponentNameFromType(ReactSharedInternals.owner.type);
|
1495
1456
|
|
1496
1457
|
if (name) {
|
1497
1458
|
return '\n\nCheck the render method of `' + name + '`.';
|
@@ -1595,9 +1556,17 @@ function validateExplicitKey(element, parentType) {
|
|
1595
1556
|
|
1596
1557
|
var childOwner = '';
|
1597
1558
|
|
1598
|
-
if (element && element._owner && element._owner !==
|
1599
|
-
|
1600
|
-
|
1559
|
+
if (element && element._owner != null && element._owner !== ReactSharedInternals.owner) {
|
1560
|
+
var ownerName = null;
|
1561
|
+
|
1562
|
+
if (typeof element._owner.tag === 'number') {
|
1563
|
+
ownerName = getComponentNameFromType(element._owner.type);
|
1564
|
+
} else if (typeof element._owner.name === 'string') {
|
1565
|
+
ownerName = element._owner.name;
|
1566
|
+
} // Give the component that originally created this child.
|
1567
|
+
|
1568
|
+
|
1569
|
+
childOwner = " It was passed a child from " + ownerName + ".";
|
1601
1570
|
}
|
1602
1571
|
|
1603
1572
|
setCurrentlyValidatingElement(element);
|
@@ -1611,11 +1580,10 @@ function validateExplicitKey(element, parentType) {
|
|
1611
1580
|
function setCurrentlyValidatingElement(element) {
|
1612
1581
|
{
|
1613
1582
|
if (element) {
|
1614
|
-
var
|
1615
|
-
|
1616
|
-
ReactDebugCurrentFrame.setExtraStackFrame(stack);
|
1583
|
+
var stack = describeUnknownElementTypeFrameInDEV(element.type);
|
1584
|
+
ReactSharedInternals.setExtraStackFrame(stack);
|
1617
1585
|
} else {
|
1618
|
-
|
1586
|
+
ReactSharedInternals.setExtraStackFrame(null);
|
1619
1587
|
}
|
1620
1588
|
}
|
1621
1589
|
}
|
@@ -2243,7 +2211,7 @@ function createCacheNode() {
|
|
2243
2211
|
|
2244
2212
|
function cache$1(fn) {
|
2245
2213
|
return function () {
|
2246
|
-
var dispatcher =
|
2214
|
+
var dispatcher = ReactSharedInternals.C;
|
2247
2215
|
|
2248
2216
|
if (!dispatcher) {
|
2249
2217
|
// If there is no dispatcher, then we treat this as not being cached.
|
@@ -2328,7 +2296,7 @@ function cache$1(fn) {
|
|
2328
2296
|
var cache = cache$1;
|
2329
2297
|
|
2330
2298
|
function resolveDispatcher() {
|
2331
|
-
var dispatcher =
|
2299
|
+
var dispatcher = ReactSharedInternals.H;
|
2332
2300
|
|
2333
2301
|
{
|
2334
2302
|
if (dispatcher === null) {
|
@@ -2463,18 +2431,18 @@ reportError : function (error) {
|
|
2463
2431
|
};
|
2464
2432
|
|
2465
2433
|
function startTransition(scope, options) {
|
2466
|
-
var prevTransition =
|
2434
|
+
var prevTransition = ReactSharedInternals.T; // Each renderer registers a callback to receive the return value of
|
2467
2435
|
// the scope function. This is used to implement async actions.
|
2468
2436
|
|
2469
2437
|
var callbacks = new Set();
|
2470
2438
|
var transition = {
|
2471
2439
|
_callbacks: callbacks
|
2472
2440
|
};
|
2473
|
-
|
2474
|
-
var currentTransition =
|
2441
|
+
ReactSharedInternals.T = transition;
|
2442
|
+
var currentTransition = ReactSharedInternals.T;
|
2475
2443
|
|
2476
2444
|
{
|
2477
|
-
|
2445
|
+
ReactSharedInternals.T._updatedFibers = new Set();
|
2478
2446
|
}
|
2479
2447
|
|
2480
2448
|
{
|
@@ -2491,7 +2459,7 @@ function startTransition(scope, options) {
|
|
2491
2459
|
reportGlobalError(error);
|
2492
2460
|
} finally {
|
2493
2461
|
warnAboutTransitionSubscriptions(prevTransition, currentTransition);
|
2494
|
-
|
2462
|
+
ReactSharedInternals.T = prevTransition;
|
2495
2463
|
}
|
2496
2464
|
}
|
2497
2465
|
}
|
@@ -2566,7 +2534,7 @@ function aggregateErrors(errors) {
|
|
2566
2534
|
|
2567
2535
|
function act(callback) {
|
2568
2536
|
{
|
2569
|
-
// When
|
2537
|
+
// When ReactSharedInternals.actQueue is not null, it signals to React that
|
2570
2538
|
// we're currently inside an `act` scope. React will push all its tasks to
|
2571
2539
|
// this queue instead of scheduling them with platform APIs.
|
2572
2540
|
//
|
@@ -2576,10 +2544,10 @@ function act(callback) {
|
|
2576
2544
|
//
|
2577
2545
|
// If we're already inside an `act` scope, reuse the existing queue.
|
2578
2546
|
var prevIsBatchingLegacy = false;
|
2579
|
-
var prevActQueue =
|
2547
|
+
var prevActQueue = ReactSharedInternals.actQueue;
|
2580
2548
|
var prevActScopeDepth = actScopeDepth;
|
2581
2549
|
actScopeDepth++;
|
2582
|
-
var queue =
|
2550
|
+
var queue = ReactSharedInternals.actQueue = prevActQueue !== null ? prevActQueue : []; // Used to reproduce behavior of `batchedUpdates` in legacy mode. Only
|
2583
2551
|
|
2584
2552
|
var result; // This tracks whether the `act` call is awaited. In certain cases, not
|
2585
2553
|
// awaiting it is a mistake, so we will detect that and warn.
|
@@ -2593,7 +2561,7 @@ function act(callback) {
|
|
2593
2561
|
if (!disableLegacyMode) ;
|
2594
2562
|
|
2595
2563
|
result = callback();
|
2596
|
-
var didScheduleLegacyUpdate = !disableLegacyMode ?
|
2564
|
+
var didScheduleLegacyUpdate = !disableLegacyMode ? ReactSharedInternals.didScheduleLegacyUpdate : false; // Replicate behavior of original `act` implementation in legacy mode,
|
2597
2565
|
// which flushed updates immediately after the scope function exits, even
|
2598
2566
|
// if it's an async function.
|
2599
2567
|
|
@@ -2611,14 +2579,14 @@ function act(callback) {
|
|
2611
2579
|
// one used to track `act` scopes. Why, you may be wondering? Because
|
2612
2580
|
// that's how it worked before version 18. Yes, it's confusing! We should
|
2613
2581
|
// delete legacy mode!!
|
2614
|
-
|
2582
|
+
ReactSharedInternals.thrownErrors.push(error);
|
2615
2583
|
}
|
2616
2584
|
|
2617
|
-
if (
|
2585
|
+
if (ReactSharedInternals.thrownErrors.length > 0) {
|
2618
2586
|
|
2619
2587
|
popActScope(prevActQueue, prevActScopeDepth);
|
2620
|
-
var thrownError = aggregateErrors(
|
2621
|
-
|
2588
|
+
var thrownError = aggregateErrors(ReactSharedInternals.thrownErrors);
|
2589
|
+
ReactSharedInternals.thrownErrors.length = 0;
|
2622
2590
|
throw thrownError;
|
2623
2591
|
}
|
2624
2592
|
|
@@ -2659,13 +2627,13 @@ function act(callback) {
|
|
2659
2627
|
// `thenable` might not be a real promise, and `flushActQueue`
|
2660
2628
|
// might throw, so we need to wrap `flushActQueue` in a
|
2661
2629
|
// try/catch.
|
2662
|
-
|
2630
|
+
ReactSharedInternals.thrownErrors.push(error);
|
2663
2631
|
}
|
2664
2632
|
|
2665
|
-
if (
|
2666
|
-
var _thrownError = aggregateErrors(
|
2633
|
+
if (ReactSharedInternals.thrownErrors.length > 0) {
|
2634
|
+
var _thrownError = aggregateErrors(ReactSharedInternals.thrownErrors);
|
2667
2635
|
|
2668
|
-
|
2636
|
+
ReactSharedInternals.thrownErrors.length = 0;
|
2669
2637
|
reject(_thrownError);
|
2670
2638
|
}
|
2671
2639
|
} else {
|
@@ -2674,10 +2642,10 @@ function act(callback) {
|
|
2674
2642
|
}, function (error) {
|
2675
2643
|
popActScope(prevActQueue, prevActScopeDepth);
|
2676
2644
|
|
2677
|
-
if (
|
2678
|
-
var _thrownError2 = aggregateErrors(
|
2645
|
+
if (ReactSharedInternals.thrownErrors.length > 0) {
|
2646
|
+
var _thrownError2 = aggregateErrors(ReactSharedInternals.thrownErrors);
|
2679
2647
|
|
2680
|
-
|
2648
|
+
ReactSharedInternals.thrownErrors.length = 0;
|
2681
2649
|
reject(_thrownError2);
|
2682
2650
|
} else {
|
2683
2651
|
reject(error);
|
@@ -2725,13 +2693,13 @@ function act(callback) {
|
|
2725
2693
|
// to be awaited, regardless of whether the callback is sync or async.
|
2726
2694
|
|
2727
2695
|
|
2728
|
-
|
2696
|
+
ReactSharedInternals.actQueue = null;
|
2729
2697
|
}
|
2730
2698
|
|
2731
|
-
if (
|
2732
|
-
var _thrownError3 = aggregateErrors(
|
2699
|
+
if (ReactSharedInternals.thrownErrors.length > 0) {
|
2700
|
+
var _thrownError3 = aggregateErrors(ReactSharedInternals.thrownErrors);
|
2733
2701
|
|
2734
|
-
|
2702
|
+
ReactSharedInternals.thrownErrors.length = 0;
|
2735
2703
|
throw _thrownError3;
|
2736
2704
|
}
|
2737
2705
|
|
@@ -2742,7 +2710,7 @@ function act(callback) {
|
|
2742
2710
|
if (prevActScopeDepth === 0) {
|
2743
2711
|
// If the `act` call is awaited, restore the queue we were
|
2744
2712
|
// using before (see long comment above) so we can flush it.
|
2745
|
-
|
2713
|
+
ReactSharedInternals.actQueue = queue;
|
2746
2714
|
enqueueTask(function () {
|
2747
2715
|
return (// Recursively flush tasks scheduled by a microtask.
|
2748
2716
|
recursivelyFlushAsyncActWork(returnValue, resolve, reject)
|
@@ -2770,7 +2738,7 @@ function popActScope(prevActQueue, prevActScopeDepth) {
|
|
2770
2738
|
function recursivelyFlushAsyncActWork(returnValue, resolve, reject) {
|
2771
2739
|
{
|
2772
2740
|
// Check if any tasks were scheduled asynchronously.
|
2773
|
-
var queue =
|
2741
|
+
var queue = ReactSharedInternals.actQueue;
|
2774
2742
|
|
2775
2743
|
if (queue !== null) {
|
2776
2744
|
if (queue.length !== 0) {
|
@@ -2786,17 +2754,17 @@ function recursivelyFlushAsyncActWork(returnValue, resolve, reject) {
|
|
2786
2754
|
return;
|
2787
2755
|
} catch (error) {
|
2788
2756
|
// Leave remaining tasks on the queue if something throws.
|
2789
|
-
|
2757
|
+
ReactSharedInternals.thrownErrors.push(error);
|
2790
2758
|
}
|
2791
2759
|
} else {
|
2792
2760
|
// The queue is empty. We can finish.
|
2793
|
-
|
2761
|
+
ReactSharedInternals.actQueue = null;
|
2794
2762
|
}
|
2795
2763
|
}
|
2796
2764
|
|
2797
|
-
if (
|
2798
|
-
var thrownError = aggregateErrors(
|
2799
|
-
|
2765
|
+
if (ReactSharedInternals.thrownErrors.length > 0) {
|
2766
|
+
var thrownError = aggregateErrors(ReactSharedInternals.thrownErrors);
|
2767
|
+
ReactSharedInternals.thrownErrors.length = 0;
|
2800
2768
|
reject(thrownError);
|
2801
2769
|
} else {
|
2802
2770
|
resolve(returnValue);
|
@@ -2818,11 +2786,11 @@ function flushActQueue(queue) {
|
|
2818
2786
|
var callback = queue[i];
|
2819
2787
|
|
2820
2788
|
do {
|
2821
|
-
|
2789
|
+
ReactSharedInternals.didUsePromise = false;
|
2822
2790
|
var continuation = callback(false);
|
2823
2791
|
|
2824
2792
|
if (continuation !== null) {
|
2825
|
-
if (
|
2793
|
+
if (ReactSharedInternals.didUsePromise) {
|
2826
2794
|
// The component just suspended. Yield to the main thread in
|
2827
2795
|
// case the promise is already resolved. If so, it will ping in
|
2828
2796
|
// a microtask and we can resume without unwinding the stack.
|
@@ -2843,7 +2811,7 @@ function flushActQueue(queue) {
|
|
2843
2811
|
} catch (error) {
|
2844
2812
|
// If something throws, leave the remaining callbacks on the queue.
|
2845
2813
|
queue.splice(0, i + 1);
|
2846
|
-
|
2814
|
+
ReactSharedInternals.thrownErrors.push(error);
|
2847
2815
|
} finally {
|
2848
2816
|
isFlushing = false;
|
2849
2817
|
}
|
@@ -2882,7 +2850,7 @@ exports.Profiler = REACT_PROFILER_TYPE;
|
|
2882
2850
|
exports.PureComponent = PureComponent;
|
2883
2851
|
exports.StrictMode = REACT_STRICT_MODE_TYPE;
|
2884
2852
|
exports.Suspense = REACT_SUSPENSE_TYPE;
|
2885
|
-
exports.
|
2853
|
+
exports.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE = ReactSharedInternals;
|
2886
2854
|
exports.act = act;
|
2887
2855
|
exports.cache = cache;
|
2888
2856
|
exports.cloneElement = cloneElement;
|