eslint-plugin-react-hooks v7 warning for useVirtualizer: Compilation Skipped: Use of incompatible library
Les mainteneurs répondent en général sous 1 jour
@kklem0 y travaille déjà.
Depuis le 25/7/2026.
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Accessibilité débutants
- 45/100
- Type d'issue
- Bug
- Clarté
- Plutôt claire
- Activité
- Calme
- Stack technique
- react, typescript
Piste de recherche
Commencez par la reproduction fournie dans StackBlitz, en particulier src/main.tsx, eslint.config.ts et package.json, et exécutez eslint avec les versions indiquées des plugins React et hooks. Comparez l’exemple useVirtualizer avec useWindowVirtualizer et examinez les points d’entrée de l’intégration React ; le travail est terminé lorsque le cas useVirtualizer reproductible n’émet plus l’avertissement de bibliothèque incompatible sans le supprimer.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Describe the bug
I see warning
~/projects/kkvivbzvmm.github 1s
❯ eslint
Warning: React version not specified in eslint-plugin-react settings. See https://github.com/jsx-eslint/eslint-plugin-react#configuration .
/home/projects/kkvivbzvmm.github/src/main.tsx
14:23 warning Compilation Skipped: Use of incompatible library
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.
/home/projects/kkvivbzvmm.github/src/main.tsx:14:23
12 | const listRef = React.useRef<HTMLDivElement | null>(null);
13 |
> 14 | const virtualizer = useVirtualizer({
| ^^^^^^^^^^^^^^ TanStack Virtual's `useVirtualizer()` API returns functions that cannot be memoized safely
15 | getScrollElement: () => window as any as Element,
16 | // const virtualizer = useWindowVirtualizer({
17 | count: 10000, react-hooks/incompatible-library
Your minimal, reproducible example
https://stackblitz.com/edit/tanstack-virtual-dvrcspge?file=eslint.config.ts
Steps to reproduce
import * as React from 'react';
import * as ReactDOM from 'react-dom/client';
import './index.css';
import {
useVirtualizer,
// useWindowVirtualizer
} from '@tanstack/react-virtual';
function Example() {
const listRef = React.useRef<HTMLDivElement | null>(null);
const virtualizer = useVirtualizer({
getScrollElement: () => window as any as Element,
// const virtualizer = useWindowVirtualizer({
count: 10000,
estimateSize: () => 35,
overscan: 5,
scrollMargin: listRef.current?.offsetTop ?? 0,
});
return (
<>
<div ref={listRef} className="List">
<div
style={{
height: `${virtualizer.getTotalSize()}px`,
width: '100%',
position: 'relative',
}}
>
{virtualizer.getVirtualItems().map((item) => (
<div
key={item.key}
className={item.index % 2 ? 'ListItemOdd' : 'ListItemEven'}
style={{
position: 'absolute',
top: 0,
left: 0,
width: '100%',
height: `${item.size}px`,
transform: `translateY(${
item.start - virtualizer.options.scrollMargin
}px)`,
}}
>
Row {item.index}
</div>
))}
</div>
</div>
</>
);
}
function App() {
return (
<div>
<p>
In many cases, when implementing a virtualizer with a window as the
scrolling element, developers often find the need to specify a
"scrollMargin." The scroll margin is a crucial setting that defines the
space or gap between the start of the page and the edges of the list.
</p>
<br />
<br />
<h3>Window scroller</h3>
<Example />
<br />
<br />
{process.env.NODE_ENV === 'development' ? (
<p>
<strong>Notice:</strong> You are currently running React in
development mode. Rendering performance will be slightly degraded
until this application is built for production.
</p>
) : null}
</div>
);
}
ReactDOM.createRoot(document.getElementById('root')!).render(
<React.StrictMode>
<App />
</React.StrictMode>
);
eslint.config.ts
import js from '@eslint/js';
import globals from 'globals';
import tseslint from 'typescript-eslint';
import pluginReact from 'eslint-plugin-react';
import { defineConfig } from 'eslint/config';
import reactHooks from 'eslint-plugin-react-hooks';
export default defineConfig([
{
files: ['**/*.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
plugins: { js },
extends: ['js/recommended'],
languageOptions: { globals: globals.browser },
},
tseslint.configs.recommended,
pluginReact.configs.flat.recommended,
reactHooks.configs.flat.recommended,
]);
package.json
"eslint": "^9.39.2",
"eslint-plugin-react": "7.37.5",
"eslint-plugin-react-hooks": "7.0.1",
Expected behavior
no warning
tried "use no memo" - didnt work
How often does this bug happen?
None
Screenshots or Videos
No response
Platform
chrome
tanstack-virtual version
^3.13.18
TypeScript version
No response
Additional context
No response
Terms & Code of Conduct
- I agree to follow this project's Code of Conduct
- I understand that if my bug cannot be reliable reproduced in a debuggable environment, it will probably not be fixed and this issue may even be closed.
- Langage dominant
- TypeScript
- Étoiles
- 7.1k
- Forks
- 472
- Merge moyen
- 1 j 2 h
- PR mergées (30 j)
- 12
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Propose un modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de TanStack/virtual
-
measureElement caches 0 size for nodes that aren't attached yet (Vue: rows stack at start 0 and the list scrolls away on mount)Peut-être pris @webn00b l’a pris il y a 9 jours. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
Les mainteneurs répondent en général sous 1 jour
-
`scrollToIndex(last, { align: 'end' })` stays short of the end after a measured row grows (virtual-core ≥ 3.17.0)Peut-être pris @minwookshin l’a pris il y a 6 jours. Ouverte
Difficulté 4/5 3-5 jours Accessibilité débutants 55/100
TanStack/virtual#1290 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
virtual-core: desktop Safari drops the prepend anchor write when history lands during the top rubber-band bouncePeut-être pris Une pull request liée à cette issue est ouverte ou déjà fusionnée. Ouverte
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 38/100
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 4/5 3-5 jours Accessibilité débutants 62/100
Les mainteneurs répondent en général sous 1 jour
-
marko-virtual: scrollToEnd during an in-flight prepend strands the view one prepend above the bottom (chat-pretext e2e fails on CI)Peut-être à nouveau libre Une pull request pour cette issue a été fermée sans être fusionnée. Ouverte
Difficulté 4/5 3-5 jours Accessibilité débutants 55/100
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de TanStack/virtual
Issues similaires
-
perf(core): getComments() runs the approved count and the comment list as two sequential queriesOuvertearea/core bot:bug bot:working
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
emdash-cms/emdash#3905 · 2 commentaires ·
Les mainteneurs répondent en général sous 1 jour
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficulté 1/5 Moins d'une heure Accessibilité débutants 90/100
lingdojo/kana-dojo#31728 · 1 commentaire · 5 réactions ·
Les mainteneurs répondent en général sous 1 jour
-
selective-claw: freshTailTurns=0 keeps ALL turns verbatim and summarizes none (slice(-0) === slice(0))Peut-être pris @zjncs l’a pris aujourd’hui. Ouvertecomponent:tokenless
Difficulté 2/5 1-3 heures Accessibilité débutants 80/100
agentic-os-org/ANOLISA#6112 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
bug needs triage
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
rjsf-team/react-jsonschema-form#5439 ·
Les mainteneurs répondent en général sous 1 jour
-
enhancement
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
Les mainteneurs répondent en général sous 1 jour