@@ -349,21 +349,25 @@ - (void)_updateVisibleNodeIndexPaths
349349 }
350350 }
351351 } else {
352- // If selfInterfaceState isn't visible, then visibleIndexPaths represents what /will/ be immediately visible at the
353- // instant we come onscreen. So, preload and display all of those things, but don't waste resources preloading yet.
354- // We handle this as a separate case to minimize set operations for offscreen preloading, including containsObject:.
352+ // If selfInterfaceState isn't visible, then visibleIndexPaths represents either what /will/ be immediately visible at the
353+ // instant we come onscreen, or what /will/ no longer be visible at the instant we come offscreen.
354+ // So, preload and display all of those things, but don't waste resources preloading others.
355+ // We handle this as a separate case to minimize set operations, including -containsObject:.
356+ //
357+ // DO NOT set Visible: even though these elements are in the visible range / "viewport",
358+ // our overall container object is itself not yet, or no longer, visible.
359+ // The moment it becomes visible, we will run the condition above.
360+
361+ BOOL shouldUpdateInterfaceState = NO ;
362+ if (ASActivateExperimentalFeature (ASExperimentalFixRangeController)) {
363+ shouldUpdateInterfaceState = [visibleIndexPaths containsObject: indexPath];
364+ } else {
365+ shouldUpdateInterfaceState = [allCurrentIndexPaths containsObject: indexPath];
366+ }
355367
356- if ([allCurrentIndexPaths containsObject: indexPath]) {
357- // DO NOT set Visible: even though these elements are in the visible range / "viewport",
358- // our overall container object is itself not visible yet. The moment it becomes visible, we will run the condition above
359-
360- // Set Layout, Preload
368+ if (shouldUpdateInterfaceState) {
361369 interfaceState |= ASInterfaceStatePreload;
362-
363370 if (rangeMode != ASLayoutRangeModeLowMemory) {
364- // Add Display.
365- // We might be looking at an indexPath that was previously in-range, but now we need to clear it.
366- // In that case we'll just set it back to MeasureLayout. Only set Display | Preload if in allCurrentIndexPaths.
367371 interfaceState |= ASInterfaceStateDisplay;
368372 }
369373 }
0 commit comments