mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-09-26 05:26:15 +02:00
Making sure multi-threading doesn't duplicate notes in the screen.
This commit is contained in:
@@ -99,6 +99,7 @@ open class CardFeedViewModel(val localFilter: FeedFilter<Note>) : ViewModel() {
|
||||
lastAccount = (localFilter as? NotificationFeedFilter)?.account
|
||||
|
||||
val updatedCards = (oldNotesState.feed.value + newCards)
|
||||
.distinctBy { it.id() }
|
||||
.sortedWith(compareBy({ it.createdAt() }, { it.id() }))
|
||||
.reversed()
|
||||
.take(localFilter.limit())
|
||||
@@ -251,6 +252,7 @@ open class CardFeedViewModel(val localFilter: FeedFilter<Note>) : ViewModel() {
|
||||
lastAccount = (localFilter as? NotificationFeedFilter)?.account
|
||||
|
||||
val updatedCards = (oldNotesState.feed.value + newCards)
|
||||
.distinctBy { it.id() }
|
||||
.sortedWith(compareBy({ it.createdAt() }, { it.id() }))
|
||||
.reversed()
|
||||
.take(localFilter.limit())
|
||||
|
Reference in New Issue
Block a user