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/umd/react.development.js
CHANGED
@@ -14,7 +14,7 @@
|
|
14
14
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.React = {}));
|
15
15
|
})(this, (function (exports) { 'use strict';
|
16
16
|
|
17
|
-
var ReactVersion = '19.0.0-canary-
|
17
|
+
var ReactVersion = '19.0.0-canary-adb717393-20240411';
|
18
18
|
|
19
19
|
// ATTENTION
|
20
20
|
// When adding new symbols to this file,
|
@@ -51,77 +51,62 @@
|
|
51
51
|
return null;
|
52
52
|
}
|
53
53
|
|
54
|
-
|
55
|
-
* Keeps track of the current dispatcher.
|
56
|
-
*/
|
57
|
-
var ReactCurrentDispatcher$1 = {
|
58
|
-
current: null
|
59
|
-
};
|
54
|
+
// -----------------------------------------------------------------------------
|
60
55
|
|
61
|
-
|
62
|
-
|
63
|
-
*/
|
64
|
-
var ReactCurrentCache = {
|
65
|
-
current: null
|
66
|
-
};
|
56
|
+
var enableScopeAPI = false; // Experimental Create Event Handle API.
|
57
|
+
var enableTransitionTracing = false; // No known bugs, but needs performance testing
|
67
58
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
var ReactCurrentBatchConfig = {
|
73
|
-
transition: null
|
74
|
-
};
|
59
|
+
var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber
|
60
|
+
// as a normal prop instead of stripping it from the props object.
|
61
|
+
// Passes `ref` as a normal prop instead of stripping it from the props object
|
62
|
+
// during element creation.
|
75
63
|
|
76
|
-
var
|
77
|
-
|
78
|
-
|
79
|
-
isBatchingLegacy: false,
|
80
|
-
didScheduleLegacyUpdate: false,
|
81
|
-
// Tracks whether something called `use` during the current batch of work.
|
82
|
-
// Determines whether we should yield to microtasks to unwrap already resolved
|
83
|
-
// promises without suspending.
|
84
|
-
didUsePromise: false,
|
85
|
-
// Track first uncaught error within this act
|
86
|
-
thrownErrors: []
|
87
|
-
};
|
64
|
+
var enableRefAsProp = true;
|
65
|
+
// This allows us to land breaking changes to remove legacy mode APIs in experimental builds
|
66
|
+
// before removing them in stable in the next Major
|
88
67
|
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
var
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
68
|
+
var disableLegacyMode = true;
|
69
|
+
|
70
|
+
var enableRenderableContext = true; // -----------------------------------------------------------------------------
|
71
|
+
// stuff. Intended to enable React core members to more easily debug scheduling
|
72
|
+
// issues in DEV builds.
|
73
|
+
|
74
|
+
var enableDebugTracing = false;
|
75
|
+
|
76
|
+
var ReactSharedInternals$1 = {
|
77
|
+
H: null,
|
78
|
+
C: null,
|
79
|
+
T: null
|
101
80
|
};
|
102
81
|
|
103
|
-
|
104
|
-
|
82
|
+
{
|
83
|
+
ReactSharedInternals$1.owner = null;
|
84
|
+
}
|
105
85
|
|
106
86
|
{
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
87
|
+
ReactSharedInternals$1.actQueue = null;
|
88
|
+
ReactSharedInternals$1.isBatchingLegacy = false;
|
89
|
+
ReactSharedInternals$1.didScheduleLegacyUpdate = false;
|
90
|
+
ReactSharedInternals$1.didUsePromise = false;
|
91
|
+
ReactSharedInternals$1.thrownErrors = [];
|
92
|
+
var currentExtraStackFrame$1 = null;
|
93
|
+
|
94
|
+
ReactSharedInternals$1.setExtraStackFrame = function (stack) {
|
95
|
+
currentExtraStackFrame$1 = stack;
|
111
96
|
}; // Stack implementation injected by the current renderer.
|
112
97
|
|
113
98
|
|
114
|
-
|
99
|
+
ReactSharedInternals$1.getCurrentStack = null;
|
115
100
|
|
116
|
-
|
101
|
+
ReactSharedInternals$1.getStackAddendum = function () {
|
117
102
|
var stack = ''; // Add an extra top frame while an element is being validated
|
118
103
|
|
119
|
-
if (currentExtraStackFrame) {
|
120
|
-
stack += currentExtraStackFrame;
|
104
|
+
if (currentExtraStackFrame$1) {
|
105
|
+
stack += currentExtraStackFrame$1;
|
121
106
|
} // Delegate to the injected renderer-specific implementation
|
122
107
|
|
123
108
|
|
124
|
-
var impl =
|
109
|
+
var impl = ReactSharedInternals$1.getCurrentStack;
|
125
110
|
|
126
111
|
if (impl) {
|
127
112
|
stack += impl() || '';
|
@@ -131,18 +116,6 @@
|
|
131
116
|
};
|
132
117
|
}
|
133
118
|
|
134
|
-
var ReactSharedInternals = {
|
135
|
-
ReactCurrentDispatcher: ReactCurrentDispatcher$1,
|
136
|
-
ReactCurrentCache: ReactCurrentCache,
|
137
|
-
ReactCurrentBatchConfig: ReactCurrentBatchConfig,
|
138
|
-
ReactCurrentOwner: ReactCurrentOwner$1
|
139
|
-
};
|
140
|
-
|
141
|
-
{
|
142
|
-
ReactSharedInternals.ReactDebugCurrentFrame = ReactDebugCurrentFrame$1;
|
143
|
-
ReactSharedInternals.ReactCurrentActQueue = ReactCurrentActQueue;
|
144
|
-
}
|
145
|
-
|
146
119
|
// by calls to these methods by a Babel plugin.
|
147
120
|
//
|
148
121
|
// In PROD (or in packages without access to React internals),
|
@@ -175,8 +148,7 @@
|
|
175
148
|
// When changing this logic, you might want to also
|
176
149
|
// update consoleWithStackDev.www.js as well.
|
177
150
|
{
|
178
|
-
var
|
179
|
-
var stack = ReactDebugCurrentFrame.getStackAddendum();
|
151
|
+
var stack = ReactSharedInternals$1.getStackAddendum();
|
180
152
|
|
181
153
|
if (stack !== '') {
|
182
154
|
format += '%s';
|
@@ -496,28 +468,6 @@
|
|
496
468
|
}
|
497
469
|
}
|
498
470
|
|
499
|
-
// -----------------------------------------------------------------------------
|
500
|
-
|
501
|
-
var enableScopeAPI = false; // Experimental Create Event Handle API.
|
502
|
-
var enableTransitionTracing = false; // No known bugs, but needs performance testing
|
503
|
-
|
504
|
-
var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber
|
505
|
-
// as a normal prop instead of stripping it from the props object.
|
506
|
-
// Passes `ref` as a normal prop instead of stripping it from the props object
|
507
|
-
// during element creation.
|
508
|
-
|
509
|
-
var enableRefAsProp = true;
|
510
|
-
// This allows us to land breaking changes to remove legacy mode APIs in experimental builds
|
511
|
-
// before removing them in stable in the next Major
|
512
|
-
|
513
|
-
var disableLegacyMode = true;
|
514
|
-
|
515
|
-
var enableRenderableContext = true; // -----------------------------------------------------------------------------
|
516
|
-
// stuff. Intended to enable React core members to more easily debug scheduling
|
517
|
-
// issues in DEV builds.
|
518
|
-
|
519
|
-
var enableDebugTracing = false;
|
520
|
-
|
521
471
|
function getWrappedName(outerType, innerType, wrapperName) {
|
522
472
|
var displayName = outerType.displayName;
|
523
473
|
|
@@ -753,9 +703,8 @@
|
|
753
703
|
}
|
754
704
|
}
|
755
705
|
|
756
|
-
var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
|
757
706
|
var prefix;
|
758
|
-
function describeBuiltInComponentFrame(name
|
707
|
+
function describeBuiltInComponentFrame(name) {
|
759
708
|
{
|
760
709
|
if (prefix === undefined) {
|
761
710
|
// Extract the VM specific prefix used by each line.
|
@@ -809,13 +758,13 @@
|
|
809
758
|
var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe[incompatible-type] It does accept undefined.
|
810
759
|
|
811
760
|
Error.prepareStackTrace = undefined;
|
812
|
-
var previousDispatcher;
|
761
|
+
var previousDispatcher = null;
|
813
762
|
|
814
763
|
{
|
815
|
-
previousDispatcher =
|
764
|
+
previousDispatcher = ReactSharedInternals$1.H; // Set the dispatcher in DEV because this might be call in the render function
|
816
765
|
// for warnings.
|
817
766
|
|
818
|
-
|
767
|
+
ReactSharedInternals$1.H = null;
|
819
768
|
disableLogs();
|
820
769
|
}
|
821
770
|
/**
|
@@ -1000,7 +949,7 @@
|
|
1000
949
|
reentry = false;
|
1001
950
|
|
1002
951
|
{
|
1003
|
-
|
952
|
+
ReactSharedInternals$1.H = previousDispatcher;
|
1004
953
|
reenableLogs();
|
1005
954
|
}
|
1006
955
|
|
@@ -1019,7 +968,7 @@
|
|
1019
968
|
|
1020
969
|
return syntheticFrame;
|
1021
970
|
}
|
1022
|
-
function describeFunctionComponentFrame(fn
|
971
|
+
function describeFunctionComponentFrame(fn) {
|
1023
972
|
{
|
1024
973
|
return describeNativeComponentFrame(fn, false);
|
1025
974
|
}
|
@@ -1030,7 +979,7 @@
|
|
1030
979
|
return !!(prototype && prototype.isReactComponent);
|
1031
980
|
}
|
1032
981
|
|
1033
|
-
function describeUnknownElementTypeFrameInDEV(type
|
982
|
+
function describeUnknownElementTypeFrameInDEV(type) {
|
1034
983
|
|
1035
984
|
if (type == null) {
|
1036
985
|
return '';
|
@@ -1061,7 +1010,7 @@
|
|
1061
1010
|
|
1062
1011
|
case REACT_MEMO_TYPE:
|
1063
1012
|
// Memo may contain any component type so we recursively resolve it.
|
1064
|
-
return describeUnknownElementTypeFrameInDEV(type.type
|
1013
|
+
return describeUnknownElementTypeFrameInDEV(type.type);
|
1065
1014
|
|
1066
1015
|
case REACT_LAZY_TYPE:
|
1067
1016
|
{
|
@@ -1071,7 +1020,7 @@
|
|
1071
1020
|
|
1072
1021
|
try {
|
1073
1022
|
// Lazy may contain any component type so we recursively resolve it.
|
1074
|
-
return describeUnknownElementTypeFrameInDEV(init(payload)
|
1023
|
+
return describeUnknownElementTypeFrameInDEV(init(payload));
|
1075
1024
|
} catch (x) {}
|
1076
1025
|
}
|
1077
1026
|
}
|
@@ -1080,11 +1029,10 @@
|
|
1080
1029
|
return '';
|
1081
1030
|
}
|
1082
1031
|
|
1083
|
-
var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
|
1084
|
-
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
1085
1032
|
var REACT_CLIENT_REFERENCE = Symbol.for('react.client.reference');
|
1086
1033
|
var specialPropKeyWarningShown;
|
1087
1034
|
var didWarnAboutElementRef;
|
1035
|
+
var didWarnAboutOldJSXRuntime;
|
1088
1036
|
|
1089
1037
|
{
|
1090
1038
|
didWarnAboutElementRef = {};
|
@@ -1319,6 +1267,20 @@
|
|
1319
1267
|
var ref = null;
|
1320
1268
|
|
1321
1269
|
if (config != null) {
|
1270
|
+
{
|
1271
|
+
if (!didWarnAboutOldJSXRuntime && '__self' in config && // Do not assume this is the result of an oudated JSX transform if key
|
1272
|
+
// is present, because the modern JSX transform sometimes outputs
|
1273
|
+
// createElement to preserve precedence between a static key and a
|
1274
|
+
// spread key. To avoid false positive warnings, we never warn if
|
1275
|
+
// there's a key.
|
1276
|
+
!('key' in config)) {
|
1277
|
+
didWarnAboutOldJSXRuntime = true;
|
1278
|
+
|
1279
|
+
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
|
1280
|
+
'https://reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html');
|
1281
|
+
}
|
1282
|
+
}
|
1283
|
+
|
1322
1284
|
if (hasValidRef(config)) ;
|
1323
1285
|
|
1324
1286
|
if (hasValidKey(config)) {
|
@@ -1387,7 +1349,7 @@
|
|
1387
1349
|
}
|
1388
1350
|
}
|
1389
1351
|
|
1390
|
-
var element = ReactElement(type, key, ref, undefined, undefined,
|
1352
|
+
var element = ReactElement(type, key, ref, undefined, undefined, ReactSharedInternals$1.owner, props);
|
1391
1353
|
|
1392
1354
|
if (type === REACT_FRAGMENT_TYPE) {
|
1393
1355
|
validateFragmentProps(element);
|
@@ -1421,8 +1383,7 @@
|
|
1421
1383
|
|
1422
1384
|
if (config != null) {
|
1423
1385
|
if (hasValidRef(config)) {
|
1424
|
-
|
1425
|
-
owner = ReactCurrentOwner.current;
|
1386
|
+
owner = ReactSharedInternals$1.owner;
|
1426
1387
|
}
|
1427
1388
|
|
1428
1389
|
if (hasValidKey(config)) {
|
@@ -1481,8 +1442,8 @@
|
|
1481
1442
|
|
1482
1443
|
function getDeclarationErrorAddendum() {
|
1483
1444
|
{
|
1484
|
-
if (
|
1485
|
-
var name = getComponentNameFromType(
|
1445
|
+
if (ReactSharedInternals$1.owner) {
|
1446
|
+
var name = getComponentNameFromType(ReactSharedInternals$1.owner.type);
|
1486
1447
|
|
1487
1448
|
if (name) {
|
1488
1449
|
return '\n\nCheck the render method of `' + name + '`.';
|
@@ -1586,9 +1547,17 @@
|
|
1586
1547
|
|
1587
1548
|
var childOwner = '';
|
1588
1549
|
|
1589
|
-
if (element && element._owner && element._owner !==
|
1590
|
-
|
1591
|
-
|
1550
|
+
if (element && element._owner != null && element._owner !== ReactSharedInternals$1.owner) {
|
1551
|
+
var ownerName = null;
|
1552
|
+
|
1553
|
+
if (typeof element._owner.tag === 'number') {
|
1554
|
+
ownerName = getComponentNameFromType(element._owner.type);
|
1555
|
+
} else if (typeof element._owner.name === 'string') {
|
1556
|
+
ownerName = element._owner.name;
|
1557
|
+
} // Give the component that originally created this child.
|
1558
|
+
|
1559
|
+
|
1560
|
+
childOwner = " It was passed a child from " + ownerName + ".";
|
1592
1561
|
}
|
1593
1562
|
|
1594
1563
|
setCurrentlyValidatingElement(element);
|
@@ -1602,11 +1571,10 @@
|
|
1602
1571
|
function setCurrentlyValidatingElement(element) {
|
1603
1572
|
{
|
1604
1573
|
if (element) {
|
1605
|
-
var
|
1606
|
-
|
1607
|
-
ReactDebugCurrentFrame.setExtraStackFrame(stack);
|
1574
|
+
var stack = describeUnknownElementTypeFrameInDEV(element.type);
|
1575
|
+
ReactSharedInternals$1.setExtraStackFrame(stack);
|
1608
1576
|
} else {
|
1609
|
-
|
1577
|
+
ReactSharedInternals$1.setExtraStackFrame(null);
|
1610
1578
|
}
|
1611
1579
|
}
|
1612
1580
|
}
|
@@ -2234,7 +2202,7 @@
|
|
2234
2202
|
|
2235
2203
|
function cache$1(fn) {
|
2236
2204
|
return function () {
|
2237
|
-
var dispatcher =
|
2205
|
+
var dispatcher = ReactSharedInternals$1.C;
|
2238
2206
|
|
2239
2207
|
if (!dispatcher) {
|
2240
2208
|
// If there is no dispatcher, then we treat this as not being cached.
|
@@ -2319,7 +2287,7 @@
|
|
2319
2287
|
var cache = cache$1;
|
2320
2288
|
|
2321
2289
|
function resolveDispatcher() {
|
2322
|
-
var dispatcher =
|
2290
|
+
var dispatcher = ReactSharedInternals$1.H;
|
2323
2291
|
|
2324
2292
|
{
|
2325
2293
|
if (dispatcher === null) {
|
@@ -3017,11 +2985,10 @@
|
|
3017
2985
|
unstable_wrapCallback: unstable_wrapCallback
|
3018
2986
|
});
|
3019
2987
|
|
3020
|
-
var
|
3021
|
-
|
3022
|
-
|
3023
|
-
|
3024
|
-
ReactCurrentBatchConfig: ReactCurrentBatchConfig,
|
2988
|
+
var ReactSharedInternals = {
|
2989
|
+
H: null,
|
2990
|
+
C: null,
|
2991
|
+
T: null,
|
3025
2992
|
// Re-export the schedule API(s) for UMD bundles.
|
3026
2993
|
// This avoids introducing a dependency on a new UMD global in a minor update,
|
3027
2994
|
// Since that would be a breaking change (e.g. for all existing CodeSandboxes).
|
@@ -3031,8 +2998,40 @@
|
|
3031
2998
|
};
|
3032
2999
|
|
3033
3000
|
{
|
3034
|
-
|
3035
|
-
|
3001
|
+
ReactSharedInternals.owner = null;
|
3002
|
+
}
|
3003
|
+
|
3004
|
+
{
|
3005
|
+
ReactSharedInternals.actQueue = null;
|
3006
|
+
ReactSharedInternals.isBatchingLegacy = false;
|
3007
|
+
ReactSharedInternals.didScheduleLegacyUpdate = false;
|
3008
|
+
ReactSharedInternals.didUsePromise = false;
|
3009
|
+
ReactSharedInternals.thrownErrors = [];
|
3010
|
+
var currentExtraStackFrame = null;
|
3011
|
+
|
3012
|
+
ReactSharedInternals.setExtraStackFrame = function (stack) {
|
3013
|
+
currentExtraStackFrame = stack;
|
3014
|
+
}; // Stack implementation injected by the current renderer.
|
3015
|
+
|
3016
|
+
|
3017
|
+
ReactSharedInternals.getCurrentStack = null;
|
3018
|
+
|
3019
|
+
ReactSharedInternals.getStackAddendum = function () {
|
3020
|
+
var stack = ''; // Add an extra top frame while an element is being validated
|
3021
|
+
|
3022
|
+
if (currentExtraStackFrame) {
|
3023
|
+
stack += currentExtraStackFrame;
|
3024
|
+
} // Delegate to the injected renderer-specific implementation
|
3025
|
+
|
3026
|
+
|
3027
|
+
var impl = ReactSharedInternals.getCurrentStack;
|
3028
|
+
|
3029
|
+
if (impl) {
|
3030
|
+
stack += impl() || '';
|
3031
|
+
}
|
3032
|
+
|
3033
|
+
return stack;
|
3034
|
+
};
|
3036
3035
|
}
|
3037
3036
|
|
3038
3037
|
var reportGlobalError = typeof reportError === 'function' ? // In modern browsers, reportError will dispatch an error event,
|
@@ -3066,18 +3065,18 @@
|
|
3066
3065
|
};
|
3067
3066
|
|
3068
3067
|
function startTransition(scope, options) {
|
3069
|
-
var prevTransition =
|
3068
|
+
var prevTransition = ReactSharedInternals$1.T; // Each renderer registers a callback to receive the return value of
|
3070
3069
|
// the scope function. This is used to implement async actions.
|
3071
3070
|
|
3072
3071
|
var callbacks = new Set();
|
3073
3072
|
var transition = {
|
3074
3073
|
_callbacks: callbacks
|
3075
3074
|
};
|
3076
|
-
|
3077
|
-
var currentTransition =
|
3075
|
+
ReactSharedInternals$1.T = transition;
|
3076
|
+
var currentTransition = ReactSharedInternals$1.T;
|
3078
3077
|
|
3079
3078
|
{
|
3080
|
-
|
3079
|
+
ReactSharedInternals$1.T._updatedFibers = new Set();
|
3081
3080
|
}
|
3082
3081
|
|
3083
3082
|
{
|
@@ -3094,7 +3093,7 @@
|
|
3094
3093
|
reportGlobalError(error);
|
3095
3094
|
} finally {
|
3096
3095
|
warnAboutTransitionSubscriptions(prevTransition, currentTransition);
|
3097
|
-
|
3096
|
+
ReactSharedInternals$1.T = prevTransition;
|
3098
3097
|
}
|
3099
3098
|
}
|
3100
3099
|
}
|
@@ -3169,7 +3168,7 @@
|
|
3169
3168
|
|
3170
3169
|
function act(callback) {
|
3171
3170
|
{
|
3172
|
-
// When
|
3171
|
+
// When ReactSharedInternals.actQueue is not null, it signals to React that
|
3173
3172
|
// we're currently inside an `act` scope. React will push all its tasks to
|
3174
3173
|
// this queue instead of scheduling them with platform APIs.
|
3175
3174
|
//
|
@@ -3179,10 +3178,10 @@
|
|
3179
3178
|
//
|
3180
3179
|
// If we're already inside an `act` scope, reuse the existing queue.
|
3181
3180
|
var prevIsBatchingLegacy = false;
|
3182
|
-
var prevActQueue =
|
3181
|
+
var prevActQueue = ReactSharedInternals.actQueue;
|
3183
3182
|
var prevActScopeDepth = actScopeDepth;
|
3184
3183
|
actScopeDepth++;
|
3185
|
-
var queue =
|
3184
|
+
var queue = ReactSharedInternals.actQueue = prevActQueue !== null ? prevActQueue : []; // Used to reproduce behavior of `batchedUpdates` in legacy mode. Only
|
3186
3185
|
|
3187
3186
|
var result; // This tracks whether the `act` call is awaited. In certain cases, not
|
3188
3187
|
// awaiting it is a mistake, so we will detect that and warn.
|
@@ -3196,7 +3195,7 @@
|
|
3196
3195
|
if (!disableLegacyMode) ;
|
3197
3196
|
|
3198
3197
|
result = callback();
|
3199
|
-
var didScheduleLegacyUpdate = !disableLegacyMode ?
|
3198
|
+
var didScheduleLegacyUpdate = !disableLegacyMode ? ReactSharedInternals.didScheduleLegacyUpdate : false; // Replicate behavior of original `act` implementation in legacy mode,
|
3200
3199
|
// which flushed updates immediately after the scope function exits, even
|
3201
3200
|
// if it's an async function.
|
3202
3201
|
|
@@ -3214,14 +3213,14 @@
|
|
3214
3213
|
// one used to track `act` scopes. Why, you may be wondering? Because
|
3215
3214
|
// that's how it worked before version 18. Yes, it's confusing! We should
|
3216
3215
|
// delete legacy mode!!
|
3217
|
-
|
3216
|
+
ReactSharedInternals.thrownErrors.push(error);
|
3218
3217
|
}
|
3219
3218
|
|
3220
|
-
if (
|
3219
|
+
if (ReactSharedInternals.thrownErrors.length > 0) {
|
3221
3220
|
|
3222
3221
|
popActScope(prevActQueue, prevActScopeDepth);
|
3223
|
-
var thrownError = aggregateErrors(
|
3224
|
-
|
3222
|
+
var thrownError = aggregateErrors(ReactSharedInternals.thrownErrors);
|
3223
|
+
ReactSharedInternals.thrownErrors.length = 0;
|
3225
3224
|
throw thrownError;
|
3226
3225
|
}
|
3227
3226
|
|
@@ -3262,13 +3261,13 @@
|
|
3262
3261
|
// `thenable` might not be a real promise, and `flushActQueue`
|
3263
3262
|
// might throw, so we need to wrap `flushActQueue` in a
|
3264
3263
|
// try/catch.
|
3265
|
-
|
3264
|
+
ReactSharedInternals.thrownErrors.push(error);
|
3266
3265
|
}
|
3267
3266
|
|
3268
|
-
if (
|
3269
|
-
var _thrownError = aggregateErrors(
|
3267
|
+
if (ReactSharedInternals.thrownErrors.length > 0) {
|
3268
|
+
var _thrownError = aggregateErrors(ReactSharedInternals.thrownErrors);
|
3270
3269
|
|
3271
|
-
|
3270
|
+
ReactSharedInternals.thrownErrors.length = 0;
|
3272
3271
|
reject(_thrownError);
|
3273
3272
|
}
|
3274
3273
|
} else {
|
@@ -3277,10 +3276,10 @@
|
|
3277
3276
|
}, function (error) {
|
3278
3277
|
popActScope(prevActQueue, prevActScopeDepth);
|
3279
3278
|
|
3280
|
-
if (
|
3281
|
-
var _thrownError2 = aggregateErrors(
|
3279
|
+
if (ReactSharedInternals.thrownErrors.length > 0) {
|
3280
|
+
var _thrownError2 = aggregateErrors(ReactSharedInternals.thrownErrors);
|
3282
3281
|
|
3283
|
-
|
3282
|
+
ReactSharedInternals.thrownErrors.length = 0;
|
3284
3283
|
reject(_thrownError2);
|
3285
3284
|
} else {
|
3286
3285
|
reject(error);
|
@@ -3328,13 +3327,13 @@
|
|
3328
3327
|
// to be awaited, regardless of whether the callback is sync or async.
|
3329
3328
|
|
3330
3329
|
|
3331
|
-
|
3330
|
+
ReactSharedInternals.actQueue = null;
|
3332
3331
|
}
|
3333
3332
|
|
3334
|
-
if (
|
3335
|
-
var _thrownError3 = aggregateErrors(
|
3333
|
+
if (ReactSharedInternals.thrownErrors.length > 0) {
|
3334
|
+
var _thrownError3 = aggregateErrors(ReactSharedInternals.thrownErrors);
|
3336
3335
|
|
3337
|
-
|
3336
|
+
ReactSharedInternals.thrownErrors.length = 0;
|
3338
3337
|
throw _thrownError3;
|
3339
3338
|
}
|
3340
3339
|
|
@@ -3345,7 +3344,7 @@
|
|
3345
3344
|
if (prevActScopeDepth === 0) {
|
3346
3345
|
// If the `act` call is awaited, restore the queue we were
|
3347
3346
|
// using before (see long comment above) so we can flush it.
|
3348
|
-
|
3347
|
+
ReactSharedInternals.actQueue = queue;
|
3349
3348
|
enqueueTask(function () {
|
3350
3349
|
return (// Recursively flush tasks scheduled by a microtask.
|
3351
3350
|
recursivelyFlushAsyncActWork(returnValue, resolve, reject)
|
@@ -3373,7 +3372,7 @@
|
|
3373
3372
|
function recursivelyFlushAsyncActWork(returnValue, resolve, reject) {
|
3374
3373
|
{
|
3375
3374
|
// Check if any tasks were scheduled asynchronously.
|
3376
|
-
var queue =
|
3375
|
+
var queue = ReactSharedInternals.actQueue;
|
3377
3376
|
|
3378
3377
|
if (queue !== null) {
|
3379
3378
|
if (queue.length !== 0) {
|
@@ -3389,17 +3388,17 @@
|
|
3389
3388
|
return;
|
3390
3389
|
} catch (error) {
|
3391
3390
|
// Leave remaining tasks on the queue if something throws.
|
3392
|
-
|
3391
|
+
ReactSharedInternals.thrownErrors.push(error);
|
3393
3392
|
}
|
3394
3393
|
} else {
|
3395
3394
|
// The queue is empty. We can finish.
|
3396
|
-
|
3395
|
+
ReactSharedInternals.actQueue = null;
|
3397
3396
|
}
|
3398
3397
|
}
|
3399
3398
|
|
3400
|
-
if (
|
3401
|
-
var thrownError = aggregateErrors(
|
3402
|
-
|
3399
|
+
if (ReactSharedInternals.thrownErrors.length > 0) {
|
3400
|
+
var thrownError = aggregateErrors(ReactSharedInternals.thrownErrors);
|
3401
|
+
ReactSharedInternals.thrownErrors.length = 0;
|
3403
3402
|
reject(thrownError);
|
3404
3403
|
} else {
|
3405
3404
|
resolve(returnValue);
|
@@ -3421,11 +3420,11 @@
|
|
3421
3420
|
var callback = queue[i];
|
3422
3421
|
|
3423
3422
|
do {
|
3424
|
-
|
3423
|
+
ReactSharedInternals.didUsePromise = false;
|
3425
3424
|
var continuation = callback(false);
|
3426
3425
|
|
3427
3426
|
if (continuation !== null) {
|
3428
|
-
if (
|
3427
|
+
if (ReactSharedInternals.didUsePromise) {
|
3429
3428
|
// The component just suspended. Yield to the main thread in
|
3430
3429
|
// case the promise is already resolved. If so, it will ping in
|
3431
3430
|
// a microtask and we can resume without unwinding the stack.
|
@@ -3446,7 +3445,7 @@
|
|
3446
3445
|
} catch (error) {
|
3447
3446
|
// If something throws, leave the remaining callbacks on the queue.
|
3448
3447
|
queue.splice(0, i + 1);
|
3449
|
-
|
3448
|
+
ReactSharedInternals.thrownErrors.push(error);
|
3450
3449
|
} finally {
|
3451
3450
|
isFlushing = false;
|
3452
3451
|
}
|
@@ -3485,7 +3484,7 @@
|
|
3485
3484
|
exports.PureComponent = PureComponent;
|
3486
3485
|
exports.StrictMode = REACT_STRICT_MODE_TYPE;
|
3487
3486
|
exports.Suspense = REACT_SUSPENSE_TYPE;
|
3488
|
-
exports.
|
3487
|
+
exports.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE = ReactSharedInternals;
|
3489
3488
|
exports.act = act;
|
3490
3489
|
exports.cache = cache;
|
3491
3490
|
exports.cloneElement = cloneElement;
|