chore(ui): upgrade virtua to 0.53.5 to fix near-bottom shrink over-correction (#991)

chore(ui): upgrade virtua to 0.53.5 to fix near-bottom shrink over-correction

Virtua 0.51 compensated a row shrinking above the reader with a relative
scrollBy issued after shrinking its container; near the bottom the browser
had already clamped scrollTop, so the shrink was subtracted twice and an
escaped reader within the clamp zone jumped by the shrink minus its gap
(70 px and 160 px measured for ordinary rows). Virtua 0.52.8 lands such a
jump with an absolute scrollTo when the recorded offset is at or beyond the
new end, and 0.53 keeps the same compensation rule (rows wholly above the
viewport when idle or scrolling up) through an anchor-based implementation.

The list's assumptions were reviewed against the new internals: Virtua's
ResizeObserver and scroll listener still attach at mount, before the
microtask that recreates the row observer and seeds the offset (the ref
now runs at instance creation); retired zero-height rows, startMargin,
keepMounted, item offset/size/index lookups and the CacheSnapshot layout
are unchanged, and no imperative Virtua operation is used. The cache
contract test no longer relied on the removed $estimateDefaultSize and now
pins that a carried itemSize is never re-estimated via $setItemSizes and
$isEstimating, with an estimating control.

A new browser test shrinks an ordinary row above a reader near the bottom
(gaps 0/10/40) and requires the read row to stay put on every painted
frame; it fails on 0.51 (gaps 10 and 40) and passes on 0.53.5. All
VirtualFollowList and session browser suites, UI unit tests, typecheck and
the UI build pass.
This commit is contained in:
Pascal André 2026-10-17 16:10:05 +02:00 • committed by GitHub
parent 2f9ccea747
commit bbab05dade
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 40 additions and 14 deletions

View file

@ -115,7 +115,7 @@ also account for off-window messages, not just the local scroll offset.
Reasons come from the closed `SCROLL_REASONS` list in `virtual-scroll-trace.ts`; the
same call opens the programmatic window and records synchronous targets. Every write
is a DOM write: the list never issues Virtua's imperative operations
(`scrollTo`/`scrollBy`/`scrollToIndex`). In Virtua 0.51 such an operation reapplies
(`scrollTo`/`scrollBy`/`scrollToIndex`). In Virtua (0.51 to 0.53) such an operation reapplies
its fixed target on every item or viewport measurement until 150 ms after the last
one; the rows a gesture mounts, or a streaming tail, keep re-arming it, and nothing
public cancels it, so it would undo any gesture or later write made meanwhile. Key