You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have replaced every single collect with a safeCollect function in my project:
/** * Only proceed with the given action if the coroutine has not been cancelled. * Necessary because Flow.collect receives items even after coroutine was cancelled * https://github.com/Kotlin/kotlinx.coroutines/issues/1265*/suspendinlinefun <T> Flow<T>.safeCollect(crossinline action:suspend (T) ->Unit) {
collect {
coroutineContext.ensureActive()
action(it)
}
}
In
LifecycleCoroutineScopeImpl.onStateChanged(ON_DESTROY)
, calledcoroutineContext.cancel()
, butcollect
still receive value on next loop.The text was updated successfully, but these errors were encountered: