diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt index d26c67cd898..e77abf987d6 100644 --- a/RELEASE-NOTES.txt +++ b/RELEASE-NOTES.txt @@ -13,6 +13,7 @@ - [Internal] Updated storage usage in CouponStore [https://github.com/woocommerce/woocommerce-ios/pull/14530] - [Internal] Update storage usage for BlazeStore [https://github.com/woocommerce/woocommerce-ios/pull/14532] - [Internal] Updated storage usage in ProductShippingClassStore [https://github.com/woocommerce/woocommerce-ios/pull/14520] +- [Internal] Updated storage usage in ShippingMethodStore [https://github.com/woocommerce/woocommerce-ios/pull/14568] - [Internal] Updated storage usage in TaxStore [https://github.com/woocommerce/woocommerce-ios/pull/14567] - [Internal] Updated storage usage in SystemStatusStore [https://github.com/woocommerce/woocommerce-ios/pull/14559] - [Internal] Updated storage usage in SitePluginStore [https://github.com/woocommerce/woocommerce-ios/pull/14560] diff --git a/Yosemite/Yosemite/Stores/ShippingMethodStore.swift b/Yosemite/Yosemite/Stores/ShippingMethodStore.swift index 4831579364c..f0292c01615 100644 --- a/Yosemite/Yosemite/Stores/ShippingMethodStore.swift +++ b/Yosemite/Yosemite/Stores/ShippingMethodStore.swift @@ -7,10 +7,6 @@ import Storage public final class ShippingMethodStore: Store { private let remote: ShippingMethodsRemote - private lazy var sharedDerivedStorage: StorageType = { - return storageManager.writerDerivedStorage - }() - public init(remote: ShippingMethodsRemote, dispatcher: Dispatcher, storageManager: StorageManagerType, @@ -77,15 +73,10 @@ private extension ShippingMethodStore { /// Triggers `completion` on main thread. /// func upsertShippingMethodsInBackground(siteID: Int64, readOnlyMethods: [ShippingMethod], completion: @escaping () -> Void) { - let derivedStorage = sharedDerivedStorage - derivedStorage.perform { [weak self] in + storageManager.performAndSave({ [weak self] storage in guard let self else { return } - self.upsertShippingMethods(siteID: siteID, readOnlyMethods: readOnlyMethods, in: derivedStorage) - } - - storageManager.saveDerivedType(derivedStorage: derivedStorage) { - DispatchQueue.main.async(execute: completion) - } + self.upsertShippingMethods(siteID: siteID, readOnlyMethods: readOnlyMethods, in: storage) + }, completion: completion, on: .main) } /// Updates or inserts Readonly `ShippingMethod` entities in specified storage.