mirror of
https://github.com/msfjarvis/compose-lobsters
synced 2025-08-14 23:27:04 +05:30
fix(android): avoid violating sorting contract
Fixes COMPOSE-LOBSTERS-1J
This commit is contained in:
parent
bc213fe3c9
commit
1a525d6e5d
1 changed files with 4 additions and 1 deletions
|
@ -100,7 +100,10 @@ constructor(
|
|||
var searchQuery by mutableStateOf("")
|
||||
|
||||
private fun mapSavedPosts(items: List<SavedPost>): ImmutableMap<Month, List<SavedPost>> {
|
||||
val sorted = items.sortedByDescending { post -> post.createdAt.toLocalDateTime() }
|
||||
val sorted =
|
||||
items.sortedWith { post1, post2 ->
|
||||
post2.createdAt.toLocalDateTime().compareTo(post1.createdAt.toLocalDateTime())
|
||||
}
|
||||
return sorted.groupBy { post -> post.createdAt.toLocalDateTime().month }.toImmutableMap()
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue