When the flow inside Switcher throws exceptions sometimes it may cancel the whole scope and this error is not handling by mapEvents method. This leads to unexpected behavior and loose events for reducing. It can be reproduced in the sample app from this repository (coroutines-loader).
The exception which can be thrown and breaks the flow:
at vivid.money.elmslie.samples.coroutines.timer.elm.TimerActor$secondsFlow$1.invokeSuspend(TimerActor.kt:31)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at kotlinx.coroutines.internal.LimitedDispatcher.run(LimitedDispatcher.kt:42)
at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:95)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:749)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664)
Suppressed: kotlinx.coroutines.JobCancellationException: ScopeCoroutine is cancelling; job=ScopeCoroutine{Cancelled}@96cd3f7
[CIRCULAR REFERENCE:java.lang.IllegalStateException: Test error]
Also, refresh one of the samples to use actual API + show the way of passing arguments to the store
When the flow inside
Switcher
throws exceptions sometimes it may cancel the whole scope and this error is not handling bymapEvents
method. This leads to unexpected behavior and loose events for reducing. It can be reproduced in the sample app from this repository (coroutines-loader).The exception which can be thrown and breaks the flow:
Also, refresh one of the samples to use actual API + show the way of passing arguments to the store