Skip to content

fix(virtualized-lists): invalidate content length on orientation change - #57871

Open
fallintoplace wants to merge 1 commit into
react:mainfrom
fallintoplace:fix/virtualized-lists-content-length-orientation
Open

fix(virtualized-lists): invalidate content length on orientation change#57871
fallintoplace wants to merge 1 commit into
react:mainfrom
fallintoplace:fix/virtualized-lists-content-length-orientation

Conversation

@fallintoplace

Copy link
Copy Markdown
Contributor

Summary

When a list changes between vertical and horizontal layouts, ListMetricsAggregator resets its cell measurements but keeps _contentLength. That value belongs to the old scrolling axis. In horizontal RTL mode, it can then be used to calculate a cell offset before the new content layout is observed.

This clears _contentLength during horizontal orientation changes so RTL calculations wait for the new content length. The reset was present in the original orientation invalidation logic and was removed when bottom-up layout support was removed.

Changelog:

[GENERAL] [FIXED] - Invalidate list content length when orientation changes.

Test Plan:

  • Added regression coverage for vertical to horizontal content length invalidation.
  • Verified horizontal RTL metrics throw until new content layout is observed.
  • Ran yarn jest packages/virtualized-lists/Lists/__tests__/ListMetricsAggregator-test.js --runInBand.
  • Ran Prettier and targeted ESLint checks.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Aug 9, 2026
@facebook-github-tools facebook-github-tools Bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Aug 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant