This repository was archived by the owner on Sep 11, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +16
-4
lines changed
src/components/structures
test/components/structures Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -25,7 +25,10 @@ var DEBUG_SCROLL = false;
25
25
26
26
// The amount of extra scroll distance to allow prior to unfilling.
27
27
// See _getExcessHeight.
28
- const UNPAGINATION_PADDING = 500 ;
28
+ const UNPAGINATION_PADDING = 1500 ;
29
+ // The number of milliseconds to debounce calls to onUnfillRequest, to prevent
30
+ // many scroll events causing many unfilling requests.
31
+ const UNFILL_REQUEST_DEBOUNCE_MS = 200 ;
29
32
30
33
if ( DEBUG_SCROLL ) {
31
34
// using bind means that we get to keep useful line numbers in the console
@@ -361,7 +364,15 @@ module.exports = React.createClass({
361
364
}
362
365
363
366
if ( markerScrollToken ) {
364
- this . props . onUnfillRequest ( backwards , markerScrollToken ) ;
367
+ // Use a debouncer to prevent multiple unfill calls in quick succession
368
+ // This is to make the unfilling process less aggressive
369
+ if ( this . _unfillDebouncer ) {
370
+ clearTimeout ( this . _unfillDebouncer ) ;
371
+ }
372
+ this . _unfillDebouncer = setTimeout ( ( ) => {
373
+ this . _unfillDebouncer = null ;
374
+ this . props . onUnfillRequest ( backwards , markerScrollToken ) ;
375
+ } , UNFILL_REQUEST_DEBOUNCE_MS ) ;
365
376
}
366
377
} ,
367
378
Original file line number Diff line number Diff line change @@ -341,8 +341,9 @@ describe('TimelinePanel', function() {
341
341
var events = scryEventTiles ( panel ) ;
342
342
expect ( events [ 0 ] . props . mxEvent ) . toBe ( timeline . getEvents ( ) [ 0 ] ) ;
343
343
344
- // Expect to be able to paginate forwards, having unpaginated a few events
345
- expect ( panel . state . canForwardPaginate ) . toBe ( true ) ;
344
+ // At this point, we make no assumption that unpagination has happened. This doesn't
345
+ // mean that we shouldn't be able to scroll all the way down to the bottom to see the
346
+ // most recent event in the timeline.
346
347
347
348
// scroll all the way to the bottom
348
349
return scrollDown ( ) ;
You can’t perform that action at this time.
0 commit comments