Skip to content

Commit

Permalink
Remove failed to load objects when they succeeded
Browse files Browse the repository at this point in the history
Oops, the app missed to remove the failed objects from the fail list when they were fetched successful.
This doesn't fix the root cause of issue #167, but should mitigate it.
  • Loading branch information
supergeorg committed May 26, 2023
1 parent d10efce commit 02a4925
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions Shared/Model/GrocyViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -268,9 +268,10 @@ final class GrocyViewModel: ObservableObject {
default:
self.postLog("Object not implemented", type: .error)
}
self.timeStampsObjects[object] = timeStamp
self.loadingObjectEntities.remove(object)
self.failedToLoadObjects.remove(object)
}
self.timeStampsObjects[object] = timeStamp
self.loadingObjectEntities.remove(object)
} catch {
self.postLog("Data request failed for \(object). Message: \("\(error)")", type: .error)
self.failedToLoadObjects.insert(object)
Expand Down Expand Up @@ -303,9 +304,10 @@ final class GrocyViewModel: ObservableObject {
case .volatileStock:
self.volatileStock = try await grocyApi.getVolatileStock(expiringDays: self.userSettings?.stockDueSoonDays ?? 5)
}
self.timeStampsAdditionalObjects[additionalObject] = timeStamp
self.loadingAdditionalEntities.remove(additionalObject)
self.failedToLoadAdditionalObjects.remove(additionalObject)
}
self.timeStampsAdditionalObjects[additionalObject] = timeStamp
self.loadingAdditionalEntities.remove(additionalObject)
} catch {
self.postLog("Data request failed for \(additionalObject). Message: \("\(error)")", type: .error)
self.failedToLoadAdditionalObjects.insert(additionalObject)
Expand Down

0 comments on commit 02a4925

Please sign in to comment.