File tree Expand file tree Collapse file tree 3 files changed +18
-0
lines changed
Spawn-App-iOS-SwiftUI/Services Expand file tree Collapse file tree 3 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -905,6 +905,12 @@ class APIService: IAPIService {
905
905
func validateCache( _ cachedItems: [ String : Date ] ) async throws -> [ String : CacheValidationResponse ] {
906
906
resetState ( )
907
907
908
+ // Don't send validation request if there are no cached items to validate
909
+ if cachedItems. isEmpty {
910
+ print ( " No cached items to validate, returning empty response " )
911
+ return [ : ]
912
+ }
913
+
908
914
guard let userId = UserAuthViewModel . shared. spawnUser? . id else {
909
915
throw APIError . invalidData
910
916
}
Original file line number Diff line number Diff line change @@ -404,6 +404,12 @@ class MockAPIService: IAPIService {
404
404
func validateCache( _ cachedItems: [ String : Date ] ) async throws -> [ String :
405
405
CacheValidationResponse ]
406
406
{
407
+ // Don't send validation request if there are no cached items to validate
408
+ if cachedItems. isEmpty {
409
+ print ( " MOCK: No cached items to validate, returning empty response " )
410
+ return [ : ]
411
+ }
412
+
407
413
// In the mock implementation, we'll pretend everything is fresh except for items
408
414
// that are older than 30 minutes
409
415
var result : [ String : CacheValidationResponse ] = [ : ]
Original file line number Diff line number Diff line change @@ -70,6 +70,12 @@ class AppCache: ObservableObject {
70
70
return
71
71
}
72
72
73
+ // Don't send validation request if we have no cached items to validate
74
+ if lastChecked. isEmpty {
75
+ print ( " No cached items to validate, skipping cache validation " )
76
+ return
77
+ }
78
+
73
79
do {
74
80
let apiService : IAPIService = MockAPIService . isMocking ? MockAPIService ( userId: userId) : APIService ( )
75
81
let result = try await apiService. validateCache ( lastChecked)
You can’t perform that action at this time.
0 commit comments