add some comments and initialization for async filling

pull/21833/head
Bruno Windels 2019-03-26 13:34:55 +01:00
부모 18b5041ed2
커밋 82a9b348c0
1개의 변경된 파일10개의 추가작업 그리고 0개의 파일을 삭제

파일 보기

@ -154,6 +154,8 @@ module.exports = React.createClass({
},
componentWillMount: function() {
this._fillRequestWhileRunning = false;
this._isFilling = false;
this._pendingFillRequests = {b: null, f: null};
if (this.props.resizeNotifier) {
@ -302,6 +304,10 @@ module.exports = React.createClass({
// `---------' -
//
// as filling is async and recursive,
// don't allow more than 1 chain of calls concurrently
// do make a note when a new request comes in while already running one,
// so we can trigger a new chain of calls once done.
if (isFirstCall) {
if (this._isFilling) {
debuglog("_isFilling: not entering while request is ongoing, marking for a subsequent request");
@ -408,6 +414,10 @@ module.exports = React.createClass({
// events) so make sure we set this before firing off the call.
this._pendingFillRequests[dir] = true;
// wait 1ms before paginating, because otherwise
// this will block the scroll event handler for +700ms
// if messages are already cached in memory,
// This would cause jumping to happen on Chrome/macOS.
return new Promise(resolve => setTimeout(resolve, 1)).then(() => {
return this.props.onFillRequest(backwards);
}).finally(() => {