Skip to content

Commit f9f28c7

Browse files
committed
Stop clearing existing products when searching
1 parent ab9398f commit f9f28c7

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

Yosemite/Yosemite/Stores/ProductStore.swift

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,9 @@ private extension ProductStore {
141141
excludedProductIDs: excludedProductIDs) { [weak self] result in
142142
switch result {
143143
case .success(let products):
144-
let shouldDeleteExistingProducts = pageNumber == Default.firstPageNumber
145144
self?.upsertSearchResultsInBackground(siteID: siteID,
146145
keyword: keyword,
147-
readOnlyProducts: products,
148-
shouldDeleteExistingProducts: shouldDeleteExistingProducts) {
146+
readOnlyProducts: products) {
149147
onCompletion(.success(()))
150148
}
151149
case .failure(let error):
@@ -673,13 +671,9 @@ private extension ProductStore {
673671
private func upsertSearchResultsInBackground(siteID: Int64,
674672
keyword: String,
675673
readOnlyProducts: [Networking.Product],
676-
shouldDeleteExistingProducts: Bool = false,
677674
onCompletion: @escaping () -> Void) {
678675
let derivedStorage = sharedDerivedStorage
679676
derivedStorage.perform { [weak self] in
680-
if shouldDeleteExistingProducts {
681-
derivedStorage.deleteProducts(siteID: siteID)
682-
}
683677
self?.upsertStoredProducts(readOnlyProducts: readOnlyProducts, in: derivedStorage)
684678
self?.upsertStoredResults(siteID: siteID, keyword: keyword, readOnlyProducts: readOnlyProducts, in: derivedStorage)
685679
}

0 commit comments

Comments
 (0)