From 235b9e8f431a3dbb00905de7024c2816dcf69b87 Mon Sep 17 00:00:00 2001 From: Selim Mustafaev Date: Tue, 17 Jan 2023 23:32:26 +0300 Subject: [PATCH] Fix history search --- AutoCat/Utils/RxRealmDataSource.swift | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/AutoCat/Utils/RxRealmDataSource.swift b/AutoCat/Utils/RxRealmDataSource.swift index 5870100..f5e9808 100644 --- a/AutoCat/Utils/RxRealmDataSource.swift +++ b/AutoCat/Utils/RxRealmDataSource.swift @@ -17,6 +17,7 @@ class RealmSectionedDataSource: NSObject, UITableViewDataSource private var sections: [DateSection] = [] private var cellIdentifier: String private var filterPredicate: FilterPredicate? + private let groupQueue = DispatchQueue(label: "group") private let onSizeChanged: ((Int) -> Void)? @@ -94,13 +95,15 @@ class RealmSectionedDataSource: NSObject, UITableViewDataSource items = items.filter(predicate) } - DispatchQueue.global().async { + self.groupQueue.async { let newSections = items.groupedByDate() - let changeset = StagedChangeset(source: self.sections, target: newSections) +// let changeset = StagedChangeset(source: self.sections, target: newSections) DispatchQueue.main.async { - self.tv.reload(using: changeset, with: animated ? .fade : .none) { newSects in - self.sections = newSects - } + self.sections = newSections + self.tv.reloadData() +// self.tv.reload(using: changeset, with: animated ? .fade : .none) { newSects in +// self.sections = newSects +// } } } }