react-dom 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-dom-server.browser.development.js +40 -13
- package/cjs/react-dom-server.browser.production.min.js +16 -15
- package/cjs/react-dom-server.node.development.js +40 -13
- package/cjs/react-dom-server.node.production.min.js +17 -16
- package/cjs/react-dom-test-utils.development.js +1 -1
- package/cjs/react-dom-test-utils.production.min.js +1 -1
- package/cjs/react-dom-unstable-fire.development.js +302 -96
- package/cjs/react-dom-unstable-fire.production.min.js +11 -11
- package/cjs/react-dom-unstable-fire.profiling.min.js +20 -19
- package/cjs/react-dom-unstable-fizz.browser.development.js +1 -1
- package/cjs/react-dom-unstable-fizz.browser.production.min.js +1 -1
- package/cjs/react-dom-unstable-fizz.node.development.js +1 -1
- package/cjs/react-dom-unstable-fizz.node.production.min.js +1 -1
- package/cjs/react-dom-unstable-native-dependencies.development.js +1 -1
- package/cjs/react-dom-unstable-native-dependencies.production.min.js +1 -1
- package/cjs/react-dom.development.js +302 -96
- package/cjs/react-dom.production.min.js +11 -11
- package/cjs/react-dom.profiling.min.js +20 -19
- package/package.json +2 -2
- package/umd/react-dom-server.browser.development.js +40 -13
- package/umd/react-dom-server.browser.production.min.js +16 -15
- package/umd/react-dom-test-utils.development.js +1 -1
- package/umd/react-dom-test-utils.production.min.js +1 -1
- package/umd/react-dom-unstable-fire.development.js +302 -96
- package/umd/react-dom-unstable-fire.production.min.js +64 -64
- package/umd/react-dom-unstable-fire.profiling.min.js +49 -48
- package/umd/react-dom-unstable-fizz.browser.development.js +1 -1
- package/umd/react-dom-unstable-fizz.browser.production.min.js +1 -1
- package/umd/react-dom-unstable-native-dependencies.development.js +1 -1
- package/umd/react-dom-unstable-native-dependencies.production.min.js +1 -1
- package/umd/react-dom.development.js +302 -96
- package/umd/react-dom.production.min.js +64 -64
- package/umd/react-dom.profiling.min.js +49 -48
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license React v16.8.
|
|
1
|
+
/** @license React v16.8.6
|
|
2
2
|
* react-dom-unstable-fire.development.js
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
@@ -5332,15 +5332,29 @@ function isInDocument(node) {
|
|
|
5332
5332
|
return node && node.ownerDocument && containsNode(node.ownerDocument.documentElement, node);
|
|
5333
5333
|
}
|
|
5334
5334
|
|
|
5335
|
+
function isSameOriginFrame(iframe) {
|
|
5336
|
+
try {
|
|
5337
|
+
// Accessing the contentDocument of a HTMLIframeElement can cause the browser
|
|
5338
|
+
// to throw, e.g. if it has a cross-origin src attribute.
|
|
5339
|
+
// Safari will show an error in the console when the access results in "Blocked a frame with origin". e.g:
|
|
5340
|
+
// iframe.contentDocument.defaultView;
|
|
5341
|
+
// A safety way is to access one of the cross origin properties: Window or Location
|
|
5342
|
+
// Which might result in "SecurityError" DOM Exception and it is compatible to Safari.
|
|
5343
|
+
// https://html.spec.whatwg.org/multipage/browsers.html#integration-with-idl
|
|
5344
|
+
|
|
5345
|
+
return typeof iframe.contentWindow.location.href === 'string';
|
|
5346
|
+
} catch (err) {
|
|
5347
|
+
return false;
|
|
5348
|
+
}
|
|
5349
|
+
}
|
|
5350
|
+
|
|
5335
5351
|
function getActiveElementDeep() {
|
|
5336
5352
|
var win = window;
|
|
5337
5353
|
var element = getActiveElement();
|
|
5338
5354
|
while (element instanceof win.HTMLIFrameElement) {
|
|
5339
|
-
|
|
5340
|
-
|
|
5341
|
-
|
|
5342
|
-
win = element.contentDocument.defaultView;
|
|
5343
|
-
} catch (e) {
|
|
5355
|
+
if (isSameOriginFrame(element)) {
|
|
5356
|
+
win = element.contentWindow;
|
|
5357
|
+
} else {
|
|
5344
5358
|
return element;
|
|
5345
5359
|
}
|
|
5346
5360
|
element = getActiveElement(win.document);
|
|
@@ -7630,14 +7644,25 @@ function createElement(type, props, rootContainerElement, parentNamespace) {
|
|
|
7630
7644
|
// See discussion in https://github.com/facebook/react/pull/6896
|
|
7631
7645
|
// and discussion in https://bugzilla.mozilla.org/show_bug.cgi?id=1276240
|
|
7632
7646
|
domElement = ownerDocument.createElement(type);
|
|
7633
|
-
// Normally attributes are assigned in `setInitialDOMProperties`, however the `multiple`
|
|
7634
|
-
//
|
|
7635
|
-
//
|
|
7636
|
-
// `select`
|
|
7647
|
+
// Normally attributes are assigned in `setInitialDOMProperties`, however the `multiple` and `size`
|
|
7648
|
+
// attributes on `select`s needs to be added before `option`s are inserted.
|
|
7649
|
+
// This prevents:
|
|
7650
|
+
// - a bug where the `select` does not scroll to the correct option because singular
|
|
7651
|
+
// `select` elements automatically pick the first item #13222
|
|
7652
|
+
// - a bug where the `select` set the first item as selected despite the `size` attribute #14239
|
|
7637
7653
|
// See https://github.com/facebook/react/issues/13222
|
|
7638
|
-
|
|
7654
|
+
// and https://github.com/facebook/react/issues/14239
|
|
7655
|
+
if (type === 'select') {
|
|
7639
7656
|
var node = domElement;
|
|
7640
|
-
|
|
7657
|
+
if (props.multiple) {
|
|
7658
|
+
node.multiple = true;
|
|
7659
|
+
} else if (props.size) {
|
|
7660
|
+
// Setting a size greater than 1 causes a select to behave like `multiple=true`, where
|
|
7661
|
+
// it is possible that no option is selected.
|
|
7662
|
+
//
|
|
7663
|
+
// This is only necessary when a select in "single selection mode".
|
|
7664
|
+
node.size = props.size;
|
|
7665
|
+
}
|
|
7641
7666
|
}
|
|
7642
7667
|
}
|
|
7643
7668
|
} else {
|
|
@@ -10005,6 +10030,7 @@ function FiberNode(tag, pendingProps, key, mode) {
|
|
|
10005
10030
|
this._debugSource = null;
|
|
10006
10031
|
this._debugOwner = null;
|
|
10007
10032
|
this._debugIsCurrentlyTiming = false;
|
|
10033
|
+
this._debugHookTypes = null;
|
|
10008
10034
|
if (!hasBadMapPolyfill && typeof Object.preventExtensions === 'function') {
|
|
10009
10035
|
Object.preventExtensions(this);
|
|
10010
10036
|
}
|
|
@@ -10072,6 +10098,7 @@ function createWorkInProgress(current, pendingProps, expirationTime) {
|
|
|
10072
10098
|
workInProgress._debugID = current._debugID;
|
|
10073
10099
|
workInProgress._debugSource = current._debugSource;
|
|
10074
10100
|
workInProgress._debugOwner = current._debugOwner;
|
|
10101
|
+
workInProgress._debugHookTypes = current._debugHookTypes;
|
|
10075
10102
|
}
|
|
10076
10103
|
|
|
10077
10104
|
workInProgress.alternate = current;
|
|
@@ -10339,6 +10366,7 @@ function assignFiberPropertiesInDEV(target, source) {
|
|
|
10339
10366
|
target._debugSource = source._debugSource;
|
|
10340
10367
|
target._debugOwner = source._debugOwner;
|
|
10341
10368
|
target._debugIsCurrentlyTiming = source._debugIsCurrentlyTiming;
|
|
10369
|
+
target._debugHookTypes = source._debugHookTypes;
|
|
10342
10370
|
return target;
|
|
10343
10371
|
}
|
|
10344
10372
|
|
|
@@ -11290,14 +11318,35 @@ function constructClassInstance(workInProgress, ctor, props, renderExpirationTim
|
|
|
11290
11318
|
var unmaskedContext = emptyContextObject;
|
|
11291
11319
|
var context = null;
|
|
11292
11320
|
var contextType = ctor.contextType;
|
|
11293
|
-
|
|
11294
|
-
|
|
11295
|
-
|
|
11321
|
+
|
|
11322
|
+
{
|
|
11323
|
+
if ('contextType' in ctor) {
|
|
11324
|
+
var isValid =
|
|
11325
|
+
// Allow null for conditional declaration
|
|
11326
|
+
contextType === null || contextType !== undefined && contextType.$$typeof === REACT_CONTEXT_TYPE && contextType._context === undefined; // Not a <Context.Consumer>
|
|
11327
|
+
|
|
11328
|
+
if (!isValid && !didWarnAboutInvalidateContextType.has(ctor)) {
|
|
11296
11329
|
didWarnAboutInvalidateContextType.add(ctor);
|
|
11297
|
-
|
|
11330
|
+
|
|
11331
|
+
var addendum = '';
|
|
11332
|
+
if (contextType === undefined) {
|
|
11333
|
+
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.';
|
|
11334
|
+
} else if (typeof contextType !== 'object') {
|
|
11335
|
+
addendum = ' However, it is set to a ' + typeof contextType + '.';
|
|
11336
|
+
} else if (contextType.$$typeof === REACT_PROVIDER_TYPE) {
|
|
11337
|
+
addendum = ' Did you accidentally pass the Context.Provider instead?';
|
|
11338
|
+
} else if (contextType._context !== undefined) {
|
|
11339
|
+
// <Context.Consumer>
|
|
11340
|
+
addendum = ' Did you accidentally pass the Context.Consumer instead?';
|
|
11341
|
+
} else {
|
|
11342
|
+
addendum = ' However, it is set to an object with keys {' + Object.keys(contextType).join(', ') + '}.';
|
|
11343
|
+
}
|
|
11344
|
+
warningWithoutStack$1(false, '%s defines an invalid contextType. ' + 'contextType should point to the Context object returned by React.createContext().%s', getComponentName(ctor) || 'Component', addendum);
|
|
11298
11345
|
}
|
|
11299
11346
|
}
|
|
11347
|
+
}
|
|
11300
11348
|
|
|
11349
|
+
if (typeof contextType === 'object' && contextType !== null) {
|
|
11301
11350
|
context = readContext(contextType);
|
|
11302
11351
|
} else {
|
|
11303
11352
|
unmaskedContext = getUnmaskedContext(workInProgress, ctor, true);
|
|
@@ -12724,7 +12773,6 @@ var currentlyRenderingFiber$1 = null;
|
|
|
12724
12773
|
// current hook list is the list that belongs to the current fiber. The
|
|
12725
12774
|
// work-in-progress hook list is a new list that will be added to the
|
|
12726
12775
|
// work-in-progress fiber.
|
|
12727
|
-
var firstCurrentHook = null;
|
|
12728
12776
|
var currentHook = null;
|
|
12729
12777
|
var nextCurrentHook = null;
|
|
12730
12778
|
var firstWorkInProgressHook = null;
|
|
@@ -12754,45 +12802,73 @@ var RE_RENDER_LIMIT = 25;
|
|
|
12754
12802
|
// In DEV, this is the name of the currently executing primitive hook
|
|
12755
12803
|
var currentHookNameInDev = null;
|
|
12756
12804
|
|
|
12757
|
-
|
|
12805
|
+
// In DEV, this list ensures that hooks are called in the same order between renders.
|
|
12806
|
+
// The list stores the order of hooks used during the initial render (mount).
|
|
12807
|
+
// Subsequent renders (updates) reference this list.
|
|
12808
|
+
var hookTypesDev = null;
|
|
12809
|
+
var hookTypesUpdateIndexDev = -1;
|
|
12810
|
+
|
|
12811
|
+
function mountHookTypesDev() {
|
|
12812
|
+
{
|
|
12813
|
+
var hookName = currentHookNameInDev;
|
|
12814
|
+
|
|
12815
|
+
if (hookTypesDev === null) {
|
|
12816
|
+
hookTypesDev = [hookName];
|
|
12817
|
+
} else {
|
|
12818
|
+
hookTypesDev.push(hookName);
|
|
12819
|
+
}
|
|
12820
|
+
}
|
|
12821
|
+
}
|
|
12822
|
+
|
|
12823
|
+
function updateHookTypesDev() {
|
|
12824
|
+
{
|
|
12825
|
+
var hookName = currentHookNameInDev;
|
|
12826
|
+
|
|
12827
|
+
if (hookTypesDev !== null) {
|
|
12828
|
+
hookTypesUpdateIndexDev++;
|
|
12829
|
+
if (hookTypesDev[hookTypesUpdateIndexDev] !== hookName) {
|
|
12830
|
+
warnOnHookMismatchInDev(hookName);
|
|
12831
|
+
}
|
|
12832
|
+
}
|
|
12833
|
+
}
|
|
12834
|
+
}
|
|
12835
|
+
|
|
12836
|
+
function warnOnHookMismatchInDev(currentHookName) {
|
|
12758
12837
|
{
|
|
12759
12838
|
var componentName = getComponentName(currentlyRenderingFiber$1.type);
|
|
12760
12839
|
if (!didWarnAboutMismatchedHooksForComponent.has(componentName)) {
|
|
12761
12840
|
didWarnAboutMismatchedHooksForComponent.add(componentName);
|
|
12762
12841
|
|
|
12763
|
-
|
|
12842
|
+
if (hookTypesDev !== null) {
|
|
12843
|
+
var table = '';
|
|
12764
12844
|
|
|
12765
|
-
|
|
12766
|
-
var prevHook = firstCurrentHook;
|
|
12767
|
-
var nextHook = firstWorkInProgressHook;
|
|
12768
|
-
var n = 1;
|
|
12769
|
-
while (prevHook !== null && nextHook !== null) {
|
|
12770
|
-
var oldHookName = prevHook._debugType;
|
|
12771
|
-
var newHookName = nextHook._debugType;
|
|
12845
|
+
var secondColumnStart = 30;
|
|
12772
12846
|
|
|
12773
|
-
var
|
|
12847
|
+
for (var i = 0; i <= hookTypesUpdateIndexDev; i++) {
|
|
12848
|
+
var oldHookName = hookTypesDev[i];
|
|
12849
|
+
var newHookName = i === hookTypesUpdateIndexDev ? currentHookName : oldHookName;
|
|
12774
12850
|
|
|
12775
|
-
|
|
12776
|
-
// lol @ IE not supporting String#repeat
|
|
12777
|
-
while (row.length < secondColumnStart) {
|
|
12778
|
-
row += ' ';
|
|
12779
|
-
}
|
|
12851
|
+
var row = i + 1 + '. ' + oldHookName;
|
|
12780
12852
|
|
|
12781
|
-
|
|
12853
|
+
// Extra space so second column lines up
|
|
12854
|
+
// lol @ IE not supporting String#repeat
|
|
12855
|
+
while (row.length < secondColumnStart) {
|
|
12856
|
+
row += ' ';
|
|
12857
|
+
}
|
|
12782
12858
|
|
|
12783
|
-
|
|
12784
|
-
prevHook = prevHook.next;
|
|
12785
|
-
nextHook = nextHook.next;
|
|
12786
|
-
n++;
|
|
12787
|
-
}
|
|
12859
|
+
row += newHookName + '\n';
|
|
12788
12860
|
|
|
12789
|
-
|
|
12861
|
+
table += row;
|
|
12862
|
+
}
|
|
12863
|
+
|
|
12864
|
+
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);
|
|
12865
|
+
}
|
|
12790
12866
|
}
|
|
12791
12867
|
}
|
|
12792
12868
|
}
|
|
12793
12869
|
|
|
12794
12870
|
function throwInvalidHookError() {
|
|
12795
|
-
invariant(false, 'Hooks can only be called inside the body of a function component. (https://fb.me/react-invalid-hook-call
|
|
12871
|
+
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.');
|
|
12796
12872
|
}
|
|
12797
12873
|
|
|
12798
12874
|
function areHookInputsEqual(nextDeps, prevDeps) {
|
|
@@ -12822,7 +12898,12 @@ function areHookInputsEqual(nextDeps, prevDeps) {
|
|
|
12822
12898
|
function renderWithHooks(current, workInProgress, Component, props, refOrContext, nextRenderExpirationTime) {
|
|
12823
12899
|
renderExpirationTime = nextRenderExpirationTime;
|
|
12824
12900
|
currentlyRenderingFiber$1 = workInProgress;
|
|
12825
|
-
|
|
12901
|
+
nextCurrentHook = current !== null ? current.memoizedState : null;
|
|
12902
|
+
|
|
12903
|
+
{
|
|
12904
|
+
hookTypesDev = current !== null ? current._debugHookTypes : null;
|
|
12905
|
+
hookTypesUpdateIndexDev = -1;
|
|
12906
|
+
}
|
|
12826
12907
|
|
|
12827
12908
|
// The following should have already been reset
|
|
12828
12909
|
// currentHook = null;
|
|
@@ -12836,8 +12917,26 @@ function renderWithHooks(current, workInProgress, Component, props, refOrContext
|
|
|
12836
12917
|
// numberOfReRenders = 0;
|
|
12837
12918
|
// sideEffectTag = 0;
|
|
12838
12919
|
|
|
12920
|
+
// TODO Warn if no hooks are used at all during mount, then some are used during update.
|
|
12921
|
+
// Currently we will identify the update render as a mount because nextCurrentHook === null.
|
|
12922
|
+
// This is tricky because it's valid for certain types of components (e.g. React.lazy)
|
|
12923
|
+
|
|
12924
|
+
// Using nextCurrentHook to differentiate between mount/update only works if at least one stateful hook is used.
|
|
12925
|
+
// Non-stateful hooks (e.g. context) don't get added to memoizedState,
|
|
12926
|
+
// so nextCurrentHook would be null during updates and mounts.
|
|
12839
12927
|
{
|
|
12840
|
-
|
|
12928
|
+
if (nextCurrentHook !== null) {
|
|
12929
|
+
ReactCurrentDispatcher$1.current = HooksDispatcherOnUpdateInDEV;
|
|
12930
|
+
} else if (hookTypesDev !== null) {
|
|
12931
|
+
// This dispatcher handles an edge case where a component is updating,
|
|
12932
|
+
// but no stateful hooks have been used.
|
|
12933
|
+
// We want to match the production code behavior (which will use HooksDispatcherOnMount),
|
|
12934
|
+
// but with the extra DEV validation to ensure hooks ordering hasn't changed.
|
|
12935
|
+
// This dispatcher does that.
|
|
12936
|
+
ReactCurrentDispatcher$1.current = HooksDispatcherOnMountWithHookTypesInDEV;
|
|
12937
|
+
} else {
|
|
12938
|
+
ReactCurrentDispatcher$1.current = HooksDispatcherOnMountInDEV;
|
|
12939
|
+
}
|
|
12841
12940
|
}
|
|
12842
12941
|
|
|
12843
12942
|
var children = Component(props, refOrContext);
|
|
@@ -12848,13 +12947,18 @@ function renderWithHooks(current, workInProgress, Component, props, refOrContext
|
|
|
12848
12947
|
numberOfReRenders += 1;
|
|
12849
12948
|
|
|
12850
12949
|
// Start over from the beginning of the list
|
|
12851
|
-
|
|
12950
|
+
nextCurrentHook = current !== null ? current.memoizedState : null;
|
|
12852
12951
|
nextWorkInProgressHook = firstWorkInProgressHook;
|
|
12853
12952
|
|
|
12854
12953
|
currentHook = null;
|
|
12855
12954
|
workInProgressHook = null;
|
|
12856
12955
|
componentUpdateQueue = null;
|
|
12857
12956
|
|
|
12957
|
+
{
|
|
12958
|
+
// Also validate hook order for cascading updates.
|
|
12959
|
+
hookTypesUpdateIndexDev = -1;
|
|
12960
|
+
}
|
|
12961
|
+
|
|
12858
12962
|
ReactCurrentDispatcher$1.current = HooksDispatcherOnUpdateInDEV;
|
|
12859
12963
|
|
|
12860
12964
|
children = Component(props, refOrContext);
|
|
@@ -12864,10 +12968,6 @@ function renderWithHooks(current, workInProgress, Component, props, refOrContext
|
|
|
12864
12968
|
numberOfReRenders = 0;
|
|
12865
12969
|
}
|
|
12866
12970
|
|
|
12867
|
-
{
|
|
12868
|
-
currentHookNameInDev = null;
|
|
12869
|
-
}
|
|
12870
|
-
|
|
12871
12971
|
// We can assume the previous dispatcher is always this one, since we set it
|
|
12872
12972
|
// at the beginning of the render phase and there's no re-entrancy.
|
|
12873
12973
|
ReactCurrentDispatcher$1.current = ContextOnlyDispatcher;
|
|
@@ -12879,18 +12979,29 @@ function renderWithHooks(current, workInProgress, Component, props, refOrContext
|
|
|
12879
12979
|
renderedWork.updateQueue = componentUpdateQueue;
|
|
12880
12980
|
renderedWork.effectTag |= sideEffectTag;
|
|
12881
12981
|
|
|
12982
|
+
{
|
|
12983
|
+
renderedWork._debugHookTypes = hookTypesDev;
|
|
12984
|
+
}
|
|
12985
|
+
|
|
12986
|
+
// This check uses currentHook so that it works the same in DEV and prod bundles.
|
|
12987
|
+
// hookTypesDev could catch more cases (e.g. context) but only in DEV bundles.
|
|
12882
12988
|
var didRenderTooFewHooks = currentHook !== null && currentHook.next !== null;
|
|
12883
12989
|
|
|
12884
12990
|
renderExpirationTime = NoWork;
|
|
12885
12991
|
currentlyRenderingFiber$1 = null;
|
|
12886
12992
|
|
|
12887
|
-
firstCurrentHook = null;
|
|
12888
12993
|
currentHook = null;
|
|
12889
12994
|
nextCurrentHook = null;
|
|
12890
12995
|
firstWorkInProgressHook = null;
|
|
12891
12996
|
workInProgressHook = null;
|
|
12892
12997
|
nextWorkInProgressHook = null;
|
|
12893
12998
|
|
|
12999
|
+
{
|
|
13000
|
+
currentHookNameInDev = null;
|
|
13001
|
+
hookTypesDev = null;
|
|
13002
|
+
hookTypesUpdateIndexDev = -1;
|
|
13003
|
+
}
|
|
13004
|
+
|
|
12894
13005
|
remainingExpirationTime = NoWork;
|
|
12895
13006
|
componentUpdateQueue = null;
|
|
12896
13007
|
sideEffectTag = 0;
|
|
@@ -12924,21 +13035,23 @@ function resetHooks() {
|
|
|
12924
13035
|
renderExpirationTime = NoWork;
|
|
12925
13036
|
currentlyRenderingFiber$1 = null;
|
|
12926
13037
|
|
|
12927
|
-
firstCurrentHook = null;
|
|
12928
13038
|
currentHook = null;
|
|
12929
13039
|
nextCurrentHook = null;
|
|
12930
13040
|
firstWorkInProgressHook = null;
|
|
12931
13041
|
workInProgressHook = null;
|
|
12932
13042
|
nextWorkInProgressHook = null;
|
|
12933
13043
|
|
|
12934
|
-
remainingExpirationTime = NoWork;
|
|
12935
|
-
componentUpdateQueue = null;
|
|
12936
|
-
sideEffectTag = 0;
|
|
12937
|
-
|
|
12938
13044
|
{
|
|
13045
|
+
hookTypesDev = null;
|
|
13046
|
+
hookTypesUpdateIndexDev = -1;
|
|
13047
|
+
|
|
12939
13048
|
currentHookNameInDev = null;
|
|
12940
13049
|
}
|
|
12941
13050
|
|
|
13051
|
+
remainingExpirationTime = NoWork;
|
|
13052
|
+
componentUpdateQueue = null;
|
|
13053
|
+
sideEffectTag = 0;
|
|
13054
|
+
|
|
12942
13055
|
didScheduleRenderPhaseUpdate = false;
|
|
12943
13056
|
renderPhaseUpdates = null;
|
|
12944
13057
|
numberOfReRenders = 0;
|
|
@@ -12955,9 +13068,6 @@ function mountWorkInProgressHook() {
|
|
|
12955
13068
|
next: null
|
|
12956
13069
|
};
|
|
12957
13070
|
|
|
12958
|
-
{
|
|
12959
|
-
hook._debugType = currentHookNameInDev;
|
|
12960
|
-
}
|
|
12961
13071
|
if (workInProgressHook === null) {
|
|
12962
13072
|
// This is the first hook in the list
|
|
12963
13073
|
firstWorkInProgressHook = workInProgressHook = hook;
|
|
@@ -13004,13 +13114,6 @@ function updateWorkInProgressHook() {
|
|
|
13004
13114
|
workInProgressHook = workInProgressHook.next = newHook;
|
|
13005
13115
|
}
|
|
13006
13116
|
nextCurrentHook = currentHook.next;
|
|
13007
|
-
|
|
13008
|
-
{
|
|
13009
|
-
newHook._debugType = currentHookNameInDev;
|
|
13010
|
-
if (currentHookNameInDev !== currentHook._debugType) {
|
|
13011
|
-
warnOnHookMismatchInDev();
|
|
13012
|
-
}
|
|
13013
|
-
}
|
|
13014
13117
|
}
|
|
13015
13118
|
return workInProgressHook;
|
|
13016
13119
|
}
|
|
@@ -13025,20 +13128,6 @@ function basicStateReducer(state, action) {
|
|
|
13025
13128
|
return typeof action === 'function' ? action(state) : action;
|
|
13026
13129
|
}
|
|
13027
13130
|
|
|
13028
|
-
function mountContext(context, observedBits) {
|
|
13029
|
-
{
|
|
13030
|
-
mountWorkInProgressHook();
|
|
13031
|
-
}
|
|
13032
|
-
return readContext(context, observedBits);
|
|
13033
|
-
}
|
|
13034
|
-
|
|
13035
|
-
function updateContext(context, observedBits) {
|
|
13036
|
-
{
|
|
13037
|
-
updateWorkInProgressHook();
|
|
13038
|
-
}
|
|
13039
|
-
return readContext(context, observedBits);
|
|
13040
|
-
}
|
|
13041
|
-
|
|
13042
13131
|
function mountReducer(reducer, initialArg, init) {
|
|
13043
13132
|
var hook = mountWorkInProgressHook();
|
|
13044
13133
|
var initialState = void 0;
|
|
@@ -13051,8 +13140,8 @@ function mountReducer(reducer, initialArg, init) {
|
|
|
13051
13140
|
var queue = hook.queue = {
|
|
13052
13141
|
last: null,
|
|
13053
13142
|
dispatch: null,
|
|
13054
|
-
|
|
13055
|
-
|
|
13143
|
+
lastRenderedReducer: reducer,
|
|
13144
|
+
lastRenderedState: initialState
|
|
13056
13145
|
};
|
|
13057
13146
|
var dispatch = queue.dispatch = dispatchAction.bind(null,
|
|
13058
13147
|
// Flow doesn't know this is non-null, but we do.
|
|
@@ -13065,6 +13154,8 @@ function updateReducer(reducer, initialArg, init) {
|
|
|
13065
13154
|
var queue = hook.queue;
|
|
13066
13155
|
!(queue !== null) ? invariant(false, 'Should have a queue. This is likely a bug in React. Please file an issue.') : void 0;
|
|
13067
13156
|
|
|
13157
|
+
queue.lastRenderedReducer = reducer;
|
|
13158
|
+
|
|
13068
13159
|
if (numberOfReRenders > 0) {
|
|
13069
13160
|
// This is a re-render. Apply the new render phase updates to the previous
|
|
13070
13161
|
var _dispatch = queue.dispatch;
|
|
@@ -13091,7 +13182,6 @@ function updateReducer(reducer, initialArg, init) {
|
|
|
13091
13182
|
}
|
|
13092
13183
|
|
|
13093
13184
|
hook.memoizedState = newState;
|
|
13094
|
-
|
|
13095
13185
|
// Don't persist the state accumlated from the render phase updates to
|
|
13096
13186
|
// the base state unless the queue is empty.
|
|
13097
13187
|
// TODO: Not sure if this is the desired semantics, but it's what we
|
|
@@ -13100,6 +13190,8 @@ function updateReducer(reducer, initialArg, init) {
|
|
|
13100
13190
|
hook.baseState = newState;
|
|
13101
13191
|
}
|
|
13102
13192
|
|
|
13193
|
+
queue.lastRenderedState = newState;
|
|
13194
|
+
|
|
13103
13195
|
return [newState, _dispatch];
|
|
13104
13196
|
}
|
|
13105
13197
|
}
|
|
@@ -13177,8 +13269,7 @@ function updateReducer(reducer, initialArg, init) {
|
|
|
13177
13269
|
hook.baseUpdate = newBaseUpdate;
|
|
13178
13270
|
hook.baseState = newBaseState;
|
|
13179
13271
|
|
|
13180
|
-
queue.
|
|
13181
|
-
queue.eagerState = _newState;
|
|
13272
|
+
queue.lastRenderedState = _newState;
|
|
13182
13273
|
}
|
|
13183
13274
|
|
|
13184
13275
|
var dispatch = queue.dispatch;
|
|
@@ -13194,8 +13285,8 @@ function mountState(initialState) {
|
|
|
13194
13285
|
var queue = hook.queue = {
|
|
13195
13286
|
last: null,
|
|
13196
13287
|
dispatch: null,
|
|
13197
|
-
|
|
13198
|
-
|
|
13288
|
+
lastRenderedReducer: basicStateReducer,
|
|
13289
|
+
lastRenderedState: initialState
|
|
13199
13290
|
};
|
|
13200
13291
|
var dispatch = queue.dispatch = dispatchAction.bind(null,
|
|
13201
13292
|
// Flow doesn't know this is non-null, but we do.
|
|
@@ -13472,21 +13563,21 @@ function dispatchAction(fiber, queue, action) {
|
|
|
13472
13563
|
// The queue is currently empty, which means we can eagerly compute the
|
|
13473
13564
|
// next state before entering the render phase. If the new state is the
|
|
13474
13565
|
// same as the current state, we may be able to bail out entirely.
|
|
13475
|
-
var
|
|
13476
|
-
if (
|
|
13566
|
+
var _lastRenderedReducer = queue.lastRenderedReducer;
|
|
13567
|
+
if (_lastRenderedReducer !== null) {
|
|
13477
13568
|
var prevDispatcher = void 0;
|
|
13478
13569
|
{
|
|
13479
13570
|
prevDispatcher = ReactCurrentDispatcher$1.current;
|
|
13480
13571
|
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
|
|
13481
13572
|
}
|
|
13482
13573
|
try {
|
|
13483
|
-
var currentState = queue.
|
|
13484
|
-
var _eagerState =
|
|
13574
|
+
var currentState = queue.lastRenderedState;
|
|
13575
|
+
var _eagerState = _lastRenderedReducer(currentState, action);
|
|
13485
13576
|
// Stash the eagerly computed state, and the reducer used to compute
|
|
13486
13577
|
// it, on the update object. If the reducer hasn't changed by the
|
|
13487
13578
|
// time we enter the render phase, then the eager state can be used
|
|
13488
13579
|
// without calling the reducer again.
|
|
13489
|
-
_update2.eagerReducer =
|
|
13580
|
+
_update2.eagerReducer = _lastRenderedReducer;
|
|
13490
13581
|
_update2.eagerState = _eagerState;
|
|
13491
13582
|
if (is(_eagerState, currentState)) {
|
|
13492
13583
|
// Fast path. We can bail out without scheduling React to re-render.
|
|
@@ -13529,6 +13620,7 @@ var ContextOnlyDispatcher = {
|
|
|
13529
13620
|
};
|
|
13530
13621
|
|
|
13531
13622
|
var HooksDispatcherOnMountInDEV = null;
|
|
13623
|
+
var HooksDispatcherOnMountWithHookTypesInDEV = null;
|
|
13532
13624
|
var HooksDispatcherOnUpdateInDEV = null;
|
|
13533
13625
|
var InvalidNestedHooksDispatcherOnMountInDEV = null;
|
|
13534
13626
|
var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
@@ -13548,26 +13640,106 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
|
13548
13640
|
},
|
|
13549
13641
|
useCallback: function (callback, deps) {
|
|
13550
13642
|
currentHookNameInDev = 'useCallback';
|
|
13643
|
+
mountHookTypesDev();
|
|
13644
|
+
return mountCallback(callback, deps);
|
|
13645
|
+
},
|
|
13646
|
+
useContext: function (context, observedBits) {
|
|
13647
|
+
currentHookNameInDev = 'useContext';
|
|
13648
|
+
mountHookTypesDev();
|
|
13649
|
+
return readContext(context, observedBits);
|
|
13650
|
+
},
|
|
13651
|
+
useEffect: function (create, deps) {
|
|
13652
|
+
currentHookNameInDev = 'useEffect';
|
|
13653
|
+
mountHookTypesDev();
|
|
13654
|
+
return mountEffect(create, deps);
|
|
13655
|
+
},
|
|
13656
|
+
useImperativeHandle: function (ref, create, deps) {
|
|
13657
|
+
currentHookNameInDev = 'useImperativeHandle';
|
|
13658
|
+
mountHookTypesDev();
|
|
13659
|
+
return mountImperativeHandle(ref, create, deps);
|
|
13660
|
+
},
|
|
13661
|
+
useLayoutEffect: function (create, deps) {
|
|
13662
|
+
currentHookNameInDev = 'useLayoutEffect';
|
|
13663
|
+
mountHookTypesDev();
|
|
13664
|
+
return mountLayoutEffect(create, deps);
|
|
13665
|
+
},
|
|
13666
|
+
useMemo: function (create, deps) {
|
|
13667
|
+
currentHookNameInDev = 'useMemo';
|
|
13668
|
+
mountHookTypesDev();
|
|
13669
|
+
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
|
13670
|
+
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
|
|
13671
|
+
try {
|
|
13672
|
+
return mountMemo(create, deps);
|
|
13673
|
+
} finally {
|
|
13674
|
+
ReactCurrentDispatcher$1.current = prevDispatcher;
|
|
13675
|
+
}
|
|
13676
|
+
},
|
|
13677
|
+
useReducer: function (reducer, initialArg, init) {
|
|
13678
|
+
currentHookNameInDev = 'useReducer';
|
|
13679
|
+
mountHookTypesDev();
|
|
13680
|
+
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
|
13681
|
+
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
|
|
13682
|
+
try {
|
|
13683
|
+
return mountReducer(reducer, initialArg, init);
|
|
13684
|
+
} finally {
|
|
13685
|
+
ReactCurrentDispatcher$1.current = prevDispatcher;
|
|
13686
|
+
}
|
|
13687
|
+
},
|
|
13688
|
+
useRef: function (initialValue) {
|
|
13689
|
+
currentHookNameInDev = 'useRef';
|
|
13690
|
+
mountHookTypesDev();
|
|
13691
|
+
return mountRef(initialValue);
|
|
13692
|
+
},
|
|
13693
|
+
useState: function (initialState) {
|
|
13694
|
+
currentHookNameInDev = 'useState';
|
|
13695
|
+
mountHookTypesDev();
|
|
13696
|
+
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
|
13697
|
+
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
|
|
13698
|
+
try {
|
|
13699
|
+
return mountState(initialState);
|
|
13700
|
+
} finally {
|
|
13701
|
+
ReactCurrentDispatcher$1.current = prevDispatcher;
|
|
13702
|
+
}
|
|
13703
|
+
},
|
|
13704
|
+
useDebugValue: function (value, formatterFn) {
|
|
13705
|
+
currentHookNameInDev = 'useDebugValue';
|
|
13706
|
+
mountHookTypesDev();
|
|
13707
|
+
return mountDebugValue(value, formatterFn);
|
|
13708
|
+
}
|
|
13709
|
+
};
|
|
13710
|
+
|
|
13711
|
+
HooksDispatcherOnMountWithHookTypesInDEV = {
|
|
13712
|
+
readContext: function (context, observedBits) {
|
|
13713
|
+
return readContext(context, observedBits);
|
|
13714
|
+
},
|
|
13715
|
+
useCallback: function (callback, deps) {
|
|
13716
|
+
currentHookNameInDev = 'useCallback';
|
|
13717
|
+
updateHookTypesDev();
|
|
13551
13718
|
return mountCallback(callback, deps);
|
|
13552
13719
|
},
|
|
13553
13720
|
useContext: function (context, observedBits) {
|
|
13554
13721
|
currentHookNameInDev = 'useContext';
|
|
13555
|
-
|
|
13722
|
+
updateHookTypesDev();
|
|
13723
|
+
return readContext(context, observedBits);
|
|
13556
13724
|
},
|
|
13557
13725
|
useEffect: function (create, deps) {
|
|
13558
13726
|
currentHookNameInDev = 'useEffect';
|
|
13727
|
+
updateHookTypesDev();
|
|
13559
13728
|
return mountEffect(create, deps);
|
|
13560
13729
|
},
|
|
13561
13730
|
useImperativeHandle: function (ref, create, deps) {
|
|
13562
13731
|
currentHookNameInDev = 'useImperativeHandle';
|
|
13732
|
+
updateHookTypesDev();
|
|
13563
13733
|
return mountImperativeHandle(ref, create, deps);
|
|
13564
13734
|
},
|
|
13565
13735
|
useLayoutEffect: function (create, deps) {
|
|
13566
13736
|
currentHookNameInDev = 'useLayoutEffect';
|
|
13737
|
+
updateHookTypesDev();
|
|
13567
13738
|
return mountLayoutEffect(create, deps);
|
|
13568
13739
|
},
|
|
13569
13740
|
useMemo: function (create, deps) {
|
|
13570
13741
|
currentHookNameInDev = 'useMemo';
|
|
13742
|
+
updateHookTypesDev();
|
|
13571
13743
|
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
|
13572
13744
|
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
|
|
13573
13745
|
try {
|
|
@@ -13578,6 +13750,7 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
|
13578
13750
|
},
|
|
13579
13751
|
useReducer: function (reducer, initialArg, init) {
|
|
13580
13752
|
currentHookNameInDev = 'useReducer';
|
|
13753
|
+
updateHookTypesDev();
|
|
13581
13754
|
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
|
13582
13755
|
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
|
|
13583
13756
|
try {
|
|
@@ -13588,10 +13761,12 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
|
13588
13761
|
},
|
|
13589
13762
|
useRef: function (initialValue) {
|
|
13590
13763
|
currentHookNameInDev = 'useRef';
|
|
13764
|
+
updateHookTypesDev();
|
|
13591
13765
|
return mountRef(initialValue);
|
|
13592
13766
|
},
|
|
13593
13767
|
useState: function (initialState) {
|
|
13594
13768
|
currentHookNameInDev = 'useState';
|
|
13769
|
+
updateHookTypesDev();
|
|
13595
13770
|
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
|
13596
13771
|
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
|
|
13597
13772
|
try {
|
|
@@ -13602,6 +13777,7 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
|
13602
13777
|
},
|
|
13603
13778
|
useDebugValue: function (value, formatterFn) {
|
|
13604
13779
|
currentHookNameInDev = 'useDebugValue';
|
|
13780
|
+
updateHookTypesDev();
|
|
13605
13781
|
return mountDebugValue(value, formatterFn);
|
|
13606
13782
|
}
|
|
13607
13783
|
};
|
|
@@ -13612,26 +13788,32 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
|
13612
13788
|
},
|
|
13613
13789
|
useCallback: function (callback, deps) {
|
|
13614
13790
|
currentHookNameInDev = 'useCallback';
|
|
13791
|
+
updateHookTypesDev();
|
|
13615
13792
|
return updateCallback(callback, deps);
|
|
13616
13793
|
},
|
|
13617
13794
|
useContext: function (context, observedBits) {
|
|
13618
13795
|
currentHookNameInDev = 'useContext';
|
|
13619
|
-
|
|
13796
|
+
updateHookTypesDev();
|
|
13797
|
+
return readContext(context, observedBits);
|
|
13620
13798
|
},
|
|
13621
13799
|
useEffect: function (create, deps) {
|
|
13622
13800
|
currentHookNameInDev = 'useEffect';
|
|
13801
|
+
updateHookTypesDev();
|
|
13623
13802
|
return updateEffect(create, deps);
|
|
13624
13803
|
},
|
|
13625
13804
|
useImperativeHandle: function (ref, create, deps) {
|
|
13626
13805
|
currentHookNameInDev = 'useImperativeHandle';
|
|
13806
|
+
updateHookTypesDev();
|
|
13627
13807
|
return updateImperativeHandle(ref, create, deps);
|
|
13628
13808
|
},
|
|
13629
13809
|
useLayoutEffect: function (create, deps) {
|
|
13630
13810
|
currentHookNameInDev = 'useLayoutEffect';
|
|
13811
|
+
updateHookTypesDev();
|
|
13631
13812
|
return updateLayoutEffect(create, deps);
|
|
13632
13813
|
},
|
|
13633
13814
|
useMemo: function (create, deps) {
|
|
13634
13815
|
currentHookNameInDev = 'useMemo';
|
|
13816
|
+
updateHookTypesDev();
|
|
13635
13817
|
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
|
13636
13818
|
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
|
|
13637
13819
|
try {
|
|
@@ -13642,6 +13824,7 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
|
13642
13824
|
},
|
|
13643
13825
|
useReducer: function (reducer, initialArg, init) {
|
|
13644
13826
|
currentHookNameInDev = 'useReducer';
|
|
13827
|
+
updateHookTypesDev();
|
|
13645
13828
|
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
|
13646
13829
|
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
|
|
13647
13830
|
try {
|
|
@@ -13652,10 +13835,12 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
|
13652
13835
|
},
|
|
13653
13836
|
useRef: function (initialValue) {
|
|
13654
13837
|
currentHookNameInDev = 'useRef';
|
|
13838
|
+
updateHookTypesDev();
|
|
13655
13839
|
return updateRef(initialValue);
|
|
13656
13840
|
},
|
|
13657
13841
|
useState: function (initialState) {
|
|
13658
13842
|
currentHookNameInDev = 'useState';
|
|
13843
|
+
updateHookTypesDev();
|
|
13659
13844
|
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
|
13660
13845
|
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
|
|
13661
13846
|
try {
|
|
@@ -13666,6 +13851,7 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
|
13666
13851
|
},
|
|
13667
13852
|
useDebugValue: function (value, formatterFn) {
|
|
13668
13853
|
currentHookNameInDev = 'useDebugValue';
|
|
13854
|
+
updateHookTypesDev();
|
|
13669
13855
|
return updateDebugValue(value, formatterFn);
|
|
13670
13856
|
}
|
|
13671
13857
|
};
|
|
@@ -13678,31 +13864,37 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
|
13678
13864
|
useCallback: function (callback, deps) {
|
|
13679
13865
|
currentHookNameInDev = 'useCallback';
|
|
13680
13866
|
warnInvalidHookAccess();
|
|
13867
|
+
mountHookTypesDev();
|
|
13681
13868
|
return mountCallback(callback, deps);
|
|
13682
13869
|
},
|
|
13683
13870
|
useContext: function (context, observedBits) {
|
|
13684
13871
|
currentHookNameInDev = 'useContext';
|
|
13685
13872
|
warnInvalidHookAccess();
|
|
13686
|
-
|
|
13873
|
+
mountHookTypesDev();
|
|
13874
|
+
return readContext(context, observedBits);
|
|
13687
13875
|
},
|
|
13688
13876
|
useEffect: function (create, deps) {
|
|
13689
13877
|
currentHookNameInDev = 'useEffect';
|
|
13690
13878
|
warnInvalidHookAccess();
|
|
13879
|
+
mountHookTypesDev();
|
|
13691
13880
|
return mountEffect(create, deps);
|
|
13692
13881
|
},
|
|
13693
13882
|
useImperativeHandle: function (ref, create, deps) {
|
|
13694
13883
|
currentHookNameInDev = 'useImperativeHandle';
|
|
13695
13884
|
warnInvalidHookAccess();
|
|
13885
|
+
mountHookTypesDev();
|
|
13696
13886
|
return mountImperativeHandle(ref, create, deps);
|
|
13697
13887
|
},
|
|
13698
13888
|
useLayoutEffect: function (create, deps) {
|
|
13699
13889
|
currentHookNameInDev = 'useLayoutEffect';
|
|
13700
13890
|
warnInvalidHookAccess();
|
|
13891
|
+
mountHookTypesDev();
|
|
13701
13892
|
return mountLayoutEffect(create, deps);
|
|
13702
13893
|
},
|
|
13703
13894
|
useMemo: function (create, deps) {
|
|
13704
13895
|
currentHookNameInDev = 'useMemo';
|
|
13705
13896
|
warnInvalidHookAccess();
|
|
13897
|
+
mountHookTypesDev();
|
|
13706
13898
|
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
|
13707
13899
|
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
|
|
13708
13900
|
try {
|
|
@@ -13714,6 +13906,7 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
|
13714
13906
|
useReducer: function (reducer, initialArg, init) {
|
|
13715
13907
|
currentHookNameInDev = 'useReducer';
|
|
13716
13908
|
warnInvalidHookAccess();
|
|
13909
|
+
mountHookTypesDev();
|
|
13717
13910
|
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
|
13718
13911
|
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
|
|
13719
13912
|
try {
|
|
@@ -13725,11 +13918,13 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
|
13725
13918
|
useRef: function (initialValue) {
|
|
13726
13919
|
currentHookNameInDev = 'useRef';
|
|
13727
13920
|
warnInvalidHookAccess();
|
|
13921
|
+
mountHookTypesDev();
|
|
13728
13922
|
return mountRef(initialValue);
|
|
13729
13923
|
},
|
|
13730
13924
|
useState: function (initialState) {
|
|
13731
13925
|
currentHookNameInDev = 'useState';
|
|
13732
13926
|
warnInvalidHookAccess();
|
|
13927
|
+
mountHookTypesDev();
|
|
13733
13928
|
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
|
13734
13929
|
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
|
|
13735
13930
|
try {
|
|
@@ -13741,6 +13936,7 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
|
13741
13936
|
useDebugValue: function (value, formatterFn) {
|
|
13742
13937
|
currentHookNameInDev = 'useDebugValue';
|
|
13743
13938
|
warnInvalidHookAccess();
|
|
13939
|
+
mountHookTypesDev();
|
|
13744
13940
|
return mountDebugValue(value, formatterFn);
|
|
13745
13941
|
}
|
|
13746
13942
|
};
|
|
@@ -13753,31 +13949,37 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
|
13753
13949
|
useCallback: function (callback, deps) {
|
|
13754
13950
|
currentHookNameInDev = 'useCallback';
|
|
13755
13951
|
warnInvalidHookAccess();
|
|
13952
|
+
updateHookTypesDev();
|
|
13756
13953
|
return updateCallback(callback, deps);
|
|
13757
13954
|
},
|
|
13758
13955
|
useContext: function (context, observedBits) {
|
|
13759
13956
|
currentHookNameInDev = 'useContext';
|
|
13760
13957
|
warnInvalidHookAccess();
|
|
13761
|
-
|
|
13958
|
+
updateHookTypesDev();
|
|
13959
|
+
return readContext(context, observedBits);
|
|
13762
13960
|
},
|
|
13763
13961
|
useEffect: function (create, deps) {
|
|
13764
13962
|
currentHookNameInDev = 'useEffect';
|
|
13765
13963
|
warnInvalidHookAccess();
|
|
13964
|
+
updateHookTypesDev();
|
|
13766
13965
|
return updateEffect(create, deps);
|
|
13767
13966
|
},
|
|
13768
13967
|
useImperativeHandle: function (ref, create, deps) {
|
|
13769
13968
|
currentHookNameInDev = 'useImperativeHandle';
|
|
13770
13969
|
warnInvalidHookAccess();
|
|
13970
|
+
updateHookTypesDev();
|
|
13771
13971
|
return updateImperativeHandle(ref, create, deps);
|
|
13772
13972
|
},
|
|
13773
13973
|
useLayoutEffect: function (create, deps) {
|
|
13774
13974
|
currentHookNameInDev = 'useLayoutEffect';
|
|
13775
13975
|
warnInvalidHookAccess();
|
|
13976
|
+
updateHookTypesDev();
|
|
13776
13977
|
return updateLayoutEffect(create, deps);
|
|
13777
13978
|
},
|
|
13778
13979
|
useMemo: function (create, deps) {
|
|
13779
13980
|
currentHookNameInDev = 'useMemo';
|
|
13780
13981
|
warnInvalidHookAccess();
|
|
13982
|
+
updateHookTypesDev();
|
|
13781
13983
|
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
|
13782
13984
|
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
|
|
13783
13985
|
try {
|
|
@@ -13789,6 +13991,7 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
|
13789
13991
|
useReducer: function (reducer, initialArg, init) {
|
|
13790
13992
|
currentHookNameInDev = 'useReducer';
|
|
13791
13993
|
warnInvalidHookAccess();
|
|
13994
|
+
updateHookTypesDev();
|
|
13792
13995
|
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
|
13793
13996
|
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
|
|
13794
13997
|
try {
|
|
@@ -13800,11 +14003,13 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
|
13800
14003
|
useRef: function (initialValue) {
|
|
13801
14004
|
currentHookNameInDev = 'useRef';
|
|
13802
14005
|
warnInvalidHookAccess();
|
|
14006
|
+
updateHookTypesDev();
|
|
13803
14007
|
return updateRef(initialValue);
|
|
13804
14008
|
},
|
|
13805
14009
|
useState: function (initialState) {
|
|
13806
14010
|
currentHookNameInDev = 'useState';
|
|
13807
14011
|
warnInvalidHookAccess();
|
|
14012
|
+
updateHookTypesDev();
|
|
13808
14013
|
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
|
13809
14014
|
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
|
|
13810
14015
|
try {
|
|
@@ -13816,6 +14021,7 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
|
13816
14021
|
useDebugValue: function (value, formatterFn) {
|
|
13817
14022
|
currentHookNameInDev = 'useDebugValue';
|
|
13818
14023
|
warnInvalidHookAccess();
|
|
14024
|
+
updateHookTypesDev();
|
|
13819
14025
|
return updateDebugValue(value, formatterFn);
|
|
13820
14026
|
}
|
|
13821
14027
|
};
|
|
@@ -17087,11 +17293,11 @@ function commitHookEffectList(unmountTag, mountTag, finishedWork) {
|
|
|
17087
17293
|
if (_destroy === null) {
|
|
17088
17294
|
addendum = ' You returned null. If your effect does not require clean ' + 'up, return undefined (or nothing).';
|
|
17089
17295
|
} else if (typeof _destroy.then === 'function') {
|
|
17090
|
-
addendum = '\n\nIt looks like you wrote useEffect(async () => ...) or returned a Promise. ' + 'Instead,
|
|
17296
|
+
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';
|
|
17091
17297
|
} else {
|
|
17092
17298
|
addendum = ' You returned: ' + _destroy;
|
|
17093
17299
|
}
|
|
17094
|
-
warningWithoutStack$1(false, 'An
|
|
17300
|
+
warningWithoutStack$1(false, 'An effect function must not return anything besides a function, ' + 'which is used for clean-up.%s%s', addendum, getStackByFiberInDevAndProd(finishedWork));
|
|
17095
17301
|
}
|
|
17096
17302
|
}
|
|
17097
17303
|
}
|
|
@@ -20550,7 +20756,7 @@ implementation) {
|
|
|
20550
20756
|
|
|
20551
20757
|
// TODO: this is special because it gets imported during build.
|
|
20552
20758
|
|
|
20553
|
-
var ReactVersion = '16.8.
|
|
20759
|
+
var ReactVersion = '16.8.6';
|
|
20554
20760
|
|
|
20555
20761
|
// This file is copy paste from ReactDOM with adjusted paths
|
|
20556
20762
|
// and a different host config import (react-reconciler/inline.fire).
|