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

Importing a machine with a targetless transition event will convert it to a self-transition #210

Closed
Valkendorm opened this issue Dec 11, 2023 · 2 comments

Comments

@Valkendorm
Copy link

Using this example machine :

createMachine({
  id: "machine",
  initial: "first",
  states: {
    first: {
      on: {
        "some.event": {
          actions: "someAction"
        }
      }
    }
  }
});

The event becomes a self-transition once imported :

import { createMachine } from "xstate";

export const machine = createMachine(
  {
    id: "machine",
    initial: "first",
    states: {
      first: {
        on: {
          "some.event": {
            target: "first",
            actions: {
              type: "someAction",
            },
          },
        },
      },
    },
    types: { events: {} as { type: "some.event" } },
  },
  {
    actions: {
      someAction: ({ context, event }) => {},
    },
    actors: {},
    guards: {},
    delays: {},
  },
);

Studio version: 0.100.0

@davidkpiano
Copy link
Member

That's not right. Looking into this.

@davidkpiano
Copy link
Member

Will be released soon!

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