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

Top-level null events are not fired if current state has no null event transitions #754

Closed
Saku2 opened this issue Oct 24, 2019 · 2 comments
Labels

Comments

@Saku2
Copy link

Saku2 commented Oct 24, 2019

Null transitions defined in the top-level of a machine are not fired if current state has no null transitions.

As far as I understand, the following examples should behave identically. Both of them should transition to 'success' state when 'ADD' event is fired.

However, the first, which has a no-op null transition defined in 'first' state, works.
Second one, which does not have a null transition defined in 'first' state, stays in 'first' state because top-level null transition is not considered.

working version: https://codesandbox.io/s/xstate-example-template-n167o
version with issue: https://codesandbox.io/s/xstate-example-template-u8v9z

@Saku2 Saku2 added the bug label Oct 24, 2019
@Andarist
Copy link
Member

Based on the description - you are right. When it comes to selecting transitions eventless transitions behave pretty much as regular ones - look at the defined algorithm https://www.w3.org/TR/scxml/#selectEventlessTransitions . Both of your demos are the same though 😉

@davidkpiano the fix for this will be straightforward if we believe that this is not a breaking change. I would prefer to wait with the fix until I finish my ongoing refactor to avoid merge conflicts though.

@davidkpiano
Copy link
Member

I agree, I don't think this is a breaking change, but a bug.

davidkpiano added a commit that referenced this issue Nov 29, 2019
fix(core): raise null events on root object, but only if machine is not "done". Fixes #754
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants