diff --git a/src/components/structures/TimelinePanel.tsx b/src/components/structures/TimelinePanel.tsx index ba3c4d203b..288c65972f 100644 --- a/src/components/structures/TimelinePanel.tsx +++ b/src/components/structures/TimelinePanel.tsx @@ -54,7 +54,6 @@ import dis from "../../dispatcher/dispatcher"; import { Action } from "../../dispatcher/actions"; import Timer from "../../utils/Timer"; import shouldHideEvent from "../../shouldHideEvent"; -import { arrayFastClone } from "../../utils/arrays"; import MessagePanel from "./MessagePanel"; import { IScrollState } from "./ScrollPanel"; import { ActionPayload } from "../../dispatcher/payloads"; @@ -1754,15 +1753,11 @@ class TimelinePanel extends React.Component { [...mainEvents], ); - // `arrayFastClone` 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 - arrayFastClone(events) - .reverse() - .forEach((event) => { - const client = MatrixClientPeg.safeGet(); - client.decryptEventIfNeeded(event); - }); + // We want the last event to be decrypted first + const client = MatrixClientPeg.safeGet(); + for (let i = events.length - 1; i >= 0; --i) { + client.decryptEventIfNeeded(events[i]); + } const firstVisibleEventIndex = this.checkForPreJoinUISI(events);