{{ message }}
Repository navigation
Commit d1cf8ed
committed
[compiler]: add
## 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)useWindowVirtualizer to known incompatible libraries (react#36912)1 parent 4db283d commit d1cf8ed
23 files changed
Lines changed: 88 additions & 74 deletions
File tree
- compiled-rn
- facebook-fbsource/xplat/js
- RKJSModules/vendor/react
- react-dom/cjs
- react-test-renderer/cjs
- react/cjs
- react-native-github/Libraries/Renderer
- implementations
- tools/eslint-plugin-react-hooks
- cjs
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
419 | 419 | | |
420 | 420 | | |
421 | 421 | | |
422 | | - | |
| 422 | + | |
423 | 423 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
218 | 218 | | |
219 | 219 | | |
220 | 220 | | |
221 | | - | |
| 221 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
218 | 218 | | |
219 | 219 | | |
220 | 220 | | |
221 | | - | |
| 221 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
32085 | 32085 | | |
32086 | 32086 | | |
32087 | 32087 | | |
32088 | | - | |
| 32088 | + | |
32089 | 32089 | | |
32090 | 32090 | | |
32091 | 32091 | | |
32092 | | - | |
| 32092 | + | |
32093 | 32093 | | |
32094 | 32094 | | |
32095 | 32095 | | |
| |||
32126 | 32126 | | |
32127 | 32127 | | |
32128 | 32128 | | |
32129 | | - | |
| 32129 | + | |
32130 | 32130 | | |
32131 | 32131 | | |
32132 | | - | |
| 32132 | + | |
32133 | 32133 | | |
32134 | 32134 | | |
32135 | 32135 | | |
| |||
32279 | 32279 | | |
32280 | 32280 | | |
32281 | 32281 | | |
32282 | | - | |
| 32282 | + | |
32283 | 32283 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
19248 | 19248 | | |
19249 | 19249 | | |
19250 | 19250 | | |
19251 | | - | |
| 19251 | + | |
19252 | 19252 | | |
19253 | 19253 | | |
19254 | 19254 | | |
19255 | 19255 | | |
19256 | 19256 | | |
19257 | 19257 | | |
19258 | | - | |
| 19258 | + | |
19259 | 19259 | | |
19260 | 19260 | | |
19261 | 19261 | | |
| |||
19277 | 19277 | | |
19278 | 19278 | | |
19279 | 19279 | | |
19280 | | - | |
| 19280 | + | |
19281 | 19281 | | |
19282 | 19282 | | |
19283 | | - | |
| 19283 | + | |
19284 | 19284 | | |
19285 | 19285 | | |
19286 | 19286 | | |
| |||
19387 | 19387 | | |
19388 | 19388 | | |
19389 | 19389 | | |
19390 | | - | |
| 19390 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
21308 | 21308 | | |
21309 | 21309 | | |
21310 | 21310 | | |
21311 | | - | |
| 21311 | + | |
21312 | 21312 | | |
21313 | 21313 | | |
21314 | 21314 | | |
21315 | 21315 | | |
21316 | 21316 | | |
21317 | 21317 | | |
21318 | | - | |
| 21318 | + | |
21319 | 21319 | | |
21320 | 21320 | | |
21321 | 21321 | | |
| |||
21337 | 21337 | | |
21338 | 21338 | | |
21339 | 21339 | | |
21340 | | - | |
| 21340 | + | |
21341 | 21341 | | |
21342 | 21342 | | |
21343 | | - | |
| 21343 | + | |
21344 | 21344 | | |
21345 | 21345 | | |
21346 | 21346 | | |
| |||
21463 | 21463 | | |
21464 | 21464 | | |
21465 | 21465 | | |
21466 | | - | |
| 21466 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
32147 | 32147 | | |
32148 | 32148 | | |
32149 | 32149 | | |
32150 | | - | |
| 32150 | + | |
32151 | 32151 | | |
32152 | 32152 | | |
32153 | 32153 | | |
32154 | | - | |
| 32154 | + | |
32155 | 32155 | | |
32156 | 32156 | | |
32157 | 32157 | | |
| |||
32188 | 32188 | | |
32189 | 32189 | | |
32190 | 32190 | | |
32191 | | - | |
| 32191 | + | |
32192 | 32192 | | |
32193 | 32193 | | |
32194 | | - | |
| 32194 | + | |
32195 | 32195 | | |
32196 | 32196 | | |
32197 | 32197 | | |
| |||
32666 | 32666 | | |
32667 | 32667 | | |
32668 | 32668 | | |
32669 | | - | |
| 32669 | + | |
32670 | 32670 | | |
32671 | 32671 | | |
32672 | 32672 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
19265 | 19265 | | |
19266 | 19266 | | |
19267 | 19267 | | |
19268 | | - | |
| 19268 | + | |
19269 | 19269 | | |
19270 | 19270 | | |
19271 | 19271 | | |
19272 | 19272 | | |
19273 | 19273 | | |
19274 | 19274 | | |
19275 | | - | |
| 19275 | + | |
19276 | 19276 | | |
19277 | 19277 | | |
19278 | 19278 | | |
| |||
19294 | 19294 | | |
19295 | 19295 | | |
19296 | 19296 | | |
19297 | | - | |
| 19297 | + | |
19298 | 19298 | | |
19299 | 19299 | | |
19300 | | - | |
| 19300 | + | |
19301 | 19301 | | |
19302 | 19302 | | |
19303 | 19303 | | |
| |||
19566 | 19566 | | |
19567 | 19567 | | |
19568 | 19568 | | |
19569 | | - | |
| 19569 | + | |

0 commit comments