hi @JohnEstropia, do you know why the completion handler never get called for that code block? if i disable the block for store in stores, it working normally, i try to in synchronous it working as expected
Originally created by @imrobbyrc on GitHub (Jan 20, 2025).
```swift
Omni.dataStack.perform(
asynchronous: { (transaction) -> [Omni.Store] in
let tags = try! transaction.importUniqueObjects(Into<Omni.StoreTag>(),
sourceArray: json["tags"].arrayValue)
let tagMapping = tags.reduce(into: [Int: Omni.StoreTag]()) { (result, object) in
result[object.id] = object
}
let stores = try transaction.importUniqueObjects(
Into<Omni.Store>(), sourceArray: json["stores"].arrayValue, preProcess: { mapping in
var storeMapping = [Int: JSON]()
for (key, storeJson) in mapping {
guard var dict = storeJson.dictionaryObject else { continue }
var tagObjects = Set<Omni.StoreTag>()
for tagId in storeJson["tag_ids"].arrayValue {
if let tag = tagMapping[tagId.intValue] {
tagObjects.insert(tag)
}
}
dict["merchant_id"] = merchantId
dict["tag_objects"] = tagObjects
storeMapping[key] = JSON(dict)
}
return storeMapping
}
)
for store in stores {
guard let transactionStore = transaction.edit(store) else { continue }
if let storeJson = storeJsonMapping[transactionStore.id],
let operatingHourJson = storeJson["operating_hours"].arrayValue
.first(where: { $0["day"].intValue == Date().omniWeekday }) {
guard var dict = operatingHourJson.dictionaryObject else { continue }
dict["store_object"] = store
try transaction.importUniqueObject(
Into<Omni.OperatingHour>(),
source: JSON(dict))
}
}
return stores
},
completion: { result in }
```
hi @JohnEstropia, do you know why the completion handler never get called for that code block? if i disable the block for store in stores, it working normally, i try to in synchronous it working as expected
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Originally created by @imrobbyrc on GitHub (Jan 20, 2025).
hi @JohnEstropia, do you know why the completion handler never get called for that code block? if i disable the block for store in stores, it working normally, i try to in synchronous it working as expected