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

Commit be23630

Browse files
committed
use arrayFastClone instead of slice
1 parent 17f4945 commit be23630

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/components/structures/TimelinePanel.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ import {haveTileForEvent} from "../views/rooms/EventTile";
3838
import {UIFeature} from "../../settings/UIFeature";
3939
import {objectHasDiff} from "../../utils/objects";
4040
import {replaceableComponent} from "../../utils/replaceableComponent";
41+
import { arrayFastClone } from "../../utils/arrays";
4142

4243
const PAGINATE_SIZE = 20;
4344
const INITIAL_SIZE = 20;
@@ -1142,11 +1143,11 @@ class TimelinePanel extends React.Component {
11421143
_getEvents() {
11431144
const events = this._timelineWindow.getEvents();
11441145

1145-
// `slice` performs a shallow copy of the array
1146+
// `arrayFastClone` performs a shallow copy of the array
11461147
// we want the last event to be decrypted first but displayed last
11471148
// `reverse` is destructive and unfortunately mutates the "events" array
1148-
events
1149-
.slice().reverse()
1149+
arrayFastClone(events)
1150+
.reverse()
11501151
.forEach(event => {
11511152
if (event.shouldAttemptDecryption()) {
11521153
event.attemptDecryption(MatrixClientPeg.get()._crypto);

0 commit comments

Comments
 (0)