[compiler] Aggregate all errors reported from DropManualMemoization (#34002)

Noticed this from my previous PR that this pass was throwing on the
first error. This PR is a small refactor to aggregate every violation
and report them all at once.

---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/facebook/react/pull/34002).
* #34022
* __->__ #34002

DiffTrain build for [6b22f31f1a](https://github.com/facebook/react/commit/6b22f31f1ac88cce1b38c67a5c97c7ab0e832823)
This commit is contained in:
poteto
2025-07-28 10:42:25 -07:00
parent 8c18e42044
commit bc990fa413
26 changed files with 277 additions and 347 deletions
+1 -1
View File
@@ -1 +1 @@
19.2.0-native-fb-c60eebff-20250728
19.2.0-native-fb-6b22f31f-20250728
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<25c3fc73f483d3bc1e7eea51752aec28>>
* @generated SignedSource<<cbc4df6ce61157f6aa20e4bdfecc121f>>
*/
"use strict";
@@ -404,5 +404,5 @@ __DEV__ &&
exports.useFormStatus = function () {
return resolveDispatcher().useHostTransitionStatus();
};
exports.version = "19.2.0-native-fb-c60eebff-20250728";
exports.version = "19.2.0-native-fb-6b22f31f-20250728";
})();
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<f731251440ee6ad177c0f7ffea90a5ad>>
* @generated SignedSource<<9b01410f22f5e09d1db49bbf6218777b>>
*/
"use strict";
@@ -203,4 +203,4 @@ exports.useFormState = function (action, initialState, permalink) {
exports.useFormStatus = function () {
return ReactSharedInternals.H.useHostTransitionStatus();
};
exports.version = "19.2.0-native-fb-c60eebff-20250728";
exports.version = "19.2.0-native-fb-6b22f31f-20250728";
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<f731251440ee6ad177c0f7ffea90a5ad>>
* @generated SignedSource<<9b01410f22f5e09d1db49bbf6218777b>>
*/
"use strict";
@@ -203,4 +203,4 @@ exports.useFormState = function (action, initialState, permalink) {
exports.useFormStatus = function () {
return ReactSharedInternals.H.useHostTransitionStatus();
};
exports.version = "19.2.0-native-fb-c60eebff-20250728";
exports.version = "19.2.0-native-fb-6b22f31f-20250728";
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<d6d8fe255dc3afe5a46d11efb4962db1>>
* @generated SignedSource<<5e7033f1de0870615b2f40810b53e26e>>
*/
/*
@@ -29012,11 +29012,11 @@ __DEV__ &&
};
(function () {
var isomorphicReactPackageVersion = React.version;
if ("19.2.0-native-fb-c60eebff-20250728" !== isomorphicReactPackageVersion)
if ("19.2.0-native-fb-6b22f31f-20250728" !== isomorphicReactPackageVersion)
throw Error(
'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' +
(isomorphicReactPackageVersion +
"\n - react-dom: 19.2.0-native-fb-c60eebff-20250728\nLearn more: https://react.dev/warnings/version-mismatch")
"\n - react-dom: 19.2.0-native-fb-6b22f31f-20250728\nLearn more: https://react.dev/warnings/version-mismatch")
);
})();
("function" === typeof Map &&
@@ -29053,10 +29053,10 @@ __DEV__ &&
!(function () {
var internals = {
bundleType: 1,
version: "19.2.0-native-fb-c60eebff-20250728",
version: "19.2.0-native-fb-6b22f31f-20250728",
rendererPackageName: "react-dom",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.2.0-native-fb-c60eebff-20250728"
reconcilerVersion: "19.2.0-native-fb-6b22f31f-20250728"
};
internals.overrideHookState = overrideHookState;
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
@@ -29194,5 +29194,5 @@ __DEV__ &&
listenToAllSupportedEvents(container);
return new ReactDOMHydrationRoot(initialChildren);
};
exports.version = "19.2.0-native-fb-c60eebff-20250728";
exports.version = "19.2.0-native-fb-6b22f31f-20250728";
})();
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<f07a290d23c1dd5281895213f3f66714>>
* @generated SignedSource<<b90863dcc29e65d742b63651ab3155b2>>
*/
/*
@@ -17123,14 +17123,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) {
};
var isomorphicReactPackageVersion$jscomp$inline_2004 = React.version;
if (
"19.2.0-native-fb-c60eebff-20250728" !==
"19.2.0-native-fb-6b22f31f-20250728" !==
isomorphicReactPackageVersion$jscomp$inline_2004
)
throw Error(
formatProdErrorMessage(
527,
isomorphicReactPackageVersion$jscomp$inline_2004,
"19.2.0-native-fb-c60eebff-20250728"
"19.2.0-native-fb-6b22f31f-20250728"
)
);
ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
@@ -17152,10 +17152,10 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
};
var internals$jscomp$inline_2523 = {
bundleType: 0,
version: "19.2.0-native-fb-c60eebff-20250728",
version: "19.2.0-native-fb-6b22f31f-20250728",
rendererPackageName: "react-dom",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.2.0-native-fb-c60eebff-20250728"
reconcilerVersion: "19.2.0-native-fb-6b22f31f-20250728"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_2524 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -17253,4 +17253,4 @@ exports.hydrateRoot = function (container, initialChildren, options) {
listenToAllSupportedEvents(container);
return new ReactDOMHydrationRoot(initialChildren);
};
exports.version = "19.2.0-native-fb-c60eebff-20250728";
exports.version = "19.2.0-native-fb-6b22f31f-20250728";
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<c0858c5457558ce43f750c87d74ee985>>
* @generated SignedSource<<ac6a18b7b9073077b4ee883d3fad1899>>
*/
/*
@@ -19081,14 +19081,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) {
};
var isomorphicReactPackageVersion$jscomp$inline_2244 = React.version;
if (
"19.2.0-native-fb-c60eebff-20250728" !==
"19.2.0-native-fb-6b22f31f-20250728" !==
isomorphicReactPackageVersion$jscomp$inline_2244
)
throw Error(
formatProdErrorMessage(
527,
isomorphicReactPackageVersion$jscomp$inline_2244,
"19.2.0-native-fb-c60eebff-20250728"
"19.2.0-native-fb-6b22f31f-20250728"
)
);
ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
@@ -19110,10 +19110,10 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
};
var internals$jscomp$inline_2251 = {
bundleType: 0,
version: "19.2.0-native-fb-c60eebff-20250728",
version: "19.2.0-native-fb-6b22f31f-20250728",
rendererPackageName: "react-dom",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.2.0-native-fb-c60eebff-20250728",
reconcilerVersion: "19.2.0-native-fb-6b22f31f-20250728",
getLaneLabelMap: function () {
for (
var map = new Map(), lane = 1, index$319 = 0;
@@ -19226,4 +19226,4 @@ exports.hydrateRoot = function (container, initialChildren, options) {
listenToAllSupportedEvents(container);
return new ReactDOMHydrationRoot(initialChildren);
};
exports.version = "19.2.0-native-fb-c60eebff-20250728";
exports.version = "19.2.0-native-fb-6b22f31f-20250728";
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<958fc23b2ac08b6c261eab9d2140ba38>>
* @generated SignedSource<<2f31ecace249d433b119a75010fc3940>>
*/
/*
@@ -29068,11 +29068,11 @@ __DEV__ &&
};
(function () {
var isomorphicReactPackageVersion = React.version;
if ("19.2.0-native-fb-c60eebff-20250728" !== isomorphicReactPackageVersion)
if ("19.2.0-native-fb-6b22f31f-20250728" !== isomorphicReactPackageVersion)
throw Error(
'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' +
(isomorphicReactPackageVersion +
"\n - react-dom: 19.2.0-native-fb-c60eebff-20250728\nLearn more: https://react.dev/warnings/version-mismatch")
"\n - react-dom: 19.2.0-native-fb-6b22f31f-20250728\nLearn more: https://react.dev/warnings/version-mismatch")
);
})();
("function" === typeof Map &&
@@ -29109,10 +29109,10 @@ __DEV__ &&
!(function () {
var internals = {
bundleType: 1,
version: "19.2.0-native-fb-c60eebff-20250728",
version: "19.2.0-native-fb-6b22f31f-20250728",
rendererPackageName: "react-dom",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.2.0-native-fb-c60eebff-20250728"
reconcilerVersion: "19.2.0-native-fb-6b22f31f-20250728"
};
internals.overrideHookState = overrideHookState;
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
@@ -29566,7 +29566,7 @@ __DEV__ &&
exports.useFormStatus = function () {
return resolveDispatcher().useHostTransitionStatus();
};
exports.version = "19.2.0-native-fb-c60eebff-20250728";
exports.version = "19.2.0-native-fb-6b22f31f-20250728";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<ced150c7e3ada24c4cd714f3a257245c>>
* @generated SignedSource<<2beae47e80b49019c144d0b90c0f237e>>
*/
/*
@@ -17134,14 +17134,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) {
};
var isomorphicReactPackageVersion$jscomp$inline_2005 = React.version;
if (
"19.2.0-native-fb-c60eebff-20250728" !==
"19.2.0-native-fb-6b22f31f-20250728" !==
isomorphicReactPackageVersion$jscomp$inline_2005
)
throw Error(
formatProdErrorMessage(
527,
isomorphicReactPackageVersion$jscomp$inline_2005,
"19.2.0-native-fb-c60eebff-20250728"
"19.2.0-native-fb-6b22f31f-20250728"
)
);
ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
@@ -17163,10 +17163,10 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
};
var internals$jscomp$inline_2526 = {
bundleType: 0,
version: "19.2.0-native-fb-c60eebff-20250728",
version: "19.2.0-native-fb-6b22f31f-20250728",
rendererPackageName: "react-dom",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.2.0-native-fb-c60eebff-20250728"
reconcilerVersion: "19.2.0-native-fb-6b22f31f-20250728"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_2527 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -17417,4 +17417,4 @@ exports.useFormState = function (action, initialState, permalink) {
exports.useFormStatus = function () {
return ReactSharedInternals.H.useHostTransitionStatus();
};
exports.version = "19.2.0-native-fb-c60eebff-20250728";
exports.version = "19.2.0-native-fb-6b22f31f-20250728";
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<e77606700d5750187de02612246d3dd9>>
* @generated SignedSource<<3799e19751c2dd5e57f48623a094201c>>
*/
/*
@@ -19096,14 +19096,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) {
};
var isomorphicReactPackageVersion$jscomp$inline_2245 = React.version;
if (
"19.2.0-native-fb-c60eebff-20250728" !==
"19.2.0-native-fb-6b22f31f-20250728" !==
isomorphicReactPackageVersion$jscomp$inline_2245
)
throw Error(
formatProdErrorMessage(
527,
isomorphicReactPackageVersion$jscomp$inline_2245,
"19.2.0-native-fb-c60eebff-20250728"
"19.2.0-native-fb-6b22f31f-20250728"
)
);
ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
@@ -19125,10 +19125,10 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
};
var internals$jscomp$inline_2252 = {
bundleType: 0,
version: "19.2.0-native-fb-c60eebff-20250728",
version: "19.2.0-native-fb-6b22f31f-20250728",
rendererPackageName: "react-dom",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.2.0-native-fb-c60eebff-20250728",
reconcilerVersion: "19.2.0-native-fb-6b22f31f-20250728",
getLaneLabelMap: function () {
for (
var map = new Map(), lane = 1, index$319 = 0;
@@ -19394,7 +19394,7 @@ exports.useFormState = function (action, initialState, permalink) {
exports.useFormStatus = function () {
return ReactSharedInternals.H.useHostTransitionStatus();
};
exports.version = "19.2.0-native-fb-c60eebff-20250728";
exports.version = "19.2.0-native-fb-6b22f31f-20250728";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<79c3017ef84bb953912cab707878d317>>
* @generated SignedSource<<d7fc0020e26d97cc47c7e902ed20e858>>
*/
"use strict";
@@ -15726,10 +15726,10 @@ __DEV__ &&
(function () {
var internals = {
bundleType: 1,
version: "19.2.0-native-fb-c60eebff-20250728",
version: "19.2.0-native-fb-6b22f31f-20250728",
rendererPackageName: "react-test-renderer",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.2.0-native-fb-c60eebff-20250728"
reconcilerVersion: "19.2.0-native-fb-6b22f31f-20250728"
};
internals.overrideHookState = overrideHookState;
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
@@ -15874,5 +15874,5 @@ __DEV__ &&
flushSyncWorkAcrossRoots_impl(0, !0));
}
};
exports.version = "19.2.0-native-fb-c60eebff-20250728";
exports.version = "19.2.0-native-fb-6b22f31f-20250728";
})();
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<57749b493ecff8717821f9aeeb2b6271>>
* @generated SignedSource<<2567121a95d7e1e1d64a6501660fa9cb>>
*/
"use strict";
@@ -9907,10 +9907,10 @@ function wrapFiber(fiber) {
}
var internals$jscomp$inline_1434 = {
bundleType: 0,
version: "19.2.0-native-fb-c60eebff-20250728",
version: "19.2.0-native-fb-6b22f31f-20250728",
rendererPackageName: "react-test-renderer",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.2.0-native-fb-c60eebff-20250728"
reconcilerVersion: "19.2.0-native-fb-6b22f31f-20250728"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1435 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -10046,4 +10046,4 @@ exports.unstable_batchedUpdates = function (fn, a) {
flushSyncWorkAcrossRoots_impl(0, !0));
}
};
exports.version = "19.2.0-native-fb-c60eebff-20250728";
exports.version = "19.2.0-native-fb-6b22f31f-20250728";
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<89704f72860d3fbd1be95585c361ae15>>
* @generated SignedSource<<e30b75844466f277610f54e9975fb67d>>
*/
"use strict";
@@ -10527,10 +10527,10 @@ function wrapFiber(fiber) {
}
var internals$jscomp$inline_1241 = {
bundleType: 0,
version: "19.2.0-native-fb-c60eebff-20250728",
version: "19.2.0-native-fb-6b22f31f-20250728",
rendererPackageName: "react-test-renderer",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.2.0-native-fb-c60eebff-20250728",
reconcilerVersion: "19.2.0-native-fb-6b22f31f-20250728",
getLaneLabelMap: function () {
for (
var map = new Map(), lane = 1, index$143 = 0;
@@ -10681,4 +10681,4 @@ exports.unstable_batchedUpdates = function (fn, a) {
flushSyncWorkAcrossRoots_impl(0, !0));
}
};
exports.version = "19.2.0-native-fb-c60eebff-20250728";
exports.version = "19.2.0-native-fb-6b22f31f-20250728";
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<c15e794658ad9c7d5605e5f4ab18b845>>
* @generated SignedSource<<9fd8c2f3de5e40e5fceda36a4485ba65>>
*/
"use strict";
@@ -1413,7 +1413,7 @@ __DEV__ &&
exports.useTransition = function () {
return resolveDispatcher().useTransition();
};
exports.version = "19.2.0-native-fb-c60eebff-20250728";
exports.version = "19.2.0-native-fb-6b22f31f-20250728";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<ae07a22ae48fb996e9266512c30678fc>>
* @generated SignedSource<<25f93a06c6108875b4c6ed4cd1311218>>
*/
"use strict";
@@ -589,4 +589,4 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactSharedInternals.H.useTransition();
};
exports.version = "19.2.0-native-fb-c60eebff-20250728";
exports.version = "19.2.0-native-fb-6b22f31f-20250728";
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<0152a2a79d2462121d6600d3a16422aa>>
* @generated SignedSource<<c2913b612947131e870e1ac0adc3dce6>>
*/
"use strict";
@@ -593,7 +593,7 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactSharedInternals.H.useTransition();
};
exports.version = "19.2.0-native-fb-c60eebff-20250728";
exports.version = "19.2.0-native-fb-6b22f31f-20250728";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
@@ -1 +1 @@
c60eebffea94a67f35c6ebbf7019e5b2145d4284
6b22f31f1ac88cce1b38c67a5c97c7ab0e832823
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<944a038736093c27ac434824dd00d12b>>
* @generated SignedSource<<fc49b5f0c5ae3427c85021843d6050f7>>
*/
"use strict";
@@ -19231,10 +19231,10 @@ __DEV__ &&
(function () {
var internals = {
bundleType: 1,
version: "19.2.0-native-fb-c60eebff-20250728",
version: "19.2.0-native-fb-6b22f31f-20250728",
rendererPackageName: "react-native-renderer",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.2.0-native-fb-c60eebff-20250728"
reconcilerVersion: "19.2.0-native-fb-6b22f31f-20250728"
};
null !== extraDevToolsConfig &&
(internals.rendererConfig = extraDevToolsConfig);
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<caf87c7216272c8baf58f79aa83976b5>>
* @generated SignedSource<<a1f6a00d6e24f48cfd92f9452af6cd58>>
*/
"use strict";
@@ -11011,10 +11011,10 @@ batchedUpdatesImpl = function (fn, a) {
var roots = new Map(),
internals$jscomp$inline_1237 = {
bundleType: 0,
version: "19.2.0-native-fb-c60eebff-20250728",
version: "19.2.0-native-fb-6b22f31f-20250728",
rendererPackageName: "react-native-renderer",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.2.0-native-fb-c60eebff-20250728"
reconcilerVersion: "19.2.0-native-fb-6b22f31f-20250728"
};
null !== extraDevToolsConfig &&
(internals$jscomp$inline_1237.rendererConfig = extraDevToolsConfig);
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<6cfa76103f123043504e741a4265a68c>>
* @generated SignedSource<<c244504cc1c7af918ef1d0858f3fa8cc>>
*/
"use strict";
@@ -12940,10 +12940,10 @@ batchedUpdatesImpl = function (fn, a) {
var roots = new Map(),
internals$jscomp$inline_1472 = {
bundleType: 0,
version: "19.2.0-native-fb-c60eebff-20250728",
version: "19.2.0-native-fb-6b22f31f-20250728",
rendererPackageName: "react-native-renderer",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.2.0-native-fb-c60eebff-20250728"
reconcilerVersion: "19.2.0-native-fb-6b22f31f-20250728"
};
null !== extraDevToolsConfig &&
(internals$jscomp$inline_1472.rendererConfig = extraDevToolsConfig);
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<efa3dec844beb6a5b295b6bc2afdf76e>>
* @generated SignedSource<<3af1d9a83987e743e543622a2bcef34a>>
*/
"use strict";
@@ -19589,11 +19589,11 @@ __DEV__ &&
shouldSuspendImpl = newShouldSuspendImpl;
};
var isomorphicReactPackageVersion = React.version;
if ("19.2.0-native-fb-c60eebff-20250728" !== isomorphicReactPackageVersion)
if ("19.2.0-native-fb-6b22f31f-20250728" !== 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.2.0-native-fb-c60eebff-20250728\nLearn more: https://react.dev/warnings/version-mismatch")
"\n - react-native-renderer: 19.2.0-native-fb-6b22f31f-20250728\nLearn more: https://react.dev/warnings/version-mismatch")
);
if (
"function" !==
@@ -19619,10 +19619,10 @@ __DEV__ &&
(function () {
var internals = {
bundleType: 1,
version: "19.2.0-native-fb-c60eebff-20250728",
version: "19.2.0-native-fb-6b22f31f-20250728",
rendererPackageName: "react-native-renderer",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.2.0-native-fb-c60eebff-20250728"
reconcilerVersion: "19.2.0-native-fb-6b22f31f-20250728"
};
null !== extraDevToolsConfig &&
(internals.rendererConfig = extraDevToolsConfig);
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<125041a4b2c7b3b16ddcaae77a1c5560>>
* @generated SignedSource<<df30fc333099da73c8a7ae7584f6676b>>
*/
"use strict";
@@ -11237,11 +11237,11 @@ function updateContainer(element, container, parentComponent, callback) {
return lane;
}
var isomorphicReactPackageVersion = React.version;
if ("19.2.0-native-fb-c60eebff-20250728" !== isomorphicReactPackageVersion)
if ("19.2.0-native-fb-6b22f31f-20250728" !== 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.2.0-native-fb-c60eebff-20250728\nLearn more: https://react.dev/warnings/version-mismatch")
"\n - react-native-renderer: 19.2.0-native-fb-6b22f31f-20250728\nLearn more: https://react.dev/warnings/version-mismatch")
);
if (
"function" !==
@@ -11291,10 +11291,10 @@ batchedUpdatesImpl = function (fn, a) {
var roots = new Map(),
internals$jscomp$inline_1295 = {
bundleType: 0,
version: "19.2.0-native-fb-c60eebff-20250728",
version: "19.2.0-native-fb-6b22f31f-20250728",
rendererPackageName: "react-native-renderer",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.2.0-native-fb-c60eebff-20250728"
reconcilerVersion: "19.2.0-native-fb-6b22f31f-20250728"
};
null !== extraDevToolsConfig &&
(internals$jscomp$inline_1295.rendererConfig = extraDevToolsConfig);
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<730539030a8bf7f99972f17fb5ba82a8>>
* @generated SignedSource<<b199d1a15ab522ed124df346412f7119>>
*/
"use strict";
@@ -13155,11 +13155,11 @@ function updateContainer(element, container, parentComponent, callback) {
return lane;
}
var isomorphicReactPackageVersion = React.version;
if ("19.2.0-native-fb-c60eebff-20250728" !== isomorphicReactPackageVersion)
if ("19.2.0-native-fb-6b22f31f-20250728" !== 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.2.0-native-fb-c60eebff-20250728\nLearn more: https://react.dev/warnings/version-mismatch")
"\n - react-native-renderer: 19.2.0-native-fb-6b22f31f-20250728\nLearn more: https://react.dev/warnings/version-mismatch")
);
if (
"function" !==
@@ -13209,10 +13209,10 @@ batchedUpdatesImpl = function (fn, a) {
var roots = new Map(),
internals$jscomp$inline_1530 = {
bundleType: 0,
version: "19.2.0-native-fb-c60eebff-20250728",
version: "19.2.0-native-fb-6b22f31f-20250728",
rendererPackageName: "react-native-renderer",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.2.0-native-fb-c60eebff-20250728"
reconcilerVersion: "19.2.0-native-fb-6b22f31f-20250728"
};
null !== extraDevToolsConfig &&
(internals$jscomp$inline_1530.rendererConfig = extraDevToolsConfig);
@@ -12,7 +12,7 @@
* @lightSyntaxTransform
* @preventMunge
* @oncall react_core
* @generated SignedSource<<fcb375dde21813a6f7625a415256ab33>>
* @generated SignedSource<<1e211c71e7a37149f580804368da78b4>>
*/
'use strict';
@@ -43756,7 +43756,7 @@ function collectMaybeMemoDependencies(value, maybeDeps, optional) {
}
return null;
}
function collectTemporaries$1(instr, env, sidemap) {
function collectTemporaries(instr, env, sidemap) {
const { value, lvalue } = instr;
switch (value.kind) {
case 'FunctionExpression': {
@@ -43853,43 +43853,69 @@ function getManualMemoizationReplacement(fn, loc, kind) {
};
}
}
function extractManualMemoizationArgs(instr, kind, sidemap) {
function extractManualMemoizationArgs(instr, kind, sidemap, errors) {
const [fnPlace, depsListPlace] = instr.value.args;
if (fnPlace == null) {
CompilerError.throwInvalidReact({
reason: `Expected a callback function to be passed to ${kind}`,
loc: instr.value.loc,
errors.pushDiagnostic(CompilerDiagnostic.create({
severity: ErrorSeverity.InvalidReact,
category: `Expected a callback function to be passed to ${kind}`,
description: `Expected a callback function to be passed to ${kind}`,
suggestions: null,
});
}).withDetail({
kind: 'error',
loc: instr.value.loc,
message: `Expected a callback function to be passed to ${kind}`,
}));
return { fnPlace: null, depsList: null };
}
if (fnPlace.kind === 'Spread' || (depsListPlace === null || depsListPlace === void 0 ? void 0 : depsListPlace.kind) === 'Spread') {
CompilerError.throwInvalidReact({
reason: `Unexpected spread argument to ${kind}`,
loc: instr.value.loc,
errors.pushDiagnostic(CompilerDiagnostic.create({
severity: ErrorSeverity.InvalidReact,
category: `Unexpected spread argument to ${kind}`,
description: `Unexpected spread argument to ${kind}`,
suggestions: null,
});
}).withDetail({
kind: 'error',
loc: instr.value.loc,
message: `Unexpected spread argument to ${kind}`,
}));
return { fnPlace: null, depsList: null };
}
let depsList = null;
if (depsListPlace != null) {
const maybeDepsList = sidemap.maybeDepsLists.get(depsListPlace.identifier.id);
if (maybeDepsList == null) {
CompilerError.throwInvalidReact({
reason: `Expected the dependency list for ${kind} to be an array literal`,
errors.pushDiagnostic(CompilerDiagnostic.create({
severity: ErrorSeverity.InvalidReact,
category: `Expected the dependency list for ${kind} to be an array literal`,
description: `Expected the dependency list for ${kind} to be an array literal`,
suggestions: null,
}).withDetail({
kind: 'error',
loc: depsListPlace.loc,
});
message: `Expected the dependency list for ${kind} to be an array literal`,
}));
return { fnPlace, depsList: null };
}
depsList = maybeDepsList.map(dep => {
depsList = [];
for (const dep of maybeDepsList) {
const maybeDep = sidemap.maybeDeps.get(dep.identifier.id);
if (maybeDep == null) {
CompilerError.throwInvalidReact({
reason: `Expected the dependency list to be an array of simple expressions (e.g. \`x\`, \`x.y.z\`, \`x?.y?.z\`)`,
errors.pushDiagnostic(CompilerDiagnostic.create({
severity: ErrorSeverity.InvalidReact,
category: `Expected the dependency list to be an array of simple expressions (e.g. \`x\`, \`x.y.z\`, \`x?.y?.z\`)`,
description: `Expected the dependency list to be an array of simple expressions (e.g. \`x\`, \`x.y.z\`, \`x?.y?.z\`)`,
suggestions: null,
}).withDetail({
kind: 'error',
loc: dep.loc,
});
message: `Expected the dependency list to be an array of simple expressions (e.g. \`x\`, \`x.y.z\`, \`x?.y?.z\`)`,
}));
}
return maybeDep;
});
else {
depsList.push(maybeDep);
}
}
}
return {
fnPlace,
@@ -43897,6 +43923,8 @@ function extractManualMemoizationArgs(instr, kind, sidemap) {
};
}
function dropManualMemoization(func) {
var _a;
const errors = new CompilerError();
const isValidationEnabled = func.env.config.validatePreserveExistingMemoizationGuarantees ||
func.env.config.validateNoSetStateInRender ||
func.env.config.enablePreserveExistingMemoizationGuarantees;
@@ -43921,15 +43949,44 @@ function dropManualMemoization(func) {
: instr.value.property.identifier.id;
const manualMemo = sidemap.manualMemos.get(id);
if (manualMemo != null) {
const { fnPlace, depsList } = extractManualMemoizationArgs(instr, manualMemo.kind, sidemap);
const { fnPlace, depsList } = extractManualMemoizationArgs(instr, manualMemo.kind, sidemap, errors);
if (fnPlace == null) {
continue;
}
if (func.env.config.validateNoVoidUseMemo &&
manualMemo.kind === 'useMemo') {
const funcToCheck = (_a = sidemap.functions.get(fnPlace.identifier.id)) === null || _a === void 0 ? void 0 : _a.value;
if (funcToCheck !== undefined && funcToCheck.loweredFunc.func) {
if (!hasNonVoidReturn(funcToCheck.loweredFunc.func)) {
errors.pushDiagnostic(CompilerDiagnostic.create({
severity: ErrorSeverity.InvalidReact,
category: 'useMemo() callbacks must return a value',
description: `This ${manualMemo.loadInstr.value.kind === 'PropertyLoad'
? 'React.useMemo'
: 'useMemo'} callback doesn't return a value. useMemo is for computing and caching values, not for arbitrary side effects.`,
suggestions: null,
}).withDetail({
kind: 'error',
loc: instr.value.loc,
message: 'useMemo() callbacks must return a value',
}));
}
}
}
instr.value = getManualMemoizationReplacement(fnPlace, instr.value.loc, manualMemo.kind);
if (isValidationEnabled) {
if (!sidemap.functions.has(fnPlace.identifier.id)) {
CompilerError.throwInvalidReact({
reason: `Expected the first argument to be an inline function expression`,
errors.pushDiagnostic(CompilerDiagnostic.create({
severity: ErrorSeverity.InvalidReact,
category: `Expected the first argument to be an inline function expression`,
description: `Expected the first argument to be an inline function expression`,
suggestions: [],
}).withDetail({
kind: 'error',
loc: fnPlace.loc,
});
message: `Expected the first argument to be an inline function expression`,
}));
continue;
}
const memoDecl = manualMemo.kind === 'useMemo'
? instr.lvalue
@@ -43947,7 +44004,7 @@ function dropManualMemoization(func) {
}
}
else {
collectTemporaries$1(instr, func.env, sidemap);
collectTemporaries(instr, func.env, sidemap);
}
}
}
@@ -43976,6 +44033,7 @@ function dropManualMemoization(func) {
markInstructionIds(func.body);
}
}
return errors.asResult();
}
function findOptionalPlaces(fn) {
const optionals = new Set();
@@ -44019,6 +44077,17 @@ function findOptionalPlaces(fn) {
}
return optionals;
}
function hasNonVoidReturn(func) {
for (const [, block] of func.body.blocks) {
if (block.terminal.kind === 'return') {
if (block.terminal.returnVariant === 'Explicit' ||
block.terminal.returnVariant === 'Implicit') {
return true;
}
}
}
return false;
}
class StableSidemap {
constructor(env) {
@@ -47619,107 +47688,6 @@ function visit(identifiers, place, kind) {
identifiers.set(place.identifier.id, { place, kind });
}
function validateNoVoidUseMemo(fn) {
const errors = new CompilerError();
const sidemap = {
useMemoHooks: new Map(),
funcExprs: new Map(),
react: new Set(),
};
for (const [, block] of fn.body.blocks) {
for (const instr of block.instructions) {
collectTemporaries(instr, fn.env, sidemap);
}
}
for (const [, block] of fn.body.blocks) {
for (const instr of block.instructions) {
if (instr.value.kind === 'CallExpression') {
const callee = instr.value.callee.identifier;
const useMemoHook = sidemap.useMemoHooks.get(callee.id);
if (useMemoHook !== undefined && instr.value.args.length > 0) {
const firstArg = instr.value.args[0];
if (firstArg.kind !== 'Identifier') {
continue;
}
let funcToCheck = sidemap.funcExprs.get(firstArg.identifier.id);
if (!funcToCheck) {
for (const [, searchBlock] of fn.body.blocks) {
for (const searchInstr of searchBlock.instructions) {
if (searchInstr.lvalue &&
searchInstr.lvalue.identifier.id === firstArg.identifier.id &&
searchInstr.value.kind === 'FunctionExpression') {
funcToCheck = searchInstr.value;
break;
}
}
if (funcToCheck)
break;
}
}
if (funcToCheck) {
const hasReturn = checkFunctionHasNonVoidReturn(funcToCheck.loweredFunc.func);
if (!hasReturn) {
errors.push({
severity: ErrorSeverity.InvalidReact,
reason: `React Compiler has skipped optimizing this component because ${useMemoHook.name} doesn't return a value. ${useMemoHook.name} should only be used for memoizing values, not running arbitrary side effects.`,
loc: useMemoHook.loc,
suggestions: null,
description: null,
});
}
}
}
}
}
}
return errors.asResult();
}
function checkFunctionHasNonVoidReturn(func) {
for (const [, block] of func.body.blocks) {
if (block.terminal.kind === 'return') {
if (block.terminal.returnVariant === 'Explicit' ||
block.terminal.returnVariant === 'Implicit') {
return true;
}
}
}
return false;
}
function collectTemporaries(instr, env, sidemap) {
const { value, lvalue } = instr;
switch (value.kind) {
case 'FunctionExpression': {
sidemap.funcExprs.set(lvalue.identifier.id, value);
break;
}
case 'LoadGlobal': {
const global = env.getGlobalDeclaration(value.binding, value.loc);
const hookKind = global !== null ? getHookKindForType(env, global) : null;
if (hookKind === 'useMemo') {
sidemap.useMemoHooks.set(lvalue.identifier.id, {
name: value.binding.name,
loc: instr.loc,
});
}
else if (value.binding.name === 'React') {
sidemap.react.add(lvalue.identifier.id);
}
break;
}
case 'PropertyLoad': {
if (sidemap.react.has(value.object.identifier.id)) {
if (value.property === 'useMemo') {
sidemap.useMemoHooks.set(lvalue.identifier.id, {
name: value.property,
loc: instr.loc,
});
}
}
break;
}
}
}
function computeUnconditionalBlocks(fn) {
const unconditionalBlocks = new Set();
const dominators = computePostDominatorTree(fn, {
@@ -50812,14 +50780,11 @@ function runWithEnvironment(func, env) {
log({ kind: 'hir', name: 'PruneMaybeThrows', value: hir });
validateContextVariableLValues(hir);
validateUseMemo(hir).unwrap();
if (env.config.validateNoVoidUseMemo) {
validateNoVoidUseMemo(hir).unwrap();
}
if (env.isInferredMemoEnabled &&
!env.config.enablePreserveExistingManualUseMemo &&
!env.config.disableMemoizationForDebugging &&
!env.config.enableChangeDetectionForDebugging) {
dropManualMemoization(hir);
dropManualMemoization(hir).unwrap();
log({ kind: 'hir', name: 'DropManualMemoization', value: hir });
}
inlineImmediatelyInvokedFunctionExpressions(hir);
@@ -6,7 +6,7 @@
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
* @generated SignedSource<<13fc2c89ad924e5db2f9d8ea5ab6c907>>
* @generated SignedSource<<7d905134e4619bd8455489186c1eb4ad>>
*/
'use strict';
@@ -43535,7 +43535,7 @@ function collectMaybeMemoDependencies(value, maybeDeps, optional) {
}
return null;
}
function collectTemporaries$1(instr, env, sidemap) {
function collectTemporaries(instr, env, sidemap) {
const { value, lvalue } = instr;
switch (value.kind) {
case 'FunctionExpression': {
@@ -43632,43 +43632,69 @@ function getManualMemoizationReplacement(fn, loc, kind) {
};
}
}
function extractManualMemoizationArgs(instr, kind, sidemap) {
function extractManualMemoizationArgs(instr, kind, sidemap, errors) {
const [fnPlace, depsListPlace] = instr.value.args;
if (fnPlace == null) {
CompilerError.throwInvalidReact({
reason: `Expected a callback function to be passed to ${kind}`,
loc: instr.value.loc,
errors.pushDiagnostic(CompilerDiagnostic.create({
severity: ErrorSeverity.InvalidReact,
category: `Expected a callback function to be passed to ${kind}`,
description: `Expected a callback function to be passed to ${kind}`,
suggestions: null,
});
}).withDetail({
kind: 'error',
loc: instr.value.loc,
message: `Expected a callback function to be passed to ${kind}`,
}));
return { fnPlace: null, depsList: null };
}
if (fnPlace.kind === 'Spread' || (depsListPlace === null || depsListPlace === void 0 ? void 0 : depsListPlace.kind) === 'Spread') {
CompilerError.throwInvalidReact({
reason: `Unexpected spread argument to ${kind}`,
loc: instr.value.loc,
errors.pushDiagnostic(CompilerDiagnostic.create({
severity: ErrorSeverity.InvalidReact,
category: `Unexpected spread argument to ${kind}`,
description: `Unexpected spread argument to ${kind}`,
suggestions: null,
});
}).withDetail({
kind: 'error',
loc: instr.value.loc,
message: `Unexpected spread argument to ${kind}`,
}));
return { fnPlace: null, depsList: null };
}
let depsList = null;
if (depsListPlace != null) {
const maybeDepsList = sidemap.maybeDepsLists.get(depsListPlace.identifier.id);
if (maybeDepsList == null) {
CompilerError.throwInvalidReact({
reason: `Expected the dependency list for ${kind} to be an array literal`,
errors.pushDiagnostic(CompilerDiagnostic.create({
severity: ErrorSeverity.InvalidReact,
category: `Expected the dependency list for ${kind} to be an array literal`,
description: `Expected the dependency list for ${kind} to be an array literal`,
suggestions: null,
}).withDetail({
kind: 'error',
loc: depsListPlace.loc,
});
message: `Expected the dependency list for ${kind} to be an array literal`,
}));
return { fnPlace, depsList: null };
}
depsList = maybeDepsList.map(dep => {
depsList = [];
for (const dep of maybeDepsList) {
const maybeDep = sidemap.maybeDeps.get(dep.identifier.id);
if (maybeDep == null) {
CompilerError.throwInvalidReact({
reason: `Expected the dependency list to be an array of simple expressions (e.g. \`x\`, \`x.y.z\`, \`x?.y?.z\`)`,
errors.pushDiagnostic(CompilerDiagnostic.create({
severity: ErrorSeverity.InvalidReact,
category: `Expected the dependency list to be an array of simple expressions (e.g. \`x\`, \`x.y.z\`, \`x?.y?.z\`)`,
description: `Expected the dependency list to be an array of simple expressions (e.g. \`x\`, \`x.y.z\`, \`x?.y?.z\`)`,
suggestions: null,
}).withDetail({
kind: 'error',
loc: dep.loc,
});
message: `Expected the dependency list to be an array of simple expressions (e.g. \`x\`, \`x.y.z\`, \`x?.y?.z\`)`,
}));
}
return maybeDep;
});
else {
depsList.push(maybeDep);
}
}
}
return {
fnPlace,
@@ -43676,6 +43702,8 @@ function extractManualMemoizationArgs(instr, kind, sidemap) {
};
}
function dropManualMemoization(func) {
var _a;
const errors = new CompilerError();
const isValidationEnabled = func.env.config.validatePreserveExistingMemoizationGuarantees ||
func.env.config.validateNoSetStateInRender ||
func.env.config.enablePreserveExistingMemoizationGuarantees;
@@ -43700,15 +43728,44 @@ function dropManualMemoization(func) {
: instr.value.property.identifier.id;
const manualMemo = sidemap.manualMemos.get(id);
if (manualMemo != null) {
const { fnPlace, depsList } = extractManualMemoizationArgs(instr, manualMemo.kind, sidemap);
const { fnPlace, depsList } = extractManualMemoizationArgs(instr, manualMemo.kind, sidemap, errors);
if (fnPlace == null) {
continue;
}
if (func.env.config.validateNoVoidUseMemo &&
manualMemo.kind === 'useMemo') {
const funcToCheck = (_a = sidemap.functions.get(fnPlace.identifier.id)) === null || _a === void 0 ? void 0 : _a.value;
if (funcToCheck !== undefined && funcToCheck.loweredFunc.func) {
if (!hasNonVoidReturn(funcToCheck.loweredFunc.func)) {
errors.pushDiagnostic(CompilerDiagnostic.create({
severity: ErrorSeverity.InvalidReact,
category: 'useMemo() callbacks must return a value',
description: `This ${manualMemo.loadInstr.value.kind === 'PropertyLoad'
? 'React.useMemo'
: 'useMemo'} callback doesn't return a value. useMemo is for computing and caching values, not for arbitrary side effects.`,
suggestions: null,
}).withDetail({
kind: 'error',
loc: instr.value.loc,
message: 'useMemo() callbacks must return a value',
}));
}
}
}
instr.value = getManualMemoizationReplacement(fnPlace, instr.value.loc, manualMemo.kind);
if (isValidationEnabled) {
if (!sidemap.functions.has(fnPlace.identifier.id)) {
CompilerError.throwInvalidReact({
reason: `Expected the first argument to be an inline function expression`,
errors.pushDiagnostic(CompilerDiagnostic.create({
severity: ErrorSeverity.InvalidReact,
category: `Expected the first argument to be an inline function expression`,
description: `Expected the first argument to be an inline function expression`,
suggestions: [],
}).withDetail({
kind: 'error',
loc: fnPlace.loc,
});
message: `Expected the first argument to be an inline function expression`,
}));
continue;
}
const memoDecl = manualMemo.kind === 'useMemo'
? instr.lvalue
@@ -43726,7 +43783,7 @@ function dropManualMemoization(func) {
}
}
else {
collectTemporaries$1(instr, func.env, sidemap);
collectTemporaries(instr, func.env, sidemap);
}
}
}
@@ -43755,6 +43812,7 @@ function dropManualMemoization(func) {
markInstructionIds(func.body);
}
}
return errors.asResult();
}
function findOptionalPlaces(fn) {
const optionals = new Set();
@@ -43798,6 +43856,17 @@ function findOptionalPlaces(fn) {
}
return optionals;
}
function hasNonVoidReturn(func) {
for (const [, block] of func.body.blocks) {
if (block.terminal.kind === 'return') {
if (block.terminal.returnVariant === 'Explicit' ||
block.terminal.returnVariant === 'Implicit') {
return true;
}
}
}
return false;
}
class StableSidemap {
constructor(env) {
@@ -47398,107 +47467,6 @@ function visit(identifiers, place, kind) {
identifiers.set(place.identifier.id, { place, kind });
}
function validateNoVoidUseMemo(fn) {
const errors = new CompilerError();
const sidemap = {
useMemoHooks: new Map(),
funcExprs: new Map(),
react: new Set(),
};
for (const [, block] of fn.body.blocks) {
for (const instr of block.instructions) {
collectTemporaries(instr, fn.env, sidemap);
}
}
for (const [, block] of fn.body.blocks) {
for (const instr of block.instructions) {
if (instr.value.kind === 'CallExpression') {
const callee = instr.value.callee.identifier;
const useMemoHook = sidemap.useMemoHooks.get(callee.id);
if (useMemoHook !== undefined && instr.value.args.length > 0) {
const firstArg = instr.value.args[0];
if (firstArg.kind !== 'Identifier') {
continue;
}
let funcToCheck = sidemap.funcExprs.get(firstArg.identifier.id);
if (!funcToCheck) {
for (const [, searchBlock] of fn.body.blocks) {
for (const searchInstr of searchBlock.instructions) {
if (searchInstr.lvalue &&
searchInstr.lvalue.identifier.id === firstArg.identifier.id &&
searchInstr.value.kind === 'FunctionExpression') {
funcToCheck = searchInstr.value;
break;
}
}
if (funcToCheck)
break;
}
}
if (funcToCheck) {
const hasReturn = checkFunctionHasNonVoidReturn(funcToCheck.loweredFunc.func);
if (!hasReturn) {
errors.push({
severity: ErrorSeverity.InvalidReact,
reason: `React Compiler has skipped optimizing this component because ${useMemoHook.name} doesn't return a value. ${useMemoHook.name} should only be used for memoizing values, not running arbitrary side effects.`,
loc: useMemoHook.loc,
suggestions: null,
description: null,
});
}
}
}
}
}
}
return errors.asResult();
}
function checkFunctionHasNonVoidReturn(func) {
for (const [, block] of func.body.blocks) {
if (block.terminal.kind === 'return') {
if (block.terminal.returnVariant === 'Explicit' ||
block.terminal.returnVariant === 'Implicit') {
return true;
}
}
}
return false;
}
function collectTemporaries(instr, env, sidemap) {
const { value, lvalue } = instr;
switch (value.kind) {
case 'FunctionExpression': {
sidemap.funcExprs.set(lvalue.identifier.id, value);
break;
}
case 'LoadGlobal': {
const global = env.getGlobalDeclaration(value.binding, value.loc);
const hookKind = global !== null ? getHookKindForType(env, global) : null;
if (hookKind === 'useMemo') {
sidemap.useMemoHooks.set(lvalue.identifier.id, {
name: value.binding.name,
loc: instr.loc,
});
}
else if (value.binding.name === 'React') {
sidemap.react.add(lvalue.identifier.id);
}
break;
}
case 'PropertyLoad': {
if (sidemap.react.has(value.object.identifier.id)) {
if (value.property === 'useMemo') {
sidemap.useMemoHooks.set(lvalue.identifier.id, {
name: value.property,
loc: instr.loc,
});
}
}
break;
}
}
}
function computeUnconditionalBlocks(fn) {
const unconditionalBlocks = new Set();
const dominators = computePostDominatorTree(fn, {
@@ -50591,14 +50559,11 @@ function runWithEnvironment(func, env) {
log({ kind: 'hir', name: 'PruneMaybeThrows', value: hir });
validateContextVariableLValues(hir);
validateUseMemo(hir).unwrap();
if (env.config.validateNoVoidUseMemo) {
validateNoVoidUseMemo(hir).unwrap();
}
if (env.isInferredMemoEnabled &&
!env.config.enablePreserveExistingManualUseMemo &&
!env.config.disableMemoizationForDebugging &&
!env.config.enableChangeDetectionForDebugging) {
dropManualMemoization(hir);
dropManualMemoization(hir).unwrap();
log({ kind: 'hir', name: 'DropManualMemoization', value: hir });
}
inlineImmediatelyInvokedFunctionExpressions(hir);
@@ -1,7 +1,7 @@
{
"name": "eslint-plugin-react-hooks",
"description": "ESLint rules for React Hooks",
"version": "0.0.0-experimental-c60eebff-20250728",
"version": "0.0.0-experimental-6b22f31f-20250728",
"repository": {
"type": "git",
"url": "https://github.com/facebook/react.git",