From d2f5b412ac282676715451ea3d43375d16775bae Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Wed, 2 Jun 2021 18:43:16 +0200 Subject: [PATCH] don't try to hook up local relations for events that are not relations and do unnecessary work --- src/matrix/room/timeline/Timeline.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/matrix/room/timeline/Timeline.js b/src/matrix/room/timeline/Timeline.js index 73086db4..49c171c1 100644 --- a/src/matrix/room/timeline/Timeline.js +++ b/src/matrix/room/timeline/Timeline.js @@ -120,12 +120,17 @@ export class Timeline { return params ? params : false; }; // first, look in local entries based on txn id - const foundInLocalEntries = this._localEntries.findAndUpdate( - e => e.id === pe.relatedTxnId, - updateOrFalse, - ); + if (pe.relatedTxnId) { + const found = this._localEntries.findAndUpdate( + e => e.id === pe.relatedTxnId, + updateOrFalse, + ); + if (found) { + return; + } + } // now look in remote entries based on event id - if (!foundInLocalEntries && pe.relatedEventId) { + if (pe.relatedEventId) { this._remoteEntries.findAndUpdate( e => e.id === pe.relatedEventId, updateOrFalse