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

Strict mode #3

Closed
MicheleBertoli opened this issue Nov 5, 2017 · 4 comments
Closed

Strict mode #3

MicheleBertoli opened this issue Nov 5, 2017 · 4 comments

Comments

@MicheleBertoli
Copy link
Owner

Add a strict option which makes the component throw an exception if the current state doesn't support the action.

withStateMachine({ config, strict: true })(App)
@ctrlplusb
Copy link

Or if a state isn't represented within the component? 😇

@davidkpiano
Copy link
Contributor

@MicheleBertoli I can also add strict mode to error for undefined state transitions in xstate version 2 if that's desirable.

Currently (in the beta), .transition(state, unhandledAction) will return undefined.

@MicheleBertoli
Copy link
Owner Author

Oh yeah @ctrlplusb, thanks for your comment.
I was thinking about "registering" the State components to the parent, in order to double check that all the states are covered.


That'd be great, thank you very much @davidkpiano.
The current beta behaviour with the undefined state makes it easy to throw an exception within this package.
However, I believe xstate users would benefit from a strict mode as well and the more react-automata is just a React/UI layer on top of existing xstate features, the better.

@MicheleBertoli
Copy link
Owner Author

Fixed in statelyai/xstate#23

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

3 participants