When updating a timeline that’s already displaying, merge articles by articleID, so that updated versions replace older versions.

This commit is contained in:
Brent Simmons 2018-02-16 21:21:27 -08:00
parent dbab809420
commit e1a51b8acd
1 changed files with 10 additions and 1 deletions

View File

@ -705,8 +705,17 @@ private extension TimelineViewController {
}
performBlockAndRestoreSelection {
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)
}
}