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

How to transition directly to a specific state instead of triggering an event name #86

Open
vanasis opened this issue Oct 31, 2024 · 1 comment

Comments

@vanasis
Copy link

vanasis commented Oct 31, 2024

Hello,

I'm using the StateMachine library to handle state transitions, but I want to streamline the process by transitioning directly to a target state instead of firing an event name. Ideally, I would specify a target state (e.g., GoToState("Approved")), and the state machine would check if there’s a valid transition path from the current state to that target state. If the transition is allowed, it should proceed; if not, it should prevent the transition.

To summarize, I'm looking to:

Specify a target state directly instead of firing an event.
Have the state machine validate if a transition to the target state exists before moving.
Is there a way to configure StateMachine to support this state-based approach rather than relying on event names?

Thank you for any help!

@ursenzler
Copy link
Member

I don't know any way to achieve this in a simple way. It's against the principles that are at the design of this state machine: states are only known to the state machine, the outside can only observe the effects of transitions.

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

No branches or pull requests

2 participants