Skip to content

Commit 5a17cfe

Browse files
committed
Tweaked executing observable code as per @ishkawa's suggestion
1 parent 96850ff commit 5a17cfe

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

Sources/Action/Action.swift

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,14 @@ public final class Action<Input, Element> {
9898
.merge()
9999

100100
executing = executionObservables.flatMap {
101-
Observable.concat([
102-
Observable.just(true),
103-
$0.ignoreElements().map { _ in true }.catchError { _ in Observable.empty() },
104-
Observable.just(false)])
101+
execution -> Observable<Bool> in
102+
let execution = execution
103+
.flatMap { _ in Observable<Bool>.empty() }
104+
.catchError { _ in Observable.empty()}
105+
106+
return Observable.concat([Observable.just(true),
107+
execution,
108+
Observable.just(false)])
105109
}
106110
.startWith(false)
107111
.shareReplay(1)
@@ -117,7 +121,7 @@ public final class Action<Input, Element> {
117121
defer {
118122
inputs.onNext(value)
119123
}
120-
124+
121125
let execution = executionObservables
122126
.take(1)
123127
.flatMap { $0 }

0 commit comments

Comments
 (0)