Open
Description
Hey team, I'm using a thread safe store via createTypedThreadSafeStore()
. My code is roughly:
storeSubscription = store.subscribe {
coroutineScope.launch { ui.update(store.state) }
}
actionFlow.onEach { action ->
store.dispatch(action)
}.flowOn(Dispatchers.Default)
.launchIn(coroutineScope)
Then in the shutdown part of the lifecycle I call on the main thread:
storeSubscription?.invoke()
and it sometimes throws the error
You may not unsubscribe from a store listener while the reducer
|is executing. See
|https://www.reduxkotlin.org/api/store#subscribelistener-storesubscriber
|for more details.
I noticed in your samples you don't unsubscribe. How do I use your library in a multi-threaded way and safely unsubscribe?
Metadata
Metadata
Assignees
Labels
No labels