Skip to content

Commit 0db01e8

Browse files
committed
refactor(flowredux): SideEffect receive a StateFlow instead of a GetState
1 parent be98f9c commit 0db01e8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

flowredux/src/commonMain/kotlin/com/hoc081098/flowredux/DefaultFlowReduxStore.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ internal class DefaultFlowReduxStore<Action, State>(
2626
private val _actionChannel = Channel<Action>(Channel.UNLIMITED)
2727
private val _actionSharedFlow = MutableSharedFlow<Action>(Channel.UNLIMITED)
2828

29+
override val stateFlow: StateFlow<State> = _stateFlow.asStateFlow()
30+
2931
init {
3032
val loopbacks = Array(sideEffects.size) { Channel<Action>() }
3133

@@ -52,7 +54,6 @@ internal class DefaultFlowReduxStore<Action, State>(
5254
.launchIn(coroutineScope)
5355
}
5456

55-
override val stateFlow: StateFlow<State> = _stateFlow.asStateFlow()
5657
override val actionSharedFlow: SharedFlow<Action> = _actionSharedFlow.asSharedFlow()
5758
override fun dispatch(action: Action): Boolean = _actionChannel
5859
.trySend(action)

0 commit comments

Comments
 (0)