When updating a timeline that’s already displaying, merge articles by articleID, so that updated versions replace older versions.
This commit is contained in:
parent
dbab809420
commit
e1a51b8acd
@ -705,8 +705,17 @@ private extension TimelineViewController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
performBlockAndRestoreSelection {
|
performBlockAndRestoreSelection {
|
||||||
|
|
||||||
var unsortedArticles = fetchUnsortedArticles(for: representedObjects)
|
var unsortedArticles = fetchUnsortedArticles(for: representedObjects)
|
||||||
unsortedArticles.formUnion(Set(articles))
|
|
||||||
|
// Merge articles by articleID. For any unique articleID in current articles, add to unsortedArticles.
|
||||||
|
let unsortedArticleIDs = unsortedArticles.articleIDs()
|
||||||
|
for article in articles {
|
||||||
|
if !unsortedArticleIDs.contains(article.articleID) {
|
||||||
|
unsortedArticles.insert(article)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
updateArticles(with: unsortedArticles)
|
updateArticles(with: unsortedArticles)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user