react-dom 16.8.0-alpha.1 → 16.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build-info.json +5 -5
- package/cjs/react-dom-server.browser.development.js +102 -45
- package/cjs/react-dom-server.browser.production.min.js +10 -10
- package/cjs/react-dom-server.node.development.js +102 -45
- package/cjs/react-dom-server.node.production.min.js +10 -10
- package/cjs/react-dom-test-utils.development.js +33 -2
- package/cjs/react-dom-test-utils.production.min.js +9 -9
- package/cjs/react-dom-unstable-fire.development.js +4212 -3555
- package/cjs/react-dom-unstable-fire.production.min.js +208 -200
- package/cjs/react-dom-unstable-fire.profiling.min.js +191 -188
- 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 +4504 -3848
- package/cjs/react-dom.production.min.js +208 -200
- package/cjs/react-dom.profiling.min.js +191 -188
- package/package.json +7 -3
- package/umd/react-dom-server.browser.development.js +102 -45
- package/umd/react-dom-server.browser.production.min.js +19 -19
- package/umd/react-dom-test-utils.development.js +33 -2
- package/umd/react-dom-test-utils.production.min.js +21 -21
- package/umd/react-dom-unstable-fire.development.js +4212 -3555
- package/umd/react-dom-unstable-fire.production.min.js +207 -202
- package/umd/react-dom-unstable-fire.profiling.min.js +212 -209
- 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 +4504 -3848
- package/umd/react-dom.production.min.js +207 -202
- package/umd/react-dom.profiling.min.js +212 -209
package/build-info.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
|
-
"branch": "
|
|
3
|
-
"buildNumber": "
|
|
4
|
-
"checksum": "
|
|
5
|
-
"commit": "
|
|
2
|
+
"branch": "master",
|
|
3
|
+
"buildNumber": "13364",
|
|
4
|
+
"checksum": "ae8143f",
|
|
5
|
+
"commit": "d1326f466",
|
|
6
6
|
"environment": "ci",
|
|
7
|
-
"reactVersion": "16.7.0-canary-
|
|
7
|
+
"reactVersion": "16.7.0-canary-d1326f466"
|
|
8
8
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license React v16.8.0
|
|
1
|
+
/** @license React v16.8.0
|
|
2
2
|
* react-dom-server.browser.development.js
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
@@ -66,7 +66,7 @@ function invariant(condition, format, a, b, c, d, e, f) {
|
|
|
66
66
|
|
|
67
67
|
// TODO: this is special because it gets imported during build.
|
|
68
68
|
|
|
69
|
-
var ReactVersion = '16.8.0
|
|
69
|
+
var ReactVersion = '16.8.0';
|
|
70
70
|
|
|
71
71
|
/**
|
|
72
72
|
* Similar to invariant but only logs a warning if the condition is not met.
|
|
@@ -312,7 +312,6 @@ var describeComponentFrame = function (name, source, ownerName) {
|
|
|
312
312
|
return '\n in ' + (name || 'Unknown') + sourceInfo;
|
|
313
313
|
};
|
|
314
314
|
|
|
315
|
-
var enableHooks = true;
|
|
316
315
|
// Helps identify side effects in begin-phase lifecycle hooks and setState reducers:
|
|
317
316
|
|
|
318
317
|
|
|
@@ -902,21 +901,6 @@ function is(x, y) {
|
|
|
902
901
|
;
|
|
903
902
|
}
|
|
904
903
|
|
|
905
|
-
function areHookInputsEqual(arr1, arr2) {
|
|
906
|
-
// Don't bother comparing lengths in prod because these arrays should be
|
|
907
|
-
// passed inline.
|
|
908
|
-
{
|
|
909
|
-
!(arr1.length === arr2.length) ? warning$1(false, 'Detected a variable number of hook dependencies. The length of the ' + 'dependencies array should be constant between renders.\n\n' + 'Previous: %s\n' + 'Incoming: %s', arr1.join(', '), arr2.join(', ')) : void 0;
|
|
910
|
-
}
|
|
911
|
-
for (var i = 0; i < arr1.length; i++) {
|
|
912
|
-
if (is(arr1[i], arr2[i])) {
|
|
913
|
-
continue;
|
|
914
|
-
}
|
|
915
|
-
return false;
|
|
916
|
-
}
|
|
917
|
-
return true;
|
|
918
|
-
}
|
|
919
|
-
|
|
920
904
|
var currentlyRenderingComponent = null;
|
|
921
905
|
var firstWorkInProgressHook = null;
|
|
922
906
|
var workInProgressHook = null;
|
|
@@ -930,12 +914,47 @@ var renderPhaseUpdates = null;
|
|
|
930
914
|
var numberOfReRenders = 0;
|
|
931
915
|
var RE_RENDER_LIMIT = 25;
|
|
932
916
|
|
|
917
|
+
var isInHookUserCodeInDev = false;
|
|
918
|
+
|
|
919
|
+
// In DEV, this is the name of the currently executing primitive hook
|
|
920
|
+
var currentHookNameInDev = void 0;
|
|
921
|
+
|
|
933
922
|
function resolveCurrentlyRenderingComponent() {
|
|
934
|
-
!(currentlyRenderingComponent !== null) ? invariant(false, 'Hooks can only be called inside the body of a function component.') : void 0;
|
|
923
|
+
!(currentlyRenderingComponent !== null) ? invariant(false, 'Hooks can only be called inside the body of a function component. (https://fb.me/react-invalid-hook-call)') : void 0;
|
|
924
|
+
{
|
|
925
|
+
!!isInHookUserCodeInDev ? warning$1(false, 'Do not call Hooks inside useEffect(...), useMemo(...), or other built-in Hooks. ' + 'You can only call Hooks at the top level of your React function. ' + 'For more information, see ' + 'https://fb.me/rules-of-hooks') : void 0;
|
|
926
|
+
}
|
|
935
927
|
return currentlyRenderingComponent;
|
|
936
928
|
}
|
|
937
929
|
|
|
930
|
+
function areHookInputsEqual(nextDeps, prevDeps) {
|
|
931
|
+
if (prevDeps === null) {
|
|
932
|
+
{
|
|
933
|
+
warning$1(false, '%s received a final argument during this render, but not during ' + 'the previous render. Even though the final argument is optional, ' + 'its type cannot change between renders.', currentHookNameInDev);
|
|
934
|
+
}
|
|
935
|
+
return false;
|
|
936
|
+
}
|
|
937
|
+
|
|
938
|
+
{
|
|
939
|
+
// Don't bother comparing lengths in prod because these arrays should be
|
|
940
|
+
// passed inline.
|
|
941
|
+
if (nextDeps.length !== prevDeps.length) {
|
|
942
|
+
warning$1(false, 'The final argument passed to %s changed size between renders. The ' + 'order and size of this array must remain constant.\n\n' + 'Previous: %s\n' + 'Incoming: %s', currentHookNameInDev, '[' + nextDeps.join(', ') + ']', '[' + prevDeps.join(', ') + ']');
|
|
943
|
+
}
|
|
944
|
+
}
|
|
945
|
+
for (var i = 0; i < prevDeps.length && i < nextDeps.length; i++) {
|
|
946
|
+
if (is(nextDeps[i], prevDeps[i])) {
|
|
947
|
+
continue;
|
|
948
|
+
}
|
|
949
|
+
return false;
|
|
950
|
+
}
|
|
951
|
+
return true;
|
|
952
|
+
}
|
|
953
|
+
|
|
938
954
|
function createHook() {
|
|
955
|
+
if (numberOfReRenders > 0) {
|
|
956
|
+
invariant(false, 'Rendered more hooks than during the previous render');
|
|
957
|
+
}
|
|
939
958
|
return {
|
|
940
959
|
memoizedState: null,
|
|
941
960
|
queue: null,
|
|
@@ -970,6 +989,9 @@ function createWorkInProgressHook() {
|
|
|
970
989
|
|
|
971
990
|
function prepareToUseHooks(componentIdentity) {
|
|
972
991
|
currentlyRenderingComponent = componentIdentity;
|
|
992
|
+
{
|
|
993
|
+
isInHookUserCodeInDev = false;
|
|
994
|
+
}
|
|
973
995
|
|
|
974
996
|
// The following should have already been reset
|
|
975
997
|
// didScheduleRenderPhaseUpdate = false;
|
|
@@ -1001,6 +1023,9 @@ function finishHooks(Component, props, children, refOrContext) {
|
|
|
1001
1023
|
numberOfReRenders = 0;
|
|
1002
1024
|
renderPhaseUpdates = null;
|
|
1003
1025
|
workInProgressHook = null;
|
|
1026
|
+
{
|
|
1027
|
+
isInHookUserCodeInDev = false;
|
|
1028
|
+
}
|
|
1004
1029
|
|
|
1005
1030
|
// These were reset above
|
|
1006
1031
|
// currentlyRenderingComponent = null;
|
|
@@ -1016,10 +1041,16 @@ function finishHooks(Component, props, children, refOrContext) {
|
|
|
1016
1041
|
function readContext(context, observedBits) {
|
|
1017
1042
|
var threadID = currentThreadID;
|
|
1018
1043
|
validateContextBounds(context, threadID);
|
|
1044
|
+
{
|
|
1045
|
+
!!isInHookUserCodeInDev ? warning$1(false, 'Context can only be read while React is rendering. ' + 'In classes, you can read it in the render method or getDerivedStateFromProps. ' + 'In function components, you can read it directly in the function body, but not ' + 'inside Hooks like useReducer() or useMemo().') : void 0;
|
|
1046
|
+
}
|
|
1019
1047
|
return context[threadID];
|
|
1020
1048
|
}
|
|
1021
1049
|
|
|
1022
1050
|
function useContext(context, observedBits) {
|
|
1051
|
+
{
|
|
1052
|
+
currentHookNameInDev = 'useContext';
|
|
1053
|
+
}
|
|
1023
1054
|
resolveCurrentlyRenderingComponent();
|
|
1024
1055
|
var threadID = currentThreadID;
|
|
1025
1056
|
validateContextBounds(context, threadID);
|
|
@@ -1031,12 +1062,20 @@ function basicStateReducer(state, action) {
|
|
|
1031
1062
|
}
|
|
1032
1063
|
|
|
1033
1064
|
function useState(initialState) {
|
|
1065
|
+
{
|
|
1066
|
+
currentHookNameInDev = 'useState';
|
|
1067
|
+
}
|
|
1034
1068
|
return useReducer(basicStateReducer,
|
|
1035
1069
|
// useReducer has a special case to support lazy useState initializers
|
|
1036
1070
|
initialState);
|
|
1037
1071
|
}
|
|
1038
1072
|
|
|
1039
|
-
function useReducer(reducer,
|
|
1073
|
+
function useReducer(reducer, initialArg, init) {
|
|
1074
|
+
{
|
|
1075
|
+
if (reducer !== basicStateReducer) {
|
|
1076
|
+
currentHookNameInDev = 'useReducer';
|
|
1077
|
+
}
|
|
1078
|
+
}
|
|
1040
1079
|
currentlyRenderingComponent = resolveCurrentlyRenderingComponent();
|
|
1041
1080
|
workInProgressHook = createWorkInProgressHook();
|
|
1042
1081
|
if (isReRender) {
|
|
@@ -1055,7 +1094,13 @@ function useReducer(reducer, initialState, initialAction) {
|
|
|
1055
1094
|
// priority because it will always be the same as the current
|
|
1056
1095
|
// render's.
|
|
1057
1096
|
var _action = update.action;
|
|
1097
|
+
{
|
|
1098
|
+
isInHookUserCodeInDev = true;
|
|
1099
|
+
}
|
|
1058
1100
|
newState = reducer(newState, _action);
|
|
1101
|
+
{
|
|
1102
|
+
isInHookUserCodeInDev = false;
|
|
1103
|
+
}
|
|
1059
1104
|
update = update.next;
|
|
1060
1105
|
} while (update !== null);
|
|
1061
1106
|
|
|
@@ -1066,13 +1111,18 @@ function useReducer(reducer, initialState, initialAction) {
|
|
|
1066
1111
|
}
|
|
1067
1112
|
return [workInProgressHook.memoizedState, _dispatch];
|
|
1068
1113
|
} else {
|
|
1114
|
+
{
|
|
1115
|
+
isInHookUserCodeInDev = true;
|
|
1116
|
+
}
|
|
1117
|
+
var initialState = void 0;
|
|
1069
1118
|
if (reducer === basicStateReducer) {
|
|
1070
1119
|
// Special case for `useState`.
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
}
|
|
1075
|
-
|
|
1120
|
+
initialState = typeof initialArg === 'function' ? initialArg() : initialArg;
|
|
1121
|
+
} else {
|
|
1122
|
+
initialState = init !== undefined ? init(initialArg) : initialArg;
|
|
1123
|
+
}
|
|
1124
|
+
{
|
|
1125
|
+
isInHookUserCodeInDev = false;
|
|
1076
1126
|
}
|
|
1077
1127
|
workInProgressHook.memoizedState = initialState;
|
|
1078
1128
|
var _queue2 = workInProgressHook.queue = {
|
|
@@ -1084,22 +1134,32 @@ function useReducer(reducer, initialState, initialAction) {
|
|
|
1084
1134
|
}
|
|
1085
1135
|
}
|
|
1086
1136
|
|
|
1087
|
-
function useMemo(nextCreate,
|
|
1137
|
+
function useMemo(nextCreate, deps) {
|
|
1088
1138
|
currentlyRenderingComponent = resolveCurrentlyRenderingComponent();
|
|
1089
1139
|
workInProgressHook = createWorkInProgressHook();
|
|
1090
1140
|
|
|
1091
|
-
var
|
|
1141
|
+
var nextDeps = deps === undefined ? null : deps;
|
|
1092
1142
|
|
|
1093
|
-
if (workInProgressHook !== null
|
|
1143
|
+
if (workInProgressHook !== null) {
|
|
1094
1144
|
var prevState = workInProgressHook.memoizedState;
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1145
|
+
if (prevState !== null) {
|
|
1146
|
+
if (nextDeps !== null) {
|
|
1147
|
+
var prevDeps = prevState[1];
|
|
1148
|
+
if (areHookInputsEqual(nextDeps, prevDeps)) {
|
|
1149
|
+
return prevState[0];
|
|
1150
|
+
}
|
|
1151
|
+
}
|
|
1098
1152
|
}
|
|
1099
1153
|
}
|
|
1100
1154
|
|
|
1155
|
+
{
|
|
1156
|
+
isInHookUserCodeInDev = true;
|
|
1157
|
+
}
|
|
1101
1158
|
var nextValue = nextCreate();
|
|
1102
|
-
|
|
1159
|
+
{
|
|
1160
|
+
isInHookUserCodeInDev = false;
|
|
1161
|
+
}
|
|
1162
|
+
workInProgressHook.memoizedState = [nextValue, nextDeps];
|
|
1103
1163
|
return nextValue;
|
|
1104
1164
|
}
|
|
1105
1165
|
|
|
@@ -1120,6 +1180,9 @@ function useRef(initialValue) {
|
|
|
1120
1180
|
}
|
|
1121
1181
|
|
|
1122
1182
|
function useLayoutEffect(create, inputs) {
|
|
1183
|
+
{
|
|
1184
|
+
currentHookNameInDev = 'useLayoutEffect';
|
|
1185
|
+
}
|
|
1123
1186
|
warning$1(false, 'useLayoutEffect does nothing on the server, because its effect cannot ' + "be encoded into the server renderer's output format. This will lead " + 'to a mismatch between the initial, non-hydrated UI and the intended ' + 'UI. To avoid this, useLayoutEffect should only be used in ' + 'components that render exclusively on the client.');
|
|
1124
1187
|
}
|
|
1125
1188
|
|
|
@@ -1156,11 +1219,13 @@ function dispatchAction(componentIdentity, queue, action) {
|
|
|
1156
1219
|
}
|
|
1157
1220
|
}
|
|
1158
1221
|
|
|
1159
|
-
function
|
|
1160
|
-
|
|
1161
|
-
return
|
|
1222
|
+
function useCallback(callback, deps) {
|
|
1223
|
+
// Callbacks are passed as they are in the server environment.
|
|
1224
|
+
return callback;
|
|
1162
1225
|
}
|
|
1163
1226
|
|
|
1227
|
+
function noop() {}
|
|
1228
|
+
|
|
1164
1229
|
var currentThreadID = 0;
|
|
1165
1230
|
|
|
1166
1231
|
function setCurrentThreadID(threadID) {
|
|
@@ -1175,8 +1240,7 @@ var Dispatcher = {
|
|
|
1175
1240
|
useRef: useRef,
|
|
1176
1241
|
useState: useState,
|
|
1177
1242
|
useLayoutEffect: useLayoutEffect,
|
|
1178
|
-
|
|
1179
|
-
useCallback: identity,
|
|
1243
|
+
useCallback: useCallback,
|
|
1180
1244
|
// useImperativeHandle is not run in the server environment
|
|
1181
1245
|
useImperativeHandle: noop,
|
|
1182
1246
|
// Effects are not run in the server environment.
|
|
@@ -1184,9 +1248,6 @@ var Dispatcher = {
|
|
|
1184
1248
|
// Debugging effect
|
|
1185
1249
|
useDebugValue: noop
|
|
1186
1250
|
};
|
|
1187
|
-
var DispatcherWithoutHooks = {
|
|
1188
|
-
readContext: readContext
|
|
1189
|
-
};
|
|
1190
1251
|
|
|
1191
1252
|
var HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml';
|
|
1192
1253
|
var MATH_NAMESPACE = 'http://www.w3.org/1998/Math/MathML';
|
|
@@ -3003,11 +3064,7 @@ var ReactDOMServerRenderer = function () {
|
|
|
3003
3064
|
var prevThreadID = currentThreadID;
|
|
3004
3065
|
setCurrentThreadID(this.threadID);
|
|
3005
3066
|
var prevDispatcher = ReactCurrentDispatcher.current;
|
|
3006
|
-
|
|
3007
|
-
ReactCurrentDispatcher.current = Dispatcher;
|
|
3008
|
-
} else {
|
|
3009
|
-
ReactCurrentDispatcher.current = DispatcherWithoutHooks;
|
|
3010
|
-
}
|
|
3067
|
+
ReactCurrentDispatcher.current = Dispatcher;
|
|
3011
3068
|
try {
|
|
3012
3069
|
// Markup generated within <Suspense> ends up buffered until we know
|
|
3013
3070
|
// nothing in that boundary suspended
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license React v16.8.0
|
|
1
|
+
/** @license React v16.8.0
|
|
2
2
|
* react-dom-server.browser.production.min.js
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
@@ -20,18 +20,18 @@ function ta(a,b,d,c){if(null===b||"undefined"===typeof b||sa(a,b,d,c))return!0;i
|
|
|
20
20
|
["capture","download"].forEach(function(a){I[a]=new H(a,4,!1,a,null)});["cols","rows","size","span"].forEach(function(a){I[a]=new H(a,6,!1,a,null)});["rowSpan","start"].forEach(function(a){I[a]=new H(a,5,!1,a.toLowerCase(),null)});var J=/[\-:]([a-z])/g;function K(a){return a[1].toUpperCase()}
|
|
21
21
|
"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(a){var b=a.replace(J,
|
|
22
22
|
K);I[b]=new H(b,1,!1,a,null)});"xlink:actuate xlink:arcrole xlink:href xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(a){var b=a.replace(J,K);I[b]=new H(b,1,!1,a,"http://www.w3.org/1999/xlink")});["xml:base","xml:lang","xml:space"].forEach(function(a){var b=a.replace(J,K);I[b]=new H(b,1,!1,a,"http://www.w3.org/XML/1998/namespace")});I.tabIndex=new H("tabIndex",1,!1,"tabindex",null);var ua=/["'&<>]/;
|
|
23
|
-
function L(a){if("boolean"===typeof a||"number"===typeof a)return""+a;a=""+a;var b=ua.exec(a);if(b){var d="",c,f=0;for(c=b.index;c<a.length;c++){switch(a.charCodeAt(c)){case 34:b=""";break;case 38:b="&";break;case 39:b="'";break;case 60:b="<";break;case 62:b=">";break;default:continue}f!==c&&(d+=a.substring(f,c));f=c+1;d+=b}a=f!==c?d+a.substring(f,c):d}return a}var M=null,N=null,O=null,P=!1,
|
|
24
|
-
function va(){return{memoizedState:null,queue:null,next:null}}function V(){null===O?null===N?(P=!1,N=O=va()):(P=!0,O=N):null===O.next?(P=!1,O=O.next=va()):(P=!0,O=O.next);return O}function wa(a,b,d,c){for(;
|
|
25
|
-
function ya(a,b,d){M=U();O=V();if(P){var c=O.queue;b=c.dispatch;if(null!==S&&(d=S.get(c),void 0!==d)){S.delete(c);c=O.memoizedState;do c=a(c,d.action),d=d.next;while(null!==d);O.memoizedState=c;return[c,b]}return[O.memoizedState,b]}a===xa?"function"===typeof b
|
|
26
|
-
function za(a,b,d){25>T?void 0:r("301");if(a===M)if(
|
|
27
|
-
var X=0,Aa={readContext:function(a){var b=X;E(a,b);return a[b]},useContext:function(a){U();var b=X;E(a,b);return a[b]},useMemo:function(a,b){M=U();O=V();b=void 0
|
|
28
|
-
b?(a={current:a},O.memoizedState=a):b},useState:function(a){return ya(xa,a)},useLayoutEffect:function(){},useCallback:function(a){return a},useImperativeHandle:W,useEffect:W,useDebugValue:W},Ba={html:"http://www.w3.org/1999/xhtml",mathml:"http://www.w3.org/1998/Math/MathML",svg:"http://www.w3.org/2000/svg"};function Ca(a){switch(a){case "svg":return"http://www.w3.org/2000/svg";case "math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}
|
|
23
|
+
function L(a){if("boolean"===typeof a||"number"===typeof a)return""+a;a=""+a;var b=ua.exec(a);if(b){var d="",c,f=0;for(c=b.index;c<a.length;c++){switch(a.charCodeAt(c)){case 34:b=""";break;case 38:b="&";break;case 39:b="'";break;case 60:b="<";break;case 62:b=">";break;default:continue}f!==c&&(d+=a.substring(f,c));f=c+1;d+=b}a=f!==c?d+a.substring(f,c):d}return a}var M=null,N=null,O=null,P=!1,Q=!1,S=null,T=0;function U(){null===M?r("307"):void 0;return M}
|
|
24
|
+
function va(){0<T&&r("312");return{memoizedState:null,queue:null,next:null}}function V(){null===O?null===N?(P=!1,N=O=va()):(P=!0,O=N):null===O.next?(P=!1,O=O.next=va()):(P=!0,O=O.next);return O}function wa(a,b,d,c){for(;Q;)Q=!1,T+=1,O=null,d=a(b,c);N=M=null;T=0;O=S=null;return d}function xa(a,b){return"function"===typeof b?b(a):b}
|
|
25
|
+
function ya(a,b,d){M=U();O=V();if(P){var c=O.queue;b=c.dispatch;if(null!==S&&(d=S.get(c),void 0!==d)){S.delete(c);c=O.memoizedState;do c=a(c,d.action),d=d.next;while(null!==d);O.memoizedState=c;return[c,b]}return[O.memoizedState,b]}a=a===xa?"function"===typeof b?b():b:void 0!==d?d(b):b;O.memoizedState=a;a=O.queue={last:null,dispatch:null};a=a.dispatch=za.bind(null,M,a);return[O.memoizedState,a]}
|
|
26
|
+
function za(a,b,d){25>T?void 0:r("301");if(a===M)if(Q=!0,a={action:d,next:null},null===S&&(S=new Map),d=S.get(b),void 0===d)S.set(b,a);else{for(b=d;null!==b.next;)b=b.next;b.next=a}}function W(){}
|
|
27
|
+
var X=0,Aa={readContext:function(a){var b=X;E(a,b);return a[b]},useContext:function(a){U();var b=X;E(a,b);return a[b]},useMemo:function(a,b){M=U();O=V();b=void 0===b?null:b;if(null!==O){var d=O.memoizedState;if(null!==d&&null!==b){a:{var c=d[1];if(null===c)c=!1;else{for(var f=0;f<c.length&&f<b.length;f++){var e=b[f],h=c[f];if((e!==h||0===e&&1/e!==1/h)&&(e===e||h===h)){c=!1;break a}}c=!0}}if(c)return d[0]}}a=a();O.memoizedState=[a,b];return a},useReducer:ya,useRef:function(a){M=U();O=V();var b=O.memoizedState;
|
|
28
|
+
return null===b?(a={current:a},O.memoizedState=a):b},useState:function(a){return ya(xa,a)},useLayoutEffect:function(){},useCallback:function(a){return a},useImperativeHandle:W,useEffect:W,useDebugValue:W},Ba={html:"http://www.w3.org/1999/xhtml",mathml:"http://www.w3.org/1998/Math/MathML",svg:"http://www.w3.org/2000/svg"};function Ca(a){switch(a){case "svg":return"http://www.w3.org/2000/svg";case "math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}
|
|
29
29
|
var Da={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0},Ea=p({menuitem:!0},Da),Y={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,
|
|
30
30
|
gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Fa=["Webkit","ms","Moz","O"];Object.keys(Y).forEach(function(a){Fa.forEach(function(b){b=b+a.charAt(0).toUpperCase()+a.substring(1);Y[b]=Y[a]})});
|
|
31
31
|
var Ga=/([A-Z])/g,Ha=/^ms-/,Z=q.Children.toArray,Ia=ka.ReactCurrentDispatcher,Ja={listing:!0,pre:!0,textarea:!0},Ka=/^[a-zA-Z][a-zA-Z:_\.\-\d]*$/,La={},Ma={};function Na(a){if(void 0===a||null===a)return a;var b="";q.Children.forEach(a,function(a){null!=a&&(b+=a)});return b}var Oa=Object.prototype.hasOwnProperty,Pa={children:null,dangerouslySetInnerHTML:null,suppressContentEditableWarning:null,suppressHydrationWarning:null};function Qa(a,b){void 0===a&&r("152",C(b)||"Component")}
|
|
32
32
|
function Ra(a,b,d){function c(c,f){var e=ma(f,b,d),g=[],h=!1,l={isMounted:function(){return!1},enqueueForceUpdate:function(){if(null===g)return null},enqueueReplaceState:function(a,b){h=!0;g=[b]},enqueueSetState:function(a,b){if(null===g)return null;g.push(b)}},k=void 0;if(f.prototype&&f.prototype.isReactComponent){if(k=new f(c.props,e,l),"function"===typeof f.getDerivedStateFromProps){var t=f.getDerivedStateFromProps.call(null,c.props,k.state);null!=t&&(k.state=p({},k.state,t))}}else if(M={},k=f(c.props,
|
|
33
33
|
e,l),k=wa(f,c.props,k,e),null==k||null==k.render){a=k;Qa(a,f);return}k.props=c.props;k.context=e;k.updater=l;l=k.state;void 0===l&&(k.state=l=null);if("function"===typeof k.UNSAFE_componentWillMount||"function"===typeof k.componentWillMount)if("function"===typeof k.componentWillMount&&"function"!==typeof f.getDerivedStateFromProps&&k.componentWillMount(),"function"===typeof k.UNSAFE_componentWillMount&&"function"!==typeof f.getDerivedStateFromProps&&k.UNSAFE_componentWillMount(),g.length){l=g;var m=
|
|
34
|
-
h;g=null;h=!1;if(m&&1===l.length)k.state=l[0];else{t=m?l[0]:k.state;var u=!0;for(m=m?1:0;m<l.length;m++){var w=l[m];w="function"===typeof w?w.call(k,t,c.props,e):w;null!=w&&(u?(u=!1,t=p({},t,w)):p(t,w))}k.state=t}}else g=null;a=k.render();Qa(a,f);c=void 0;if("function"===typeof k.getChildContext&&(e=f.childContextTypes,"object"===typeof e)){c=k.getChildContext();for(var
|
|
34
|
+
h;g=null;h=!1;if(m&&1===l.length)k.state=l[0];else{t=m?l[0]:k.state;var u=!0;for(m=m?1:0;m<l.length;m++){var w=l[m];w="function"===typeof w?w.call(k,t,c.props,e):w;null!=w&&(u?(u=!1,t=p({},t,w)):p(t,w))}k.state=t}}else g=null;a=k.render();Qa(a,f);c=void 0;if("function"===typeof k.getChildContext&&(e=f.childContextTypes,"object"===typeof e)){c=k.getChildContext();for(var R in c)R in e?void 0:r("108",C(f)||"Unknown",R)}c&&(b=p({},b,c))}for(;q.isValidElement(a);){var f=a,e=f.type;if("function"!==typeof e)break;
|
|
35
35
|
c(f,e)}return{child:a,context:b}}
|
|
36
36
|
var Sa=function(){function a(b,d){if(!(this instanceof a))throw new TypeError("Cannot call a class as a function");q.isValidElement(b)?b.type!==x?b=[b]:(b=b.props.children,b=q.isValidElement(b)?[b]:Z(b)):b=Z(b);b={type:null,domNamespace:Ba.html,children:b,childIndex:0,context:la,footer:""};var c=F[0];if(0===c){var f=F;c=f.length;var e=2*c;65536>=e?void 0:r("304");var h=new Uint16Array(e);h.set(f);F=h;F[0]=c+1;for(f=c;f<e-1;f++)F[f]=f+1;F[e-1]=0}else F[0]=F[c];this.threadID=c;this.stack=[b];this.exhausted=
|
|
37
37
|
!1;this.currentSelectValue=null;this.previousWasTextNode=!1;this.makeStaticMarkup=d;this.suspenseDepth=0;this.contextIndex=-1;this.contextStack=[];this.contextValueStack=[]}a.prototype.destroy=function(){if(!this.exhausted){this.exhausted=!0;var a=this.threadID;F[a]=F[0];F[0]=a}};a.prototype.pushProvider=function(a){var b=++this.contextIndex,c=a.type._context,f=this.threadID;E(c,f);var e=c[f];this.contextStack[b]=c;this.contextValueStack[b]=e;c[f]=a.props.value};a.prototype.popProvider=function(){var a=
|
|
@@ -43,7 +43,7 @@ domNamespace:c,children:e,childIndex:0,context:d,footer:""});return"";case ia:re
|
|
|
43
43
|
childIndex:0,context:d,footer:""});return"";case ja:r("295")}r("130",null==b?b:typeof b,"")};a.prototype.renderDOM=function(a,d,c){var b=a.type.toLowerCase();c===Ba.html&&Ca(b);La.hasOwnProperty(b)||(Ka.test(b)?void 0:r("65",b),La[b]=!0);var e=a.props;if("input"===b)e=p({type:void 0},e,{defaultChecked:void 0,defaultValue:void 0,value:null!=e.value?e.value:e.defaultValue,checked:null!=e.checked?e.checked:e.defaultChecked});else if("textarea"===b){var h=e.value;if(null==h){h=e.defaultValue;var g=e.children;
|
|
44
44
|
null!=g&&(null!=h?r("92"):void 0,Array.isArray(g)&&(1>=g.length?void 0:r("93"),g=g[0]),h=""+g);null==h&&(h="")}e=p({},e,{value:void 0,children:""+h})}else if("select"===b)this.currentSelectValue=null!=e.value?e.value:e.defaultValue,e=p({},e,{value:void 0});else if("option"===b){g=this.currentSelectValue;var D=Na(e.children);if(null!=g){var B=null!=e.value?e.value+"":D;h=!1;if(Array.isArray(g))for(var n=0;n<g.length;n++){if(""+g[n]===B){h=!0;break}}else h=""+g===B;e=p({selected:void 0,children:void 0},
|
|
45
45
|
e,{selected:h,children:D})}}if(h=e)Ea[b]&&(null!=h.children||null!=h.dangerouslySetInnerHTML?r("137",b,""):void 0),null!=h.dangerouslySetInnerHTML&&(null!=h.children?r("60"):void 0,"object"===typeof h.dangerouslySetInnerHTML&&"__html"in h.dangerouslySetInnerHTML?void 0:r("61")),null!=h.style&&"object"!==typeof h.style?r("62",""):void 0;h=e;g=this.makeStaticMarkup;D=1===this.stack.length;B="<"+a.type;for(y in h)if(Oa.call(h,y)){var l=h[y];if(null!=l){if("style"===y){n=void 0;var k="",t="";for(n in l)if(l.hasOwnProperty(n)){var m=
|
|
46
|
-
0===n.indexOf("--"),u=l[n];if(null!=u){var w=n;if(Ma.hasOwnProperty(w))w=Ma[w];else{var
|
|
46
|
+
0===n.indexOf("--"),u=l[n];if(null!=u){var w=n;if(Ma.hasOwnProperty(w))w=Ma[w];else{var R=w.replace(Ga,"-$1").toLowerCase().replace(Ha,"-ms-");w=Ma[w]=R}k+=t+w+":";t=n;m=null==u||"boolean"===typeof u||""===u?"":m||"number"!==typeof u||0===u||Y.hasOwnProperty(t)&&Y[t]?(""+u).trim():u+"px";k+=m;t=";"}}l=k||null}n=null;b:if(m=b,u=h,-1===m.indexOf("-"))m="string"===typeof u.is;else switch(m){case "annotation-xml":case "color-profile":case "font-face":case "font-face-src":case "font-face-uri":case "font-face-format":case "font-face-name":case "missing-glyph":m=
|
|
47
47
|
!1;break b;default:m=!0}if(m)Pa.hasOwnProperty(y)||(n=y,n=ra(n)&&null!=l?n+"="+('"'+L(l)+'"'):"");else{m=y;n=l;l=I.hasOwnProperty(m)?I[m]:null;if(u="style"!==m)u=null!==l?0===l.type:!(2<m.length)||"o"!==m[0]&&"O"!==m[0]||"n"!==m[1]&&"N"!==m[1]?!1:!0;u||ta(m,n,l,!1)?n="":null!==l?(m=l.attributeName,l=l.type,n=3===l||4===l&&!0===n?m+'=""':m+"="+('"'+L(n)+'"')):n=ra(m)?m+"="+('"'+L(n)+'"'):""}n&&(B+=" "+n)}}g||D&&(B+=' data-reactroot=""');var y=B;h="";Da.hasOwnProperty(b)?y+="/>":(y+=">",h="</"+a.type+
|
|
48
48
|
">");a:{g=e.dangerouslySetInnerHTML;if(null!=g){if(null!=g.__html){g=g.__html;break a}}else if(g=e.children,"string"===typeof g||"number"===typeof g){g=L(g);break a}g=null}null!=g?(e=[],Ja[b]&&"\n"===g.charAt(0)&&(y+="\n"),y+=g):e=Z(e.children);a=a.type;c=null==c||"http://www.w3.org/1999/xhtml"===c?Ca(a):"http://www.w3.org/2000/svg"===c&&"foreignObject"===a?"http://www.w3.org/1999/xhtml":c;this.stack.push({domNamespace:c,type:b,children:e,childIndex:0,context:d,footer:h});this.previousWasTextNode=
|
|
49
|
-
!1;return y};return a}(),Ta={renderToString:function(a){a=new Sa(a,!1);try{return a.read(Infinity)}finally{a.destroy()}},renderToStaticMarkup:function(a){a=new Sa(a,!0);try{return a.read(Infinity)}finally{a.destroy()}},renderToNodeStream:function(){r("207")},renderToStaticNodeStream:function(){r("208")},version:"16.8.0
|
|
49
|
+
!1;return y};return a}(),Ta={renderToString:function(a){a=new Sa(a,!1);try{return a.read(Infinity)}finally{a.destroy()}},renderToStaticMarkup:function(a){a=new Sa(a,!0);try{return a.read(Infinity)}finally{a.destroy()}},renderToNodeStream:function(){r("207")},renderToStaticNodeStream:function(){r("208")},version:"16.8.0"},Ua={default:Ta},Va=Ua&&Ta||Ua;module.exports=Va.default||Va;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license React v16.8.0
|
|
1
|
+
/** @license React v16.8.0
|
|
2
2
|
* react-dom-server.node.development.js
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
@@ -22,7 +22,7 @@ var stream = require('stream');
|
|
|
22
22
|
|
|
23
23
|
// TODO: this is special because it gets imported during build.
|
|
24
24
|
|
|
25
|
-
var ReactVersion = '16.8.0
|
|
25
|
+
var ReactVersion = '16.8.0';
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
28
|
* Use invariant() to assert state which your program assumes to be true.
|
|
@@ -313,7 +313,6 @@ var describeComponentFrame = function (name, source, ownerName) {
|
|
|
313
313
|
return '\n in ' + (name || 'Unknown') + sourceInfo;
|
|
314
314
|
};
|
|
315
315
|
|
|
316
|
-
var enableHooks = true;
|
|
317
316
|
// Helps identify side effects in begin-phase lifecycle hooks and setState reducers:
|
|
318
317
|
|
|
319
318
|
|
|
@@ -903,21 +902,6 @@ function is(x, y) {
|
|
|
903
902
|
;
|
|
904
903
|
}
|
|
905
904
|
|
|
906
|
-
function areHookInputsEqual(arr1, arr2) {
|
|
907
|
-
// Don't bother comparing lengths in prod because these arrays should be
|
|
908
|
-
// passed inline.
|
|
909
|
-
{
|
|
910
|
-
!(arr1.length === arr2.length) ? warning$1(false, 'Detected a variable number of hook dependencies. The length of the ' + 'dependencies array should be constant between renders.\n\n' + 'Previous: %s\n' + 'Incoming: %s', arr1.join(', '), arr2.join(', ')) : void 0;
|
|
911
|
-
}
|
|
912
|
-
for (var i = 0; i < arr1.length; i++) {
|
|
913
|
-
if (is(arr1[i], arr2[i])) {
|
|
914
|
-
continue;
|
|
915
|
-
}
|
|
916
|
-
return false;
|
|
917
|
-
}
|
|
918
|
-
return true;
|
|
919
|
-
}
|
|
920
|
-
|
|
921
905
|
var currentlyRenderingComponent = null;
|
|
922
906
|
var firstWorkInProgressHook = null;
|
|
923
907
|
var workInProgressHook = null;
|
|
@@ -931,12 +915,47 @@ var renderPhaseUpdates = null;
|
|
|
931
915
|
var numberOfReRenders = 0;
|
|
932
916
|
var RE_RENDER_LIMIT = 25;
|
|
933
917
|
|
|
918
|
+
var isInHookUserCodeInDev = false;
|
|
919
|
+
|
|
920
|
+
// In DEV, this is the name of the currently executing primitive hook
|
|
921
|
+
var currentHookNameInDev = void 0;
|
|
922
|
+
|
|
934
923
|
function resolveCurrentlyRenderingComponent() {
|
|
935
|
-
!(currentlyRenderingComponent !== null) ? invariant(false, 'Hooks can only be called inside the body of a function component.') : void 0;
|
|
924
|
+
!(currentlyRenderingComponent !== null) ? invariant(false, 'Hooks can only be called inside the body of a function component. (https://fb.me/react-invalid-hook-call)') : void 0;
|
|
925
|
+
{
|
|
926
|
+
!!isInHookUserCodeInDev ? warning$1(false, 'Do not call Hooks inside useEffect(...), useMemo(...), or other built-in Hooks. ' + 'You can only call Hooks at the top level of your React function. ' + 'For more information, see ' + 'https://fb.me/rules-of-hooks') : void 0;
|
|
927
|
+
}
|
|
936
928
|
return currentlyRenderingComponent;
|
|
937
929
|
}
|
|
938
930
|
|
|
931
|
+
function areHookInputsEqual(nextDeps, prevDeps) {
|
|
932
|
+
if (prevDeps === null) {
|
|
933
|
+
{
|
|
934
|
+
warning$1(false, '%s received a final argument during this render, but not during ' + 'the previous render. Even though the final argument is optional, ' + 'its type cannot change between renders.', currentHookNameInDev);
|
|
935
|
+
}
|
|
936
|
+
return false;
|
|
937
|
+
}
|
|
938
|
+
|
|
939
|
+
{
|
|
940
|
+
// Don't bother comparing lengths in prod because these arrays should be
|
|
941
|
+
// passed inline.
|
|
942
|
+
if (nextDeps.length !== prevDeps.length) {
|
|
943
|
+
warning$1(false, 'The final argument passed to %s changed size between renders. The ' + 'order and size of this array must remain constant.\n\n' + 'Previous: %s\n' + 'Incoming: %s', currentHookNameInDev, '[' + nextDeps.join(', ') + ']', '[' + prevDeps.join(', ') + ']');
|
|
944
|
+
}
|
|
945
|
+
}
|
|
946
|
+
for (var i = 0; i < prevDeps.length && i < nextDeps.length; i++) {
|
|
947
|
+
if (is(nextDeps[i], prevDeps[i])) {
|
|
948
|
+
continue;
|
|
949
|
+
}
|
|
950
|
+
return false;
|
|
951
|
+
}
|
|
952
|
+
return true;
|
|
953
|
+
}
|
|
954
|
+
|
|
939
955
|
function createHook() {
|
|
956
|
+
if (numberOfReRenders > 0) {
|
|
957
|
+
invariant(false, 'Rendered more hooks than during the previous render');
|
|
958
|
+
}
|
|
940
959
|
return {
|
|
941
960
|
memoizedState: null,
|
|
942
961
|
queue: null,
|
|
@@ -971,6 +990,9 @@ function createWorkInProgressHook() {
|
|
|
971
990
|
|
|
972
991
|
function prepareToUseHooks(componentIdentity) {
|
|
973
992
|
currentlyRenderingComponent = componentIdentity;
|
|
993
|
+
{
|
|
994
|
+
isInHookUserCodeInDev = false;
|
|
995
|
+
}
|
|
974
996
|
|
|
975
997
|
// The following should have already been reset
|
|
976
998
|
// didScheduleRenderPhaseUpdate = false;
|
|
@@ -1002,6 +1024,9 @@ function finishHooks(Component, props, children, refOrContext) {
|
|
|
1002
1024
|
numberOfReRenders = 0;
|
|
1003
1025
|
renderPhaseUpdates = null;
|
|
1004
1026
|
workInProgressHook = null;
|
|
1027
|
+
{
|
|
1028
|
+
isInHookUserCodeInDev = false;
|
|
1029
|
+
}
|
|
1005
1030
|
|
|
1006
1031
|
// These were reset above
|
|
1007
1032
|
// currentlyRenderingComponent = null;
|
|
@@ -1017,10 +1042,16 @@ function finishHooks(Component, props, children, refOrContext) {
|
|
|
1017
1042
|
function readContext(context, observedBits) {
|
|
1018
1043
|
var threadID = currentThreadID;
|
|
1019
1044
|
validateContextBounds(context, threadID);
|
|
1045
|
+
{
|
|
1046
|
+
!!isInHookUserCodeInDev ? warning$1(false, 'Context can only be read while React is rendering. ' + 'In classes, you can read it in the render method or getDerivedStateFromProps. ' + 'In function components, you can read it directly in the function body, but not ' + 'inside Hooks like useReducer() or useMemo().') : void 0;
|
|
1047
|
+
}
|
|
1020
1048
|
return context[threadID];
|
|
1021
1049
|
}
|
|
1022
1050
|
|
|
1023
1051
|
function useContext(context, observedBits) {
|
|
1052
|
+
{
|
|
1053
|
+
currentHookNameInDev = 'useContext';
|
|
1054
|
+
}
|
|
1024
1055
|
resolveCurrentlyRenderingComponent();
|
|
1025
1056
|
var threadID = currentThreadID;
|
|
1026
1057
|
validateContextBounds(context, threadID);
|
|
@@ -1032,12 +1063,20 @@ function basicStateReducer(state, action) {
|
|
|
1032
1063
|
}
|
|
1033
1064
|
|
|
1034
1065
|
function useState(initialState) {
|
|
1066
|
+
{
|
|
1067
|
+
currentHookNameInDev = 'useState';
|
|
1068
|
+
}
|
|
1035
1069
|
return useReducer(basicStateReducer,
|
|
1036
1070
|
// useReducer has a special case to support lazy useState initializers
|
|
1037
1071
|
initialState);
|
|
1038
1072
|
}
|
|
1039
1073
|
|
|
1040
|
-
function useReducer(reducer,
|
|
1074
|
+
function useReducer(reducer, initialArg, init) {
|
|
1075
|
+
{
|
|
1076
|
+
if (reducer !== basicStateReducer) {
|
|
1077
|
+
currentHookNameInDev = 'useReducer';
|
|
1078
|
+
}
|
|
1079
|
+
}
|
|
1041
1080
|
currentlyRenderingComponent = resolveCurrentlyRenderingComponent();
|
|
1042
1081
|
workInProgressHook = createWorkInProgressHook();
|
|
1043
1082
|
if (isReRender) {
|
|
@@ -1056,7 +1095,13 @@ function useReducer(reducer, initialState, initialAction) {
|
|
|
1056
1095
|
// priority because it will always be the same as the current
|
|
1057
1096
|
// render's.
|
|
1058
1097
|
var _action = update.action;
|
|
1098
|
+
{
|
|
1099
|
+
isInHookUserCodeInDev = true;
|
|
1100
|
+
}
|
|
1059
1101
|
newState = reducer(newState, _action);
|
|
1102
|
+
{
|
|
1103
|
+
isInHookUserCodeInDev = false;
|
|
1104
|
+
}
|
|
1060
1105
|
update = update.next;
|
|
1061
1106
|
} while (update !== null);
|
|
1062
1107
|
|
|
@@ -1067,13 +1112,18 @@ function useReducer(reducer, initialState, initialAction) {
|
|
|
1067
1112
|
}
|
|
1068
1113
|
return [workInProgressHook.memoizedState, _dispatch];
|
|
1069
1114
|
} else {
|
|
1115
|
+
{
|
|
1116
|
+
isInHookUserCodeInDev = true;
|
|
1117
|
+
}
|
|
1118
|
+
var initialState = void 0;
|
|
1070
1119
|
if (reducer === basicStateReducer) {
|
|
1071
1120
|
// Special case for `useState`.
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
}
|
|
1076
|
-
|
|
1121
|
+
initialState = typeof initialArg === 'function' ? initialArg() : initialArg;
|
|
1122
|
+
} else {
|
|
1123
|
+
initialState = init !== undefined ? init(initialArg) : initialArg;
|
|
1124
|
+
}
|
|
1125
|
+
{
|
|
1126
|
+
isInHookUserCodeInDev = false;
|
|
1077
1127
|
}
|
|
1078
1128
|
workInProgressHook.memoizedState = initialState;
|
|
1079
1129
|
var _queue2 = workInProgressHook.queue = {
|
|
@@ -1085,22 +1135,32 @@ function useReducer(reducer, initialState, initialAction) {
|
|
|
1085
1135
|
}
|
|
1086
1136
|
}
|
|
1087
1137
|
|
|
1088
|
-
function useMemo(nextCreate,
|
|
1138
|
+
function useMemo(nextCreate, deps) {
|
|
1089
1139
|
currentlyRenderingComponent = resolveCurrentlyRenderingComponent();
|
|
1090
1140
|
workInProgressHook = createWorkInProgressHook();
|
|
1091
1141
|
|
|
1092
|
-
var
|
|
1142
|
+
var nextDeps = deps === undefined ? null : deps;
|
|
1093
1143
|
|
|
1094
|
-
if (workInProgressHook !== null
|
|
1144
|
+
if (workInProgressHook !== null) {
|
|
1095
1145
|
var prevState = workInProgressHook.memoizedState;
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1146
|
+
if (prevState !== null) {
|
|
1147
|
+
if (nextDeps !== null) {
|
|
1148
|
+
var prevDeps = prevState[1];
|
|
1149
|
+
if (areHookInputsEqual(nextDeps, prevDeps)) {
|
|
1150
|
+
return prevState[0];
|
|
1151
|
+
}
|
|
1152
|
+
}
|
|
1099
1153
|
}
|
|
1100
1154
|
}
|
|
1101
1155
|
|
|
1156
|
+
{
|
|
1157
|
+
isInHookUserCodeInDev = true;
|
|
1158
|
+
}
|
|
1102
1159
|
var nextValue = nextCreate();
|
|
1103
|
-
|
|
1160
|
+
{
|
|
1161
|
+
isInHookUserCodeInDev = false;
|
|
1162
|
+
}
|
|
1163
|
+
workInProgressHook.memoizedState = [nextValue, nextDeps];
|
|
1104
1164
|
return nextValue;
|
|
1105
1165
|
}
|
|
1106
1166
|
|
|
@@ -1121,6 +1181,9 @@ function useRef(initialValue) {
|
|
|
1121
1181
|
}
|
|
1122
1182
|
|
|
1123
1183
|
function useLayoutEffect(create, inputs) {
|
|
1184
|
+
{
|
|
1185
|
+
currentHookNameInDev = 'useLayoutEffect';
|
|
1186
|
+
}
|
|
1124
1187
|
warning$1(false, 'useLayoutEffect does nothing on the server, because its effect cannot ' + "be encoded into the server renderer's output format. This will lead " + 'to a mismatch between the initial, non-hydrated UI and the intended ' + 'UI. To avoid this, useLayoutEffect should only be used in ' + 'components that render exclusively on the client.');
|
|
1125
1188
|
}
|
|
1126
1189
|
|
|
@@ -1157,11 +1220,13 @@ function dispatchAction(componentIdentity, queue, action) {
|
|
|
1157
1220
|
}
|
|
1158
1221
|
}
|
|
1159
1222
|
|
|
1160
|
-
function
|
|
1161
|
-
|
|
1162
|
-
return
|
|
1223
|
+
function useCallback(callback, deps) {
|
|
1224
|
+
// Callbacks are passed as they are in the server environment.
|
|
1225
|
+
return callback;
|
|
1163
1226
|
}
|
|
1164
1227
|
|
|
1228
|
+
function noop() {}
|
|
1229
|
+
|
|
1165
1230
|
var currentThreadID = 0;
|
|
1166
1231
|
|
|
1167
1232
|
function setCurrentThreadID(threadID) {
|
|
@@ -1176,8 +1241,7 @@ var Dispatcher = {
|
|
|
1176
1241
|
useRef: useRef,
|
|
1177
1242
|
useState: useState,
|
|
1178
1243
|
useLayoutEffect: useLayoutEffect,
|
|
1179
|
-
|
|
1180
|
-
useCallback: identity,
|
|
1244
|
+
useCallback: useCallback,
|
|
1181
1245
|
// useImperativeHandle is not run in the server environment
|
|
1182
1246
|
useImperativeHandle: noop,
|
|
1183
1247
|
// Effects are not run in the server environment.
|
|
@@ -1185,9 +1249,6 @@ var Dispatcher = {
|
|
|
1185
1249
|
// Debugging effect
|
|
1186
1250
|
useDebugValue: noop
|
|
1187
1251
|
};
|
|
1188
|
-
var DispatcherWithoutHooks = {
|
|
1189
|
-
readContext: readContext
|
|
1190
|
-
};
|
|
1191
1252
|
|
|
1192
1253
|
var HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml';
|
|
1193
1254
|
var MATH_NAMESPACE = 'http://www.w3.org/1998/Math/MathML';
|
|
@@ -3004,11 +3065,7 @@ var ReactDOMServerRenderer = function () {
|
|
|
3004
3065
|
var prevThreadID = currentThreadID;
|
|
3005
3066
|
setCurrentThreadID(this.threadID);
|
|
3006
3067
|
var prevDispatcher = ReactCurrentDispatcher.current;
|
|
3007
|
-
|
|
3008
|
-
ReactCurrentDispatcher.current = Dispatcher;
|
|
3009
|
-
} else {
|
|
3010
|
-
ReactCurrentDispatcher.current = DispatcherWithoutHooks;
|
|
3011
|
-
}
|
|
3068
|
+
ReactCurrentDispatcher.current = Dispatcher;
|
|
3012
3069
|
try {
|
|
3013
3070
|
// Markup generated within <Suspense> ends up buffered until we know
|
|
3014
3071
|
// nothing in that boundary suspended
|