Making sure multi-threading doesn't duplicate notes in the screen.

pull/496/head
Vitor Pamplona 2023-07-08 16:35:07 -04:00
rodzic bc89062681
commit ab8b0beb02
1 zmienionych plików z 2 dodań i 0 usunięć

Wyświetl plik

@ -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())