Skip to content

[virtualizer] Render the rows and columns in view on small scrolls in controlled layout - #23865

Merged
rita-codes merged 6 commits into
mui:masterfrom
rita-codes:virtualizer-controlled-blank-rows
Oct 19, 2026
Merged

rita-codes merged 6 commits into
mui:masterfrom
rita-codes:virtualizer-controlled-blank-rows

Conversation

@rita-codes

@rita-codes rita-codes commented Oct 14, 2026 •

Copy link
Copy Markdown
Member

Fixes #23864

Found while fixing #23859: the Scheduler timeline uses the controlled layout, and rows reached by small scrolls weren't rendered. With this fix, #23860 no longer needs its own workaround to mount the focused row.

The controlled layout renders no buffer, so a scroll shorter than the average row height (or under 50px horizontally) could expose rows or columns that weren't rendered yet. The virtualizer now also updates when the viewport goes past the rendered rows or columns. Uncontrolled and sticky layouts are unchanged.

isLowOnRenderedBuffer also leaves out the right-pinned columns in the controlled layout, like computeRenderContext does. Without it, the check would recompute on every scroll when columns are pinned to the right.

Measured with the React Profiler on the Scheduler timeline (monthAndYear preset, 40 resources, 1000 events, 600px of horizontal scroll in 4px steps): no difference in render count or render time, since the timeline already commits on every scroll event.

Added four browser tests, one per edge of the viewport. They fail on master and pass with the fix.

Before
https://github.com/user-attachments/assets/33b7a560-f5c1-4046-a7b5-b9510c7344a1

Screen.Recording.2026-10-14.at.11.32.18.mov

After
https://github.com/user-attachments/assets/61bee2ca-8155-48ad-a12a-f4636924c1fd

Screen.Recording.2026-10-14.at.11.32.52.mov

… controlled layout

The controlled layout renders no buffer, so a scroll below the row or column threshold could expose rows or columns that were not rendered yet. Also update the render context when the viewport reaches past the rendered range.
@rita-codes rita-codes added type: bug It doesn't behave as expected. scope: virtualizer labels Oct 14, 2026
@code-infra-dashboard

code-infra-dashboard Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Deploy preview

https://deploy-preview-23865--material-ui-x.netlify.app/
QR code for https://deploy-preview-23865--material-ui-x.netlify.app/

Bundle size

Bundle Parsed size Gzip size
@mui/x-data-grid 🔺+112B(+0.03%) 🔺+18B(+0.01%)
@mui/x-data-grid-pro 🔺+112B(+0.02%) 🔺+25B(+0.02%)
@mui/x-data-grid-premium 🔺+113B(+0.02%) 🔺+22B(+0.01%)
@mui/x-charts 0B(0.00%) 0B(0.00%)
@mui/x-charts-pro 0B(0.00%) 0B(0.00%)
@mui/x-charts-premium 0B(0.00%) 0B(0.00%)
@mui/x-date-pickers 0B(0.00%) 0B(0.00%)
@mui/x-date-pickers-pro 0B(0.00%) 0B(0.00%)
@mui/x-tree-view 0B(0.00%) 0B(0.00%)
@mui/x-tree-view-pro 🔺+112B(+0.08%) 🔺+26B(+0.06%)
@mui/x-scheduler 0B(0.00%) 0B(0.00%)
@mui/x-scheduler-premium 🔺+112B(+0.02%) 🔺+33B(+0.02%)
@mui/x-chat 0B(0.00%) 0B(0.00%)
@mui/x-license 0B(0.00%) 0B(0.00%)

Details of bundle changes


Check out the code infra dashboard for more information about this PR.

@rita-codes
rita-codes marked this pull request as ready for review October 14, 2026 09:35
@rita-codes
rita-codes requested a review from romgrk as a code owner October 14, 2026 09:35
@rita-codes
rita-codes merged commit 649752c into mui:master Oct 19, 2026
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope: virtualizer type: bug It doesn't behave as expected.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[virtualizer] Blank strips on small scrolls in the controlled layout

2 participants