React-virtualized: Grid Renders All Non-Visible Rows

Created on 1 Sep 2016  路  3Comments  路  Source: bvaughn/react-virtualized

I have an issue where after updating a grid after a dynamic row height changes all subsequent rows get re-rendered (past visible range).

I believe this section may be responsible.
https://github.com/bvaughn/react-virtualized/blob/master/source/Grid/utils/updateScrollIndexHelper.js#L55

I'm debugging and it seems Grid.componentDidUpdate calls updateScrollIndexHelper which sets scrollToIndex to list.length (see linked section) so that CellSizeAndPositionManager.getUpdatedOffsetForIndex re-renders everything from lastMeasuredIndex to the end

enhancement

Most helpful comment

@iChip Check out 7.22.2~ hot off the press. Hopefully it will improve performance for you? :)

All 3 comments

Good catch @iChip. This logic was written before CellMeasurer existed and so the underlying assumption was that it would be cheap/fast to query sizes for remaining cells. I should be able to relax this a lot though. It really isn't necessary to measure to the end of the collection, only to the end of the viewport. I'll try to get a patch release made sometime today.

Thanks @bvaughn, appreciate the prompt response!

@iChip Check out 7.22.2~ hot off the press. Hopefully it will improve performance for you? :)

Was this page helpful?
0 / 5 - 0 ratings