From 1d9709d4e314a0ed89bf76a63e9bd4ddd161791c Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Fri, 11 Jun 2021 11:02:31 +0200 Subject: [PATCH] also compare by key if the timestamps are the same --- src/domain/session/room/timeline/ReactionsViewModel.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/domain/session/room/timeline/ReactionsViewModel.js b/src/domain/session/room/timeline/ReactionsViewModel.js index 6a813d03..b7426b49 100644 --- a/src/domain/session/room/timeline/ReactionsViewModel.js +++ b/src/domain/session/room/timeline/ReactionsViewModel.js @@ -135,7 +135,12 @@ class ReactionViewModel { const a = this._annotation; const b = other._annotation; if (a && b) { - return a.firstTimestamp - b.firstTimestamp; + const cmp = a.firstTimestamp - b.firstTimestamp; + if (cmp === 0) { + return this.key < other.key ? -1 : 1; + } else { + return cmp; + } } else if (a) { return -1; } else {