react-test-renderer 16.8.2 → 16.8.6
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 +6 -6
- package/cjs/react-test-renderer-shallow.development.js +120 -83
- package/cjs/react-test-renderer-shallow.production.min.js +24 -23
- package/cjs/react-test-renderer.development.js +266 -85
- package/cjs/react-test-renderer.production.min.js +9 -9
- package/package.json +3 -3
- package/umd/react-test-renderer-shallow.development.js +126 -84
- package/umd/react-test-renderer-shallow.production.min.js +24 -23
- package/umd/react-test-renderer.development.js +266 -85
- package/umd/react-test-renderer.production.min.js +93 -93
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license React v16.8.
|
|
1
|
+
/** @license React v16.8.6
|
|
2
2
|
* react-test-renderer.development.js
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
@@ -1968,6 +1968,7 @@ function FiberNode(tag, pendingProps, key, mode) {
|
|
|
1968
1968
|
this._debugSource = null;
|
|
1969
1969
|
this._debugOwner = null;
|
|
1970
1970
|
this._debugIsCurrentlyTiming = false;
|
|
1971
|
+
this._debugHookTypes = null;
|
|
1971
1972
|
if (!hasBadMapPolyfill && typeof Object.preventExtensions === 'function') {
|
|
1972
1973
|
Object.preventExtensions(this);
|
|
1973
1974
|
}
|
|
@@ -2035,6 +2036,7 @@ function createWorkInProgress(current, pendingProps, expirationTime) {
|
|
|
2035
2036
|
workInProgress._debugID = current._debugID;
|
|
2036
2037
|
workInProgress._debugSource = current._debugSource;
|
|
2037
2038
|
workInProgress._debugOwner = current._debugOwner;
|
|
2039
|
+
workInProgress._debugHookTypes = current._debugHookTypes;
|
|
2038
2040
|
}
|
|
2039
2041
|
|
|
2040
2042
|
workInProgress.alternate = current;
|
|
@@ -2302,6 +2304,7 @@ function assignFiberPropertiesInDEV(target, source) {
|
|
|
2302
2304
|
target._debugSource = source._debugSource;
|
|
2303
2305
|
target._debugOwner = source._debugOwner;
|
|
2304
2306
|
target._debugIsCurrentlyTiming = source._debugIsCurrentlyTiming;
|
|
2307
|
+
target._debugHookTypes = source._debugHookTypes;
|
|
2305
2308
|
return target;
|
|
2306
2309
|
}
|
|
2307
2310
|
|
|
@@ -3544,14 +3547,35 @@ function constructClassInstance(workInProgress, ctor, props, renderExpirationTim
|
|
|
3544
3547
|
var unmaskedContext = emptyContextObject;
|
|
3545
3548
|
var context = null;
|
|
3546
3549
|
var contextType = ctor.contextType;
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
+
|
|
3551
|
+
{
|
|
3552
|
+
if ('contextType' in ctor) {
|
|
3553
|
+
var isValid =
|
|
3554
|
+
// Allow null for conditional declaration
|
|
3555
|
+
contextType === null || contextType !== undefined && contextType.$$typeof === REACT_CONTEXT_TYPE && contextType._context === undefined; // Not a <Context.Consumer>
|
|
3556
|
+
|
|
3557
|
+
if (!isValid && !didWarnAboutInvalidateContextType.has(ctor)) {
|
|
3550
3558
|
didWarnAboutInvalidateContextType.add(ctor);
|
|
3551
|
-
|
|
3559
|
+
|
|
3560
|
+
var addendum = '';
|
|
3561
|
+
if (contextType === undefined) {
|
|
3562
|
+
addendum = ' However, it is set to undefined. ' + 'This can be caused by a typo or by mixing up named and default imports. ' + 'This can also happen due to a circular dependency, so ' + 'try moving the createContext() call to a separate file.';
|
|
3563
|
+
} else if (typeof contextType !== 'object') {
|
|
3564
|
+
addendum = ' However, it is set to a ' + typeof contextType + '.';
|
|
3565
|
+
} else if (contextType.$$typeof === REACT_PROVIDER_TYPE) {
|
|
3566
|
+
addendum = ' Did you accidentally pass the Context.Provider instead?';
|
|
3567
|
+
} else if (contextType._context !== undefined) {
|
|
3568
|
+
// <Context.Consumer>
|
|
3569
|
+
addendum = ' Did you accidentally pass the Context.Consumer instead?';
|
|
3570
|
+
} else {
|
|
3571
|
+
addendum = ' However, it is set to an object with keys {' + Object.keys(contextType).join(', ') + '}.';
|
|
3572
|
+
}
|
|
3573
|
+
warningWithoutStack$1(false, '%s defines an invalid contextType. ' + 'contextType should point to the Context object returned by React.createContext().%s', getComponentName(ctor) || 'Component', addendum);
|
|
3552
3574
|
}
|
|
3553
3575
|
}
|
|
3576
|
+
}
|
|
3554
3577
|
|
|
3578
|
+
if (typeof contextType === 'object' && contextType !== null) {
|
|
3555
3579
|
context = readContext(contextType);
|
|
3556
3580
|
} else {
|
|
3557
3581
|
unmaskedContext = getUnmaskedContext(workInProgress, ctor, true);
|
|
@@ -4978,7 +5002,6 @@ var currentlyRenderingFiber$1 = null;
|
|
|
4978
5002
|
// current hook list is the list that belongs to the current fiber. The
|
|
4979
5003
|
// work-in-progress hook list is a new list that will be added to the
|
|
4980
5004
|
// work-in-progress fiber.
|
|
4981
|
-
var firstCurrentHook = null;
|
|
4982
5005
|
var currentHook = null;
|
|
4983
5006
|
var nextCurrentHook = null;
|
|
4984
5007
|
var firstWorkInProgressHook = null;
|
|
@@ -5008,45 +5031,73 @@ var RE_RENDER_LIMIT = 25;
|
|
|
5008
5031
|
// In DEV, this is the name of the currently executing primitive hook
|
|
5009
5032
|
var currentHookNameInDev = null;
|
|
5010
5033
|
|
|
5011
|
-
|
|
5034
|
+
// In DEV, this list ensures that hooks are called in the same order between renders.
|
|
5035
|
+
// The list stores the order of hooks used during the initial render (mount).
|
|
5036
|
+
// Subsequent renders (updates) reference this list.
|
|
5037
|
+
var hookTypesDev = null;
|
|
5038
|
+
var hookTypesUpdateIndexDev = -1;
|
|
5039
|
+
|
|
5040
|
+
function mountHookTypesDev() {
|
|
5041
|
+
{
|
|
5042
|
+
var hookName = currentHookNameInDev;
|
|
5043
|
+
|
|
5044
|
+
if (hookTypesDev === null) {
|
|
5045
|
+
hookTypesDev = [hookName];
|
|
5046
|
+
} else {
|
|
5047
|
+
hookTypesDev.push(hookName);
|
|
5048
|
+
}
|
|
5049
|
+
}
|
|
5050
|
+
}
|
|
5051
|
+
|
|
5052
|
+
function updateHookTypesDev() {
|
|
5053
|
+
{
|
|
5054
|
+
var hookName = currentHookNameInDev;
|
|
5055
|
+
|
|
5056
|
+
if (hookTypesDev !== null) {
|
|
5057
|
+
hookTypesUpdateIndexDev++;
|
|
5058
|
+
if (hookTypesDev[hookTypesUpdateIndexDev] !== hookName) {
|
|
5059
|
+
warnOnHookMismatchInDev(hookName);
|
|
5060
|
+
}
|
|
5061
|
+
}
|
|
5062
|
+
}
|
|
5063
|
+
}
|
|
5064
|
+
|
|
5065
|
+
function warnOnHookMismatchInDev(currentHookName) {
|
|
5012
5066
|
{
|
|
5013
5067
|
var componentName = getComponentName(currentlyRenderingFiber$1.type);
|
|
5014
5068
|
if (!didWarnAboutMismatchedHooksForComponent.has(componentName)) {
|
|
5015
5069
|
didWarnAboutMismatchedHooksForComponent.add(componentName);
|
|
5016
5070
|
|
|
5017
|
-
|
|
5071
|
+
if (hookTypesDev !== null) {
|
|
5072
|
+
var table = '';
|
|
5018
5073
|
|
|
5019
|
-
|
|
5020
|
-
var prevHook = firstCurrentHook;
|
|
5021
|
-
var nextHook = firstWorkInProgressHook;
|
|
5022
|
-
var n = 1;
|
|
5023
|
-
while (prevHook !== null && nextHook !== null) {
|
|
5024
|
-
var oldHookName = prevHook._debugType;
|
|
5025
|
-
var newHookName = nextHook._debugType;
|
|
5074
|
+
var secondColumnStart = 30;
|
|
5026
5075
|
|
|
5027
|
-
var
|
|
5076
|
+
for (var i = 0; i <= hookTypesUpdateIndexDev; i++) {
|
|
5077
|
+
var oldHookName = hookTypesDev[i];
|
|
5078
|
+
var newHookName = i === hookTypesUpdateIndexDev ? currentHookName : oldHookName;
|
|
5028
5079
|
|
|
5029
|
-
|
|
5030
|
-
// lol @ IE not supporting String#repeat
|
|
5031
|
-
while (row.length < secondColumnStart) {
|
|
5032
|
-
row += ' ';
|
|
5033
|
-
}
|
|
5080
|
+
var row = i + 1 + '. ' + oldHookName;
|
|
5034
5081
|
|
|
5035
|
-
|
|
5082
|
+
// Extra space so second column lines up
|
|
5083
|
+
// lol @ IE not supporting String#repeat
|
|
5084
|
+
while (row.length < secondColumnStart) {
|
|
5085
|
+
row += ' ';
|
|
5086
|
+
}
|
|
5036
5087
|
|
|
5037
|
-
|
|
5038
|
-
prevHook = prevHook.next;
|
|
5039
|
-
nextHook = nextHook.next;
|
|
5040
|
-
n++;
|
|
5041
|
-
}
|
|
5088
|
+
row += newHookName + '\n';
|
|
5042
5089
|
|
|
5043
|
-
|
|
5090
|
+
table += row;
|
|
5091
|
+
}
|
|
5092
|
+
|
|
5093
|
+
warning$1(false, 'React has detected a change in the order of Hooks called by %s. ' + 'This will lead to bugs and errors if not fixed. ' + 'For more information, read the Rules of Hooks: https://fb.me/rules-of-hooks\n\n' + ' Previous render Next render\n' + ' ------------------------------------------------------\n' + '%s' + ' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n', componentName, table);
|
|
5094
|
+
}
|
|
5044
5095
|
}
|
|
5045
5096
|
}
|
|
5046
5097
|
}
|
|
5047
5098
|
|
|
5048
5099
|
function throwInvalidHookError() {
|
|
5049
|
-
invariant(false, 'Hooks can only be called inside the body of a function component. (https://fb.me/react-invalid-hook-call
|
|
5100
|
+
invariant(false, '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.');
|
|
5050
5101
|
}
|
|
5051
5102
|
|
|
5052
5103
|
function areHookInputsEqual(nextDeps, prevDeps) {
|
|
@@ -5076,7 +5127,12 @@ function areHookInputsEqual(nextDeps, prevDeps) {
|
|
|
5076
5127
|
function renderWithHooks(current, workInProgress, Component, props, refOrContext, nextRenderExpirationTime) {
|
|
5077
5128
|
renderExpirationTime = nextRenderExpirationTime;
|
|
5078
5129
|
currentlyRenderingFiber$1 = workInProgress;
|
|
5079
|
-
|
|
5130
|
+
nextCurrentHook = current !== null ? current.memoizedState : null;
|
|
5131
|
+
|
|
5132
|
+
{
|
|
5133
|
+
hookTypesDev = current !== null ? current._debugHookTypes : null;
|
|
5134
|
+
hookTypesUpdateIndexDev = -1;
|
|
5135
|
+
}
|
|
5080
5136
|
|
|
5081
5137
|
// The following should have already been reset
|
|
5082
5138
|
// currentHook = null;
|
|
@@ -5090,8 +5146,26 @@ function renderWithHooks(current, workInProgress, Component, props, refOrContext
|
|
|
5090
5146
|
// numberOfReRenders = 0;
|
|
5091
5147
|
// sideEffectTag = 0;
|
|
5092
5148
|
|
|
5149
|
+
// TODO Warn if no hooks are used at all during mount, then some are used during update.
|
|
5150
|
+
// Currently we will identify the update render as a mount because nextCurrentHook === null.
|
|
5151
|
+
// This is tricky because it's valid for certain types of components (e.g. React.lazy)
|
|
5152
|
+
|
|
5153
|
+
// Using nextCurrentHook to differentiate between mount/update only works if at least one stateful hook is used.
|
|
5154
|
+
// Non-stateful hooks (e.g. context) don't get added to memoizedState,
|
|
5155
|
+
// so nextCurrentHook would be null during updates and mounts.
|
|
5093
5156
|
{
|
|
5094
|
-
|
|
5157
|
+
if (nextCurrentHook !== null) {
|
|
5158
|
+
ReactCurrentDispatcher$1.current = HooksDispatcherOnUpdateInDEV;
|
|
5159
|
+
} else if (hookTypesDev !== null) {
|
|
5160
|
+
// This dispatcher handles an edge case where a component is updating,
|
|
5161
|
+
// but no stateful hooks have been used.
|
|
5162
|
+
// We want to match the production code behavior (which will use HooksDispatcherOnMount),
|
|
5163
|
+
// but with the extra DEV validation to ensure hooks ordering hasn't changed.
|
|
5164
|
+
// This dispatcher does that.
|
|
5165
|
+
ReactCurrentDispatcher$1.current = HooksDispatcherOnMountWithHookTypesInDEV;
|
|
5166
|
+
} else {
|
|
5167
|
+
ReactCurrentDispatcher$1.current = HooksDispatcherOnMountInDEV;
|
|
5168
|
+
}
|
|
5095
5169
|
}
|
|
5096
5170
|
|
|
5097
5171
|
var children = Component(props, refOrContext);
|
|
@@ -5102,13 +5176,18 @@ function renderWithHooks(current, workInProgress, Component, props, refOrContext
|
|
|
5102
5176
|
numberOfReRenders += 1;
|
|
5103
5177
|
|
|
5104
5178
|
// Start over from the beginning of the list
|
|
5105
|
-
|
|
5179
|
+
nextCurrentHook = current !== null ? current.memoizedState : null;
|
|
5106
5180
|
nextWorkInProgressHook = firstWorkInProgressHook;
|
|
5107
5181
|
|
|
5108
5182
|
currentHook = null;
|
|
5109
5183
|
workInProgressHook = null;
|
|
5110
5184
|
componentUpdateQueue = null;
|
|
5111
5185
|
|
|
5186
|
+
{
|
|
5187
|
+
// Also validate hook order for cascading updates.
|
|
5188
|
+
hookTypesUpdateIndexDev = -1;
|
|
5189
|
+
}
|
|
5190
|
+
|
|
5112
5191
|
ReactCurrentDispatcher$1.current = HooksDispatcherOnUpdateInDEV;
|
|
5113
5192
|
|
|
5114
5193
|
children = Component(props, refOrContext);
|
|
@@ -5118,10 +5197,6 @@ function renderWithHooks(current, workInProgress, Component, props, refOrContext
|
|
|
5118
5197
|
numberOfReRenders = 0;
|
|
5119
5198
|
}
|
|
5120
5199
|
|
|
5121
|
-
{
|
|
5122
|
-
currentHookNameInDev = null;
|
|
5123
|
-
}
|
|
5124
|
-
|
|
5125
5200
|
// We can assume the previous dispatcher is always this one, since we set it
|
|
5126
5201
|
// at the beginning of the render phase and there's no re-entrancy.
|
|
5127
5202
|
ReactCurrentDispatcher$1.current = ContextOnlyDispatcher;
|
|
@@ -5133,18 +5208,29 @@ function renderWithHooks(current, workInProgress, Component, props, refOrContext
|
|
|
5133
5208
|
renderedWork.updateQueue = componentUpdateQueue;
|
|
5134
5209
|
renderedWork.effectTag |= sideEffectTag;
|
|
5135
5210
|
|
|
5211
|
+
{
|
|
5212
|
+
renderedWork._debugHookTypes = hookTypesDev;
|
|
5213
|
+
}
|
|
5214
|
+
|
|
5215
|
+
// This check uses currentHook so that it works the same in DEV and prod bundles.
|
|
5216
|
+
// hookTypesDev could catch more cases (e.g. context) but only in DEV bundles.
|
|
5136
5217
|
var didRenderTooFewHooks = currentHook !== null && currentHook.next !== null;
|
|
5137
5218
|
|
|
5138
5219
|
renderExpirationTime = NoWork;
|
|
5139
5220
|
currentlyRenderingFiber$1 = null;
|
|
5140
5221
|
|
|
5141
|
-
firstCurrentHook = null;
|
|
5142
5222
|
currentHook = null;
|
|
5143
5223
|
nextCurrentHook = null;
|
|
5144
5224
|
firstWorkInProgressHook = null;
|
|
5145
5225
|
workInProgressHook = null;
|
|
5146
5226
|
nextWorkInProgressHook = null;
|
|
5147
5227
|
|
|
5228
|
+
{
|
|
5229
|
+
currentHookNameInDev = null;
|
|
5230
|
+
hookTypesDev = null;
|
|
5231
|
+
hookTypesUpdateIndexDev = -1;
|
|
5232
|
+
}
|
|
5233
|
+
|
|
5148
5234
|
remainingExpirationTime = NoWork;
|
|
5149
5235
|
componentUpdateQueue = null;
|
|
5150
5236
|
sideEffectTag = 0;
|
|
@@ -5178,21 +5264,23 @@ function resetHooks() {
|
|
|
5178
5264
|
renderExpirationTime = NoWork;
|
|
5179
5265
|
currentlyRenderingFiber$1 = null;
|
|
5180
5266
|
|
|
5181
|
-
firstCurrentHook = null;
|
|
5182
5267
|
currentHook = null;
|
|
5183
5268
|
nextCurrentHook = null;
|
|
5184
5269
|
firstWorkInProgressHook = null;
|
|
5185
5270
|
workInProgressHook = null;
|
|
5186
5271
|
nextWorkInProgressHook = null;
|
|
5187
5272
|
|
|
5188
|
-
remainingExpirationTime = NoWork;
|
|
5189
|
-
componentUpdateQueue = null;
|
|
5190
|
-
sideEffectTag = 0;
|
|
5191
|
-
|
|
5192
5273
|
{
|
|
5274
|
+
hookTypesDev = null;
|
|
5275
|
+
hookTypesUpdateIndexDev = -1;
|
|
5276
|
+
|
|
5193
5277
|
currentHookNameInDev = null;
|
|
5194
5278
|
}
|
|
5195
5279
|
|
|
5280
|
+
remainingExpirationTime = NoWork;
|
|
5281
|
+
componentUpdateQueue = null;
|
|
5282
|
+
sideEffectTag = 0;
|
|
5283
|
+
|
|
5196
5284
|
didScheduleRenderPhaseUpdate = false;
|
|
5197
5285
|
renderPhaseUpdates = null;
|
|
5198
5286
|
numberOfReRenders = 0;
|
|
@@ -5209,9 +5297,6 @@ function mountWorkInProgressHook() {
|
|
|
5209
5297
|
next: null
|
|
5210
5298
|
};
|
|
5211
5299
|
|
|
5212
|
-
{
|
|
5213
|
-
hook._debugType = currentHookNameInDev;
|
|
5214
|
-
}
|
|
5215
5300
|
if (workInProgressHook === null) {
|
|
5216
5301
|
// This is the first hook in the list
|
|
5217
5302
|
firstWorkInProgressHook = workInProgressHook = hook;
|
|
@@ -5258,13 +5343,6 @@ function updateWorkInProgressHook() {
|
|
|
5258
5343
|
workInProgressHook = workInProgressHook.next = newHook;
|
|
5259
5344
|
}
|
|
5260
5345
|
nextCurrentHook = currentHook.next;
|
|
5261
|
-
|
|
5262
|
-
{
|
|
5263
|
-
newHook._debugType = currentHookNameInDev;
|
|
5264
|
-
if (currentHookNameInDev !== currentHook._debugType) {
|
|
5265
|
-
warnOnHookMismatchInDev();
|
|
5266
|
-
}
|
|
5267
|
-
}
|
|
5268
5346
|
}
|
|
5269
5347
|
return workInProgressHook;
|
|
5270
5348
|
}
|
|
@@ -5279,20 +5357,6 @@ function basicStateReducer(state, action) {
|
|
|
5279
5357
|
return typeof action === 'function' ? action(state) : action;
|
|
5280
5358
|
}
|
|
5281
5359
|
|
|
5282
|
-
function mountContext(context, observedBits) {
|
|
5283
|
-
{
|
|
5284
|
-
mountWorkInProgressHook();
|
|
5285
|
-
}
|
|
5286
|
-
return readContext(context, observedBits);
|
|
5287
|
-
}
|
|
5288
|
-
|
|
5289
|
-
function updateContext(context, observedBits) {
|
|
5290
|
-
{
|
|
5291
|
-
updateWorkInProgressHook();
|
|
5292
|
-
}
|
|
5293
|
-
return readContext(context, observedBits);
|
|
5294
|
-
}
|
|
5295
|
-
|
|
5296
5360
|
function mountReducer(reducer, initialArg, init) {
|
|
5297
5361
|
var hook = mountWorkInProgressHook();
|
|
5298
5362
|
var initialState = void 0;
|
|
@@ -5305,8 +5369,8 @@ function mountReducer(reducer, initialArg, init) {
|
|
|
5305
5369
|
var queue = hook.queue = {
|
|
5306
5370
|
last: null,
|
|
5307
5371
|
dispatch: null,
|
|
5308
|
-
|
|
5309
|
-
|
|
5372
|
+
lastRenderedReducer: reducer,
|
|
5373
|
+
lastRenderedState: initialState
|
|
5310
5374
|
};
|
|
5311
5375
|
var dispatch = queue.dispatch = dispatchAction.bind(null,
|
|
5312
5376
|
// Flow doesn't know this is non-null, but we do.
|
|
@@ -5319,6 +5383,8 @@ function updateReducer(reducer, initialArg, init) {
|
|
|
5319
5383
|
var queue = hook.queue;
|
|
5320
5384
|
!(queue !== null) ? invariant(false, 'Should have a queue. This is likely a bug in React. Please file an issue.') : void 0;
|
|
5321
5385
|
|
|
5386
|
+
queue.lastRenderedReducer = reducer;
|
|
5387
|
+
|
|
5322
5388
|
if (numberOfReRenders > 0) {
|
|
5323
5389
|
// This is a re-render. Apply the new render phase updates to the previous
|
|
5324
5390
|
var _dispatch = queue.dispatch;
|
|
@@ -5345,7 +5411,6 @@ function updateReducer(reducer, initialArg, init) {
|
|
|
5345
5411
|
}
|
|
5346
5412
|
|
|
5347
5413
|
hook.memoizedState = newState;
|
|
5348
|
-
|
|
5349
5414
|
// Don't persist the state accumlated from the render phase updates to
|
|
5350
5415
|
// the base state unless the queue is empty.
|
|
5351
5416
|
// TODO: Not sure if this is the desired semantics, but it's what we
|
|
@@ -5354,6 +5419,8 @@ function updateReducer(reducer, initialArg, init) {
|
|
|
5354
5419
|
hook.baseState = newState;
|
|
5355
5420
|
}
|
|
5356
5421
|
|
|
5422
|
+
queue.lastRenderedState = newState;
|
|
5423
|
+
|
|
5357
5424
|
return [newState, _dispatch];
|
|
5358
5425
|
}
|
|
5359
5426
|
}
|
|
@@ -5431,8 +5498,7 @@ function updateReducer(reducer, initialArg, init) {
|
|
|
5431
5498
|
hook.baseUpdate = newBaseUpdate;
|
|
5432
5499
|
hook.baseState = newBaseState;
|
|
5433
5500
|
|
|
5434
|
-
queue.
|
|
5435
|
-
queue.eagerState = _newState;
|
|
5501
|
+
queue.lastRenderedState = _newState;
|
|
5436
5502
|
}
|
|
5437
5503
|
|
|
5438
5504
|
var dispatch = queue.dispatch;
|
|
@@ -5448,8 +5514,8 @@ function mountState(initialState) {
|
|
|
5448
5514
|
var queue = hook.queue = {
|
|
5449
5515
|
last: null,
|
|
5450
5516
|
dispatch: null,
|
|
5451
|
-
|
|
5452
|
-
|
|
5517
|
+
lastRenderedReducer: basicStateReducer,
|
|
5518
|
+
lastRenderedState: initialState
|
|
5453
5519
|
};
|
|
5454
5520
|
var dispatch = queue.dispatch = dispatchAction.bind(null,
|
|
5455
5521
|
// Flow doesn't know this is non-null, but we do.
|
|
@@ -5726,21 +5792,21 @@ function dispatchAction(fiber, queue, action) {
|
|
|
5726
5792
|
// The queue is currently empty, which means we can eagerly compute the
|
|
5727
5793
|
// next state before entering the render phase. If the new state is the
|
|
5728
5794
|
// same as the current state, we may be able to bail out entirely.
|
|
5729
|
-
var
|
|
5730
|
-
if (
|
|
5795
|
+
var _lastRenderedReducer = queue.lastRenderedReducer;
|
|
5796
|
+
if (_lastRenderedReducer !== null) {
|
|
5731
5797
|
var prevDispatcher = void 0;
|
|
5732
5798
|
{
|
|
5733
5799
|
prevDispatcher = ReactCurrentDispatcher$1.current;
|
|
5734
5800
|
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
|
|
5735
5801
|
}
|
|
5736
5802
|
try {
|
|
5737
|
-
var currentState = queue.
|
|
5738
|
-
var _eagerState =
|
|
5803
|
+
var currentState = queue.lastRenderedState;
|
|
5804
|
+
var _eagerState = _lastRenderedReducer(currentState, action);
|
|
5739
5805
|
// Stash the eagerly computed state, and the reducer used to compute
|
|
5740
5806
|
// it, on the update object. If the reducer hasn't changed by the
|
|
5741
5807
|
// time we enter the render phase, then the eager state can be used
|
|
5742
5808
|
// without calling the reducer again.
|
|
5743
|
-
_update2.eagerReducer =
|
|
5809
|
+
_update2.eagerReducer = _lastRenderedReducer;
|
|
5744
5810
|
_update2.eagerState = _eagerState;
|
|
5745
5811
|
if (is(_eagerState, currentState)) {
|
|
5746
5812
|
// Fast path. We can bail out without scheduling React to re-render.
|
|
@@ -5783,6 +5849,7 @@ var ContextOnlyDispatcher = {
|
|
|
5783
5849
|
};
|
|
5784
5850
|
|
|
5785
5851
|
var HooksDispatcherOnMountInDEV = null;
|
|
5852
|
+
var HooksDispatcherOnMountWithHookTypesInDEV = null;
|
|
5786
5853
|
var HooksDispatcherOnUpdateInDEV = null;
|
|
5787
5854
|
var InvalidNestedHooksDispatcherOnMountInDEV = null;
|
|
5788
5855
|
var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
@@ -5802,26 +5869,106 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
|
5802
5869
|
},
|
|
5803
5870
|
useCallback: function (callback, deps) {
|
|
5804
5871
|
currentHookNameInDev = 'useCallback';
|
|
5872
|
+
mountHookTypesDev();
|
|
5873
|
+
return mountCallback(callback, deps);
|
|
5874
|
+
},
|
|
5875
|
+
useContext: function (context, observedBits) {
|
|
5876
|
+
currentHookNameInDev = 'useContext';
|
|
5877
|
+
mountHookTypesDev();
|
|
5878
|
+
return readContext(context, observedBits);
|
|
5879
|
+
},
|
|
5880
|
+
useEffect: function (create, deps) {
|
|
5881
|
+
currentHookNameInDev = 'useEffect';
|
|
5882
|
+
mountHookTypesDev();
|
|
5883
|
+
return mountEffect(create, deps);
|
|
5884
|
+
},
|
|
5885
|
+
useImperativeHandle: function (ref, create, deps) {
|
|
5886
|
+
currentHookNameInDev = 'useImperativeHandle';
|
|
5887
|
+
mountHookTypesDev();
|
|
5888
|
+
return mountImperativeHandle(ref, create, deps);
|
|
5889
|
+
},
|
|
5890
|
+
useLayoutEffect: function (create, deps) {
|
|
5891
|
+
currentHookNameInDev = 'useLayoutEffect';
|
|
5892
|
+
mountHookTypesDev();
|
|
5893
|
+
return mountLayoutEffect(create, deps);
|
|
5894
|
+
},
|
|
5895
|
+
useMemo: function (create, deps) {
|
|
5896
|
+
currentHookNameInDev = 'useMemo';
|
|
5897
|
+
mountHookTypesDev();
|
|
5898
|
+
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
|
5899
|
+
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
|
|
5900
|
+
try {
|
|
5901
|
+
return mountMemo(create, deps);
|
|
5902
|
+
} finally {
|
|
5903
|
+
ReactCurrentDispatcher$1.current = prevDispatcher;
|
|
5904
|
+
}
|
|
5905
|
+
},
|
|
5906
|
+
useReducer: function (reducer, initialArg, init) {
|
|
5907
|
+
currentHookNameInDev = 'useReducer';
|
|
5908
|
+
mountHookTypesDev();
|
|
5909
|
+
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
|
5910
|
+
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
|
|
5911
|
+
try {
|
|
5912
|
+
return mountReducer(reducer, initialArg, init);
|
|
5913
|
+
} finally {
|
|
5914
|
+
ReactCurrentDispatcher$1.current = prevDispatcher;
|
|
5915
|
+
}
|
|
5916
|
+
},
|
|
5917
|
+
useRef: function (initialValue) {
|
|
5918
|
+
currentHookNameInDev = 'useRef';
|
|
5919
|
+
mountHookTypesDev();
|
|
5920
|
+
return mountRef(initialValue);
|
|
5921
|
+
},
|
|
5922
|
+
useState: function (initialState) {
|
|
5923
|
+
currentHookNameInDev = 'useState';
|
|
5924
|
+
mountHookTypesDev();
|
|
5925
|
+
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
|
5926
|
+
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
|
|
5927
|
+
try {
|
|
5928
|
+
return mountState(initialState);
|
|
5929
|
+
} finally {
|
|
5930
|
+
ReactCurrentDispatcher$1.current = prevDispatcher;
|
|
5931
|
+
}
|
|
5932
|
+
},
|
|
5933
|
+
useDebugValue: function (value, formatterFn) {
|
|
5934
|
+
currentHookNameInDev = 'useDebugValue';
|
|
5935
|
+
mountHookTypesDev();
|
|
5936
|
+
return mountDebugValue(value, formatterFn);
|
|
5937
|
+
}
|
|
5938
|
+
};
|
|
5939
|
+
|
|
5940
|
+
HooksDispatcherOnMountWithHookTypesInDEV = {
|
|
5941
|
+
readContext: function (context, observedBits) {
|
|
5942
|
+
return readContext(context, observedBits);
|
|
5943
|
+
},
|
|
5944
|
+
useCallback: function (callback, deps) {
|
|
5945
|
+
currentHookNameInDev = 'useCallback';
|
|
5946
|
+
updateHookTypesDev();
|
|
5805
5947
|
return mountCallback(callback, deps);
|
|
5806
5948
|
},
|
|
5807
5949
|
useContext: function (context, observedBits) {
|
|
5808
5950
|
currentHookNameInDev = 'useContext';
|
|
5809
|
-
|
|
5951
|
+
updateHookTypesDev();
|
|
5952
|
+
return readContext(context, observedBits);
|
|
5810
5953
|
},
|
|
5811
5954
|
useEffect: function (create, deps) {
|
|
5812
5955
|
currentHookNameInDev = 'useEffect';
|
|
5956
|
+
updateHookTypesDev();
|
|
5813
5957
|
return mountEffect(create, deps);
|
|
5814
5958
|
},
|
|
5815
5959
|
useImperativeHandle: function (ref, create, deps) {
|
|
5816
5960
|
currentHookNameInDev = 'useImperativeHandle';
|
|
5961
|
+
updateHookTypesDev();
|
|
5817
5962
|
return mountImperativeHandle(ref, create, deps);
|
|
5818
5963
|
},
|
|
5819
5964
|
useLayoutEffect: function (create, deps) {
|
|
5820
5965
|
currentHookNameInDev = 'useLayoutEffect';
|
|
5966
|
+
updateHookTypesDev();
|
|
5821
5967
|
return mountLayoutEffect(create, deps);
|
|
5822
5968
|
},
|
|
5823
5969
|
useMemo: function (create, deps) {
|
|
5824
5970
|
currentHookNameInDev = 'useMemo';
|
|
5971
|
+
updateHookTypesDev();
|
|
5825
5972
|
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
|
5826
5973
|
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
|
|
5827
5974
|
try {
|
|
@@ -5832,6 +5979,7 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
|
5832
5979
|
},
|
|
5833
5980
|
useReducer: function (reducer, initialArg, init) {
|
|
5834
5981
|
currentHookNameInDev = 'useReducer';
|
|
5982
|
+
updateHookTypesDev();
|
|
5835
5983
|
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
|
5836
5984
|
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
|
|
5837
5985
|
try {
|
|
@@ -5842,10 +5990,12 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
|
5842
5990
|
},
|
|
5843
5991
|
useRef: function (initialValue) {
|
|
5844
5992
|
currentHookNameInDev = 'useRef';
|
|
5993
|
+
updateHookTypesDev();
|
|
5845
5994
|
return mountRef(initialValue);
|
|
5846
5995
|
},
|
|
5847
5996
|
useState: function (initialState) {
|
|
5848
5997
|
currentHookNameInDev = 'useState';
|
|
5998
|
+
updateHookTypesDev();
|
|
5849
5999
|
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
|
5850
6000
|
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
|
|
5851
6001
|
try {
|
|
@@ -5856,6 +6006,7 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
|
5856
6006
|
},
|
|
5857
6007
|
useDebugValue: function (value, formatterFn) {
|
|
5858
6008
|
currentHookNameInDev = 'useDebugValue';
|
|
6009
|
+
updateHookTypesDev();
|
|
5859
6010
|
return mountDebugValue(value, formatterFn);
|
|
5860
6011
|
}
|
|
5861
6012
|
};
|
|
@@ -5866,26 +6017,32 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
|
5866
6017
|
},
|
|
5867
6018
|
useCallback: function (callback, deps) {
|
|
5868
6019
|
currentHookNameInDev = 'useCallback';
|
|
6020
|
+
updateHookTypesDev();
|
|
5869
6021
|
return updateCallback(callback, deps);
|
|
5870
6022
|
},
|
|
5871
6023
|
useContext: function (context, observedBits) {
|
|
5872
6024
|
currentHookNameInDev = 'useContext';
|
|
5873
|
-
|
|
6025
|
+
updateHookTypesDev();
|
|
6026
|
+
return readContext(context, observedBits);
|
|
5874
6027
|
},
|
|
5875
6028
|
useEffect: function (create, deps) {
|
|
5876
6029
|
currentHookNameInDev = 'useEffect';
|
|
6030
|
+
updateHookTypesDev();
|
|
5877
6031
|
return updateEffect(create, deps);
|
|
5878
6032
|
},
|
|
5879
6033
|
useImperativeHandle: function (ref, create, deps) {
|
|
5880
6034
|
currentHookNameInDev = 'useImperativeHandle';
|
|
6035
|
+
updateHookTypesDev();
|
|
5881
6036
|
return updateImperativeHandle(ref, create, deps);
|
|
5882
6037
|
},
|
|
5883
6038
|
useLayoutEffect: function (create, deps) {
|
|
5884
6039
|
currentHookNameInDev = 'useLayoutEffect';
|
|
6040
|
+
updateHookTypesDev();
|
|
5885
6041
|
return updateLayoutEffect(create, deps);
|
|
5886
6042
|
},
|
|
5887
6043
|
useMemo: function (create, deps) {
|
|
5888
6044
|
currentHookNameInDev = 'useMemo';
|
|
6045
|
+
updateHookTypesDev();
|
|
5889
6046
|
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
|
5890
6047
|
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
|
|
5891
6048
|
try {
|
|
@@ -5896,6 +6053,7 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
|
5896
6053
|
},
|
|
5897
6054
|
useReducer: function (reducer, initialArg, init) {
|
|
5898
6055
|
currentHookNameInDev = 'useReducer';
|
|
6056
|
+
updateHookTypesDev();
|
|
5899
6057
|
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
|
5900
6058
|
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
|
|
5901
6059
|
try {
|
|
@@ -5906,10 +6064,12 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
|
5906
6064
|
},
|
|
5907
6065
|
useRef: function (initialValue) {
|
|
5908
6066
|
currentHookNameInDev = 'useRef';
|
|
6067
|
+
updateHookTypesDev();
|
|
5909
6068
|
return updateRef(initialValue);
|
|
5910
6069
|
},
|
|
5911
6070
|
useState: function (initialState) {
|
|
5912
6071
|
currentHookNameInDev = 'useState';
|
|
6072
|
+
updateHookTypesDev();
|
|
5913
6073
|
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
|
5914
6074
|
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
|
|
5915
6075
|
try {
|
|
@@ -5920,6 +6080,7 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
|
5920
6080
|
},
|
|
5921
6081
|
useDebugValue: function (value, formatterFn) {
|
|
5922
6082
|
currentHookNameInDev = 'useDebugValue';
|
|
6083
|
+
updateHookTypesDev();
|
|
5923
6084
|
return updateDebugValue(value, formatterFn);
|
|
5924
6085
|
}
|
|
5925
6086
|
};
|
|
@@ -5932,31 +6093,37 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
|
5932
6093
|
useCallback: function (callback, deps) {
|
|
5933
6094
|
currentHookNameInDev = 'useCallback';
|
|
5934
6095
|
warnInvalidHookAccess();
|
|
6096
|
+
mountHookTypesDev();
|
|
5935
6097
|
return mountCallback(callback, deps);
|
|
5936
6098
|
},
|
|
5937
6099
|
useContext: function (context, observedBits) {
|
|
5938
6100
|
currentHookNameInDev = 'useContext';
|
|
5939
6101
|
warnInvalidHookAccess();
|
|
5940
|
-
|
|
6102
|
+
mountHookTypesDev();
|
|
6103
|
+
return readContext(context, observedBits);
|
|
5941
6104
|
},
|
|
5942
6105
|
useEffect: function (create, deps) {
|
|
5943
6106
|
currentHookNameInDev = 'useEffect';
|
|
5944
6107
|
warnInvalidHookAccess();
|
|
6108
|
+
mountHookTypesDev();
|
|
5945
6109
|
return mountEffect(create, deps);
|
|
5946
6110
|
},
|
|
5947
6111
|
useImperativeHandle: function (ref, create, deps) {
|
|
5948
6112
|
currentHookNameInDev = 'useImperativeHandle';
|
|
5949
6113
|
warnInvalidHookAccess();
|
|
6114
|
+
mountHookTypesDev();
|
|
5950
6115
|
return mountImperativeHandle(ref, create, deps);
|
|
5951
6116
|
},
|
|
5952
6117
|
useLayoutEffect: function (create, deps) {
|
|
5953
6118
|
currentHookNameInDev = 'useLayoutEffect';
|
|
5954
6119
|
warnInvalidHookAccess();
|
|
6120
|
+
mountHookTypesDev();
|
|
5955
6121
|
return mountLayoutEffect(create, deps);
|
|
5956
6122
|
},
|
|
5957
6123
|
useMemo: function (create, deps) {
|
|
5958
6124
|
currentHookNameInDev = 'useMemo';
|
|
5959
6125
|
warnInvalidHookAccess();
|
|
6126
|
+
mountHookTypesDev();
|
|
5960
6127
|
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
|
5961
6128
|
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
|
|
5962
6129
|
try {
|
|
@@ -5968,6 +6135,7 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
|
5968
6135
|
useReducer: function (reducer, initialArg, init) {
|
|
5969
6136
|
currentHookNameInDev = 'useReducer';
|
|
5970
6137
|
warnInvalidHookAccess();
|
|
6138
|
+
mountHookTypesDev();
|
|
5971
6139
|
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
|
5972
6140
|
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
|
|
5973
6141
|
try {
|
|
@@ -5979,11 +6147,13 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
|
5979
6147
|
useRef: function (initialValue) {
|
|
5980
6148
|
currentHookNameInDev = 'useRef';
|
|
5981
6149
|
warnInvalidHookAccess();
|
|
6150
|
+
mountHookTypesDev();
|
|
5982
6151
|
return mountRef(initialValue);
|
|
5983
6152
|
},
|
|
5984
6153
|
useState: function (initialState) {
|
|
5985
6154
|
currentHookNameInDev = 'useState';
|
|
5986
6155
|
warnInvalidHookAccess();
|
|
6156
|
+
mountHookTypesDev();
|
|
5987
6157
|
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
|
5988
6158
|
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
|
|
5989
6159
|
try {
|
|
@@ -5995,6 +6165,7 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
|
5995
6165
|
useDebugValue: function (value, formatterFn) {
|
|
5996
6166
|
currentHookNameInDev = 'useDebugValue';
|
|
5997
6167
|
warnInvalidHookAccess();
|
|
6168
|
+
mountHookTypesDev();
|
|
5998
6169
|
return mountDebugValue(value, formatterFn);
|
|
5999
6170
|
}
|
|
6000
6171
|
};
|
|
@@ -6007,31 +6178,37 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
|
6007
6178
|
useCallback: function (callback, deps) {
|
|
6008
6179
|
currentHookNameInDev = 'useCallback';
|
|
6009
6180
|
warnInvalidHookAccess();
|
|
6181
|
+
updateHookTypesDev();
|
|
6010
6182
|
return updateCallback(callback, deps);
|
|
6011
6183
|
},
|
|
6012
6184
|
useContext: function (context, observedBits) {
|
|
6013
6185
|
currentHookNameInDev = 'useContext';
|
|
6014
6186
|
warnInvalidHookAccess();
|
|
6015
|
-
|
|
6187
|
+
updateHookTypesDev();
|
|
6188
|
+
return readContext(context, observedBits);
|
|
6016
6189
|
},
|
|
6017
6190
|
useEffect: function (create, deps) {
|
|
6018
6191
|
currentHookNameInDev = 'useEffect';
|
|
6019
6192
|
warnInvalidHookAccess();
|
|
6193
|
+
updateHookTypesDev();
|
|
6020
6194
|
return updateEffect(create, deps);
|
|
6021
6195
|
},
|
|
6022
6196
|
useImperativeHandle: function (ref, create, deps) {
|
|
6023
6197
|
currentHookNameInDev = 'useImperativeHandle';
|
|
6024
6198
|
warnInvalidHookAccess();
|
|
6199
|
+
updateHookTypesDev();
|
|
6025
6200
|
return updateImperativeHandle(ref, create, deps);
|
|
6026
6201
|
},
|
|
6027
6202
|
useLayoutEffect: function (create, deps) {
|
|
6028
6203
|
currentHookNameInDev = 'useLayoutEffect';
|
|
6029
6204
|
warnInvalidHookAccess();
|
|
6205
|
+
updateHookTypesDev();
|
|
6030
6206
|
return updateLayoutEffect(create, deps);
|
|
6031
6207
|
},
|
|
6032
6208
|
useMemo: function (create, deps) {
|
|
6033
6209
|
currentHookNameInDev = 'useMemo';
|
|
6034
6210
|
warnInvalidHookAccess();
|
|
6211
|
+
updateHookTypesDev();
|
|
6035
6212
|
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
|
6036
6213
|
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
|
|
6037
6214
|
try {
|
|
@@ -6043,6 +6220,7 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
|
6043
6220
|
useReducer: function (reducer, initialArg, init) {
|
|
6044
6221
|
currentHookNameInDev = 'useReducer';
|
|
6045
6222
|
warnInvalidHookAccess();
|
|
6223
|
+
updateHookTypesDev();
|
|
6046
6224
|
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
|
6047
6225
|
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
|
|
6048
6226
|
try {
|
|
@@ -6054,11 +6232,13 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
|
6054
6232
|
useRef: function (initialValue) {
|
|
6055
6233
|
currentHookNameInDev = 'useRef';
|
|
6056
6234
|
warnInvalidHookAccess();
|
|
6235
|
+
updateHookTypesDev();
|
|
6057
6236
|
return updateRef(initialValue);
|
|
6058
6237
|
},
|
|
6059
6238
|
useState: function (initialState) {
|
|
6060
6239
|
currentHookNameInDev = 'useState';
|
|
6061
6240
|
warnInvalidHookAccess();
|
|
6241
|
+
updateHookTypesDev();
|
|
6062
6242
|
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
|
6063
6243
|
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
|
|
6064
6244
|
try {
|
|
@@ -6070,6 +6250,7 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
|
6070
6250
|
useDebugValue: function (value, formatterFn) {
|
|
6071
6251
|
currentHookNameInDev = 'useDebugValue';
|
|
6072
6252
|
warnInvalidHookAccess();
|
|
6253
|
+
updateHookTypesDev();
|
|
6073
6254
|
return updateDebugValue(value, formatterFn);
|
|
6074
6255
|
}
|
|
6075
6256
|
};
|
|
@@ -9341,11 +9522,11 @@ function commitHookEffectList(unmountTag, mountTag, finishedWork) {
|
|
|
9341
9522
|
if (_destroy === null) {
|
|
9342
9523
|
addendum = ' You returned null. If your effect does not require clean ' + 'up, return undefined (or nothing).';
|
|
9343
9524
|
} else if (typeof _destroy.then === 'function') {
|
|
9344
|
-
addendum = '\n\nIt looks like you wrote useEffect(async () => ...) or returned a Promise. ' + 'Instead,
|
|
9525
|
+
addendum = '\n\nIt looks like you wrote useEffect(async () => ...) or returned a Promise. ' + 'Instead, write the async function inside your effect ' + 'and call it immediately:\n\n' + 'useEffect(() => {\n' + ' async function fetchData() {\n' + ' // You can await here\n' + ' const response = await MyAPI.getData(someId);\n' + ' // ...\n' + ' }\n' + ' fetchData();\n' + '}, [someId]); // Or [] if effect doesn\'t need props or state\n\n' + 'Learn more about data fetching with Hooks: https://fb.me/react-hooks-data-fetching';
|
|
9345
9526
|
} else {
|
|
9346
9527
|
addendum = ' You returned: ' + _destroy;
|
|
9347
9528
|
}
|
|
9348
|
-
warningWithoutStack$1(false, 'An
|
|
9529
|
+
warningWithoutStack$1(false, 'An effect function must not return anything besides a function, ' + 'which is used for clean-up.%s%s', addendum, getStackByFiberInDevAndProd(finishedWork));
|
|
9349
9530
|
}
|
|
9350
9531
|
}
|
|
9351
9532
|
}
|
|
@@ -12652,7 +12833,7 @@ function injectIntoDevTools(devToolsConfig) {
|
|
|
12652
12833
|
|
|
12653
12834
|
// TODO: this is special because it gets imported during build.
|
|
12654
12835
|
|
|
12655
|
-
var ReactVersion = '16.8.
|
|
12836
|
+
var ReactVersion = '16.8.6';
|
|
12656
12837
|
|
|
12657
12838
|
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
12658
12839
|
|