diff --git a/domains/state/src/main/kotlin/app/dapk/state/State.kt b/domains/state/src/main/kotlin/app/dapk/state/State.kt index 777137f..b8819c8 100644 --- a/domains/state/src/main/kotlin/app/dapk/state/State.kt +++ b/domains/state/src/main/kotlin/app/dapk/state/State.kt @@ -4,7 +4,7 @@ import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.launch import kotlin.reflect.KClass -fun createStore(reducerFactory: ReducerFactory, coroutineScope: CoroutineScope, log: Boolean = false): Store { +fun createStore(reducerFactory: ReducerFactory, coroutineScope: CoroutineScope): Store { val subscribers = mutableListOf<(S) -> Unit>() var state: S = reducerFactory.initialState() return object : Store { @@ -13,17 +13,9 @@ fun createStore(reducerFactory: ReducerFactory, coroutineScope: Coroutine override fun dispatch(action: Action) { coroutineScope.launch { - if (log) println("??? dispatch $action") state = reducer.reduce(action).also { nextState -> if (nextState != state) { - if (log) { - println("??? action: $action result...") - println("??? current: $state") - println("??? next: $nextState") - } subscribers.forEach { it.invoke(nextState) } - } else { - if (log) println("??? action: $action skipped, no change") } } }