Skip to content

Commit 966f1b7

Browse files
committed
fix(core): takeUntil
1 parent d1fcdb8 commit 966f1b7

File tree

5 files changed

+6
-15
lines changed

5 files changed

+6
-15
lines changed

.idea/compiler.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/gradle.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/runConfigurations.xml

Lines changed: 0 additions & 10 deletions
This file was deleted.

core/src/main/java/com/hoc/flowmvi/core/FlowExt.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ fun <T, R> Flow<T>.takeUntil(notifier: Flow<R>): Flow<T> = channelFlow {
3333
launch {
3434
try {
3535
collect { send(it) }
36+
close()
3637
} catch (e: CancellationException) {
3738
outerScope.cancel(e) // cancel outer scope on cancellation exception, too
3839
}
@@ -91,9 +92,9 @@ fun <A, B, R> Flow<A>.withLatestFrom(other: Flow<B>, transform: suspend (A, B) -
9192

9293
@ExperimentalCoroutinesApi
9394
suspend fun main() {
94-
(1..100).asFlow()
95+
(1..2).asFlow()
9596
.onEach { delay(50) }
96-
.takeUntil(flow { delay(200); emit(Unit) })
97+
.takeUntil(flow { delay(100000); emit(Unit) })
9798
.collect { println(">>>>> $it") }
9899

99100
println("Done")

0 commit comments

Comments
 (0)