File tree Expand file tree Collapse file tree 1 file changed +17
-2
lines changed
Sources/CacheStore/Stores/CacheStore Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -218,8 +218,23 @@ extension CacheStore {
218218
219219 guard cacheStoreCount == updatedStore. cache. count else { return false }
220220
221- return updatedStore. cache. map { key, value in
222- isValueEqual ( toUpdatedValue: value, forKey: key)
221+ return updatedStore. cache. map { key, value -> Bool in
222+ let mirror = Mirror ( reflecting: value)
223+
224+ if mirror. displayStyle != . optional {
225+ return isValueEqual ( toUpdatedValue: value, forKey: key)
226+ }
227+
228+ if mirror. children. isEmpty {
229+ return ( try ? require ( key) ) == nil
230+ }
231+
232+ guard
233+ let ( _, unwrappedValue) = mirror. children. first
234+ else { return ( try ? require ( key) ) == nil }
235+
236+ return isValueEqual ( toUpdatedValue: unwrappedValue, forKey: key)
237+
223238 }
224239 . reduce ( into: true ) { result, condition in
225240 guard condition else {
You can’t perform that action at this time.
0 commit comments