Make the unpagination process less aggressive

This increases `UNPAGINATION_PADDING` (see the ASCII on ScrollPanel.js, `_getExcessHeight`), and also debounces unfilling requests made for 200ms. This forces unfilling requests not to be sent unless the next 200ms has no scrolling, effectively.
This commit is contained in:
Luke Barnard 2016-11-22 16:47:56 +00:00
parent 06f12b91b8
commit d1a5d94916

View file

@ -25,7 +25,7 @@ var DEBUG_SCROLL = false;
// The amount of extra scroll distance to allow prior to unfilling.
// See _getExcessHeight.
const UNPAGINATION_PADDING = 500;
const UNPAGINATION_PADDING = 1500;
if (DEBUG_SCROLL) {
// using bind means that we get to keep useful line numbers in the console
@ -361,7 +361,14 @@ module.exports = React.createClass({
}
if (markerScrollToken) {
this.props.onUnfillRequest(backwards, markerScrollToken);
// Use a debouncer to prevent multiple unfill calls in quick succession
// This is to make the unfilling process less aggressive
if (this._unfillDebouncer) {
clearTimeout(this._unfillDebouncer);
}
this._unfillDebouncer = setTimeout(() => {
this.props.onUnfillRequest(backwards, markerScrollToken);
}, 200);
}
},