Repository navigation
Conversation
|
Hi @gtkatakura! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at [email protected]. Thanks! |
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
react#34493 added `@tanstack/react-virtual`'s `useVirtualizer` to the known incompatible libraries, but not `useWindowVirtualizer`. Both hooks wrap the same `useVirtualizerBase` and return a referentially-stable virtualizer whose methods (e.g. `getVirtualItems()`, `getTotalSize()`) return internally-mutated values, so `useWindowVirtualizer` breaks memoization in the same way.
…(Rust HIR) Mirror the TS DefaultModuleTypeProvider change in the Rust port (react_compiler_hir): register `useWindowVirtualizer` alongside `useVirtualizer` for `@tanstack/react-virtual`. Both wrap the same `useVirtualizerBase` and return a referentially-stable virtualizer whose methods return internally-mutated values, so both break memoization.
eb6234d to
7079fb2
Compare
|
thanks! |
#36912) ## Summary #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 #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 #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 #34493 which changed only the TS file. The Rust change keeps the two providers in sync. DiffTrain build for [08725f2](08725f2)
#36912) ## Summary #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 #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 #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 #34493 which changed only the TS file. The Rust change keeps the two providers in sync. DiffTrain build for [08725f2](08725f2)
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)
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)
Summary
#34493 added
@tanstack/react-virtual'suseVirtualizerto the known incompatible libraries, but notuseWindowVirtualizer.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
useVirtualizerwas registered, code usinguseWindowVirtualizeris silently compiled with the same unsafe memoization. In our app this frozegetVirtualItems()to its first-render value (an empty[]before measurement), producing permanently-empty virtualized lists — the same class of bug #34493 fixed, just via the window variant.This registers
useWindowVirtualizeralongsideuseVirtualizerwith the identical shape, in both implementations:compiler/packages/babel-plugin-react-compiler/src/HIR/DefaultModuleTypeProvider.tscompiler/crates/react_compiler_hir/src/default_module_type_provider.rs(Rust port)See also the community report referenced in #34493: TanStack/virtual#736 (comment)
How did you test this change?
Each addition mirrors the existing
useVirtualizerentry exactly (same kind, params, return type, andknownIncompatiblemessage shape); both are data-only additions to the module type providers, following the precedent set by #34493 which changed only the TS file. The Rust change keeps the two providers in sync.