fixed some potential crashes

Signed-off-by: Toni Förster <toni.foerster@gmail.com>
This commit is contained in:
Toni Förster 2024-08-28 15:39:03 +02:00
parent a194738bb6
commit bde9aade11
No known key found for this signature in database
GPG Key ID: 292F3E5086C83FC7

View File

@ -20,10 +20,16 @@ final class Store<Data>: ResourceObserver, ObservableObject {
}
func replace(_ items: Data) {
all = items
// Ensure the change happens on the main thread
DispatchQueue.main.async {
self.all = items
}
}
func clear() {
all = nil
// Ensure clearing happens on the main thread
DispatchQueue.main.async {
self.all = nil
}
}
}