Warn for useFormState on initial render (#30292)

This was missed in the mount dev dispatcher. It was only in the rerender
dispatcher which means that it was only logged during the rerender.
Since DevTools can hide logs during rerenders, this hid the warning in
StrictMode.

DiffTrain build for commit https://github.com/facebook/react/commit/274c980c535bb34e17f5d97cc22ef4dd296ab413.
This commit is contained in:
sebmarkbage
2024-07-08 20:50:19 +00:00
parent e99785f305
commit ff1f53f34b
14 changed files with 44 additions and 41 deletions
+1 -1
View File
@@ -1 +1 @@
19.0.0-native-fb-df783f9ea1-20240708
19.0.0-native-fb-274c980c53-20240708
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<b79bb3a4890e5e05b0b98d095f5ec6a9>>
* @generated SignedSource<<406a88d1a4fab2a1a30035ac1866b4c5>>
*/
"use strict";
@@ -13722,6 +13722,7 @@ __DEV__ &&
HooksDispatcherOnMountInDEV.useFormState = function (action, initialState) {
currentHookNameInDev = "useFormState";
mountHookTypesDev();
warnOnUseFormStateInDev();
return mountActionState(action, initialState);
};
HooksDispatcherOnMountInDEV.useActionState = function (
@@ -15079,14 +15080,14 @@ __DEV__ &&
scheduleRoot: scheduleRoot,
setRefreshHandler: setRefreshHandler,
getCurrentFiber: getCurrentFiberForDevTools,
reconcilerVersion: "19.0.0-native-fb-df783f9ea1-20240708"
reconcilerVersion: "19.0.0-native-fb-274c980c53-20240708"
});
})({
findFiberByHostInstance: function () {
throw Error("TestRenderer does not support findFiberByHostInstance()");
},
bundleType: 1,
version: "19.0.0-native-fb-df783f9ea1-20240708",
version: "19.0.0-native-fb-274c980c53-20240708",
rendererPackageName: "react-test-renderer"
});
exports._Scheduler = Scheduler;
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<9dcd7685e1640c17fbdf82a52a452035>>
* @generated SignedSource<<e5832359bed54301755c310c71ed4199>>
*/
"use strict";
@@ -9384,7 +9384,7 @@ var devToolsConfig$jscomp$inline_1053 = {
throw Error("TestRenderer does not support findFiberByHostInstance()");
},
bundleType: 0,
version: "19.0.0-native-fb-df783f9ea1-20240708",
version: "19.0.0-native-fb-274c980c53-20240708",
rendererPackageName: "react-test-renderer"
};
var internals$jscomp$inline_1240 = {
@@ -9415,7 +9415,7 @@ var internals$jscomp$inline_1240 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "19.0.0-native-fb-df783f9ea1-20240708"
reconcilerVersion: "19.0.0-native-fb-274c980c53-20240708"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1241 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<661fb6132400bc6cbf49596db0acc720>>
* @generated SignedSource<<919306dbc91ada1359ea3c6b0b32c618>>
*/
"use strict";
@@ -10004,7 +10004,7 @@ var devToolsConfig$jscomp$inline_1136 = {
throw Error("TestRenderer does not support findFiberByHostInstance()");
},
bundleType: 0,
version: "19.0.0-native-fb-df783f9ea1-20240708",
version: "19.0.0-native-fb-274c980c53-20240708",
rendererPackageName: "react-test-renderer"
};
(function (internals) {
@@ -10048,7 +10048,7 @@ var devToolsConfig$jscomp$inline_1136 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "19.0.0-native-fb-df783f9ea1-20240708"
reconcilerVersion: "19.0.0-native-fb-274c980c53-20240708"
});
exports._Scheduler = Scheduler;
exports.act = act;
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<eee457cdc760bc83f6841edabd786565>>
* @generated SignedSource<<3787381ad3f2eac13a1287257e1acce9>>
*/
"use strict";
@@ -1748,7 +1748,7 @@ __DEV__ &&
exports.useTransition = function () {
return resolveDispatcher().useTransition();
};
exports.version = "19.0.0-native-fb-df783f9ea1-20240708";
exports.version = "19.0.0-native-fb-274c980c53-20240708";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<7c12730813cc8752d34681669dee99a2>>
* @generated SignedSource<<35b776e96f5f1727760c923395a99766>>
*/
"use strict";
@@ -604,4 +604,4 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactSharedInternals.H.useTransition();
};
exports.version = "19.0.0-native-fb-df783f9ea1-20240708";
exports.version = "19.0.0-native-fb-274c980c53-20240708";
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<157ac3b6e8ae340940bc85ec2c3806cc>>
* @generated SignedSource<<1b02bac183a08adfa82d1581390cdd01>>
*/
"use strict";
@@ -608,7 +608,7 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactSharedInternals.H.useTransition();
};
exports.version = "19.0.0-native-fb-df783f9ea1-20240708";
exports.version = "19.0.0-native-fb-274c980c53-20240708";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
@@ -1 +1 @@
df783f9ea1b6f95e05f830602da1de5ffb325d30
274c980c535bb34e17f5d97cc22ef4dd296ab413
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<cb3e48516a63e1d432c10d2a36d40a98>>
* @generated SignedSource<<8f233b6d522b2bcef18aa23caa2b608c>>
*/
"use strict";
@@ -15432,6 +15432,7 @@ __DEV__ &&
HooksDispatcherOnMountInDEV.useFormState = function (action, initialState) {
currentHookNameInDev = "useFormState";
mountHookTypesDev();
warnOnUseFormStateInDev();
return mountActionState(action, initialState);
};
HooksDispatcherOnMountInDEV.useActionState = function (
@@ -16686,12 +16687,12 @@ __DEV__ &&
scheduleRoot: scheduleRoot,
setRefreshHandler: setRefreshHandler,
getCurrentFiber: getCurrentFiberForDevTools,
reconcilerVersion: "19.0.0-native-fb-df783f9ea1-20240708"
reconcilerVersion: "19.0.0-native-fb-274c980c53-20240708"
});
})({
findFiberByHostInstance: getInstanceFromNode,
bundleType: 1,
version: "19.0.0-native-fb-df783f9ea1-20240708",
version: "19.0.0-native-fb-274c980c53-20240708",
rendererPackageName: "react-native-renderer",
rendererConfig: {
getInspectorDataForInstance: getInspectorDataForInstance,
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<bf8cd3f7673a3494d679c3432fe18b20>>
* @generated SignedSource<<6f6cef3e69da66fa484d591f777702cb>>
*/
"use strict";
@@ -10601,7 +10601,7 @@ var roots = new Map(),
devToolsConfig$jscomp$inline_1136 = {
findFiberByHostInstance: getInstanceFromNode,
bundleType: 0,
version: "19.0.0-native-fb-df783f9ea1-20240708",
version: "19.0.0-native-fb-274c980c53-20240708",
rendererPackageName: "react-native-renderer",
rendererConfig: {
getInspectorDataForInstance: getInspectorDataForInstance,
@@ -10644,7 +10644,7 @@ var internals$jscomp$inline_1362 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "19.0.0-native-fb-df783f9ea1-20240708"
reconcilerVersion: "19.0.0-native-fb-274c980c53-20240708"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1363 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<7a2d2c38e9e972f0fdb209afc217198b>>
* @generated SignedSource<<08e9aaca9ad2b99e51f08d8dc61d33e4>>
*/
"use strict";
@@ -11307,7 +11307,7 @@ var roots = new Map(),
devToolsConfig$jscomp$inline_1217 = {
findFiberByHostInstance: getInstanceFromNode,
bundleType: 0,
version: "19.0.0-native-fb-df783f9ea1-20240708",
version: "19.0.0-native-fb-274c980c53-20240708",
rendererPackageName: "react-native-renderer",
rendererConfig: {
getInspectorDataForInstance: getInspectorDataForInstance,
@@ -11363,7 +11363,7 @@ var roots = new Map(),
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "19.0.0-native-fb-df783f9ea1-20240708"
reconcilerVersion: "19.0.0-native-fb-274c980c53-20240708"
});
exports.createPortal = function (children, containerTag) {
return createPortal$1(
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<10ecfca0d7c38d9b16345cadd1a04f79>>
* @generated SignedSource<<969999f0d202ee723f8948c461929937>>
*/
"use strict";
@@ -15664,6 +15664,7 @@ __DEV__ &&
HooksDispatcherOnMountInDEV.useFormState = function (action, initialState) {
currentHookNameInDev = "useFormState";
mountHookTypesDev();
warnOnUseFormStateInDev();
return mountActionState(action, initialState);
};
HooksDispatcherOnMountInDEV.useActionState = function (
@@ -16874,11 +16875,11 @@ __DEV__ &&
var emptyObject = {};
Object.freeze(emptyObject);
var isomorphicReactPackageVersion = React.version;
if ("19.0.0-native-fb-df783f9ea1-20240708" !== isomorphicReactPackageVersion)
if ("19.0.0-native-fb-274c980c53-20240708" !== isomorphicReactPackageVersion)
throw Error(
'Incompatible React versions: The "react" and "react-native-renderer" packages must have the exact same version. Instead got:\n - react: ' +
(isomorphicReactPackageVersion +
"\n - react-native-renderer: 19.0.0-native-fb-df783f9ea1-20240708\nLearn more: https://react.dev/warnings/version-mismatch")
"\n - react-native-renderer: 19.0.0-native-fb-274c980c53-20240708\nLearn more: https://react.dev/warnings/version-mismatch")
);
if (
"function" !==
@@ -16926,12 +16927,12 @@ __DEV__ &&
scheduleRoot: scheduleRoot,
setRefreshHandler: setRefreshHandler,
getCurrentFiber: getCurrentFiberForDevTools,
reconcilerVersion: "19.0.0-native-fb-df783f9ea1-20240708"
reconcilerVersion: "19.0.0-native-fb-274c980c53-20240708"
});
})({
findFiberByHostInstance: getInstanceFromTag,
bundleType: 1,
version: "19.0.0-native-fb-df783f9ea1-20240708",
version: "19.0.0-native-fb-274c980c53-20240708",
rendererPackageName: "react-native-renderer",
rendererConfig: {
getInspectorDataForInstance: getInspectorDataForInstance,
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<20445ebee951182a5c4c0efc7124a273>>
* @generated SignedSource<<22f86bde09af5f4baa1bc50a71e3ea2b>>
*/
"use strict";
@@ -10755,11 +10755,11 @@ function traverseOwnerTreeUp(hierarchy, instance) {
traverseOwnerTreeUp(hierarchy, instance);
}
var isomorphicReactPackageVersion = React.version;
if ("19.0.0-native-fb-df783f9ea1-20240708" !== isomorphicReactPackageVersion)
if ("19.0.0-native-fb-274c980c53-20240708" !== isomorphicReactPackageVersion)
throw Error(
'Incompatible React versions: The "react" and "react-native-renderer" packages must have the exact same version. Instead got:\n - react: ' +
(isomorphicReactPackageVersion +
"\n - react-native-renderer: 19.0.0-native-fb-df783f9ea1-20240708\nLearn more: https://react.dev/warnings/version-mismatch")
"\n - react-native-renderer: 19.0.0-native-fb-274c980c53-20240708\nLearn more: https://react.dev/warnings/version-mismatch")
);
if (
"function" !==
@@ -10809,7 +10809,7 @@ var roots = new Map(),
devToolsConfig$jscomp$inline_1210 = {
findFiberByHostInstance: getInstanceFromTag,
bundleType: 0,
version: "19.0.0-native-fb-df783f9ea1-20240708",
version: "19.0.0-native-fb-274c980c53-20240708",
rendererPackageName: "react-native-renderer",
rendererConfig: {
getInspectorDataForInstance: getInspectorDataForInstance,
@@ -10852,7 +10852,7 @@ var internals$jscomp$inline_1457 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "19.0.0-native-fb-df783f9ea1-20240708"
reconcilerVersion: "19.0.0-native-fb-274c980c53-20240708"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1458 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<72eed3f790662c68e40b18ee2fe345ad>>
* @generated SignedSource<<6194cf6db9b6afa369f5cfa3ca37b088>>
*/
"use strict";
@@ -11462,11 +11462,11 @@ function traverseOwnerTreeUp(hierarchy, instance) {
traverseOwnerTreeUp(hierarchy, instance);
}
var isomorphicReactPackageVersion = React.version;
if ("19.0.0-native-fb-df783f9ea1-20240708" !== isomorphicReactPackageVersion)
if ("19.0.0-native-fb-274c980c53-20240708" !== isomorphicReactPackageVersion)
throw Error(
'Incompatible React versions: The "react" and "react-native-renderer" packages must have the exact same version. Instead got:\n - react: ' +
(isomorphicReactPackageVersion +
"\n - react-native-renderer: 19.0.0-native-fb-df783f9ea1-20240708\nLearn more: https://react.dev/warnings/version-mismatch")
"\n - react-native-renderer: 19.0.0-native-fb-274c980c53-20240708\nLearn more: https://react.dev/warnings/version-mismatch")
);
if (
"function" !==
@@ -11516,7 +11516,7 @@ var roots = new Map(),
devToolsConfig$jscomp$inline_1291 = {
findFiberByHostInstance: getInstanceFromTag,
bundleType: 0,
version: "19.0.0-native-fb-df783f9ea1-20240708",
version: "19.0.0-native-fb-274c980c53-20240708",
rendererPackageName: "react-native-renderer",
rendererConfig: {
getInspectorDataForInstance: getInspectorDataForInstance,
@@ -11572,7 +11572,7 @@ var roots = new Map(),
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "19.0.0-native-fb-df783f9ea1-20240708"
reconcilerVersion: "19.0.0-native-fb-274c980c53-20240708"
});
exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = {
computeComponentStackForErrorReporting: function (reactTag) {