Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit b42dfc5

Browse files
authored
Merge pull request #1354 from matrix-org/dbkr/fix_super_slow_room_change
Fix room change sometimes being very slow
2 parents 32b33c6 + a2f2070 commit b42dfc5

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/components/structures/TimelinePanel.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -344,9 +344,16 @@ var TimelinePanel = React.createClass({
344344
newState[canPaginateOtherWayKey] = true;
345345
}
346346

347-
this.setState(newState);
348-
349-
return r;
347+
// Don't resolve until the setState has completed: we need to let
348+
// the component update before we consider the pagination completed,
349+
// otherwise we'll end up paginating in all the history the js-sdk
350+
// has in memory because we never gave the component a chance to scroll
351+
// itself into the right place
352+
return new Promise((resolve) => {
353+
this.setState(newState, () => {
354+
resolve(r);
355+
});
356+
});
350357
});
351358
},
352359

0 commit comments

Comments
 (0)