Commit e3f5938 1 parent 0a4a311 commit e3f5938 Copy full SHA for e3f5938
File tree 1 file changed +5
-2
lines changed
1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ import VirtualBody from './virtual/body';
7
7
import { statics } from './util' ;
8
8
9
9
const noop = ( ) => { } ;
10
+ const THRESHOLD = 10 ;
10
11
export default function virtual ( BaseComponent ) {
11
12
class VirtualTable extends React . Component {
12
13
static VirtualBody = VirtualBody ;
@@ -143,7 +144,9 @@ export default function virtual(BaseComponent) {
143
144
return 0 ;
144
145
}
145
146
146
- return this . start * rowHeight ;
147
+ const start = Math . max ( this . start - THRESHOLD , 0 ) ;
148
+
149
+ return start * rowHeight ;
147
150
}
148
151
149
152
getVisibleRange ( ExpectStart ) {
@@ -273,7 +276,7 @@ export default function virtual(BaseComponent) {
273
276
dataSource . forEach ( ( current , index , record ) => {
274
277
if ( ! current . hidden ) {
275
278
count += 1 ;
276
- if ( count >= start && count < end ) {
279
+ if ( count >= Math . max ( start - THRESHOLD , 0 ) && count < end ) {
277
280
newDataSource . push ( current ) ;
278
281
}
279
282
}
You can’t perform that action at this time.
0 commit comments