diff --git a/packages/virtualized-lists/Lists/ViewabilityHelper.js b/packages/virtualized-lists/Lists/ViewabilityHelper.js index 5fc5addc11b..150d07363b2 100644 --- a/packages/virtualized-lists/Lists/ViewabilityHelper.js +++ b/packages/virtualized-lists/Lists/ViewabilityHelper.js @@ -302,9 +302,14 @@ class ViewabilityHelper { ) => ViewToken, ) { // Filter out indices that have gone out of view since this call was scheduled. - viewableIndicesToCheck = viewableIndicesToCheck.filter(ii => - this._viewableIndices.includes(ii), - ); + // Both call sites pass the array stored in `this._viewableIndices`, in which + // case every index is trivially still viewable and the O(n^2) filter can be + // skipped. + if (viewableIndicesToCheck !== this._viewableIndices) { + viewableIndicesToCheck = viewableIndicesToCheck.filter(ii => + this._viewableIndices.includes(ii), + ); + } const prevItems = this._viewableItems; const nextItems = new Map( viewableIndicesToCheck.map(ii => {