Repository navigation
Conversation
…lap them computeWindowedRenderLimits finds the visible cells by binary-searching getCellMetricsApprox, which places an unmeasured cell at the current average cell length times its index. A spacer keeps the size it was rendered with, so once the average changes, the estimates for the cells in a spacer can overlap the rendered cells after it. After a large prepend at the top under maintainVisibleContentPosition, the prepended cells rendered above the spacer change the average before native's correction arrives, the corrected offset maps into the spacer, and the cells on screen are unmounted. When the search disagrees with a mounted cell's measured frame about where the viewport starts, use the mounted cells that cover the viewport. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2 of 3 tasks
This branch has not been deployed
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.
Summary:
computeWindowedRenderLimitsfinds the visible cells by binary-searching estimated cell offsets, and an unmeasured cell is estimated at the current average cell length times its index. A spacer keeps the size it was rendered with, so once the average changes, the estimates for the cells in a spacer can overlap the rendered cells after it. After a large prepend at the top undermaintainVisibleContentPosition, the prepended cells rendered above the spacer change the average before native's correction arrives, the corrected offset maps into the spacer, and the cells on screen are unmounted. This takes the visible range from the mounted cells' measured frames when the search disagrees with them about where the viewport starts. When estimates and measurements agree, nothing changes.Fixes #58939. Repro: https://github.com/mozzius/virtualizedlist-average-mismatch-repro
Changelog:
[GENERAL] [FIXED] - Fix VirtualizedList unmounting the cells on screen when the estimates for a spacer above them overlap them
Test Plan:
VirtualizedList-test.js: onmainthe window moves to10..12and unmounts cells 20-24, which are on screen; with the fix they stay. All other VirtualizedList tests pass unmodified.yarn jest packages/virtualized-lists,yarn flow-check,yarn lint,yarn prettier.🤖 Generated with Claude Code