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

Setting Initial State #15

Open
suciuvlad opened this issue May 27, 2020 · 0 comments
Open

Setting Initial State #15

suciuvlad opened this issue May 27, 2020 · 0 comments

Comments

@suciuvlad
Copy link

@jinzhu Is there a reason why setting
OrderStateMachine.Initial("draft")
is not reflected in the initial state of the object?

Currently it looks like the initial state is only applied when an Event happens. For example trying to transition to an invalid state.

Steps to reproduce:

order := &Order;
var OrderStateMachine = transition.New(order)
OrderStateMachine.Initial("draft")
OrderStateMachine.State("checkout")
order.GetState() // returns ""
OrderStatemachine.Trigger("cancel", &order, nil)
order.GetState() // returns "draft"
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

1 participant