@@ -207,7 +207,7 @@ class BaseTable extends React.PureComponent {
207
207
}
208
208
209
209
/**
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)
211
211
*/
212
212
resetAfterRowIndex ( rowIndex = 0 , shouldForceUpdate = true ) {
213
213
if ( ! this . props . estimatedRowHeight ) return ;
@@ -217,6 +217,20 @@ class BaseTable extends React.PureComponent {
217
217
this . rightTable && this . rightTable . resetAfterRowIndex ( rowIndex , shouldForceUpdate ) ;
218
218
}
219
219
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
+
220
234
/**
221
235
* Scroll to the specified offset.
222
236
* Useful for animating position changes.
@@ -673,7 +687,7 @@ class BaseTable extends React.PureComponent {
673
687
674
688
const _data = expandColumnKey ? this . _flattenOnKeys ( data , this . getExpandedRowKeys ( ) , this . props . rowKey ) : data ;
675
689
if ( this . _data !== _data ) {
676
- this . _resetRowHeightCache ( ) ;
690
+ this . resetAfterRowIndex ( 0 , false ) ;
677
691
this . _data = _data ;
678
692
}
679
693
// should be after `this._data` assigned
@@ -989,17 +1003,6 @@ class BaseTable extends React.PureComponent {
989
1003
this . _rowHeightMapBuffer [ rowKey ] = size ;
990
1004
this . _updateRowHeights ( ) ;
991
1005
}
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
- }
1003
1006
}
1004
1007
1005
1008
BaseTable . Column = Column ;
0 commit comments