use arrayFastClone instead of slice
This commit is contained in:
parent
17f4945323
commit
be236309c5
1 changed files with 4 additions and 3 deletions
|
@ -38,6 +38,7 @@ import {haveTileForEvent} from "../views/rooms/EventTile";
|
||||||
import {UIFeature} from "../../settings/UIFeature";
|
import {UIFeature} from "../../settings/UIFeature";
|
||||||
import {objectHasDiff} from "../../utils/objects";
|
import {objectHasDiff} from "../../utils/objects";
|
||||||
import {replaceableComponent} from "../../utils/replaceableComponent";
|
import {replaceableComponent} from "../../utils/replaceableComponent";
|
||||||
|
import { arrayFastClone } from "../../utils/arrays";
|
||||||
|
|
||||||
const PAGINATE_SIZE = 20;
|
const PAGINATE_SIZE = 20;
|
||||||
const INITIAL_SIZE = 20;
|
const INITIAL_SIZE = 20;
|
||||||
|
@ -1142,11 +1143,11 @@ class TimelinePanel extends React.Component {
|
||||||
_getEvents() {
|
_getEvents() {
|
||||||
const events = this._timelineWindow.getEvents();
|
const events = this._timelineWindow.getEvents();
|
||||||
|
|
||||||
// `slice` performs a shallow copy of the array
|
// `arrayFastClone` performs a shallow copy of the array
|
||||||
// we want the last event to be decrypted first but displayed last
|
// we want the last event to be decrypted first but displayed last
|
||||||
// `reverse` is destructive and unfortunately mutates the "events" array
|
// `reverse` is destructive and unfortunately mutates the "events" array
|
||||||
events
|
arrayFastClone(events)
|
||||||
.slice().reverse()
|
.reverse()
|
||||||
.forEach(event => {
|
.forEach(event => {
|
||||||
if (event.shouldAttemptDecryption()) {
|
if (event.shouldAttemptDecryption()) {
|
||||||
event.attemptDecryption(MatrixClientPeg.get()._crypto);
|
event.attemptDecryption(MatrixClientPeg.get()._crypto);
|
||||||
|
|
Loading…
Reference in a new issue