Skip to content

Commit

Permalink
Pass StoreActionDispatcher’s send method to StoreProxy.
Browse files Browse the repository at this point in the history
  • Loading branch information
StevenLambion committed Aug 29, 2019
1 parent de2a34e commit e22c6f6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Sources/SwiftDux/Store/StoreActionDispatcher.swift
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ internal struct StoreActionDispatcher<State> : ActionDispatcher, Subscriber wher
/// on the main thread.
/// - Parameter actionPlan: The action to dispatch
private func send(actionPlan: ActionPlan<State>) {
if let publisher = actionPlan.run(StoreProxy(store: upstream)) {
if let publisher = actionPlan.run(StoreProxy(store: upstream, send: self.send)) {
publisher.subscribe(self)
}
}
Expand Down
4 changes: 2 additions & 2 deletions Sources/SwiftDux/Store/StoreProxy.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ public struct StoreProxy<State> where State: StateType {
getState()
}

internal init(store: Store<State>, next: SendAction? = nil) {
let send: SendAction = { [weak store] in store?.send($0) }
internal init(store: Store<State>, send: SendAction? = nil, next: SendAction? = nil) {
let send: SendAction = send ?? { [weak store] in store?.send($0) }
self.didChange = store.didChange
self.getState = { [weak store] in store?.state }
self.send = send
Expand Down

0 comments on commit e22c6f6

Please sign in to comment.