Merge pull request #1354 from matrix-org/dbkr/fix_super_slow_room_change

Fix room change sometimes being very slow
This commit is contained in:
David Baker
2017-08-31 13:20:50 +01:00
committed by GitHub

View File

@@ -344,9 +344,16 @@ var TimelinePanel = React.createClass({
newState[canPaginateOtherWayKey] = true;
}
this.setState(newState);
return r;
// Don't resolve until the setState has completed: we need to let
// the component update before we consider the pagination completed,
// otherwise we'll end up paginating in all the history the js-sdk
// has in memory because we never gave the component a chance to scroll
// itself into the right place
return new Promise((resolve) => {
this.setState(newState, () => {
resolve(r);
});
});
});
},