Skip to content

Commit 7e90901

Browse files
authored
Make Effect.publisher eager (#2968)
* Make Effect.publisher eager. * wip
1 parent 3c1b72f commit 7e90901

File tree

2 files changed

+4
-11
lines changed

2 files changed

+4
-11
lines changed

ComposableArchitecture.xcworkspace/xcshareddata/swiftpm/Package.resolved

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Sources/ComposableArchitecture/Effects/Publisher.swift

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,11 @@ extension Effect {
55
///
66
/// - Parameter createPublisher: The closure to execute when the effect is performed.
77
/// - Returns: An effect wrapping a Combine publisher.
8-
public static func publisher<P: Publisher>(_ createPublisher: @escaping () -> P) -> Self
8+
public static func publisher<P: Publisher>(_ createPublisher: () -> P) -> Self
99
where P.Output == Action, P.Failure == Never {
1010
Self(
1111
operation: .publisher(
12-
withEscapedDependencies { continuation in
13-
Deferred {
14-
continuation.yield {
15-
createPublisher()
16-
}
17-
}
18-
}
19-
.eraseToAnyPublisher()
12+
createPublisher().eraseToAnyPublisher()
2013
)
2114
)
2215
}

0 commit comments

Comments
 (0)