Skip to content

Commit 00bed60

Browse files
committed
Set initialStatusesByProduct outside of observation
1 parent 2da5f16 commit 00bed60

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

WooCommerce/Classes/ServiceLocator/ProductImageUploader.swift

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ final class ProductImageUploader: ProductImageUploaderProtocol {
130130
} else {
131131
actionHandler = ProductImageActionHandler(siteID: key.siteID, productID: key.productOrVariationID, imageStatuses: originalStatuses, stores: stores)
132132
actionHandlersByProduct[key] = actionHandler
133+
initialStatusesByProduct[key] = originalStatuses
133134
observeStatusUpdates(key: key, actionHandler: actionHandler)
134135
}
135136

@@ -251,10 +252,6 @@ private extension ProductImageUploader {
251252
let observationToken = actionHandler.addUpdateObserver(self) { [weak self] (productImageStatuses, error) in
252253
guard let self = self else { return }
253254

254-
if initialStatusesByProduct[key] == nil {
255-
initialStatusesByProduct[key] = productImageStatuses
256-
}
257-
258255
if !activeUploadsPublisher.contains(key), productImageStatuses.hasPendingUpload {
259256
activeUploadsPublisher.append(key)
260257
} else if let initialStatuses = initialStatusesByProduct[key],

0 commit comments

Comments
 (0)