This commit is contained in:
fmodf 2024-07-22 20:36:31 +02:00
parent 2dc41c2013
commit 8568b1afa6

View file

@ -42,6 +42,9 @@ final class Store<State: Stateable, Action: Codable>: ObservableObject {
// Run reducers/middlewares // Run reducers/middlewares
func dispatch(_ action: Action) { func dispatch(_ action: Action) {
if !Thread.isMainThread {
print("❌WARNING!: AppStore.dispatch should be called from the main thread")
}
serialQueue.sync { [weak self] in serialQueue.sync { [weak self] in
guard let wSelf = self else { return } guard let wSelf = self else { return }
let newState = wSelf.dispatch(wSelf.state, action) let newState = wSelf.dispatch(wSelf.state, action)