Alexander Black
01/08/2022, 5:38 AMoverride fun invoke(store: Store<AppState>): (next: Dispatcher) -> (action: Any) -> Any {
return { next ->
{ action ->
if (action is Request) coroutineScope.launch {
action.execute(store.getState, store.dispatch, api, db)
}
next(action)
}
}
}
but the problem is that the state can get very out of wack in this situation if the coroutineScope is not on the same thread as the rest of the store. which in my case does not work out well.