1
0
mirror of https://github.com/nicoverbruggen/phpmon.git synced 2025-08-08 04:20:07 +02:00

🐛 Fix delay due to use of async

This commit is contained in:
2022-02-20 14:26:56 +01:00
parent 6b3c562af2
commit ae7b285eb0

View File

@ -47,21 +47,18 @@ class ServicesView: NSView, XibLoadable {
override func viewWillDraw() { override func viewWillDraw() {
super.viewWillDraw() super.viewWillDraw()
self.loadData() Task { await self.loadData() }
} }
@objc func updateInformation() { @objc func updateInformation() {
self.loadData() Task { await self.loadData() }
} }
func loadData() { func loadData() async {
self.applyAllInfoFieldsFromCachedValue()
let services = await HomebrewService.loadAll()
ServicesView.services = Dictionary(uniqueKeysWithValues: services.map{ ($0.name, $0) })
self.applyAllInfoFieldsFromCachedValue() self.applyAllInfoFieldsFromCachedValue()
Task {
let services = await HomebrewService.loadAll()
ServicesView.services = Dictionary(uniqueKeysWithValues: services.map{ ($0.name, $0) })
self.applyAllInfoFieldsFromCachedValue()
}
} }
func applyAllInfoFieldsFromCachedValue() { func applyAllInfoFieldsFromCachedValue() {