@@ -122,19 +122,17 @@ export class GridSizeStore {
122122 const viewportHeight = this . computeBodyViewport ( ) ;
123123
124124 // Don't lock height before the grid body has rendered content.
125- // viewportHeight is 0 when cells have no layout yet, which would
125+ // clientHeight is 0 when the element has no layout yet, which would
126126 // produce a negative height and break scrolling.
127127 if ( viewportHeight <= 0 ) {
128128 return ;
129129 }
130130
131- // Compare scrollHeight and clientHeight from the same element to correctly
132- // detect whether content already overflows a fixed-height container.
133- // If it does, do not subtract the pre-fetch offset — that would hide the
134- // last rows and trigger the next page too early. Only subtract when the
135- // grid does not yet overflow (auto-height grid) to create a small synthetic
136- // overflow that makes the body scrollable.
137- const overflows = gridBody . scrollHeight > gridBody . clientHeight ;
131+ // If content already overflows the container (fixed-height grid), do not subtract the
132+ // pre-fetch offset — that would hide the last rows and trigger the next page too early.
133+ // Only subtract the offset when the grid does not yet overflow (auto-height grid) so
134+ // that we create a small synthetic overflow that makes the body scrollable.
135+ const overflows = gridBody . scrollHeight > viewportHeight ;
138136 this . gridBodyHeight = viewportHeight - ( overflows ? 0 : VIRTUAL_SCROLLING_OFFSET ) ;
139137 this . lockedAtPageSize = currentPageSize ;
140138 }
0 commit comments