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

Fix room change sometimes being very slow
pull/21833/head
David Baker 2017-08-31 13:20:50 +01:00 committed by GitHub
commit b42dfc51e1
1 changed files with 10 additions and 3 deletions

View File

@ -344,9 +344,16 @@ var TimelinePanel = React.createClass({
newState[canPaginateOtherWayKey] = true; newState[canPaginateOtherWayKey] = true;
} }
this.setState(newState); // Don't resolve until the setState has completed: we need to let
// the component update before we consider the pagination completed,
return r; // 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);
});
});
}); });
}, },