From 91c9f1803ef6db069da1c445ff47136fe1b8ac7b Mon Sep 17 00:00:00 2001 From: josephsavona Date: Thu, 28 Aug 2025 16:27:20 -0700 Subject: [PATCH] [compiler] Detect known incompatible libraries (#34027) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A few libraries are known to be incompatible with memoization, whether manually via `useMemo()` or via React Compiler. This puts us in a tricky situation. On the one hand, we understand that these libraries were developed prior to our documenting the [Rules of React](https://react.dev/reference/rules), and their designs were the result of trying to deliver a great experience for their users and balance multiple priorities around DX, performance, etc. At the same time, using these libraries with memoization — and in particular with automatic memoization via React Compiler — can break apps by causing the components using these APIs not to update. Concretely, the APIs have in common that they return a function which returns different values over time, but where the function itself does not change. Memoizing the result on the identity of the function will mean that the value never changes. Developers reasonable interpret this as "React Compiler broke my code". Of course, the best solution is to work with developers of these libraries to address the root cause, and we're doing that. We've previously discussed this situation with both of the respective libraries: * React Hook Form: https://github.com/react-hook-form/react-hook-form/issues/11910#issuecomment-2135608761 * TanStack Table: https://github.com/facebook/react/issues/33057#issuecomment-2840600158 and https://github.com/TanStack/table/issues/5567 In the meantime we need to make sure that React Compiler can work out of the box as much as possible. This means teaching it about popular libraries that cannot be memoized. We also can't silently skip compilation, as this confuses users, so we need these error messages to be visible to users. To that end, this PR adds: * A flag to mark functions/hooks as incompatible * Validation against use of such functions * A default type provider to provide declarations for two known-incompatible libraries Note that Mobx is also incompatible, but the `observable()` function is called outside of the component itself, so the compiler cannot currently detect it. We may add validation for such APIs in the future. Again, we really empathize with the developers of these libraries. We've tried to word the error message non-judgementally, because we get that it's hard! We're open to feedback about the error message, please let us know. DiffTrain build for [4082b0e7d3c042d49ef8987547b923051936956f](https://github.com/facebook/react/commit/4082b0e7d3c042d49ef8987547b923051936956f) --- 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 | 107 +++++++++++++++--- .../eslint-plugin-react-hooks.production.js | 107 +++++++++++++++--- .../eslint-plugin-react-hooks/package.json | 2 +- 26 files changed, 275 insertions(+), 113 deletions(-) diff --git a/compiled-rn/VERSION_NATIVE_FB b/compiled-rn/VERSION_NATIVE_FB index fdf79adab3..b8fdb8e20d 100644 --- a/compiled-rn/VERSION_NATIVE_FB +++ b/compiled-rn/VERSION_NATIVE_FB @@ -1 +1 @@ -19.2.0-native-fb-872b4fef-20250828 \ No newline at end of file +19.2.0-native-fb-4082b0e7-20250828 \ 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 d7ffc319c2..b4bab35810 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<<900ad256fe6c3ac39b417274a1e8b35f>> + * @generated SignedSource<<4175c435d44f4319000cb9436906673a>> */ "use strict"; @@ -404,5 +404,5 @@ __DEV__ && exports.useFormStatus = function () { return resolveDispatcher().useHostTransitionStatus(); }; - exports.version = "19.2.0-native-fb-872b4fef-20250828"; + exports.version = "19.2.0-native-fb-4082b0e7-20250828"; })(); 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 dd7e459bc3..87f8a08ac8 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<<9cb135702a4f45635a5a436f02e09003>> + * @generated SignedSource<<5d8d1e06786393aa6dee0f4c366443e2>> */ "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-872b4fef-20250828"; +exports.version = "19.2.0-native-fb-4082b0e7-20250828"; 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 dd7e459bc3..87f8a08ac8 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<<9cb135702a4f45635a5a436f02e09003>> + * @generated SignedSource<<5d8d1e06786393aa6dee0f4c366443e2>> */ "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-872b4fef-20250828"; +exports.version = "19.2.0-native-fb-4082b0e7-20250828"; 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 80daf542f1..95f0603f9d 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<> */ /* @@ -29448,11 +29448,11 @@ __DEV__ && }; (function () { var isomorphicReactPackageVersion = React.version; - if ("19.2.0-native-fb-872b4fef-20250828" !== isomorphicReactPackageVersion) + if ("19.2.0-native-fb-4082b0e7-20250828" !== 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-872b4fef-20250828\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.2.0-native-fb-4082b0e7-20250828\nLearn more: https://react.dev/warnings/version-mismatch") ); })(); ("function" === typeof Map && @@ -29489,10 +29489,10 @@ __DEV__ && !(function () { var internals = { bundleType: 1, - version: "19.2.0-native-fb-872b4fef-20250828", + version: "19.2.0-native-fb-4082b0e7-20250828", rendererPackageName: "react-dom", currentDispatcherRef: ReactSharedInternals, - reconcilerVersion: "19.2.0-native-fb-872b4fef-20250828" + reconcilerVersion: "19.2.0-native-fb-4082b0e7-20250828" }; internals.overrideHookState = overrideHookState; internals.overrideHookStateDeletePath = overrideHookStateDeletePath; @@ -29631,5 +29631,5 @@ __DEV__ && listenToAllSupportedEvents(container); return new ReactDOMHydrationRoot(initialChildren); }; - exports.version = "19.2.0-native-fb-872b4fef-20250828"; + exports.version = "19.2.0-native-fb-4082b0e7-20250828"; })(); 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 9e59dbadad..5a60dccd5f 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<<974ad2eb818dfd4907aab37eccdbab15>> + * @generated SignedSource<<8d6d9e793eb29ee9af951fc3851228d5>> */ /* @@ -17258,14 +17258,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) { }; var isomorphicReactPackageVersion$jscomp$inline_2034 = React.version; if ( - "19.2.0-native-fb-872b4fef-20250828" !== + "19.2.0-native-fb-4082b0e7-20250828" !== isomorphicReactPackageVersion$jscomp$inline_2034 ) throw Error( formatProdErrorMessage( 527, isomorphicReactPackageVersion$jscomp$inline_2034, - "19.2.0-native-fb-872b4fef-20250828" + "19.2.0-native-fb-4082b0e7-20250828" ) ); ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { @@ -17287,10 +17287,10 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { }; var internals$jscomp$inline_2565 = { bundleType: 0, - version: "19.2.0-native-fb-872b4fef-20250828", + version: "19.2.0-native-fb-4082b0e7-20250828", rendererPackageName: "react-dom", currentDispatcherRef: ReactSharedInternals, - reconcilerVersion: "19.2.0-native-fb-872b4fef-20250828" + reconcilerVersion: "19.2.0-native-fb-4082b0e7-20250828" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_2566 = __REACT_DEVTOOLS_GLOBAL_HOOK__; @@ -17388,4 +17388,4 @@ exports.hydrateRoot = function (container, initialChildren, options) { listenToAllSupportedEvents(container); return new ReactDOMHydrationRoot(initialChildren); }; -exports.version = "19.2.0-native-fb-872b4fef-20250828"; +exports.version = "19.2.0-native-fb-4082b0e7-20250828"; 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 8daaefd651..ca3833b6eb 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<> + * @generated SignedSource<<02cfe06f045497c2649aed5a9f17bc41>> */ /* @@ -19268,14 +19268,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) { }; var isomorphicReactPackageVersion$jscomp$inline_2285 = React.version; if ( - "19.2.0-native-fb-872b4fef-20250828" !== + "19.2.0-native-fb-4082b0e7-20250828" !== isomorphicReactPackageVersion$jscomp$inline_2285 ) throw Error( formatProdErrorMessage( 527, isomorphicReactPackageVersion$jscomp$inline_2285, - "19.2.0-native-fb-872b4fef-20250828" + "19.2.0-native-fb-4082b0e7-20250828" ) ); ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { @@ -19297,10 +19297,10 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { }; var internals$jscomp$inline_2292 = { bundleType: 0, - version: "19.2.0-native-fb-872b4fef-20250828", + version: "19.2.0-native-fb-4082b0e7-20250828", rendererPackageName: "react-dom", currentDispatcherRef: ReactSharedInternals, - reconcilerVersion: "19.2.0-native-fb-872b4fef-20250828", + reconcilerVersion: "19.2.0-native-fb-4082b0e7-20250828", getLaneLabelMap: function () { for ( var map = new Map(), lane = 1, index$321 = 0; @@ -19414,4 +19414,4 @@ exports.hydrateRoot = function (container, initialChildren, options) { listenToAllSupportedEvents(container); return new ReactDOMHydrationRoot(initialChildren); }; -exports.version = "19.2.0-native-fb-872b4fef-20250828"; +exports.version = "19.2.0-native-fb-4082b0e7-20250828"; 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 97e143dd00..1e28f9204e 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<<0486a24a2afbb4f15e0f9515e509b97f>> + * @generated SignedSource<> */ /* @@ -29504,11 +29504,11 @@ __DEV__ && }; (function () { var isomorphicReactPackageVersion = React.version; - if ("19.2.0-native-fb-872b4fef-20250828" !== isomorphicReactPackageVersion) + if ("19.2.0-native-fb-4082b0e7-20250828" !== 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-872b4fef-20250828\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.2.0-native-fb-4082b0e7-20250828\nLearn more: https://react.dev/warnings/version-mismatch") ); })(); ("function" === typeof Map && @@ -29545,10 +29545,10 @@ __DEV__ && !(function () { var internals = { bundleType: 1, - version: "19.2.0-native-fb-872b4fef-20250828", + version: "19.2.0-native-fb-4082b0e7-20250828", rendererPackageName: "react-dom", currentDispatcherRef: ReactSharedInternals, - reconcilerVersion: "19.2.0-native-fb-872b4fef-20250828" + reconcilerVersion: "19.2.0-native-fb-4082b0e7-20250828" }; internals.overrideHookState = overrideHookState; internals.overrideHookStateDeletePath = overrideHookStateDeletePath; @@ -30003,7 +30003,7 @@ __DEV__ && exports.useFormStatus = function () { return resolveDispatcher().useHostTransitionStatus(); }; - exports.version = "19.2.0-native-fb-872b4fef-20250828"; + exports.version = "19.2.0-native-fb-4082b0e7-20250828"; "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 be3fd51c3e..aacc270be3 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<<1f8f1c948f52fa4ee6ba9c1236786753>> */ /* @@ -17269,14 +17269,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) { }; var isomorphicReactPackageVersion$jscomp$inline_2035 = React.version; if ( - "19.2.0-native-fb-872b4fef-20250828" !== + "19.2.0-native-fb-4082b0e7-20250828" !== isomorphicReactPackageVersion$jscomp$inline_2035 ) throw Error( formatProdErrorMessage( 527, isomorphicReactPackageVersion$jscomp$inline_2035, - "19.2.0-native-fb-872b4fef-20250828" + "19.2.0-native-fb-4082b0e7-20250828" ) ); ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { @@ -17298,10 +17298,10 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { }; var internals$jscomp$inline_2568 = { bundleType: 0, - version: "19.2.0-native-fb-872b4fef-20250828", + version: "19.2.0-native-fb-4082b0e7-20250828", rendererPackageName: "react-dom", currentDispatcherRef: ReactSharedInternals, - reconcilerVersion: "19.2.0-native-fb-872b4fef-20250828" + reconcilerVersion: "19.2.0-native-fb-4082b0e7-20250828" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_2569 = __REACT_DEVTOOLS_GLOBAL_HOOK__; @@ -17552,4 +17552,4 @@ exports.useFormState = function (action, initialState, permalink) { exports.useFormStatus = function () { return ReactSharedInternals.H.useHostTransitionStatus(); }; -exports.version = "19.2.0-native-fb-872b4fef-20250828"; +exports.version = "19.2.0-native-fb-4082b0e7-20250828"; 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 a4c7f8a172..12bf542d1e 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<<6953358e513e81e472bfb050e6b0e04a>> + * @generated SignedSource<<8fa3c002aca208939e8997eabbefd78e>> */ /* @@ -19283,14 +19283,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) { }; var isomorphicReactPackageVersion$jscomp$inline_2286 = React.version; if ( - "19.2.0-native-fb-872b4fef-20250828" !== + "19.2.0-native-fb-4082b0e7-20250828" !== isomorphicReactPackageVersion$jscomp$inline_2286 ) throw Error( formatProdErrorMessage( 527, isomorphicReactPackageVersion$jscomp$inline_2286, - "19.2.0-native-fb-872b4fef-20250828" + "19.2.0-native-fb-4082b0e7-20250828" ) ); ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { @@ -19312,10 +19312,10 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { }; var internals$jscomp$inline_2293 = { bundleType: 0, - version: "19.2.0-native-fb-872b4fef-20250828", + version: "19.2.0-native-fb-4082b0e7-20250828", rendererPackageName: "react-dom", currentDispatcherRef: ReactSharedInternals, - reconcilerVersion: "19.2.0-native-fb-872b4fef-20250828", + reconcilerVersion: "19.2.0-native-fb-4082b0e7-20250828", getLaneLabelMap: function () { for ( var map = new Map(), lane = 1, index$321 = 0; @@ -19582,7 +19582,7 @@ exports.useFormState = function (action, initialState, permalink) { exports.useFormStatus = function () { return ReactSharedInternals.H.useHostTransitionStatus(); }; -exports.version = "19.2.0-native-fb-872b4fef-20250828"; +exports.version = "19.2.0-native-fb-4082b0e7-20250828"; "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 1c6dc0ebbf..091fb6cb38 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<<7a0a14e45e53136451878b4f30466bd0>> + * @generated SignedSource<> */ "use strict"; @@ -15758,10 +15758,10 @@ __DEV__ && (function () { var internals = { bundleType: 1, - version: "19.2.0-native-fb-872b4fef-20250828", + version: "19.2.0-native-fb-4082b0e7-20250828", rendererPackageName: "react-test-renderer", currentDispatcherRef: ReactSharedInternals, - reconcilerVersion: "19.2.0-native-fb-872b4fef-20250828" + reconcilerVersion: "19.2.0-native-fb-4082b0e7-20250828" }; internals.overrideHookState = overrideHookState; internals.overrideHookStateDeletePath = overrideHookStateDeletePath; @@ -15906,5 +15906,5 @@ __DEV__ && flushSyncWorkAcrossRoots_impl(0, !0)); } }; - exports.version = "19.2.0-native-fb-872b4fef-20250828"; + exports.version = "19.2.0-native-fb-4082b0e7-20250828"; })(); 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 357de8680f..39a80c7114 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<<2bb0ab8b2fb1e2b4480a51531700a05f>> + * @generated SignedSource<<1fe59c8867a3d3ec239a29e0f083b088>> */ "use strict"; @@ -9924,10 +9924,10 @@ function wrapFiber(fiber) { } var internals$jscomp$inline_1428 = { bundleType: 0, - version: "19.2.0-native-fb-872b4fef-20250828", + version: "19.2.0-native-fb-4082b0e7-20250828", rendererPackageName: "react-test-renderer", currentDispatcherRef: ReactSharedInternals, - reconcilerVersion: "19.2.0-native-fb-872b4fef-20250828" + reconcilerVersion: "19.2.0-native-fb-4082b0e7-20250828" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_1429 = __REACT_DEVTOOLS_GLOBAL_HOOK__; @@ -10063,4 +10063,4 @@ exports.unstable_batchedUpdates = function (fn, a) { flushSyncWorkAcrossRoots_impl(0, !0)); } }; -exports.version = "19.2.0-native-fb-872b4fef-20250828"; +exports.version = "19.2.0-native-fb-4082b0e7-20250828"; 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 fee5fa7b96..3fbfa3fa2b 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<> */ "use strict"; @@ -10544,10 +10544,10 @@ function wrapFiber(fiber) { } var internals$jscomp$inline_1236 = { bundleType: 0, - version: "19.2.0-native-fb-872b4fef-20250828", + version: "19.2.0-native-fb-4082b0e7-20250828", rendererPackageName: "react-test-renderer", currentDispatcherRef: ReactSharedInternals, - reconcilerVersion: "19.2.0-native-fb-872b4fef-20250828", + reconcilerVersion: "19.2.0-native-fb-4082b0e7-20250828", getLaneLabelMap: function () { for ( var map = new Map(), lane = 1, index$142 = 0; @@ -10698,4 +10698,4 @@ exports.unstable_batchedUpdates = function (fn, a) { flushSyncWorkAcrossRoots_impl(0, !0)); } }; -exports.version = "19.2.0-native-fb-872b4fef-20250828"; +exports.version = "19.2.0-native-fb-4082b0e7-20250828"; 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 f7a38a7f53..9c68a55b75 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<> + * @generated SignedSource<<3f38182abeeeea340638c73d9b9838db>> */ "use strict"; @@ -1388,7 +1388,7 @@ __DEV__ && exports.useTransition = function () { return resolveDispatcher().useTransition(); }; - exports.version = "19.2.0-native-fb-872b4fef-20250828"; + exports.version = "19.2.0-native-fb-4082b0e7-20250828"; "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 30de324149..b869481c38 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<<15623d62d0df693ff1ee07d9932f19cc>> + * @generated SignedSource<<240d3e889cb22857ef10b94026622163>> */ "use strict"; @@ -579,4 +579,4 @@ exports.useSyncExternalStore = function ( exports.useTransition = function () { return ReactSharedInternals.H.useTransition(); }; -exports.version = "19.2.0-native-fb-872b4fef-20250828"; +exports.version = "19.2.0-native-fb-4082b0e7-20250828"; 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 f91a98b950..13cc3e1577 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<<7ada3456afade1b983834df82c744a8f>> + * @generated SignedSource<> */ "use strict"; @@ -583,7 +583,7 @@ exports.useSyncExternalStore = function ( exports.useTransition = function () { return ReactSharedInternals.H.useTransition(); }; -exports.version = "19.2.0-native-fb-872b4fef-20250828"; +exports.version = "19.2.0-native-fb-4082b0e7-20250828"; "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 4668dcbd9b..47703a5065 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 @@ -872b4fef6ded18aa9bda5f7729340384a914ba7b +4082b0e7d3c042d49ef8987547b923051936956f 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 a0f732706c..d5c7b55513 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<> + * @generated SignedSource<<802d8abf3b571d4b4620231af2cf2637>> */ "use strict"; @@ -19594,10 +19594,10 @@ __DEV__ && (function () { var internals = { bundleType: 1, - version: "19.2.0-native-fb-872b4fef-20250828", + version: "19.2.0-native-fb-4082b0e7-20250828", rendererPackageName: "react-native-renderer", currentDispatcherRef: ReactSharedInternals, - reconcilerVersion: "19.2.0-native-fb-872b4fef-20250828" + reconcilerVersion: "19.2.0-native-fb-4082b0e7-20250828" }; 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 1fadbe7568..b1074df603 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"; @@ -11108,10 +11108,10 @@ batchedUpdatesImpl = function (fn, a) { var roots = new Map(), internals$jscomp$inline_1260 = { bundleType: 0, - version: "19.2.0-native-fb-872b4fef-20250828", + version: "19.2.0-native-fb-4082b0e7-20250828", rendererPackageName: "react-native-renderer", currentDispatcherRef: ReactSharedInternals, - reconcilerVersion: "19.2.0-native-fb-872b4fef-20250828" + reconcilerVersion: "19.2.0-native-fb-4082b0e7-20250828" }; null !== extraDevToolsConfig && (internals$jscomp$inline_1260.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 be6237cceb..456155fb48 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<<997358f9bcaeaa0bbd650d779cfb8a68>> + * @generated SignedSource<<66d00cd75c1b7aa7223aedb7febad749>> */ "use strict"; @@ -13059,10 +13059,10 @@ batchedUpdatesImpl = function (fn, a) { var roots = new Map(), internals$jscomp$inline_1504 = { bundleType: 0, - version: "19.2.0-native-fb-872b4fef-20250828", + version: "19.2.0-native-fb-4082b0e7-20250828", rendererPackageName: "react-native-renderer", currentDispatcherRef: ReactSharedInternals, - reconcilerVersion: "19.2.0-native-fb-872b4fef-20250828" + reconcilerVersion: "19.2.0-native-fb-4082b0e7-20250828" }; null !== extraDevToolsConfig && (internals$jscomp$inline_1504.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 e6642340e8..07ab643a54 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<<79059deab65e0a9850cc284ec4eabbcd>> + * @generated SignedSource<> */ "use strict"; @@ -19878,11 +19878,11 @@ __DEV__ && shouldSuspendImpl = newShouldSuspendImpl; }; var isomorphicReactPackageVersion = React.version; - if ("19.2.0-native-fb-872b4fef-20250828" !== isomorphicReactPackageVersion) + if ("19.2.0-native-fb-4082b0e7-20250828" !== 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-872b4fef-20250828\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-native-renderer: 19.2.0-native-fb-4082b0e7-20250828\nLearn more: https://react.dev/warnings/version-mismatch") ); if ( "function" !== @@ -19908,10 +19908,10 @@ __DEV__ && (function () { var internals = { bundleType: 1, - version: "19.2.0-native-fb-872b4fef-20250828", + version: "19.2.0-native-fb-4082b0e7-20250828", rendererPackageName: "react-native-renderer", currentDispatcherRef: ReactSharedInternals, - reconcilerVersion: "19.2.0-native-fb-872b4fef-20250828" + reconcilerVersion: "19.2.0-native-fb-4082b0e7-20250828" }; 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 330e25576b..f15276c327 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<<7cb77220def7085e1d783c6255e46685>> + * @generated SignedSource<<5fbd7821bced8c658cde79fbabf122d0>> */ "use strict"; @@ -11254,11 +11254,11 @@ function updateContainer(element, container, parentComponent, callback) { return lane; } var isomorphicReactPackageVersion = React.version; -if ("19.2.0-native-fb-872b4fef-20250828" !== isomorphicReactPackageVersion) +if ("19.2.0-native-fb-4082b0e7-20250828" !== 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-872b4fef-20250828\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-native-renderer: 19.2.0-native-fb-4082b0e7-20250828\nLearn more: https://react.dev/warnings/version-mismatch") ); if ( "function" !== @@ -11308,10 +11308,10 @@ batchedUpdatesImpl = function (fn, a) { var roots = new Map(), internals$jscomp$inline_1290 = { bundleType: 0, - version: "19.2.0-native-fb-872b4fef-20250828", + version: "19.2.0-native-fb-4082b0e7-20250828", rendererPackageName: "react-native-renderer", currentDispatcherRef: ReactSharedInternals, - reconcilerVersion: "19.2.0-native-fb-872b4fef-20250828" + reconcilerVersion: "19.2.0-native-fb-4082b0e7-20250828" }; null !== extraDevToolsConfig && (internals$jscomp$inline_1290.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 5e0f0bbd7c..bcb9f288bc 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<> + * @generated SignedSource<> */ "use strict"; @@ -13194,11 +13194,11 @@ function updateContainer(element, container, parentComponent, callback) { return lane; } var isomorphicReactPackageVersion = React.version; -if ("19.2.0-native-fb-872b4fef-20250828" !== isomorphicReactPackageVersion) +if ("19.2.0-native-fb-4082b0e7-20250828" !== 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-872b4fef-20250828\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-native-renderer: 19.2.0-native-fb-4082b0e7-20250828\nLearn more: https://react.dev/warnings/version-mismatch") ); if ( "function" !== @@ -13248,10 +13248,10 @@ batchedUpdatesImpl = function (fn, a) { var roots = new Map(), internals$jscomp$inline_1534 = { bundleType: 0, - version: "19.2.0-native-fb-872b4fef-20250828", + version: "19.2.0-native-fb-4082b0e7-20250828", rendererPackageName: "react-native-renderer", currentDispatcherRef: ReactSharedInternals, - reconcilerVersion: "19.2.0-native-fb-872b4fef-20250828" + reconcilerVersion: "19.2.0-native-fb-4082b0e7-20250828" }; null !== extraDevToolsConfig && (internals$jscomp$inline_1534.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 fc7e647215..9fd5afba19 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<> + * @generated SignedSource<<92021fc3beead9e56f852b5daa23438d>> */ 'use strict'; @@ -17653,6 +17653,7 @@ var ErrorSeverity; ErrorSeverity["InvalidReact"] = "InvalidReact"; ErrorSeverity["InvalidConfig"] = "InvalidConfig"; ErrorSeverity["CannotPreserveMemoization"] = "CannotPreserveMemoization"; + ErrorSeverity["IncompatibleLibrary"] = "IncompatibleLibrary"; ErrorSeverity["Todo"] = "Todo"; ErrorSeverity["Invariant"] = "Invariant"; })(ErrorSeverity || (ErrorSeverity = {})); @@ -17919,7 +17920,8 @@ class CompilerError extends Error { case ErrorSeverity.InvalidJS: case ErrorSeverity.InvalidReact: case ErrorSeverity.InvalidConfig: - case ErrorSeverity.UnsupportedJS: { + case ErrorSeverity.UnsupportedJS: + case ErrorSeverity.IncompatibleLibrary: { return true; } case ErrorSeverity.CannotPreserveMemoization: @@ -17957,8 +17959,9 @@ function printErrorSummary(severity, message) { severityCategory = 'Error'; break; } + case ErrorSeverity.IncompatibleLibrary: case ErrorSeverity.CannotPreserveMemoization: { - severityCategory = 'Memoization'; + severityCategory = 'Compilation Skipped'; break; } case ErrorSeverity.Invariant: { @@ -17983,6 +17986,7 @@ var ErrorCategory; ErrorCategory["UseMemo"] = "UseMemo"; ErrorCategory["Factories"] = "Factories"; ErrorCategory["PreserveManualMemo"] = "PreserveManualMemo"; + ErrorCategory["IncompatibleLibrary"] = "IncompatibleLibrary"; ErrorCategory["Immutability"] = "Immutability"; ErrorCategory["Globals"] = "Globals"; ErrorCategory["Refs"] = "Refs"; @@ -18215,6 +18219,14 @@ function getRuleForCategoryImpl(category) { recommended: true, }; } + case ErrorCategory.IncompatibleLibrary: { + return { + category, + name: 'incompatible-library', + description: 'Validates against usage of libraries which are incompatible with memoization (manual or automatic)', + recommended: true, + }; + } default: { assertExhaustive$1(category, `Unsupported category ${category}`); } @@ -30842,7 +30854,7 @@ for (const [name, type_] of TYPED_GLOBALS) { DEFAULT_GLOBALS.set('globalThis', addObject(DEFAULT_SHAPES, 'globalThis', TYPED_GLOBALS)); DEFAULT_GLOBALS.set('global', addObject(DEFAULT_SHAPES, 'global', TYPED_GLOBALS)); function installTypeConfig(globals, shapes, typeConfig, moduleName, loc) { - var _a, _b, _c, _d; + var _a, _b, _c, _d, _e, _f; switch (typeConfig.kind) { case 'type': { switch (typeConfig.name) { @@ -30876,22 +30888,24 @@ function installTypeConfig(globals, shapes, typeConfig, moduleName, loc) { noAlias: typeConfig.noAlias === true, mutableOnlyIfOperandsAreMutable: typeConfig.mutableOnlyIfOperandsAreMutable === true, aliasing: typeConfig.aliasing, + knownIncompatible: (_a = typeConfig.knownIncompatible) !== null && _a !== void 0 ? _a : null, }); } case 'hook': { return addHook(shapes, { hookKind: 'Custom', - positionalParams: (_a = typeConfig.positionalParams) !== null && _a !== void 0 ? _a : [], - restParam: (_b = typeConfig.restParam) !== null && _b !== void 0 ? _b : Effect.Freeze, + positionalParams: (_b = typeConfig.positionalParams) !== null && _b !== void 0 ? _b : [], + restParam: (_c = typeConfig.restParam) !== null && _c !== void 0 ? _c : Effect.Freeze, calleeEffect: Effect.Read, returnType: installTypeConfig(globals, shapes, typeConfig.returnType, moduleName, loc), - returnValueKind: (_c = typeConfig.returnValueKind) !== null && _c !== void 0 ? _c : ValueKind.Frozen, + returnValueKind: (_d = typeConfig.returnValueKind) !== null && _d !== void 0 ? _d : ValueKind.Frozen, noAlias: typeConfig.noAlias === true, aliasing: typeConfig.aliasing, + knownIncompatible: (_e = typeConfig.knownIncompatible) !== null && _e !== void 0 ? _e : null, }); } case 'object': { - return addObject(shapes, null, Object.entries((_d = typeConfig.properties) !== null && _d !== void 0 ? _d : {}).map(([key, value]) => { + return addObject(shapes, null, Object.entries((_f = typeConfig.properties) !== null && _f !== void 0 ? _f : {}).map(([key, value]) => { var _a; const type = installTypeConfig(globals, shapes, value, moduleName, loc); const expectHook = isHookName$2(key); @@ -31092,6 +31106,7 @@ const FunctionTypeSchema = zod.z.object({ impure: zod.z.boolean().nullable().optional(), canonicalName: zod.z.string().nullable().optional(), aliasing: AliasingSignatureSchema.nullable().optional(), + knownIncompatible: zod.z.string().nullable().optional(), }); const HookTypeSchema = zod.z.object({ kind: zod.z.literal('hook'), @@ -31101,6 +31116,7 @@ const HookTypeSchema = zod.z.object({ returnValueKind: ValueKindSchema.nullable().optional(), noAlias: zod.z.boolean().nullable().optional(), aliasing: AliasingSignatureSchema.nullable().optional(), + knownIncompatible: zod.z.string().nullable().optional(), }); const BuiltInTypeSchema = zod.z.union([ zod.z.literal('Any'), @@ -31602,6 +31618,50 @@ const Resolved = Object.assign(Object.assign({}, Primitives), { nullable(type, p }; } }); +function defaultModuleTypeProvider(moduleName) { + switch (moduleName) { + case 'react-hook-form': { + return { + kind: 'object', + properties: { + useForm: { + kind: 'hook', + returnType: { + kind: 'object', + properties: { + watch: { + kind: 'function', + positionalParams: [], + restParam: Effect.Read, + calleeEffect: Effect.Read, + returnType: { kind: 'type', name: 'Any' }, + returnValueKind: ValueKind.Mutable, + knownIncompatible: `React Hook Form's \`useForm()\` API returns a \`watch()\` function which cannot be memoized safely.`, + }, + }, + }, + }, + }, + }; + } + case '@tanstack/react-table': { + return { + kind: 'object', + properties: { + useReactTable: { + kind: 'hook', + positionalParams: [], + restParam: Effect.Read, + returnType: { kind: 'type', name: 'Any' }, + knownIncompatible: `TanStack Table's \`useReactTable()\` API returns functions that cannot be memoized safely`, + }, + }, + }; + } + } + return null; +} + var _Environment_instances, _Environment_globals, _Environment_shapes, _Environment_moduleTypes, _Environment_nextIdentifer, _Environment_nextBlock, _Environment_nextScope, _Environment_scope, _Environment_outlinedFunctions, _Environment_contextIdentifiers, _Environment_hoistedIdentifiers, _Environment_flowTypeEnvironment, _Environment_resolveModuleType, _Environment_isKnownReactModule, _Environment_getCustomHookType; const ReactElementSymbolSchema = zod.z.object({ elementSymbol: zod.z.union([ @@ -31964,12 +32024,14 @@ class Environment { } } _Environment_globals = new WeakMap(), _Environment_shapes = new WeakMap(), _Environment_moduleTypes = new WeakMap(), _Environment_nextIdentifer = new WeakMap(), _Environment_nextBlock = new WeakMap(), _Environment_nextScope = new WeakMap(), _Environment_scope = new WeakMap(), _Environment_outlinedFunctions = new WeakMap(), _Environment_contextIdentifiers = new WeakMap(), _Environment_hoistedIdentifiers = new WeakMap(), _Environment_flowTypeEnvironment = new WeakMap(), _Environment_instances = new WeakSet(), _Environment_resolveModuleType = function _Environment_resolveModuleType(moduleName, loc) { + var _a; let moduleType = __classPrivateFieldGet(this, _Environment_moduleTypes, "f").get(moduleName); if (moduleType === undefined) { - if (this.config.moduleTypeProvider == null) { + const moduleTypeProvider = (_a = this.config.moduleTypeProvider) !== null && _a !== void 0 ? _a : defaultModuleTypeProvider; + if (moduleTypeProvider == null) { return null; } - const unparsedModuleConfig = this.config.moduleTypeProvider(moduleName); + const unparsedModuleConfig = moduleTypeProvider(moduleName); if (unparsedModuleConfig != null) { const parsedModuleConfig = TypeSchema.safeParse(unparsedModuleConfig); if (!parsedModuleConfig.success) { @@ -40777,6 +40839,25 @@ function computeEffectsForLegacySignature(state, signature, lvalue, receiver, ar }), }); } + if (signature.knownIncompatible != null && state.env.isInferredMemoEnabled) { + const errors = new CompilerError(); + errors.pushDiagnostic(CompilerDiagnostic.create({ + category: ErrorCategory.IncompatibleLibrary, + severity: ErrorSeverity.IncompatibleLibrary, + reason: 'Use of incompatible library', + description: [ + 'This API returns functions which cannot be memoized without leading to stale UI. ' + + 'To prevent this, by default React Compiler will skip memoizing this component/hook. ' + + 'However, you may see issues if values from this API are passed to other components/hooks that are ' + + 'memoized.', + ].join(''), + }).withDetail({ + kind: 'error', + loc: receiver.loc, + message: signature.knownIncompatible, + })); + throw errors; + } const stores = []; const captures = []; function visit(place, effect) { @@ -48254,7 +48335,7 @@ function validateInferredDep(dep, temporaries, declsWithinMemoBlock, validDepsIn errorState.pushDiagnostic(CompilerDiagnostic.create({ category: ErrorCategory.PreserveManualMemo, severity: ErrorSeverity.CannotPreserveMemoization, - reason: 'Compilation skipped because existing memoization could not be preserved', + reason: 'Existing memoization could not be preserved', description: [ 'React Compiler has skipped optimizing this component because the existing manual memoization could not be preserved. ', 'The inferred dependencies did not match the manually specified dependencies, which could cause the value to change more or less frequently than expected. ', @@ -48415,7 +48496,7 @@ class Visitor extends ReactiveFunctionVisitor { state.errors.pushDiagnostic(CompilerDiagnostic.create({ category: ErrorCategory.PreserveManualMemo, severity: ErrorSeverity.CannotPreserveMemoization, - reason: 'Compilation skipped because existing memoization could not be preserved', + reason: 'Existing memoization could not be preserved', description: [ 'React Compiler has skipped optimizing this component because the existing manual memoization could not be preserved. ', 'This dependency may be mutated later, which could cause the value to change unexpectedly.', @@ -48452,7 +48533,7 @@ class Visitor extends ReactiveFunctionVisitor { state.errors.pushDiagnostic(CompilerDiagnostic.create({ category: ErrorCategory.PreserveManualMemo, severity: ErrorSeverity.CannotPreserveMemoization, - reason: 'Compilation skipped because existing memoization could not be preserved', + reason: 'Existing memoization could not be preserved', description: [ 'React Compiler has skipped optimizing this component because the existing manual memoization could not be preserved. This value was memoized in source but not in compilation output. ', '', 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 5fc74af431..74fc6fa28d 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<<0cf4d579071cd6361df2fa74ba2aa318>> + * @generated SignedSource<<99d6960a9525c443d8865ab7661a6fcc>> */ 'use strict'; @@ -17638,6 +17638,7 @@ var ErrorSeverity; ErrorSeverity["InvalidReact"] = "InvalidReact"; ErrorSeverity["InvalidConfig"] = "InvalidConfig"; ErrorSeverity["CannotPreserveMemoization"] = "CannotPreserveMemoization"; + ErrorSeverity["IncompatibleLibrary"] = "IncompatibleLibrary"; ErrorSeverity["Todo"] = "Todo"; ErrorSeverity["Invariant"] = "Invariant"; })(ErrorSeverity || (ErrorSeverity = {})); @@ -17904,7 +17905,8 @@ class CompilerError extends Error { case ErrorSeverity.InvalidJS: case ErrorSeverity.InvalidReact: case ErrorSeverity.InvalidConfig: - case ErrorSeverity.UnsupportedJS: { + case ErrorSeverity.UnsupportedJS: + case ErrorSeverity.IncompatibleLibrary: { return true; } case ErrorSeverity.CannotPreserveMemoization: @@ -17942,8 +17944,9 @@ function printErrorSummary(severity, message) { severityCategory = 'Error'; break; } + case ErrorSeverity.IncompatibleLibrary: case ErrorSeverity.CannotPreserveMemoization: { - severityCategory = 'Memoization'; + severityCategory = 'Compilation Skipped'; break; } case ErrorSeverity.Invariant: { @@ -17968,6 +17971,7 @@ var ErrorCategory; ErrorCategory["UseMemo"] = "UseMemo"; ErrorCategory["Factories"] = "Factories"; ErrorCategory["PreserveManualMemo"] = "PreserveManualMemo"; + ErrorCategory["IncompatibleLibrary"] = "IncompatibleLibrary"; ErrorCategory["Immutability"] = "Immutability"; ErrorCategory["Globals"] = "Globals"; ErrorCategory["Refs"] = "Refs"; @@ -18200,6 +18204,14 @@ function getRuleForCategoryImpl(category) { recommended: true, }; } + case ErrorCategory.IncompatibleLibrary: { + return { + category, + name: 'incompatible-library', + description: 'Validates against usage of libraries which are incompatible with memoization (manual or automatic)', + recommended: true, + }; + } default: { assertExhaustive$1(category, `Unsupported category ${category}`); } @@ -30621,7 +30633,7 @@ for (const [name, type_] of TYPED_GLOBALS) { DEFAULT_GLOBALS.set('globalThis', addObject(DEFAULT_SHAPES, 'globalThis', TYPED_GLOBALS)); DEFAULT_GLOBALS.set('global', addObject(DEFAULT_SHAPES, 'global', TYPED_GLOBALS)); function installTypeConfig(globals, shapes, typeConfig, moduleName, loc) { - var _a, _b, _c, _d; + var _a, _b, _c, _d, _e, _f; switch (typeConfig.kind) { case 'type': { switch (typeConfig.name) { @@ -30655,22 +30667,24 @@ function installTypeConfig(globals, shapes, typeConfig, moduleName, loc) { noAlias: typeConfig.noAlias === true, mutableOnlyIfOperandsAreMutable: typeConfig.mutableOnlyIfOperandsAreMutable === true, aliasing: typeConfig.aliasing, + knownIncompatible: (_a = typeConfig.knownIncompatible) !== null && _a !== void 0 ? _a : null, }); } case 'hook': { return addHook(shapes, { hookKind: 'Custom', - positionalParams: (_a = typeConfig.positionalParams) !== null && _a !== void 0 ? _a : [], - restParam: (_b = typeConfig.restParam) !== null && _b !== void 0 ? _b : Effect.Freeze, + positionalParams: (_b = typeConfig.positionalParams) !== null && _b !== void 0 ? _b : [], + restParam: (_c = typeConfig.restParam) !== null && _c !== void 0 ? _c : Effect.Freeze, calleeEffect: Effect.Read, returnType: installTypeConfig(globals, shapes, typeConfig.returnType, moduleName, loc), - returnValueKind: (_c = typeConfig.returnValueKind) !== null && _c !== void 0 ? _c : ValueKind.Frozen, + returnValueKind: (_d = typeConfig.returnValueKind) !== null && _d !== void 0 ? _d : ValueKind.Frozen, noAlias: typeConfig.noAlias === true, aliasing: typeConfig.aliasing, + knownIncompatible: (_e = typeConfig.knownIncompatible) !== null && _e !== void 0 ? _e : null, }); } case 'object': { - return addObject(shapes, null, Object.entries((_d = typeConfig.properties) !== null && _d !== void 0 ? _d : {}).map(([key, value]) => { + return addObject(shapes, null, Object.entries((_f = typeConfig.properties) !== null && _f !== void 0 ? _f : {}).map(([key, value]) => { var _a; const type = installTypeConfig(globals, shapes, value, moduleName, loc); const expectHook = isHookName$2(key); @@ -30871,6 +30885,7 @@ const FunctionTypeSchema = zod.z.object({ impure: zod.z.boolean().nullable().optional(), canonicalName: zod.z.string().nullable().optional(), aliasing: AliasingSignatureSchema.nullable().optional(), + knownIncompatible: zod.z.string().nullable().optional(), }); const HookTypeSchema = zod.z.object({ kind: zod.z.literal('hook'), @@ -30880,6 +30895,7 @@ const HookTypeSchema = zod.z.object({ returnValueKind: ValueKindSchema.nullable().optional(), noAlias: zod.z.boolean().nullable().optional(), aliasing: AliasingSignatureSchema.nullable().optional(), + knownIncompatible: zod.z.string().nullable().optional(), }); const BuiltInTypeSchema = zod.z.union([ zod.z.literal('Any'), @@ -31381,6 +31397,50 @@ const Resolved = Object.assign(Object.assign({}, Primitives), { nullable(type, p }; } }); +function defaultModuleTypeProvider(moduleName) { + switch (moduleName) { + case 'react-hook-form': { + return { + kind: 'object', + properties: { + useForm: { + kind: 'hook', + returnType: { + kind: 'object', + properties: { + watch: { + kind: 'function', + positionalParams: [], + restParam: Effect.Read, + calleeEffect: Effect.Read, + returnType: { kind: 'type', name: 'Any' }, + returnValueKind: ValueKind.Mutable, + knownIncompatible: `React Hook Form's \`useForm()\` API returns a \`watch()\` function which cannot be memoized safely.`, + }, + }, + }, + }, + }, + }; + } + case '@tanstack/react-table': { + return { + kind: 'object', + properties: { + useReactTable: { + kind: 'hook', + positionalParams: [], + restParam: Effect.Read, + returnType: { kind: 'type', name: 'Any' }, + knownIncompatible: `TanStack Table's \`useReactTable()\` API returns functions that cannot be memoized safely`, + }, + }, + }; + } + } + return null; +} + var _Environment_instances, _Environment_globals, _Environment_shapes, _Environment_moduleTypes, _Environment_nextIdentifer, _Environment_nextBlock, _Environment_nextScope, _Environment_scope, _Environment_outlinedFunctions, _Environment_contextIdentifiers, _Environment_hoistedIdentifiers, _Environment_flowTypeEnvironment, _Environment_resolveModuleType, _Environment_isKnownReactModule, _Environment_getCustomHookType; const ReactElementSymbolSchema = zod.z.object({ elementSymbol: zod.z.union([ @@ -31743,12 +31803,14 @@ class Environment { } } _Environment_globals = new WeakMap(), _Environment_shapes = new WeakMap(), _Environment_moduleTypes = new WeakMap(), _Environment_nextIdentifer = new WeakMap(), _Environment_nextBlock = new WeakMap(), _Environment_nextScope = new WeakMap(), _Environment_scope = new WeakMap(), _Environment_outlinedFunctions = new WeakMap(), _Environment_contextIdentifiers = new WeakMap(), _Environment_hoistedIdentifiers = new WeakMap(), _Environment_flowTypeEnvironment = new WeakMap(), _Environment_instances = new WeakSet(), _Environment_resolveModuleType = function _Environment_resolveModuleType(moduleName, loc) { + var _a; let moduleType = __classPrivateFieldGet(this, _Environment_moduleTypes, "f").get(moduleName); if (moduleType === undefined) { - if (this.config.moduleTypeProvider == null) { + const moduleTypeProvider = (_a = this.config.moduleTypeProvider) !== null && _a !== void 0 ? _a : defaultModuleTypeProvider; + if (moduleTypeProvider == null) { return null; } - const unparsedModuleConfig = this.config.moduleTypeProvider(moduleName); + const unparsedModuleConfig = moduleTypeProvider(moduleName); if (unparsedModuleConfig != null) { const parsedModuleConfig = TypeSchema.safeParse(unparsedModuleConfig); if (!parsedModuleConfig.success) { @@ -40556,6 +40618,25 @@ function computeEffectsForLegacySignature(state, signature, lvalue, receiver, ar }), }); } + if (signature.knownIncompatible != null && state.env.isInferredMemoEnabled) { + const errors = new CompilerError(); + errors.pushDiagnostic(CompilerDiagnostic.create({ + category: ErrorCategory.IncompatibleLibrary, + severity: ErrorSeverity.IncompatibleLibrary, + reason: 'Use of incompatible library', + description: [ + 'This API returns functions which cannot be memoized without leading to stale UI. ' + + 'To prevent this, by default React Compiler will skip memoizing this component/hook. ' + + 'However, you may see issues if values from this API are passed to other components/hooks that are ' + + 'memoized.', + ].join(''), + }).withDetail({ + kind: 'error', + loc: receiver.loc, + message: signature.knownIncompatible, + })); + throw errors; + } const stores = []; const captures = []; function visit(place, effect) { @@ -48033,7 +48114,7 @@ function validateInferredDep(dep, temporaries, declsWithinMemoBlock, validDepsIn errorState.pushDiagnostic(CompilerDiagnostic.create({ category: ErrorCategory.PreserveManualMemo, severity: ErrorSeverity.CannotPreserveMemoization, - reason: 'Compilation skipped because existing memoization could not be preserved', + reason: 'Existing memoization could not be preserved', description: [ 'React Compiler has skipped optimizing this component because the existing manual memoization could not be preserved. ', 'The inferred dependencies did not match the manually specified dependencies, which could cause the value to change more or less frequently than expected. ', @@ -48194,7 +48275,7 @@ class Visitor extends ReactiveFunctionVisitor { state.errors.pushDiagnostic(CompilerDiagnostic.create({ category: ErrorCategory.PreserveManualMemo, severity: ErrorSeverity.CannotPreserveMemoization, - reason: 'Compilation skipped because existing memoization could not be preserved', + reason: 'Existing memoization could not be preserved', description: [ 'React Compiler has skipped optimizing this component because the existing manual memoization could not be preserved. ', 'This dependency may be mutated later, which could cause the value to change unexpectedly.', @@ -48231,7 +48312,7 @@ class Visitor extends ReactiveFunctionVisitor { state.errors.pushDiagnostic(CompilerDiagnostic.create({ category: ErrorCategory.PreserveManualMemo, severity: ErrorSeverity.CannotPreserveMemoization, - reason: 'Compilation skipped because existing memoization could not be preserved', + reason: 'Existing memoization could not be preserved', description: [ 'React Compiler has skipped optimizing this component because the existing manual memoization could not be preserved. This value was memoized in source but not in compilation output. ', '', 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 ac964bf437..dfd0b5147a 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-872b4fef-20250828", + "version": "0.0.0-experimental-4082b0e7-20250828", "repository": { "type": "git", "url": "https://github.com/facebook/react.git",