mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-09-28 17:57:39 +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
|
lastAccount = (localFilter as? NotificationFeedFilter)?.account
|
||||||
|
|
||||||
val updatedCards = (oldNotesState.feed.value + newCards)
|
val updatedCards = (oldNotesState.feed.value + newCards)
|
||||||
|
.distinctBy { it.id() }
|
||||||
.sortedWith(compareBy({ it.createdAt() }, { it.id() }))
|
.sortedWith(compareBy({ it.createdAt() }, { it.id() }))
|
||||||
.reversed()
|
.reversed()
|
||||||
.take(localFilter.limit())
|
.take(localFilter.limit())
|
||||||
@@ -251,6 +252,7 @@ open class CardFeedViewModel(val localFilter: FeedFilter<Note>) : ViewModel() {
|
|||||||
lastAccount = (localFilter as? NotificationFeedFilter)?.account
|
lastAccount = (localFilter as? NotificationFeedFilter)?.account
|
||||||
|
|
||||||
val updatedCards = (oldNotesState.feed.value + newCards)
|
val updatedCards = (oldNotesState.feed.value + newCards)
|
||||||
|
.distinctBy { it.id() }
|
||||||
.sortedWith(compareBy({ it.createdAt() }, { it.id() }))
|
.sortedWith(compareBy({ it.createdAt() }, { it.id() }))
|
||||||
.reversed()
|
.reversed()
|
||||||
.take(localFilter.limit())
|
.take(localFilter.limit())
|
||||||
|
Reference in New Issue
Block a user