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

Commit

Permalink
Decrypt last events first to avoid shifts when scrolling up
Browse files Browse the repository at this point in the history
  • Loading branch information
germain-gg committed May 7, 2021
1 parent fa30285 commit 6e3f8d6
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/components/structures/TimelinePanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -1142,7 +1142,12 @@ class TimelinePanel extends React.Component {
_getEvents() {
const events = this._timelineWindow.getEvents();


// `slice` performs a shallow copy of the array
// we want the last event to be decrypted first but displayed last
// `reverse` is destructive and unfortunately mutates the "events" array
events
.slice().reverse()
.forEach(event => {
if (event.shouldAttemptDecryption()) {
event.attemptDecryption(MatrixClientPeg.get()._crypto);
Expand Down

0 comments on commit 6e3f8d6

Please sign in to comment.