We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When I trigger two dispatch functions one after anther the first state gets skipped. Here is an example:
data class State(val name: String = "test") sealed interface Action { data class Rename(val name: String) : Action } val reducer: Reducer<State> = reducerForActionType<State, Action> { state, action -> when (action) { is Action.Rename -> state.copy(name = action.name) } } @Composable fun App() { StoreProvider(createStore(reducer, State())) { Component() } } @Composable fun Component() { val name by selectState<State, String> { this.name } val dispatch = rememberDispatcher() LaunchedEffect(name){ println(name) } LaunchedEffect(Unit){ dispatch(Action.Rename("a")) dispatch(Action.Rename("b")) } Text(text = name) }
When running the following code I can see on the console the following:
I/System.out: test I/System.out: b
What I would expect:
I/System.out: test I/System.out: a I/System.out: b
When further having a look into it and adding a delay(1) between the two dispatch events, I can get inconsistent outputs: Output 1:
delay(1)
I/System.out: test I/System.out: b I/System.out: b
Output 2:
Output 3:
The text was updated successfully, but these errors were encountered:
This is expected behaviour for compose as multiple updates suring recomposition cycle are squashed to the latest before rendering.
Sorry, something went wrong.
No branches or pull requests
When I trigger two dispatch functions one after anther the first state gets skipped.
Here is an example:
When running the following code I can see on the console the following:
What I would expect:
When further having a look into it and adding a
delay(1)
between the two dispatch events, I can get inconsistent outputs:Output 1:
Output 2:
Output 3:
The text was updated successfully, but these errors were encountered: