From 2eb2e4e9b37543c52af71e406e91242b2341e37f Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Thu, 3 Jun 2021 19:57:29 +0200 Subject: [PATCH] more stable sorting order for reactions --- src/domain/session/room/timeline/ReactionsViewModel.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/domain/session/room/timeline/ReactionsViewModel.js b/src/domain/session/room/timeline/ReactionsViewModel.js index 9385664c..ba9b7eb4 100644 --- a/src/domain/session/room/timeline/ReactionsViewModel.js +++ b/src/domain/session/room/timeline/ReactionsViewModel.js @@ -83,7 +83,13 @@ class ReactionViewModel extends ViewModel { } _compare(other) { - return this._annotation.count - other._annotation.count; + const a = this._annotation; + const b = other._annotation; + if (a.count !== b.count) { + return b.count - a.count; + } else { + return a.firstTimestamp - b.firstTimestamp; + } } toggleReaction() {