Skip to content

Setting Initial State #15

@suciuvlad

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"

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