Skip to content
New issue

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

Fix orchestrated/recursive state computation to ensure proper state updates #347

Conversation

DomenicDev
Copy link
Contributor

This development fixes a bug in which the orchestrated state computation (with sagas) did not return the very last state computation but the state after the first computation/decision-making.

In summary, the state computation was successfully performed, but the result was never returned.

val newState = events.fold(currentState) { s, e -> evolve(s, e) }
events.flatMapConcat { react(it) }.onEach { newState.computeNewState(it) }.collect()
var newState = events.fold(currentState) { s, e -> evolve(s, e) }
events.flatMapConcat { react(it) }.collect {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! Thanks, Domenic.

@idugalic idugalic merged commit 882bc5a into fraktalio:main Jan 13, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants