Closed joelk-2023 closed 5 months ago
Hello, you are welcome) Your case looks like ChoiseState, have you tried it? https://nsk90.github.io/kstatemachine/#:~:text=in%20machine%20behaviour.-,Choice%20state,-Choice%20state%20allows
How can a ChoiceState be used as an initial state, and will it emit the state to the flow? Can you show an example? Thanks!
Oops looks that choiceState as initial state is not supported. Here is a test: https://github.com/nsk90/kstatemachine/blob/b9c09c9e9b82015199b740680562dd79e612f745/tests/src/commonTest/kotlin/ru/nsk/kstatemachine/ChoiceStateTest.kt#L59 I dont remember why, should check the reason.
Currently the library, does not resolve such complex redirections (like joinState) on entering into initial state path. As this may lead to purely configured machine structure. I will see if I can implement this in new version. I recommend using your current solution as workaround.
now ChoiceState can be used in initial state path. The StateMachine will check it and redirect to calculated state.
Thanks for this library!
We have a use case where the initial state is "Loading", it then executes a business condition function to determine which nested state to transition to. Currently this is implemented using something like this:
SCXML shows that the Transition Event is optional. Is there a better way to enforce that a transition must be executed immediately upon entry as a default Transition?