diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/viewmodels/thread/ThreadFeedFilter.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/viewmodels/thread/ThreadFeedFilter.kt index 4f96bc0e6..2d9200179 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/viewmodels/thread/ThreadFeedFilter.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/viewmodels/thread/ThreadFeedFilter.kt @@ -64,9 +64,8 @@ class ThreadFeedFilter( val eventsInHex = filteredThreadInfo.allNotes.map { it.idHex }.toSet() val now = TimeUtils.now() - // Currently orders by date of each event, descending, at each level of the reply stack - val order = - compareByDescending { + val signatures = + filteredThreadInfo.allNotes.associateWith { ThreadLevelCalculator .replyLevelSignature( it, @@ -78,6 +77,11 @@ class ThreadFeedFilter( ).signature } + // Currently orders by date of each event, descending, at each level of the reply stack + val order = + compareByDescending { signatures[it] } + .thenBy { it.idHex } + return filteredThreadInfo.allNotes.sortedWith(order) } }