Skip to content

Actions are not updated when the transition is to the same state #74

@good-idea

Description

@good-idea

With a statechart that looks like this, where an event triggers a transition to the same state, its associated actions are not updated unless transition is called with the second (data) argument.

const statechart = {
  initial: "login",
  states: {
    login: {
      on: {
        error: {
          login: {
            actions: ["showErrorMessage"]
          }
        },
        success: {
          welcome: {
            actions: ["showSuccessMessage"]
          }
        }
      }
    },
    welcome: {}
  }
};

doesn't work: transition('error')
works: transition('error', {})

Here is a reproduction.

Updated: this works if you pass in an empty object as the second arg to transition

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions