@@ -207,7 +207,7 @@ class BaseTable extends React.PureComponent {
207207 }
208208
209209 /**
210- * Reset cached row heights after a specific rowIndex, should be used only in dynamic mode(estimatedRowHeight is provided)
210+ * Reset cached offsets for positioning after a specific rowIndex, should be used only in dynamic mode(estimatedRowHeight is provided)
211211 */
212212 resetAfterRowIndex ( rowIndex = 0 , shouldForceUpdate = true ) {
213213 if ( ! this . props . estimatedRowHeight ) return ;
@@ -217,6 +217,20 @@ class BaseTable extends React.PureComponent {
217217 this . rightTable && this . rightTable . resetAfterRowIndex ( rowIndex , shouldForceUpdate ) ;
218218 }
219219
220+ /**
221+ * Reset row height cache, useful if `data` changed entirely, should be used only in dynamic mode(estimatedRowHeight is provided)
222+ */
223+ resetRowHeightCache ( ) {
224+ if ( ! this . props . estimatedRowHeight ) return ;
225+
226+ this . _resetIndex = null ;
227+ this . _rowHeightMapBuffer = { } ;
228+ this . _rowHeightMap = { } ;
229+ this . _mainRowHeightMap = { } ;
230+ this . _leftRowHeightMap = { } ;
231+ this . _rightRowHeightMap = { } ;
232+ }
233+
220234 /**
221235 * Scroll to the specified offset.
222236 * Useful for animating position changes.
@@ -673,7 +687,7 @@ class BaseTable extends React.PureComponent {
673687
674688 const _data = expandColumnKey ? this . _flattenOnKeys ( data , this . getExpandedRowKeys ( ) , this . props . rowKey ) : data ;
675689 if ( this . _data !== _data ) {
676- this . _resetRowHeightCache ( ) ;
690+ this . resetAfterRowIndex ( 0 , false ) ;
677691 this . _data = _data ;
678692 }
679693 // should be after `this._data` assigned
@@ -989,17 +1003,6 @@ class BaseTable extends React.PureComponent {
9891003 this . _rowHeightMapBuffer [ rowKey ] = size ;
9901004 this . _updateRowHeights ( ) ;
9911005 }
992-
993- _resetRowHeightCache ( ) {
994- if ( ! this . props . estimatedRowHeight ) return ;
995-
996- this . _resetIndex = null ;
997- this . _rowHeightMapBuffer = { } ;
998- this . _rowHeightMap = { } ;
999- this . _mainRowHeightMap = { } ;
1000- this . _leftRowHeightMap = { } ;
1001- this . _rightRowHeightMap = { } ;
1002- }
10031006}
10041007
10051008BaseTable . Column = Column ;
0 commit comments