Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

virtual-core: a clamp retry can overwrite a scroll command and ignores _canWriteScroll()

Aperta
#1,327 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
25/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
react, typescript

Direzione di ricerca

Start in the virtual-core scroll write path: _retryClampedAdjustment, _canWriteScroll, _startScroll, _writeAwaitingCommand, and the _willUpdate and resizeItem calls that grow the sizer. Reproduce the case where a clamped retry at { target: 4850, maxAtWrite: 4800 } fires after a scrollToIndex write to 550. Done when a command's target is never overwritten by a retry, the retry respects _canWriteScroll(), and tests cover desktop and the iOS 27 tail timer.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Problem

_retryClampedAdjustment repeats a compensation write that the browser clamped because the sizer was not big enough yet (#1258). It has two problems.

1. The retry can overwrite a scroll command
  1. A hold flush or a compensation write is clamped. The virtualizer records a retry, for example { target: 4850, maxAtWrite: 4800 }.
  2. A scroll command writes. For example, scrollToIndex writes 550.
  3. _willUpdate or resizeItem runs before the command's read-back. The sizer is now bigger, so the retry writes 4850.

The scroll position is 4850, not the target of the command.

  • This occurs on desktop and on iOS.
  • On iOS 27 it occurs more often. The tail timer flushes the hold and then writes a queued command in the same task.
  • It occurs only with adapters whose notify does not grow the sizer synchronously. The React adapter grows it synchronously.
  • #1324 fixed this for a queued command: _writeAwaitingCommand clears the retry. Other commands still have the problem.
2. The retry ignores _canWriteScroll()

The retry can write during the iOS touch tail or under a finger that drags. iOS ignores a write under a finger. On iOS 26 and earlier, a write during the tail stops the momentum.

Possible fix

  • Clear _clampedAdjustment when a command starts (_startScroll), or skip the retry while scrollState !== null.
  • In _retryClampedAdjustment, return early when _canWriteScroll() is false. Keep the record for the next opportunity.
  • Add tests for desktop and for the iOS 27 tail timer.

Found during the review of #1324. Related: #1258, #1307.

Lingua principale
TypeScript
Stelle
7.1k
Fork
472
Merge medio
1g 4h
PR unite (30g)
29

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di TanStack/virtual

Tutte le issue di TanStack/virtual

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.