[compiler]: add `useWindowVirtualizer` to known incompatible librarie… · code/lib-react@d1cf8ed · GitHub
Skip to content

Commit d1cf8ed

Browse files
committed
[compiler]: add useWindowVirtualizer to known incompatible libraries (react#36912)
## Summary react#34493 added `@tanstack/react-virtual`'s `useVirtualizer` to the known incompatible libraries, but not `useWindowVirtualizer`. Both hooks are thin wrappers around the same internal `useVirtualizerBase`, so they return the same referentially-stable virtualizer instance. Its methods (e.g. `getVirtualItems()`, `getTotalSize()`) return internally-mutated values rather than new ones, which is exactly the "interior mutability" pattern that breaks memoization described in the module type provider. Because only `useVirtualizer` was registered, code using `useWindowVirtualizer` is silently compiled with the same unsafe memoization. In our app this froze `getVirtualItems()` to its first-render value (an empty `[]` before measurement), producing permanently-empty virtualized lists — the same class of bug react#34493 fixed, just via the window variant. This registers `useWindowVirtualizer` alongside `useVirtualizer` with the identical shape, in **both** implementations: - `compiler/packages/babel-plugin-react-compiler/src/HIR/DefaultModuleTypeProvider.ts` - `compiler/crates/react_compiler_hir/src/default_module_type_provider.rs` (Rust port) See also the community report referenced in react#34493: TanStack/virtual#736 (comment) ## How did you test this change? Each addition mirrors the existing `useVirtualizer` entry exactly (same kind, params, return type, and `knownIncompatible` message shape); both are data-only additions to the module type providers, following the precedent set by react#34493 which changed only the TS file. The Rust change keeps the two providers in sync. DiffTrain build for [08725f2](react@08725f2)
1 parent 4db283d commit d1cf8ed

23 files changed

Lines changed: 88 additions & 74 deletions

‎compiled-rn/VERSION_NATIVE_FB‎

Lines changed: 1 addition & 1 deletion

‎compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOM-dev.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<f32f959875c346132957e61f73bb3796>>
10+
* @generated SignedSource<<25132f5cd865052a3164fcbddc2e115a>>
1111
*/
1212

1313
"use strict";
@@ -419,5 +419,5 @@ __DEV__ &&
419419
exports.useFormStatus = function () {
420420
return resolveDispatcher().useHostTransitionStatus();
421421
};
422-
exports.version = "19.3.0-native-fb-23def8fd-20260706";
422+
exports.version = "19.3.0-native-fb-08725f21-20260706";
423423
})();

‎compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOM-prod.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<7ddf70731add248fba449801afe1605f>>
10+
* @generated SignedSource<<cd068049a8c98dcad2e342f5c89aee21>>
1111
*/
1212

