Avoiding dropped values from AsyncPublisher #2208
-
Say I have a long living effect like this in a reducer: EffectTask.run { send in
for await value in myPublisher.values { // myPublisher.values is of type AsyncPublisher
await send(.update(value))
}
} If I can work around this by adding some buffering to the stream with something like Is there a better way to handle this? Ideally I could queue up actions without needing to Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
@jayhickey If you're using a Combine publisher, you could use return .publisher {
myPublisher
.map { .update($0) }
} This API is not deprecated and we plan to continue to support it in 1.0. |
Beta Was this translation helpful? Give feedback.
@jayhickey If you're using a Combine publisher, you could use
Effect.publisher
:This API is not deprecated and we plan to continue to support it in 1.0.