{"action":"opened","issue":{"url":"https://api.github.com/repos/davidkpiano/xstate/issues/192","repository_url":"https://api.github.com/repos/davidkpiano/xstate","labels_url":"https://api.github.com/repos/davidkpiano/xstate/issues/192/labels{/name}","comments_url":"https://api.github.com/repos/davidkpiano/xstate/issues/192/comments","events_url":"https://api.github.com/repos/davidkpiano/xstate/issues/192/events","html_url":"https://github.com/davidkpiano/xstate/issues/192","id":368414684,"node_id":"MDU6SXNzdWUzNjg0MTQ2ODQ=","number":192,"title":"The interpreter doesn't execute actions before evaluating guards","user":{"login":"carloslfu","id":5993168,"node_id":"MDQ6VXNlcjU5OTMxNjg=","avatar_url":"https://avatars3.githubusercontent.com/u/5993168?v=4","gravatar_id":"","url":"https://api.github.com/users/carloslfu","html_url":"https://github.com/carloslfu","followers_url":"https://api.github.com/users/carloslfu/followers","following_url":"https://api.github.com/users/carloslfu/following{/other_user}","gists_url":"https://api.github.com/users/carloslfu/gists{/gist_id}","starred_url":"https://api.github.com/users/carloslfu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/carloslfu/subscriptions","organizations_url":"https://api.github.com/users/carloslfu/orgs","repos_url":"https://api.github.com/users/carloslfu/repos","events_url":"https://api.github.com/users/carloslfu/events{/privacy}","received_events_url":"https://api.github.com/users/carloslfu/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-10-09T21:57:19Z","updated_at":"2018-10-09T21:57:19Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"## Bug or feature request?\r\nbug I guess\r\n## Description:\r\nThe interpreter doesn't execute actions before evaluating guards, so if you use eventless transitions the next state is wrong. I don't know if it's expected but seem like a bug.\r\n\r\nMinimal example:\r\n\r\n```javascript\r\nimport { Machine } from 'xstate'\r\nimport { interpret } from 'xstate/lib/interpreter'\r\n\r\nconst interpreter = interpret(Machine({\r\n  initial: 'A',\r\n  context: {\r\n    flag: false\r\n  },\r\n  on: {\r\n    EVENT: {\r\n      target: '.B',\r\n      actions: 'setFlagToTrue'\r\n    }\r\n  },\r\n  states: {\r\n    A: {},\r\n    B: {\r\n      on: {\r\n        '': {\r\n          cond: ctx => ctx.flag,\r\n          target: 'C'\r\n        }\r\n      }\r\n    },\r\n    C: {}\r\n  }\r\n}, {\r\n  actions: {\r\n    setFlagToTrue: ctx => ctx.flag = true\r\n  }\r\n}))\r\n\r\ninterpreter.onTransition(state => console.log(state.value, state))\r\n\r\ninterpreter.init()\r\n\r\ninterpreter.send('EVENT')\r\n```\r\n\r\n## (Bug) Expected result:\r\n\r\nThe state should be 'C'.\r\n\r\n## (Bug) Actual result:\r\n\r\nThe state is 'B'.\r\n"}}
{"actor":{"display_login":"carloslfu"}}