From 87083b07dda47d749dcd5267b2c9fbf3ccbf3e4b Mon Sep 17 00:00:00 2001 From: Adam Brown Date: Wed, 2 Nov 2022 14:45:08 +0000 Subject: [PATCH] removing debug log option for state changes --- domains/state/src/main/kotlin/app/dapk/state/State.kt | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) 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") } } }