1313
"use strict";
@@ -218,4 +218,4 @@ exports.useFormState = function (action, initialState, permalink) {
218218
exports.useFormStatus = function () {
219219
return ReactSharedInternals.H.useHostTransitionStatus();
220220
};
221-
exports.version = "19.3.0-native-fb-23def8fd-20260706";
221+
exports.version = "19.3.0-native-fb-08725f21-20260706";

‎compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOM-profiling.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<7ddf70731add248fba449801afe1605f>>
10+
* @generated SignedSource<<cd068049a8c98dcad2e342f5c89aee21>>
1111
*/
1212

1313
"use strict";
@@ -218,4 +218,4 @@ exports.useFormState = function (action, initialState, permalink) {
218218
exports.useFormStatus = function () {
219219
return ReactSharedInternals.H.useHostTransitionStatus();
220220
};
221-
exports.version = "19.3.0-native-fb-23def8fd-20260706";
221+
exports.version = "19.3.0-native-fb-08725f21-20260706";

‎compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMClient-dev.js‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<996b622640142555538c8cae8a70f3ad>>
10+
* @generated SignedSource<<3e18421581a328f7782909a6bc4d76b4>>
1111
*/
1212

1313
/*
@@ -32085,11 +32085,11 @@ __DEV__ &&
3208532085
};
3208632086
(function () {
3208732087
var isomorphicReactPackageVersion = React.version;
32088-
if ("19.3.0-native-fb-23def8fd-20260706" !== isomorphicReactPackageVersion)
32088+
if ("19.3.0-native-fb-08725f21-20260706" !== isomorphicReactPackageVersion)
3208932089
throw Error(
3209032090
'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' +
3209132091
(isomorphicReactPackageVersion +
32092-
"\n - react-dom: 19.3.0-native-fb-23def8fd-20260706\nLearn more: https://react.dev/warnings/version-mismatch")
32092+
"\n - react-dom: 19.3.0-native-fb-08725f21-20260706\nLearn more: https://react.dev/warnings/version-mismatch")
3209332093
);
3209432094
})();
3209532095
("function" === typeof Map &&
@@ -32126,10 +32126,10 @@ __DEV__ &&
3212632126
!(function () {
3212732127
var internals = {
3212832128
bundleType: 1,
32129-
version: "19.3.0-native-fb-23def8fd-20260706",
32129+
version: "19.3.0-native-fb-08725f21-20260706",
3213032130
rendererPackageName: "react-dom",
3213132131
currentDispatcherRef: ReactSharedInternals,
32132-
reconcilerVersion: "19.3.0-native-fb-23def8fd-20260706"
32132+
reconcilerVersion: "19.3.0-native-fb-08725f21-20260706"
3213332133
};
3213432134
internals.overrideHookState = overrideHookState;
3213532135
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
@@ -32279,5 +32279,5 @@ __DEV__ &&
3227932279
listenToAllSupportedEvents(container);
3228032280
return new ReactDOMHydrationRoot(initialChildren);
3228132281
};
32282-
exports.version = "19.3.0-native-fb-23def8fd-20260706";
32282+
exports.version = "19.3.0-native-fb-08725f21-20260706";
3228332283
})();

‎compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMClient-prod.js‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<4f5d0ab0009f954a8f0a9a48622bdca2>>
10+
* @generated SignedSource<<f557363556f055161a31c23ce1d5f75a>>
1111
*/
1212

1313
/*
@@ -19248,14 +19248,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) {
1924819248
};
1924919249
var isomorphicReactPackageVersion$jscomp$inline_2134 = React.version;
1925019250
if (
19251-
"19.3.0-native-fb-23def8fd-20260706" !==
19251+
"19.3.0-native-fb-08725f21-20260706" !==
1925219252
isomorphicReactPackageVersion$jscomp$inline_2134
1925319253
)
1925419254
throw Error(
1925519255
formatProdErrorMessage(
1925619256
527,
1925719257
isomorphicReactPackageVersion$jscomp$inline_2134,
19258-
"19.3.0-native-fb-23def8fd-20260706"
19258+
"19.3.0-native-fb-08725f21-20260706"
1925919259
)
1926019260
);
1926119261
ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
@@ -19277,10 +19277,10 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
1927719277
};
1927819278
var internals$jscomp$inline_2730 = {
1927919279
bundleType: 0,
19280-
version: "19.3.0-native-fb-23def8fd-20260706",
19280+
version: "19.3.0-native-fb-08725f21-20260706",
1928119281
rendererPackageName: "react-dom",
1928219282
currentDispatcherRef: ReactSharedInternals,
19283-
reconcilerVersion: "19.3.0-native-fb-23def8fd-20260706"
19283+
reconcilerVersion: "19.3.0-native-fb-08725f21-20260706"
1928419284
};
1928519285
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
1928619286
var hook$jscomp$inline_2731 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -19387,4 +19387,4 @@ exports.hydrateRoot = function (container, initialChildren, options) {
1938719387
listenToAllSupportedEvents(container);
1938819388
return new ReactDOMHydrationRoot(initialChildren);
1938919389
};
19390-
exports.version = "19.3.0-native-fb-23def8fd-20260706";
19390+
exports.version = "19.3.0-native-fb-08725f21-20260706";

‎compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMClient-profiling.js‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<edd08f2ecfce3cdbeff405b054b0736e>>
10+
* @generated SignedSource<<d35826a31ca292a9aea469b445a66832>>
1111
*/
1212

1313
/*
@@ -21308,14 +21308,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) {
2130821308
};
2130921309
var isomorphicReactPackageVersion$jscomp$inline_2481 = React.version;
2131021310
if (
21311-
"19.3.0-native-fb-23def8fd-20260706" !==
21311+
"19.3.0-native-fb-08725f21-20260706" !==
2131221312
isomorphicReactPackageVersion$jscomp$inline_2481
2131321313
)
2131421314
throw Error(
2131521315
formatProdErrorMessage(
2131621316
527,
2131721317
isomorphicReactPackageVersion$jscomp$inline_2481,
21318-
"19.3.0-native-fb-23def8fd-20260706"
21318+
"19.3.0-native-fb-08725f21-20260706"
2131921319
)
2132021320
);
2132121321
ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
@@ -21337,10 +21337,10 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
2133721337
};
2133821338
var internals$jscomp$inline_2488 = {
2133921339
bundleType: 0,
21340-
version: "19.3.0-native-fb-23def8fd-20260706",
21340+
version: "19.3.0-native-fb-08725f21-20260706",
2134121341
rendererPackageName: "react-dom",
2134221342
currentDispatcherRef: ReactSharedInternals,
21343-
reconcilerVersion: "19.3.0-native-fb-23def8fd-20260706",
21343+
reconcilerVersion: "19.3.0-native-fb-08725f21-20260706",
2134421344
getLaneLabelMap: function () {
2134521345
for (
2134621346
var map = new Map(), lane = 1, index$346 = 0;
@@ -21463,4 +21463,4 @@ exports.hydrateRoot = function (container, initialChildren, options) {
2146321463
listenToAllSupportedEvents(container);
2146421464
return new ReactDOMHydrationRoot(initialChildren);
2146521465
};
21466-
exports.version = "19.3.0-native-fb-23def8fd-20260706";
21466+
exports.version = "19.3.0-native-fb-08725f21-20260706";

‎compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMProfiling-dev.js‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<cf0ec2387467574921b6c6e50e9b01eb>>
10+
* @generated SignedSource<<d2db00bac411a05452676b3eb8dca6e5>>
1111
*/
1212

1313
/*
@@ -32147,11 +32147,11 @@ __DEV__ &&
3214732147
};
3214832148
(function () {
3214932149
var isomorphicReactPackageVersion = React.version;
32150-
if ("19.3.0-native-fb-23def8fd-20260706" !== isomorphicReactPackageVersion)
32150+
if ("19.3.0-native-fb-08725f21-20260706" !== isomorphicReactPackageVersion)
3215132151
throw Error(
3215232152
'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' +
3215332153
(isomorphicReactPackageVersion +
32154-
"\n - react-dom: 19.3.0-native-fb-23def8fd-20260706\nLearn more: https://react.dev/warnings/version-mismatch")
32154+
"\n - react-dom: 19.3.0-native-fb-08725f21-20260706\nLearn more: https://react.dev/warnings/version-mismatch")
3215532155
);
3215632156
})();
3215732157
("function" === typeof Map &&
@@ -32188,10 +32188,10 @@ __DEV__ &&
3218832188
!(function () {
3218932189
var internals = {
3219032190
bundleType: 1,
32191-
version: "19.3.0-native-fb-23def8fd-20260706",
32191+
version: "19.3.0-native-fb-08725f21-20260706",
3219232192
rendererPackageName: "react-dom",
3219332193
currentDispatcherRef: ReactSharedInternals,
32194-
reconcilerVersion: "19.3.0-native-fb-23def8fd-20260706"
32194+
reconcilerVersion: "19.3.0-native-fb-08725f21-20260706"
3219532195
};
3219632196
internals.overrideHookState = overrideHookState;
3219732197
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
@@ -32666,7 +32666,7 @@ __DEV__ &&
3266632666
exports.useFormStatus = function () {
3266732667
return resolveDispatcher().useHostTransitionStatus();
3266832668
};
32669-
exports.version = "19.3.0-native-fb-23def8fd-20260706";
32669+
exports.version = "19.3.0-native-fb-08725f21-20260706";
3267032670
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
3267132671
"function" ===
3267232672
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

‎compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMProfiling-prod.js‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<ea34c5b463229da320989863dd950c11>>
10+
* @generated SignedSource<<2f877693369f678f6b872f3863d1d617>>
1111
*/
1212

1313
/*
@@ -19265,14 +19265,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) {
1926519265
};
1926619266
var isomorphicReactPackageVersion$jscomp$inline_2135 = React.version;
1926719267
if (
19268-
"19.3.0-native-fb-23def8fd-20260706" !==
19268+
"19.3.0-native-fb-08725f21-20260706" !==
1926919269
isomorphicReactPackageVersion$jscomp$inline_2135
1927019270
)
1927119271
throw Error(
1927219272
formatProdErrorMessage(
1927319273
527,
1927419274
isomorphicReactPackageVersion$jscomp$inline_2135,
19275-
"19.3.0-native-fb-23def8fd-20260706"
19275+
"19.3.0-native-fb-08725f21-20260706"
1927619276
)
1927719277
);
1927819278
ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
@@ -19294,10 +19294,10 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
1929419294
};
1929519295
var internals$jscomp$inline_2733 = {
1929619296
bundleType: 0,
19297-
version: "19.3.0-native-fb-23def8fd-20260706",
19297+
version: "19.3.0-native-fb-08725f21-20260706",
1929819298
rendererPackageName: "react-dom",
1929919299
currentDispatcherRef: ReactSharedInternals,
19300-
reconcilerVersion: "19.3.0-native-fb-23def8fd-20260706"
19300+
reconcilerVersion: "19.3.0-native-fb-08725f21-20260706"
1930119301
};
1930219302
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
1930319303
var hook$jscomp$inline_2734 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -19566,4 +19566,4 @@ exports.useFormState = function (action, initialState, permalink) {
1956619566
exports.useFormStatus = function () {
1956719567
return ReactSharedInternals.H.useHostTransitionStatus();
1956819568
};
19569-
exports.version = "19.3.0-native-fb-23def8fd-20260706";
19569+
exports.version = "19.3.0-native-fb-08725f21-20260706";

‎compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMProfiling-profiling.js‎

Lines changed: 6 additions & 6 deletions

0 commit comments

Comments
 (0)