Skip to content

Error: m is not a function #34

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

Open
amitnovick opened this issue Sep 17, 2019 · 2 comments
Open

Error: m is not a function #34

amitnovick opened this issue Sep 17, 2019 · 2 comments

Comments

@amitnovick
Copy link

amitnovick commented Sep 17, 2019

Description

Loading this Visualizer with this Gist
A minimal reproduction linked in the comment below triggers the following error:

TypeError: m is not a function
    at StateChartNode.js:191
    at Array.map (<anonymous>)
    at e.render (StateChartNode.js:176)
@amitnovick amitnovick changed the title Error: Error: m is not a function Sep 17, 2019
@amitnovick
Copy link
Author

OK found out what the problematic part is: the delay configuration seems to break something.

Minimal reproduction

@amitnovick
Copy link
Author

amitnovick commented Sep 17, 2019

In the Minimal Reproduction Gist I had a delay function defined in-line, which should work according to the Docs, but causes the error when loaded into the VIsualizer:

    first: {
      after: [
        {
          delay: () => 1000, // 👈
          target: 'second',
        },
      ],
    },

However, switching out the delay function with a string with the value of a function defined in the delays options seems to make the error go away:

const machine = Machine(
  {
    initial: 'first',
    states: {
      first: {
        after: [
          {
            delay: 'minimumDelay', // 👈
            target: 'second',
          },
        ],
      },
      second: {},
    },
  },
  {
    delays: {
      minimumDelay: () => 1000,
    },
  },
); 

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

No branches or pull requests

1 participant