Skip to content

Setting Initial State #15

Description

@suciuvlad

@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"

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions