aboutsummaryrefslogtreecommitdiff
path: root/kvision-modules
diff options
context:
space:
mode:
Diffstat (limited to 'kvision-modules')
-rw-r--r--kvision-modules/kvision-redux-kotlin/src/main/kotlin/pl/treksoft/kvision/redux/ReduxStore.kt6
-rw-r--r--kvision-modules/kvision-redux/src/main/kotlin/pl/treksoft/kvision/redux/ReduxStore.kt6
2 files changed, 6 insertions, 6 deletions
diff --git a/kvision-modules/kvision-redux-kotlin/src/main/kotlin/pl/treksoft/kvision/redux/ReduxStore.kt b/kvision-modules/kvision-redux-kotlin/src/main/kotlin/pl/treksoft/kvision/redux/ReduxStore.kt
index a37f1ac9..c4889567 100644
--- a/kvision-modules/kvision-redux-kotlin/src/main/kotlin/pl/treksoft/kvision/redux/ReduxStore.kt
+++ b/kvision-modules/kvision-redux-kotlin/src/main/kotlin/pl/treksoft/kvision/redux/ReduxStore.kt
@@ -96,10 +96,10 @@ class ReduxStore<S : Any, A : RAction>(
store.dispatch(thunk)
}
- override fun subscribe(observer: (S) -> Unit) {
- store.subscribe {
+ override fun subscribe(observer: (S) -> Unit): () -> Unit {
+ observer(getState())
+ return store.subscribe {
observer(getState())
}
- observer(getState())
}
}
diff --git a/kvision-modules/kvision-redux/src/main/kotlin/pl/treksoft/kvision/redux/ReduxStore.kt b/kvision-modules/kvision-redux/src/main/kotlin/pl/treksoft/kvision/redux/ReduxStore.kt
index 93c4f6a9..2fd0b744 100644
--- a/kvision-modules/kvision-redux/src/main/kotlin/pl/treksoft/kvision/redux/ReduxStore.kt
+++ b/kvision-modules/kvision-redux/src/main/kotlin/pl/treksoft/kvision/redux/ReduxStore.kt
@@ -112,10 +112,10 @@ class ReduxStore<S : Any, A : RAction>(
})
}
- override fun subscribe(observer: (S) -> Unit) {
- store.subscribe {
+ override fun subscribe(observer: (S) -> Unit): () -> Unit {
+ observer(getState())
+ return store.subscribe {
observer(getState())
}
- observer(getState())
}
}