[compiler] Improve ref validation error message (#34003)

Improves the error message for ValidateNoRefAccessInRender, using the
new diagnostic type as well as providing a longer but succinct summary
of what refs are for and why they're unsafe to access in render.

---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/facebook/react/pull/34003).
* #34027
* #34026
* #34025
* #34024
* #34005
* #34006
* #34004
* __->__ #34003

DiffTrain build for [79dc706498](https://github.com/facebook/react/commit/79dc706498c4f8ef077167898492693197e1b975)
This commit is contained in:
josephsavona
2025-07-29 10:11:27 -07:00
parent 263abf8d70
commit 1d149910da
26 changed files with 225 additions and 185 deletions
+1 -1
View File
@@ -1 +1 @@
19.2.0-native-fb-85bbe39e-20250729
19.2.0-native-fb-79dc7064-20250729
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<8309c6f6204dc58642f11648d3aa0a80>>
* @generated SignedSource<<5100227c38f1767bcc610300d94bb495>>
*/
"use strict";
@@ -404,5 +404,5 @@ __DEV__ &&
exports.useFormStatus = function () {
return resolveDispatcher().useHostTransitionStatus();
};
exports.version = "19.2.0-native-fb-85bbe39e-20250729";
exports.version = "19.2.0-native-fb-79dc7064-20250729";
})();
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<ada4c5f7b2f76a58ce90e22caec463a6>>
* @generated SignedSource<<8ff975b58bd07faa2d9814bbab8ad686>>
*/
"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-85bbe39e-20250729";
exports.version = "19.2.0-native-fb-79dc7064-20250729";
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<ada4c5f7b2f76a58ce90e22caec463a6>>
* @generated SignedSource<<8ff975b58bd07faa2d9814bbab8ad686>>
*/
"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-85bbe39e-20250729";
exports.version = "19.2.0-native-fb-79dc7064-20250729";
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<c937c3fa71b645aaf141079a4eb3a7ea>>
* @generated SignedSource<<eca41d1a13a320259be685c4e443478d>>
*/
/*
@@ -29025,11 +29025,11 @@ __DEV__ &&
};
(function () {
var isomorphicReactPackageVersion = React.version;
if ("19.2.0-native-fb-85bbe39e-20250729" !== isomorphicReactPackageVersion)
if ("19.2.0-native-fb-79dc7064-20250729" !== 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-85bbe39e-20250729\nLearn more: https://react.dev/warnings/version-mismatch")
"\n - react-dom: 19.2.0-native-fb-79dc7064-20250729\nLearn more: https://react.dev/warnings/version-mismatch")
);
})();
("function" === typeof Map &&
@@ -29066,10 +29066,10 @@ __DEV__ &&
!(function () {
var internals = {
bundleType: 1,
version: "19.2.0-native-fb-85bbe39e-20250729",
version: "19.2.0-native-fb-79dc7064-20250729",
rendererPackageName: "react-dom",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.2.0-native-fb-85bbe39e-20250729"
reconcilerVersion: "19.2.0-native-fb-79dc7064-20250729"
};
internals.overrideHookState = overrideHookState;
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
@@ -29207,5 +29207,5 @@ __DEV__ &&
listenToAllSupportedEvents(container);
return new ReactDOMHydrationRoot(initialChildren);
};
exports.version = "19.2.0-native-fb-85bbe39e-20250729";
exports.version = "19.2.0-native-fb-79dc7064-20250729";
})();
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<3e01d9d8dfe70d003aabdbd917c652f1>>
* @generated SignedSource<<16ecd92c96e0780450a26f2313941ec9>>
*/
/*
@@ -17128,14 +17128,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) {
};
var isomorphicReactPackageVersion$jscomp$inline_2002 = React.version;
if (
"19.2.0-native-fb-85bbe39e-20250729" !==
"19.2.0-native-fb-79dc7064-20250729" !==
isomorphicReactPackageVersion$jscomp$inline_2002
)
throw Error(
formatProdErrorMessage(
527,
isomorphicReactPackageVersion$jscomp$inline_2002,
"19.2.0-native-fb-85bbe39e-20250729"
"19.2.0-native-fb-79dc7064-20250729"
)
);
ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
@@ -17157,10 +17157,10 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
};
var internals$jscomp$inline_2521 = {
bundleType: 0,
version: "19.2.0-native-fb-85bbe39e-20250729",
version: "19.2.0-native-fb-79dc7064-20250729",
rendererPackageName: "react-dom",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.2.0-native-fb-85bbe39e-20250729"
reconcilerVersion: "19.2.0-native-fb-79dc7064-20250729"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_2522 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -17258,4 +17258,4 @@ exports.hydrateRoot = function (container, initialChildren, options) {
listenToAllSupportedEvents(container);
return new ReactDOMHydrationRoot(initialChildren);
};
exports.version = "19.2.0-native-fb-85bbe39e-20250729";
exports.version = "19.2.0-native-fb-79dc7064-20250729";
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<0bb697ac6752af2d62713e28025820ad>>
* @generated SignedSource<<a5e571ee1773f491354da47334b3fa9f>>
*/
/*
@@ -19086,14 +19086,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) {
};
var isomorphicReactPackageVersion$jscomp$inline_2242 = React.version;
if (
"19.2.0-native-fb-85bbe39e-20250729" !==
"19.2.0-native-fb-79dc7064-20250729" !==
isomorphicReactPackageVersion$jscomp$inline_2242
)
throw Error(
formatProdErrorMessage(
527,
isomorphicReactPackageVersion$jscomp$inline_2242,
"19.2.0-native-fb-85bbe39e-20250729"
"19.2.0-native-fb-79dc7064-20250729"
)
);
ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
@@ -19115,10 +19115,10 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
};
var internals$jscomp$inline_2249 = {
bundleType: 0,
version: "19.2.0-native-fb-85bbe39e-20250729",
version: "19.2.0-native-fb-79dc7064-20250729",
rendererPackageName: "react-dom",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.2.0-native-fb-85bbe39e-20250729",
reconcilerVersion: "19.2.0-native-fb-79dc7064-20250729",
getLaneLabelMap: function () {
for (
var map = new Map(), lane = 1, index$319 = 0;
@@ -19231,4 +19231,4 @@ exports.hydrateRoot = function (container, initialChildren, options) {
listenToAllSupportedEvents(container);
return new ReactDOMHydrationRoot(initialChildren);
};
exports.version = "19.2.0-native-fb-85bbe39e-20250729";
exports.version = "19.2.0-native-fb-79dc7064-20250729";
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<042e52f96fa5db2d4229f53a3c16cce1>>
* @generated SignedSource<<d40c8016cde465d3fac17e4bd12beb0b>>
*/
/*
@@ -29081,11 +29081,11 @@ __DEV__ &&
};
(function () {
var isomorphicReactPackageVersion = React.version;
if ("19.2.0-native-fb-85bbe39e-20250729" !== isomorphicReactPackageVersion)
if ("19.2.0-native-fb-79dc7064-20250729" !== 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-85bbe39e-20250729\nLearn more: https://react.dev/warnings/version-mismatch")
"\n - react-dom: 19.2.0-native-fb-79dc7064-20250729\nLearn more: https://react.dev/warnings/version-mismatch")
);
})();
("function" === typeof Map &&
@@ -29122,10 +29122,10 @@ __DEV__ &&
!(function () {
var internals = {
bundleType: 1,
version: "19.2.0-native-fb-85bbe39e-20250729",
version: "19.2.0-native-fb-79dc7064-20250729",
rendererPackageName: "react-dom",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.2.0-native-fb-85bbe39e-20250729"
reconcilerVersion: "19.2.0-native-fb-79dc7064-20250729"
};
internals.overrideHookState = overrideHookState;
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
@@ -29579,7 +29579,7 @@ __DEV__ &&
exports.useFormStatus = function () {
return resolveDispatcher().useHostTransitionStatus();
};
exports.version = "19.2.0-native-fb-85bbe39e-20250729";
exports.version = "19.2.0-native-fb-79dc7064-20250729";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<eadc7a18ef76f75a63fb3d42612062f3>>
* @generated SignedSource<<5b055dc755c28ae3a86d828a42c00abf>>
*/
/*
@@ -17139,14 +17139,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) {
};
var isomorphicReactPackageVersion$jscomp$inline_2003 = React.version;
if (
"19.2.0-native-fb-85bbe39e-20250729" !==
"19.2.0-native-fb-79dc7064-20250729" !==
isomorphicReactPackageVersion$jscomp$inline_2003
)
throw Error(
formatProdErrorMessage(
527,
isomorphicReactPackageVersion$jscomp$inline_2003,
"19.2.0-native-fb-85bbe39e-20250729"
"19.2.0-native-fb-79dc7064-20250729"
)
);
ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
@@ -17168,10 +17168,10 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
};
var internals$jscomp$inline_2524 = {
bundleType: 0,
version: "19.2.0-native-fb-85bbe39e-20250729",
version: "19.2.0-native-fb-79dc7064-20250729",
rendererPackageName: "react-dom",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.2.0-native-fb-85bbe39e-20250729"
reconcilerVersion: "19.2.0-native-fb-79dc7064-20250729"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_2525 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -17422,4 +17422,4 @@ exports.useFormState = function (action, initialState, permalink) {
exports.useFormStatus = function () {
return ReactSharedInternals.H.useHostTransitionStatus();
};
exports.version = "19.2.0-native-fb-85bbe39e-20250729";
exports.version = "19.2.0-native-fb-79dc7064-20250729";
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<19b79154878565bc9201c3fda345c2e1>>
* @generated SignedSource<<1d89a3052bd4a9de985b789602a88419>>
*/
/*
@@ -19101,14 +19101,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) {
};
var isomorphicReactPackageVersion$jscomp$inline_2243 = React.version;
if (
"19.2.0-native-fb-85bbe39e-20250729" !==
"19.2.0-native-fb-79dc7064-20250729" !==
isomorphicReactPackageVersion$jscomp$inline_2243
)
throw Error(
formatProdErrorMessage(
527,
isomorphicReactPackageVersion$jscomp$inline_2243,
"19.2.0-native-fb-85bbe39e-20250729"
"19.2.0-native-fb-79dc7064-20250729"
)
);
ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
@@ -19130,10 +19130,10 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
};
var internals$jscomp$inline_2250 = {
bundleType: 0,
version: "19.2.0-native-fb-85bbe39e-20250729",
version: "19.2.0-native-fb-79dc7064-20250729",
rendererPackageName: "react-dom",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.2.0-native-fb-85bbe39e-20250729",
reconcilerVersion: "19.2.0-native-fb-79dc7064-20250729",
getLaneLabelMap: function () {
for (
var map = new Map(), lane = 1, index$319 = 0;
@@ -19399,7 +19399,7 @@ exports.useFormState = function (action, initialState, permalink) {
exports.useFormStatus = function () {
return ReactSharedInternals.H.useHostTransitionStatus();
};
exports.version = "19.2.0-native-fb-85bbe39e-20250729";
exports.version = "19.2.0-native-fb-79dc7064-20250729";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<a9676cd0395eb965e4ca373c40fffcce>>
* @generated SignedSource<<720fd1945dbb0a473801fb17f4a12e84>>
*/
"use strict";
@@ -15739,10 +15739,10 @@ __DEV__ &&
(function () {
var internals = {
bundleType: 1,
version: "19.2.0-native-fb-85bbe39e-20250729",
version: "19.2.0-native-fb-79dc7064-20250729",
rendererPackageName: "react-test-renderer",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.2.0-native-fb-85bbe39e-20250729"
reconcilerVersion: "19.2.0-native-fb-79dc7064-20250729"
};
internals.overrideHookState = overrideHookState;
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
@@ -15887,5 +15887,5 @@ __DEV__ &&
flushSyncWorkAcrossRoots_impl(0, !0));
}
};
exports.version = "19.2.0-native-fb-85bbe39e-20250729";
exports.version = "19.2.0-native-fb-79dc7064-20250729";
})();
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<8ac89ed282e82fc209412af10cf45113>>
* @generated SignedSource<<6642abeb557c0c634cf2ce7a4ebc34d0>>
*/
"use strict";
@@ -9912,10 +9912,10 @@ function wrapFiber(fiber) {
}
var internals$jscomp$inline_1432 = {
bundleType: 0,
version: "19.2.0-native-fb-85bbe39e-20250729",
version: "19.2.0-native-fb-79dc7064-20250729",
rendererPackageName: "react-test-renderer",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.2.0-native-fb-85bbe39e-20250729"
reconcilerVersion: "19.2.0-native-fb-79dc7064-20250729"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1433 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -10051,4 +10051,4 @@ exports.unstable_batchedUpdates = function (fn, a) {
flushSyncWorkAcrossRoots_impl(0, !0));
}
};
exports.version = "19.2.0-native-fb-85bbe39e-20250729";
exports.version = "19.2.0-native-fb-79dc7064-20250729";
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<c3a94ef5848fadafc09577fe8f5a5e7f>>
* @generated SignedSource<<6033c674f5f1ce75bdd8fac2ea383a60>>
*/
"use strict";
@@ -10532,10 +10532,10 @@ function wrapFiber(fiber) {
}
var internals$jscomp$inline_1239 = {
bundleType: 0,
version: "19.2.0-native-fb-85bbe39e-20250729",
version: "19.2.0-native-fb-79dc7064-20250729",
rendererPackageName: "react-test-renderer",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.2.0-native-fb-85bbe39e-20250729",
reconcilerVersion: "19.2.0-native-fb-79dc7064-20250729",
getLaneLabelMap: function () {
for (
var map = new Map(), lane = 1, index$143 = 0;
@@ -10686,4 +10686,4 @@ exports.unstable_batchedUpdates = function (fn, a) {
flushSyncWorkAcrossRoots_impl(0, !0));
}
};
exports.version = "19.2.0-native-fb-85bbe39e-20250729";
exports.version = "19.2.0-native-fb-79dc7064-20250729";
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<26bdbf2271269f7b76f948ebacab25e7>>
* @generated SignedSource<<e76439481f12fcd45fc1c74db7bdcb2d>>
*/
"use strict";
@@ -1413,7 +1413,7 @@ __DEV__ &&
exports.useTransition = function () {
return resolveDispatcher().useTransition();
};
exports.version = "19.2.0-native-fb-85bbe39e-20250729";
exports.version = "19.2.0-native-fb-79dc7064-20250729";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<784de8dcc608ae5a9f197deb3d5f1d95>>
* @generated SignedSource<<3b4ccea00b3bcdaddc4d9345bca8debb>>
*/
"use strict";
@@ -589,4 +589,4 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactSharedInternals.H.useTransition();
};
exports.version = "19.2.0-native-fb-85bbe39e-20250729";
exports.version = "19.2.0-native-fb-79dc7064-20250729";
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<3d838420a83d53fadbd63eea7c41bcf8>>
* @generated SignedSource<<cfa14048f5909ffed2d4a1b15e4ddb77>>
*/
"use strict";
@@ -593,7 +593,7 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactSharedInternals.H.useTransition();
};
exports.version = "19.2.0-native-fb-85bbe39e-20250729";
exports.version = "19.2.0-native-fb-79dc7064-20250729";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
@@ -1 +1 @@
85bbe39ef8e24a192b5e9f2987b1babf8ce772e1
79dc706498c4f8ef077167898492693197e1b975
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<2b97cb825a8de14dc2d802c2bffb3c88>>
* @generated SignedSource<<738e785daf5d7f764e2ebc2cb1bb185c>>
*/
"use strict";
@@ -19244,10 +19244,10 @@ __DEV__ &&
(function () {
var internals = {
bundleType: 1,
version: "19.2.0-native-fb-85bbe39e-20250729",
version: "19.2.0-native-fb-79dc7064-20250729",
rendererPackageName: "react-native-renderer",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.2.0-native-fb-85bbe39e-20250729"
reconcilerVersion: "19.2.0-native-fb-79dc7064-20250729"
};
null !== extraDevToolsConfig &&
(internals.rendererConfig = extraDevToolsConfig);
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<e79e448514c1bbc3d57e7e3a9c2be592>>
* @generated SignedSource<<d65d865271440b469356e3f4e57c7dc7>>
*/
"use strict";
@@ -11016,10 +11016,10 @@ batchedUpdatesImpl = function (fn, a) {
var roots = new Map(),
internals$jscomp$inline_1235 = {
bundleType: 0,
version: "19.2.0-native-fb-85bbe39e-20250729",
version: "19.2.0-native-fb-79dc7064-20250729",
rendererPackageName: "react-native-renderer",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.2.0-native-fb-85bbe39e-20250729"
reconcilerVersion: "19.2.0-native-fb-79dc7064-20250729"
};
null !== extraDevToolsConfig &&
(internals$jscomp$inline_1235.rendererConfig = extraDevToolsConfig);
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<0fc4f358ea3a17ef04da144fd603e629>>
* @generated SignedSource<<bc067959c9587ee73d8f244ba6764ee2>>
*/
"use strict";
@@ -12945,10 +12945,10 @@ batchedUpdatesImpl = function (fn, a) {
var roots = new Map(),
internals$jscomp$inline_1470 = {
bundleType: 0,
version: "19.2.0-native-fb-85bbe39e-20250729",
version: "19.2.0-native-fb-79dc7064-20250729",
rendererPackageName: "react-native-renderer",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.2.0-native-fb-85bbe39e-20250729"
reconcilerVersion: "19.2.0-native-fb-79dc7064-20250729"
};
null !== extraDevToolsConfig &&
(internals$jscomp$inline_1470.rendererConfig = extraDevToolsConfig);
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<aeb9f96e76ba12ca6f01361c0603bf76>>
* @generated SignedSource<<f40d8d1b86477cd8d6b9b1b36fc69922>>
*/
"use strict";
@@ -19602,11 +19602,11 @@ __DEV__ &&
shouldSuspendImpl = newShouldSuspendImpl;
};
var isomorphicReactPackageVersion = React.version;
if ("19.2.0-native-fb-85bbe39e-20250729" !== isomorphicReactPackageVersion)
if ("19.2.0-native-fb-79dc7064-20250729" !== 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-85bbe39e-20250729\nLearn more: https://react.dev/warnings/version-mismatch")
"\n - react-native-renderer: 19.2.0-native-fb-79dc7064-20250729\nLearn more: https://react.dev/warnings/version-mismatch")
);
if (
"function" !==
@@ -19632,10 +19632,10 @@ __DEV__ &&
(function () {
var internals = {
bundleType: 1,
version: "19.2.0-native-fb-85bbe39e-20250729",
version: "19.2.0-native-fb-79dc7064-20250729",
rendererPackageName: "react-native-renderer",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.2.0-native-fb-85bbe39e-20250729"
reconcilerVersion: "19.2.0-native-fb-79dc7064-20250729"
};
null !== extraDevToolsConfig &&
(internals.rendererConfig = extraDevToolsConfig);
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<ed3ec45618fe9436c7c57d855d48ca1a>>
* @generated SignedSource<<c8c710d94a061b74e2391219cd8d6854>>
*/
"use strict";
@@ -11242,11 +11242,11 @@ function updateContainer(element, container, parentComponent, callback) {
return lane;
}
var isomorphicReactPackageVersion = React.version;
if ("19.2.0-native-fb-85bbe39e-20250729" !== isomorphicReactPackageVersion)
if ("19.2.0-native-fb-79dc7064-20250729" !== 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-85bbe39e-20250729\nLearn more: https://react.dev/warnings/version-mismatch")
"\n - react-native-renderer: 19.2.0-native-fb-79dc7064-20250729\nLearn more: https://react.dev/warnings/version-mismatch")
);
if (
"function" !==
@@ -11296,10 +11296,10 @@ batchedUpdatesImpl = function (fn, a) {
var roots = new Map(),
internals$jscomp$inline_1293 = {
bundleType: 0,
version: "19.2.0-native-fb-85bbe39e-20250729",
version: "19.2.0-native-fb-79dc7064-20250729",
rendererPackageName: "react-native-renderer",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.2.0-native-fb-85bbe39e-20250729"
reconcilerVersion: "19.2.0-native-fb-79dc7064-20250729"
};
null !== extraDevToolsConfig &&
(internals$jscomp$inline_1293.rendererConfig = extraDevToolsConfig);
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<5d86196437272ff1e42fd23146d7f24f>>
* @generated SignedSource<<be4b226e6adb168b1de833cee3f3f29c>>
*/
"use strict";
@@ -13160,11 +13160,11 @@ function updateContainer(element, container, parentComponent, callback) {
return lane;
}
var isomorphicReactPackageVersion = React.version;
if ("19.2.0-native-fb-85bbe39e-20250729" !== isomorphicReactPackageVersion)
if ("19.2.0-native-fb-79dc7064-20250729" !== 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-85bbe39e-20250729\nLearn more: https://react.dev/warnings/version-mismatch")
"\n - react-native-renderer: 19.2.0-native-fb-79dc7064-20250729\nLearn more: https://react.dev/warnings/version-mismatch")
);
if (
"function" !==
@@ -13214,10 +13214,10 @@ batchedUpdatesImpl = function (fn, a) {
var roots = new Map(),
internals$jscomp$inline_1528 = {
bundleType: 0,
version: "19.2.0-native-fb-85bbe39e-20250729",
version: "19.2.0-native-fb-79dc7064-20250729",
rendererPackageName: "react-native-renderer",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.2.0-native-fb-85bbe39e-20250729"
reconcilerVersion: "19.2.0-native-fb-79dc7064-20250729"
};
null !== extraDevToolsConfig &&
(internals$jscomp$inline_1528.rendererConfig = extraDevToolsConfig);
@@ -12,7 +12,7 @@
* @lightSyntaxTransform
* @preventMunge
* @oncall react_core
* @generated SignedSource<<85f4a03610e3d0a39fe3599dabbf580e>>
* @generated SignedSource<<7b5ad27d2ad9b3ff54e2ffc7a755e6a3>>
*/
'use strict';
@@ -48417,27 +48417,30 @@ function validateNoRefAccessInRenderImpl(fn, env) {
const hookKind = getHookKindForType(fn.env, callee.identifier.type);
let returnType = { kind: 'None' };
const fnType = env.get(callee.identifier.id);
let didError = false;
if ((fnType === null || fnType === void 0 ? void 0 : fnType.kind) === 'Structure' && fnType.fn !== null) {
returnType = fnType.fn.returnType;
if (fnType.fn.readRefEffect) {
errors.push({
didError = true;
errors.pushDiagnostic(CompilerDiagnostic.create({
severity: ErrorSeverity.InvalidReact,
reason: 'This function accesses a ref value (the `current` property), which may not be accessed during render. (https://react.dev/reference/react/useRef)',
category: 'Cannot access refs during render',
description: ERROR_DESCRIPTION,
}).withDetail({
kind: 'error',
loc: callee.loc,
description: callee.identifier.name !== null &&
callee.identifier.name.kind === 'named'
? `Function \`${callee.identifier.name.value}\` accesses a ref`
: null,
suggestions: null,
});
message: `This function accesses a ref value`,
}));
}
}
for (const operand of eachInstructionValueOperand(instr.value)) {
if (hookKind != null) {
validateNoDirectRefValueAccess(errors, operand, env);
}
else {
validateNoRefAccess(errors, env, operand, operand.loc);
if (!didError) {
for (const operand of eachInstructionValueOperand(instr.value)) {
if (hookKind != null) {
validateNoDirectRefValueAccess(errors, operand, env);
}
else {
validateNoRefPassedToFunction(errors, env, operand, operand.loc);
}
}
}
env.set(instr.lvalue.identifier.id, returnType);
@@ -48478,7 +48481,7 @@ function validateNoRefAccessInRenderImpl(fn, env) {
safeBlocks.delete(block.id);
}
else {
validateNoRefAccess(errors, env, instr.value.object, instr.loc);
validateNoRefUpdate(errors, env, instr.value.object, instr.loc);
}
for (const operand of eachInstructionValueOperand(instr.value)) {
if (operand === instr.value.object) {
@@ -48582,16 +48585,15 @@ function destructure(type) {
function guardCheck(errors, operand, env) {
var _a;
if (((_a = env.get(operand.identifier.id)) === null || _a === void 0 ? void 0 : _a.kind) === 'Guard') {
errors.push({
errors.pushDiagnostic(CompilerDiagnostic.create({
severity: ErrorSeverity.InvalidReact,
reason: 'Ref values (the `current` property) may not be accessed during render. (https://react.dev/reference/react/useRef)',
category: 'Cannot access refs during render',
description: ERROR_DESCRIPTION,
}).withDetail({
kind: 'error',
loc: operand.loc,
description: operand.identifier.name !== null &&
operand.identifier.name.kind === 'named'
? `Cannot access ref value \`${operand.identifier.name.value}\``
: null,
suggestions: null,
});
message: `Cannot access ref value during render`,
}));
}
}
function validateNoRefValueAccess(errors, env, operand) {
@@ -48599,52 +48601,70 @@ function validateNoRefValueAccess(errors, env, operand) {
const type = destructure(env.get(operand.identifier.id));
if ((type === null || type === void 0 ? void 0 : type.kind) === 'RefValue' ||
((type === null || type === void 0 ? void 0 : type.kind) === 'Structure' && ((_a = type.fn) === null || _a === void 0 ? void 0 : _a.readRefEffect))) {
errors.push({
errors.pushDiagnostic(CompilerDiagnostic.create({
severity: ErrorSeverity.InvalidReact,
reason: 'Ref values (the `current` property) may not be accessed during render. (https://react.dev/reference/react/useRef)',
category: 'Cannot access refs during render',
description: ERROR_DESCRIPTION,
}).withDetail({
kind: 'error',
loc: (type.kind === 'RefValue' && type.loc) || operand.loc,
description: operand.identifier.name !== null &&
operand.identifier.name.kind === 'named'
? `Cannot access ref value \`${operand.identifier.name.value}\``
: null,
suggestions: null,
});
message: `Cannot access ref value during render`,
}));
}
}
function validateNoRefAccess(errors, env, operand, loc) {
function validateNoRefPassedToFunction(errors, env, operand, loc) {
var _a;
const type = destructure(env.get(operand.identifier.id));
if ((type === null || type === void 0 ? void 0 : type.kind) === 'Ref' ||
(type === null || type === void 0 ? void 0 : type.kind) === 'RefValue' ||
((type === null || type === void 0 ? void 0 : type.kind) === 'Structure' && ((_a = type.fn) === null || _a === void 0 ? void 0 : _a.readRefEffect))) {
errors.push({
errors.pushDiagnostic(CompilerDiagnostic.create({
severity: ErrorSeverity.InvalidReact,
reason: 'Ref values (the `current` property) may not be accessed during render. (https://react.dev/reference/react/useRef)',
category: 'Cannot access refs during render',
description: ERROR_DESCRIPTION,
}).withDetail({
kind: 'error',
loc: (type.kind === 'RefValue' && type.loc) || loc,
description: operand.identifier.name !== null &&
operand.identifier.name.kind === 'named'
? `Cannot access ref value \`${operand.identifier.name.value}\``
: null,
suggestions: null,
});
message: `Passing a ref to a function may read its value during render`,
}));
}
}
function validateNoRefUpdate(errors, env, operand, loc) {
var _a;
const type = destructure(env.get(operand.identifier.id));
if ((type === null || type === void 0 ? void 0 : type.kind) === 'Ref' ||
(type === null || type === void 0 ? void 0 : type.kind) === 'RefValue' ||
((type === null || type === void 0 ? void 0 : type.kind) === 'Structure' && ((_a = type.fn) === null || _a === void 0 ? void 0 : _a.readRefEffect))) {
errors.pushDiagnostic(CompilerDiagnostic.create({
severity: ErrorSeverity.InvalidReact,
category: 'Cannot access refs during render',
description: ERROR_DESCRIPTION,
}).withDetail({
kind: 'error',
loc: (type.kind === 'RefValue' && type.loc) || loc,
message: `Cannot update ref during render`,
}));
}
}
function validateNoDirectRefValueAccess(errors, operand, env) {
var _a;
const type = destructure(env.get(operand.identifier.id));
if ((type === null || type === void 0 ? void 0 : type.kind) === 'RefValue') {
errors.push({
errors.pushDiagnostic(CompilerDiagnostic.create({
severity: ErrorSeverity.InvalidReact,
reason: 'Ref values (the `current` property) may not be accessed during render. (https://react.dev/reference/react/useRef)',
category: 'Cannot access refs during render',
description: ERROR_DESCRIPTION,
}).withDetail({
kind: 'error',
loc: (_a = type.loc) !== null && _a !== void 0 ? _a : operand.loc,
description: operand.identifier.name !== null &&
operand.identifier.name.kind === 'named'
? `Cannot access ref value \`${operand.identifier.name.value}\``
: null,
suggestions: null,
});
message: `Cannot access ref value during render`,
}));
}
}
const ERROR_DESCRIPTION = 'React refs are values that are not needed for rendering. Refs should only be accessed ' +
'outside of render, such as in event handlers or effects. ' +
'Accessing a ref value (the `current` property) during render can cause your component ' +
'not to update as expected (https://react.dev/reference/react/useRef)';
function validateNoSetStateInRender(fn) {
const unconditionalSetStateFunctions = new Set();
@@ -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<<377758887af8926074774ed2f3e15beb>>
* @generated SignedSource<<64572058ce96b666592e1c4520ef72ad>>
*/
'use strict';
@@ -48196,27 +48196,30 @@ function validateNoRefAccessInRenderImpl(fn, env) {
const hookKind = getHookKindForType(fn.env, callee.identifier.type);
let returnType = { kind: 'None' };
const fnType = env.get(callee.identifier.id);
let didError = false;
if ((fnType === null || fnType === void 0 ? void 0 : fnType.kind) === 'Structure' && fnType.fn !== null) {
returnType = fnType.fn.returnType;
if (fnType.fn.readRefEffect) {
errors.push({
didError = true;
errors.pushDiagnostic(CompilerDiagnostic.create({
severity: ErrorSeverity.InvalidReact,
reason: 'This function accesses a ref value (the `current` property), which may not be accessed during render. (https://react.dev/reference/react/useRef)',
category: 'Cannot access refs during render',
description: ERROR_DESCRIPTION,
}).withDetail({
kind: 'error',
loc: callee.loc,
description: callee.identifier.name !== null &&
callee.identifier.name.kind === 'named'
? `Function \`${callee.identifier.name.value}\` accesses a ref`
: null,
suggestions: null,
});
message: `This function accesses a ref value`,
}));
}
}
for (const operand of eachInstructionValueOperand(instr.value)) {
if (hookKind != null) {
validateNoDirectRefValueAccess(errors, operand, env);
}
else {
validateNoRefAccess(errors, env, operand, operand.loc);
if (!didError) {
for (const operand of eachInstructionValueOperand(instr.value)) {
if (hookKind != null) {
validateNoDirectRefValueAccess(errors, operand, env);
}
else {
validateNoRefPassedToFunction(errors, env, operand, operand.loc);
}
}
}
env.set(instr.lvalue.identifier.id, returnType);
@@ -48257,7 +48260,7 @@ function validateNoRefAccessInRenderImpl(fn, env) {
safeBlocks.delete(block.id);
}
else {
validateNoRefAccess(errors, env, instr.value.object, instr.loc);
validateNoRefUpdate(errors, env, instr.value.object, instr.loc);
}
for (const operand of eachInstructionValueOperand(instr.value)) {
if (operand === instr.value.object) {
@@ -48361,16 +48364,15 @@ function destructure(type) {
function guardCheck(errors, operand, env) {
var _a;
if (((_a = env.get(operand.identifier.id)) === null || _a === void 0 ? void 0 : _a.kind) === 'Guard') {
errors.push({
errors.pushDiagnostic(CompilerDiagnostic.create({
severity: ErrorSeverity.InvalidReact,
reason: 'Ref values (the `current` property) may not be accessed during render. (https://react.dev/reference/react/useRef)',
category: 'Cannot access refs during render',
description: ERROR_DESCRIPTION,
}).withDetail({
kind: 'error',
loc: operand.loc,
description: operand.identifier.name !== null &&
operand.identifier.name.kind === 'named'
? `Cannot access ref value \`${operand.identifier.name.value}\``
: null,
suggestions: null,
});
message: `Cannot access ref value during render`,
}));
}
}
function validateNoRefValueAccess(errors, env, operand) {
@@ -48378,52 +48380,70 @@ function validateNoRefValueAccess(errors, env, operand) {
const type = destructure(env.get(operand.identifier.id));
if ((type === null || type === void 0 ? void 0 : type.kind) === 'RefValue' ||
((type === null || type === void 0 ? void 0 : type.kind) === 'Structure' && ((_a = type.fn) === null || _a === void 0 ? void 0 : _a.readRefEffect))) {
errors.push({
errors.pushDiagnostic(CompilerDiagnostic.create({
severity: ErrorSeverity.InvalidReact,
reason: 'Ref values (the `current` property) may not be accessed during render. (https://react.dev/reference/react/useRef)',
category: 'Cannot access refs during render',
description: ERROR_DESCRIPTION,
}).withDetail({
kind: 'error',
loc: (type.kind === 'RefValue' && type.loc) || operand.loc,
description: operand.identifier.name !== null &&
operand.identifier.name.kind === 'named'
? `Cannot access ref value \`${operand.identifier.name.value}\``
: null,
suggestions: null,
});
message: `Cannot access ref value during render`,
}));
}
}
function validateNoRefAccess(errors, env, operand, loc) {
function validateNoRefPassedToFunction(errors, env, operand, loc) {
var _a;
const type = destructure(env.get(operand.identifier.id));
if ((type === null || type === void 0 ? void 0 : type.kind) === 'Ref' ||
(type === null || type === void 0 ? void 0 : type.kind) === 'RefValue' ||
((type === null || type === void 0 ? void 0 : type.kind) === 'Structure' && ((_a = type.fn) === null || _a === void 0 ? void 0 : _a.readRefEffect))) {
errors.push({
errors.pushDiagnostic(CompilerDiagnostic.create({
severity: ErrorSeverity.InvalidReact,
reason: 'Ref values (the `current` property) may not be accessed during render. (https://react.dev/reference/react/useRef)',
category: 'Cannot access refs during render',
description: ERROR_DESCRIPTION,
}).withDetail({
kind: 'error',
loc: (type.kind === 'RefValue' && type.loc) || loc,
description: operand.identifier.name !== null &&
operand.identifier.name.kind === 'named'
? `Cannot access ref value \`${operand.identifier.name.value}\``
: null,
suggestions: null,
});
message: `Passing a ref to a function may read its value during render`,
}));
}
}
function validateNoRefUpdate(errors, env, operand, loc) {
var _a;
const type = destructure(env.get(operand.identifier.id));
if ((type === null || type === void 0 ? void 0 : type.kind) === 'Ref' ||
(type === null || type === void 0 ? void 0 : type.kind) === 'RefValue' ||
((type === null || type === void 0 ? void 0 : type.kind) === 'Structure' && ((_a = type.fn) === null || _a === void 0 ? void 0 : _a.readRefEffect))) {
errors.pushDiagnostic(CompilerDiagnostic.create({
severity: ErrorSeverity.InvalidReact,
category: 'Cannot access refs during render',
description: ERROR_DESCRIPTION,
}).withDetail({
kind: 'error',
loc: (type.kind === 'RefValue' && type.loc) || loc,
message: `Cannot update ref during render`,
}));
}
}
function validateNoDirectRefValueAccess(errors, operand, env) {
var _a;
const type = destructure(env.get(operand.identifier.id));
if ((type === null || type === void 0 ? void 0 : type.kind) === 'RefValue') {
errors.push({
errors.pushDiagnostic(CompilerDiagnostic.create({
severity: ErrorSeverity.InvalidReact,
reason: 'Ref values (the `current` property) may not be accessed during render. (https://react.dev/reference/react/useRef)',
category: 'Cannot access refs during render',
description: ERROR_DESCRIPTION,
}).withDetail({
kind: 'error',
loc: (_a = type.loc) !== null && _a !== void 0 ? _a : operand.loc,
description: operand.identifier.name !== null &&
operand.identifier.name.kind === 'named'
? `Cannot access ref value \`${operand.identifier.name.value}\``
: null,
suggestions: null,
});
message: `Cannot access ref value during render`,
}));
}
}
const ERROR_DESCRIPTION = 'React refs are values that are not needed for rendering. Refs should only be accessed ' +
'outside of render, such as in event handlers or effects. ' +
'Accessing a ref value (the `current` property) during render can cause your component ' +
'not to update as expected (https://react.dev/reference/react/useRef)';
function validateNoSetStateInRender(fn) {
const unconditionalSetStateFunctions = new Set();
@@ -1,7 +1,7 @@
{
"name": "eslint-plugin-react-hooks",
"description": "ESLint rules for React Hooks",
"version": "0.0.0-experimental-85bbe39e-20250729",
"version": "0.0.0-experimental-79dc7064-20250729",
"repository": {
"type": "git",
"url": "https://github.com/facebook/react.git",