Coalesce unread count backing store rebuilds to prevent feeds list flickering while syncing and the feeds filter is engaged. (Regression)

This commit is contained in:
Maurice Parker 2020-02-25 10:42:56 -08:00
parent d222a9f617
commit a4bbf65944
1 changed files with 9 additions and 3 deletions

View File

@ -61,6 +61,7 @@ class SceneCoordinator: NSObject, UndoableCommandRunner, UnreadCountProvider {
private var wasRootSplitViewControllerCollapsed = false
private let fetchAndMergeArticlesQueue = CoalescingQueue(name: "Fetch and Merge Articles", interval: 0.5)
private let rebuildBackingStoresWithMergeQueue = CoalescingQueue(name: "Rebuild The Backing Stores by Merging", interval: 0.5)
private var fetchSerialNumber = 0
private let fetchRequestQueue = FetchRequestQueue()
@ -445,9 +446,7 @@ class SceneCoordinator: NSObject, UndoableCommandRunner, UnreadCountProvider {
return
}
addShadowTableToFilterExceptions()
rebuildBackingStores()
treeControllerDelegate.resetFilterExceptions()
rebuildBackingStoresWithMergeQueue.add(self, #selector(rebuildBackingStoresWithMerge))
}
@objc func statusesDidChange(_ note: Notification) {
@ -569,6 +568,7 @@ class SceneCoordinator: NSObject, UndoableCommandRunner, UnreadCountProvider {
func suspend() {
fetchAndMergeArticlesQueue.performCallsImmediately()
rebuildBackingStoresWithMergeQueue.performCallsImmediately()
fetchRequestQueue.cancelAllRequests()
}
@ -1362,6 +1362,12 @@ private extension SceneCoordinator {
}
}
@objc func rebuildBackingStoresWithMerge() {
addShadowTableToFilterExceptions()
rebuildBackingStores()
treeControllerDelegate.resetFilterExceptions()
}
func rebuildShadowTable() {
shadowTable = [[Node]]()