@@ -262,7 +262,7 @@ export class ListLayout<T, O extends ListLayoutOptions = ListLayoutOptions> exte
262
262
y = 0 ;
263
263
}
264
264
265
- for ( let node of collection ) {
265
+ for ( let node of collectionNodes ) {
266
266
let rowHeight = ( this . rowHeight ?? this . estimatedRowHeight ?? DEFAULT_HEIGHT ) + this . gap ;
267
267
// Skip rows before the valid rectangle unless they are already cached.
268
268
if ( node . type === 'item' && y + rowHeight < this . requestedRect . y && ! this . isValid ( node , y ) ) {
@@ -279,12 +279,13 @@ export class ListLayout<T, O extends ListLayoutOptions = ListLayoutOptions> exte
279
279
}
280
280
281
281
// Build each loader that exists in the collection that is outside the visible rect so that they are persisted
282
- // at the proper estimated location
283
- if ( y > this . requestedRect . maxY ) {
282
+ // at the proper estimated location. If the node.type is "section" then we don't do this shortcut since we have to
283
+ // build the sections to see how tall they are.
284
+ if ( ( node . type === 'item' || node . type === 'loader' ) && y > this . requestedRect . maxY ) {
284
285
let lastProcessedIndex = collectionNodes . indexOf ( node ) ;
285
286
for ( let loaderNode of loaderNodes ) {
286
287
let loaderNodeIndex = collectionNodes . indexOf ( loaderNode ) ;
287
- // Subtract by an addition 1 since we've already added the current item's height to y
288
+ // Subtract by an additional 1 since we've already added the current item's height to y
288
289
y += ( loaderNodeIndex - lastProcessedIndex - 1 ) * rowHeight ;
289
290
let loader = this . buildChild ( loaderNode , this . padding , y , null ) ;
290
291
nodes . push ( loader ) ;
0 commit comments