No need to recreate Sets.
This commit is contained in:
@@ -294,12 +294,12 @@ abstract class FeedViewModel(val localFilter: FeedFilter<Note>) : ViewModel(), I
|
|||||||
val oldNotesState = _feedContent.value
|
val oldNotesState = _feedContent.value
|
||||||
if (localFilter is AdditiveFeedFilter && lastFeedKey == localFilter.feedKey()) {
|
if (localFilter is AdditiveFeedFilter && lastFeedKey == localFilter.feedKey()) {
|
||||||
if (oldNotesState is FeedState.Loaded) {
|
if (oldNotesState is FeedState.Loaded) {
|
||||||
val newList = localFilter.updateListWith(oldNotesState.feed.value, newItems.toSet()).distinctBy { it.idHex }.toImmutableList()
|
val newList = localFilter.updateListWith(oldNotesState.feed.value, newItems).distinctBy { it.idHex }.toImmutableList()
|
||||||
if (!equalImmutableLists(newList, oldNotesState.feed.value)) {
|
if (!equalImmutableLists(newList, oldNotesState.feed.value)) {
|
||||||
updateFeed(newList)
|
updateFeed(newList)
|
||||||
}
|
}
|
||||||
} else if (oldNotesState is FeedState.Empty) {
|
} else if (oldNotesState is FeedState.Empty) {
|
||||||
val newList = localFilter.updateListWith(emptyList(), newItems.toSet()).distinctBy { it.idHex }.toImmutableList()
|
val newList = localFilter.updateListWith(emptyList(), newItems).distinctBy { it.idHex }.toImmutableList()
|
||||||
if (newList.isNotEmpty()) {
|
if (newList.isNotEmpty()) {
|
||||||
updateFeed(newList)
|
updateFeed(newList)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user