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

Commit 6e3f8d6

Browse files
committed
Decrypt last events first to avoid shifts when scrolling up
1 parent fa30285 commit 6e3f8d6

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/components/structures/TimelinePanel.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1142,7 +1142,12 @@ class TimelinePanel extends React.Component {
11421142
_getEvents() {
11431143
const events = this._timelineWindow.getEvents();
11441144

1145+
1146+
// `slice` performs a shallow copy of the array
1147+
// we want the last event to be decrypted first but displayed last
1148+
// `reverse` is destructive and unfortunately mutates the "events" array
11451149
events
1150+
.slice().reverse()
11461151
.forEach(event => {
11471152
if (event.shouldAttemptDecryption()) {
11481153
event.attemptDecryption(MatrixClientPeg.get()._crypto);

0 commit comments

Comments
 (0)