Cached Row Heights Go Stale in Virtualized Lists, Causing Scroll Jumps
A developer's follow-up on ResizeObserver feedback loops warns that fixing the loop by measuring rows once creates a new issue: cached row heights can become outdated when content changes after measurement. Common triggers include late-loading fonts, images without fixed aspect ratios, and diff viewers that reflow lines on toggle. The resulting errors appear far from their source, such as a scrollbar jump when a user scrolls past rows whose true heights differ from the cached values. The article evaluates CSS content-visibility as a partial fix, noting it self-corrects only for rows already rendered and cannot be invalidated for offscreen rows. It proposes a two-tier cache that reconciles heights when rows enter the viewport, recomputing total height only when a previously seen value changes.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in