fix(virtual-core): viewport drifts when above-viewport rows resize over multiple frames#1212
Merged
piecyk merged 1 commit intoJun 30, 2026
Conversation
…er multiple frames Folding adjustments eagerly into `scrollOffset` means the browser's scroll event for an adjustment write now arrives at exactly the offset we already hold, and the direction computation classified that equality as `'backward'`. With `isScrolling` held for `isScrollingResetDelay` after the event, the default `shouldAdjustScrollPositionOnItemSizeChange` then skipped every above-viewport re-measure compensation until the reset — so multi-frame reflows (a side pane's width animation re-wrapping rows while the user is scrolled up) drifted the viewport, with only ~1 frame in 9 compensated. An event at the held offset carries no directional information, so keep the previous direction for it instead of computing the comparison. Real gestures still latch normally (their read-backs never equal the held offset, which moves with each event), an equality read-back during a real backward gesture correctly stays `'backward'`, and the `isScrolling === false` reset emission still clears the direction.
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Contributor
Author
|
View your CI Pipeline Execution ↗ for commit 0756722
☁️ Nx Cloud last updated this comment at |
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🎯 Changes
Folding adjustments eagerly into
scrollOffsetmeans the browser's scroll event for an adjustment write now arrives at exactly the offset we already hold, and the direction computation classified that equality as'backward'. WithisScrollingheld forisScrollingResetDelayafter the event, the defaultshouldAdjustScrollPositionOnItemSizeChangethen skipped every above-viewport re-measure compensation until the reset — so multi-frame reflows (a side pane's width animation re-wrapping rows while the user is scrolled up) drifted the viewport, with only ~1 frame in 9 compensated.An event at the held offset carries no directional information, so keep the previous direction for it instead of computing the comparison. Real gestures still latch normally (their read-backs never equal the held offset, which moves with each event), an equality read-back during a real backward gesture correctly stays
'backward', and theisScrolling === falsereset emission still clears the direction.✅ Checklist
pnpm run test:pr.🚀 Release Impact
This PR was assisted by Claude Code.
Summary by CodeRabbit