You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-07-30 02:21:17 +03:00
Use UNFILL_REQUEST_DEBOUNCE_MS constant, reset unfillDebouncer timeout reference.
This commit is contained in:
@ -26,6 +26,9 @@ var DEBUG_SCROLL = false;
|
|||||||
// The amount of extra scroll distance to allow prior to unfilling.
|
// The amount of extra scroll distance to allow prior to unfilling.
|
||||||
// See _getExcessHeight.
|
// See _getExcessHeight.
|
||||||
const UNPAGINATION_PADDING = 1500;
|
const UNPAGINATION_PADDING = 1500;
|
||||||
|
// The number of milliseconds to debounce calls to onUnfillRequest, to prevent
|
||||||
|
// many scroll events causing many unfilling requests.
|
||||||
|
const UNFILL_REQUEST_DEBOUNCE_MS = 200;
|
||||||
|
|
||||||
if (DEBUG_SCROLL) {
|
if (DEBUG_SCROLL) {
|
||||||
// using bind means that we get to keep useful line numbers in the console
|
// using bind means that we get to keep useful line numbers in the console
|
||||||
@ -367,8 +370,9 @@ module.exports = React.createClass({
|
|||||||
clearTimeout(this._unfillDebouncer);
|
clearTimeout(this._unfillDebouncer);
|
||||||
}
|
}
|
||||||
this._unfillDebouncer = setTimeout(() => {
|
this._unfillDebouncer = setTimeout(() => {
|
||||||
|
this._unfillDebouncer = null;
|
||||||
this.props.onUnfillRequest(backwards, markerScrollToken);
|
this.props.onUnfillRequest(backwards, markerScrollToken);
|
||||||
}, 200);
|
}, UNFILL_REQUEST_DEBOUNCE_MS);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user