From 1d149910da011e18dc67a9f7fa22476bebca2e73 Mon Sep 17 00:00:00 2001 From: josephsavona Date: Tue, 29 Jul 2025 10:11:27 -0700 Subject: [PATCH] [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 [79dc706498c4f8ef077167898492693197e1b975](https://github.com/facebook/react/commit/79dc706498c4f8ef077167898492693197e1b975) --- compiled-rn/VERSION_NATIVE_FB | 2 +- .../react/react-dom/cjs/ReactDOM-dev.js | 4 +- .../react/react-dom/cjs/ReactDOM-prod.js | 4 +- .../react/react-dom/cjs/ReactDOM-profiling.js | 4 +- .../react/react-dom/cjs/ReactDOMClient-dev.js | 12 +- .../react-dom/cjs/ReactDOMClient-prod.js | 12 +- .../react-dom/cjs/ReactDOMClient-profiling.js | 12 +- .../react-dom/cjs/ReactDOMProfiling-dev.js | 12 +- .../react-dom/cjs/ReactDOMProfiling-prod.js | 12 +- .../cjs/ReactDOMProfiling-profiling.js | 12 +- .../cjs/ReactTestRenderer-dev.js | 8 +- .../cjs/ReactTestRenderer-prod.js | 8 +- .../cjs/ReactTestRenderer-profiling.js | 8 +- .../vendor/react/react/cjs/React-dev.js | 4 +- .../vendor/react/react/cjs/React-prod.js | 4 +- .../vendor/react/react/cjs/React-profiling.js | 4 +- .../Libraries/Renderer/REVISION | 2 +- .../implementations/ReactFabric-dev.fb.js | 6 +- .../implementations/ReactFabric-prod.fb.js | 6 +- .../ReactFabric-profiling.fb.js | 6 +- .../ReactNativeRenderer-dev.fb.js | 10 +- .../ReactNativeRenderer-prod.fb.js | 10 +- .../ReactNativeRenderer-profiling.fb.js | 10 +- .../eslint-plugin-react-hooks.development.js | 118 ++++++++++-------- .../eslint-plugin-react-hooks.production.js | 118 ++++++++++-------- .../eslint-plugin-react-hooks/package.json | 2 +- 26 files changed, 225 insertions(+), 185 deletions(-) diff --git a/compiled-rn/VERSION_NATIVE_FB b/compiled-rn/VERSION_NATIVE_FB index c594342560..9b970f8941 100644 --- a/compiled-rn/VERSION_NATIVE_FB +++ b/compiled-rn/VERSION_NATIVE_FB @@ -1 +1 @@ -19.2.0-native-fb-85bbe39e-20250729 \ No newline at end of file +19.2.0-native-fb-79dc7064-20250729 \ No newline at end of file diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOM-dev.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOM-dev.js index 891a196cbf..003dd8267c 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOM-dev.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOM-dev.js @@ -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"; })(); diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOM-prod.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOM-prod.js index a21ba83ae5..1471d22c34 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOM-prod.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOM-prod.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<> + * @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"; diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOM-profiling.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOM-profiling.js index a21ba83ae5..1471d22c34 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOM-profiling.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOM-profiling.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<> + * @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"; diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMClient-dev.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMClient-dev.js index 30d5dc4d81..4478ab1c4e 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMClient-dev.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMClient-dev.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<> + * @generated SignedSource<> */ /* @@ -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"; })(); diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMClient-prod.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMClient-prod.js index 0dbe4661b9..c808486320 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMClient-prod.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMClient-prod.js @@ -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"; diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMClient-profiling.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMClient-profiling.js index 55b109b80f..4cb10089f1 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMClient-profiling.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMClient-profiling.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<0bb697ac6752af2d62713e28025820ad>> + * @generated SignedSource<> */ /* @@ -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"; diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMProfiling-dev.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMProfiling-dev.js index 04a37558ad..904ba06605 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMProfiling-dev.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMProfiling-dev.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<042e52f96fa5db2d4229f53a3c16cce1>> + * @generated SignedSource<> */ /* @@ -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 && diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMProfiling-prod.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMProfiling-prod.js index 5982506beb..528704bcd7 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMProfiling-prod.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMProfiling-prod.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<> + * @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"; diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMProfiling-profiling.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMProfiling-profiling.js index 84e51d1047..5bd7af6695 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMProfiling-profiling.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMProfiling-profiling.js @@ -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 && diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-test-renderer/cjs/ReactTestRenderer-dev.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-test-renderer/cjs/ReactTestRenderer-dev.js index 82077f1125..60863e8496 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-test-renderer/cjs/ReactTestRenderer-dev.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-test-renderer/cjs/ReactTestRenderer-dev.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<> + * @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"; })(); diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-test-renderer/cjs/ReactTestRenderer-prod.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-test-renderer/cjs/ReactTestRenderer-prod.js index 7502c57aaa..5b4bde36cc 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-test-renderer/cjs/ReactTestRenderer-prod.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-test-renderer/cjs/ReactTestRenderer-prod.js @@ -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"; diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-test-renderer/cjs/ReactTestRenderer-profiling.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-test-renderer/cjs/ReactTestRenderer-profiling.js index 3187dac9a3..8347cf0ceb 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-test-renderer/cjs/ReactTestRenderer-profiling.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-test-renderer/cjs/ReactTestRenderer-profiling.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<> + * @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"; diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react/cjs/React-dev.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react/cjs/React-dev.js index 69c2c14c89..afe1ca1bb2 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react/cjs/React-dev.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react/cjs/React-dev.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<26bdbf2271269f7b76f948ebacab25e7>> + * @generated SignedSource<> */ "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 && diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react/cjs/React-prod.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react/cjs/React-prod.js index e041a685c8..fdbf3aaee8 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react/cjs/React-prod.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react/cjs/React-prod.js @@ -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"; diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react/cjs/React-profiling.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react/cjs/React-profiling.js index 44eb40d05d..fa1ab54bab 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react/cjs/React-profiling.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react/cjs/React-profiling.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<3d838420a83d53fadbd63eea7c41bcf8>> + * @generated SignedSource<> */ "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 && diff --git a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/REVISION b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/REVISION index 05936c9fe9..68ad780738 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/REVISION +++ b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/REVISION @@ -1 +1 @@ -85bbe39ef8e24a192b5e9f2987b1babf8ce772e1 +79dc706498c4f8ef077167898492693197e1b975 diff --git a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-dev.fb.js b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-dev.fb.js index 05c6a94219..181a5aa07a 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-dev.fb.js +++ b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-dev.fb.js @@ -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); diff --git a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-prod.fb.js b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-prod.fb.js index 64b0017c48..b5c89dfea6 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-prod.fb.js +++ b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-prod.fb.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<> + * @generated SignedSource<> */ "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); diff --git a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-profiling.fb.js b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-profiling.fb.js index 7f50ff9be0..0afa47ef5a 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-profiling.fb.js +++ b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-profiling.fb.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<0fc4f358ea3a17ef04da144fd603e629>> + * @generated SignedSource<> */ "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); diff --git a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js index dd8d71299f..30b9f93ae2 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js +++ b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<> + * @generated SignedSource<> */ "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); diff --git a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-prod.fb.js b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-prod.fb.js index 7d8df29a15..ab08e76302 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-prod.fb.js +++ b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-prod.fb.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<> + * @generated SignedSource<> */ "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); diff --git a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.fb.js b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.fb.js index 0cf92230e9..f0cafb8997 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.fb.js +++ b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.fb.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<5d86196437272ff1e42fd23146d7f24f>> + * @generated SignedSource<> */ "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); diff --git a/compiled-rn/facebook-fbsource/xplat/js/tools/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.development.js b/compiled-rn/facebook-fbsource/xplat/js/tools/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.development.js index 65e1dee070..19b19f523f 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/tools/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.development.js +++ b/compiled-rn/facebook-fbsource/xplat/js/tools/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.development.js @@ -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(); diff --git a/compiled-rn/facebook-fbsource/xplat/js/tools/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.production.js b/compiled-rn/facebook-fbsource/xplat/js/tools/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.production.js index d784959f0d..df9868668e 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/tools/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.production.js +++ b/compiled-rn/facebook-fbsource/xplat/js/tools/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.production.js @@ -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(); diff --git a/compiled-rn/facebook-fbsource/xplat/js/tools/eslint-plugin-react-hooks/package.json b/compiled-rn/facebook-fbsource/xplat/js/tools/eslint-plugin-react-hooks/package.json index fcc4021b89..90f0e5368d 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/tools/eslint-plugin-react-hooks/package.json +++ b/compiled-rn/facebook-fbsource/xplat/js/tools/eslint-plugin-react-hooks/package.json @@ -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",