mirror of
				https://github.com/yattee/yattee.git
				synced 2025-11-03 22:22:02 +00:00 
			
		
		
		
	fixed some potential crashes
Signed-off-by: Toni Förster <toni.foerster@gmail.com>
This commit is contained in:
		@@ -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
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user