diff --git a/Examples/Search/Search/SearchView.swift b/Examples/Search/Search/SearchView.swift index 82e65e399b8f..82e410361197 100644 --- a/Examples/Search/Search/SearchView.swift +++ b/Examples/Search/Search/SearchView.swift @@ -68,7 +68,6 @@ let searchReducer = Reducer { return environment.weatherClient .searchLocation(query) - .receive(on: environment.mainQueue) .catchToEffect() .debounce(id: SearchLocationId(), for: 0.3, scheduler: environment.mainQueue) .map(SearchAction.locationsResponse) diff --git a/Sources/ComposableArchitecture/Effects/Debouncing.swift b/Sources/ComposableArchitecture/Effects/Debouncing.swift index bafc85983807..52d5f96744a7 100644 --- a/Sources/ComposableArchitecture/Effects/Debouncing.swift +++ b/Sources/ComposableArchitecture/Effects/Debouncing.swift @@ -14,8 +14,8 @@ extension Effect { /// struct SearchId: Hashable {} /// /// return environment.search(text) - /// .map(Action.searchResponse) /// .debounce(id: SearchId(), for: 0.5, scheduler: environment.mainQueue) + /// .map(Action.searchResponse) /// ``` /// /// - Parameters: @@ -33,7 +33,7 @@ extension Effect { Just(()) .setFailureType(to: Failure.self) .delay(for: dueTime, scheduler: scheduler, options: options) - .flatMap { self } + .flatMap { self.receive(on: scheduler) } .eraseToEffect() .cancellable(id: id, cancelInFlight: true) } diff --git a/Sources/ComposableArchitecture/Effects/Deferring.swift b/Sources/ComposableArchitecture/Effects/Deferring.swift index af0a472c6fe5..b1a92133bfbc 100644 --- a/Sources/ComposableArchitecture/Effects/Deferring.swift +++ b/Sources/ComposableArchitecture/Effects/Deferring.swift @@ -6,8 +6,8 @@ extension Effect { /// ```swift /// case let .textChanged(text): /// return environment.search(text) - /// .map(Action.searchResponse) /// .deferred(for: 0.5, scheduler: environment.mainQueue) + /// .map(Action.searchResponse) /// ``` /// /// - Parameters: @@ -24,7 +24,7 @@ extension Effect { Just(()) .setFailureType(to: Failure.self) .delay(for: dueTime, scheduler: scheduler, options: options) - .flatMap { self } + .flatMap { self.receive(on: scheduler) } .eraseToEffect() } }