Skip to content

Commit

Permalink
Make Effect.publisher eager (#2968)
Browse files Browse the repository at this point in the history
* Make Effect.publisher eager.

* wip
  • Loading branch information
mbrandonw authored Apr 9, 2024
1 parent 3c1b72f commit 7e90901
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-custom-dump",
"state" : {
"revision" : "3ce83179e5f0c83ad54c305779c6b438e82aaf1d",
"version" : "1.2.1"
"revision" : "f01efb26f3a192a0e88dcdb7c3c391ec2fc25d9c",
"version" : "1.3.0"
}
},
{
Expand Down
11 changes: 2 additions & 9 deletions Sources/ComposableArchitecture/Effects/Publisher.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,11 @@ extension Effect {
///
/// - Parameter createPublisher: The closure to execute when the effect is performed.
/// - Returns: An effect wrapping a Combine publisher.
public static func publisher<P: Publisher>(_ createPublisher: @escaping () -> P) -> Self
public static func publisher<P: Publisher>(_ createPublisher: () -> P) -> Self
where P.Output == Action, P.Failure == Never {
Self(
operation: .publisher(
withEscapedDependencies { continuation in
Deferred {
continuation.yield {
createPublisher()
}
}
}
.eraseToAnyPublisher()
createPublisher().eraseToAnyPublisher()
)
)
}
Expand Down

0 comments on commit 7e90901

Please sign in to comment.