Merge pull request #2052 from vitorpamplona/claude/fix-sorting-order-p23ZY

Improve sorting stability by adding secondary sort keys
This commit is contained in:
Vitor Pamplona
2026-03-31 08:42:46 -04:00
committed by GitHub
8 changed files with 14 additions and 18 deletions
@@ -196,7 +196,7 @@ fun ReadsScreen(
remember {
EventCollectionState<LongTextNoteEvent>(
getId = { it.id },
sortComparator = compareByDescending { it.publishedAt() ?: it.createdAt },
sortComparator = compareByDescending<LongTextNoteEvent> { it.publishedAt() ?: it.createdAt }.thenBy { it.id },
maxSize = 100,
scope = scope,
)
@@ -829,7 +829,7 @@ fun UserProfileScreen(
}
} else {
items(
articleEvents.sortedByDescending { it.publishedAt() ?: it.createdAt },
articleEvents.sortedWith(compareByDescending<LongTextNoteEvent> { it.publishedAt() ?: it.createdAt }.thenBy { it.id }),
key = { "art-${it.id}" },
) { article ->
LongFormCard(
@@ -871,7 +871,7 @@ fun UserProfileScreen(
}
} else {
items(
highlightEvents.sortedByDescending { it.createdAt },
highlightEvents.sortedWith(compareByDescending<HighlightEvent> { it.createdAt }.thenBy { it.id }),
key = { "hl-${it.id}" },
) { highlight ->
PublishedHighlightCard(