From f976eeaf13d0d2c735c501406a6e469f880508d5 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Thu, 8 Apr 2021 18:36:09 +0200 Subject: [PATCH] rename SortedArray.replace to update --- src/matrix/room/timeline/Timeline.js | 4 +++- src/observable/list/SortedArray.js | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/matrix/room/timeline/Timeline.js b/src/matrix/room/timeline/Timeline.js index 7743ddb8..5c9091df 100644 --- a/src/matrix/room/timeline/Timeline.js +++ b/src/matrix/room/timeline/Timeline.js @@ -76,7 +76,9 @@ export class Timeline { replaceEntries(entries) { for (const entry of entries) { - this._remoteEntries.replace(entry); + // this will use the comparator and thus + // check for equality using the compare method in BaseEntry + this._remoteEntries.update(entry); } } diff --git a/src/observable/list/SortedArray.js b/src/observable/list/SortedArray.js index 6d3e90c6..193661cf 100644 --- a/src/observable/list/SortedArray.js +++ b/src/observable/list/SortedArray.js @@ -41,11 +41,11 @@ export class SortedArray extends BaseObservableList { } } - replace(item) { + update(item, updateParams = null) { const idx = this.indexOf(item); if (idx !== -1) { this._items[idx] = item; - this.emitUpdate(idx, item, null); + this.emitUpdate(idx, item, updateParams); } }