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

ui: Adds <StateChart /> component for wiring together Ember+XState #7742

Merged
merged 1 commit into from
May 1, 2020

Conversation

johncowen
Copy link
Contributor

@johncowen johncowen commented Apr 30, 2020

This PR adds a new <StateChart /> and related components (<Action /> and <Guard />).

The components themselves wire together XState and Ember so you can use XState's state charts within ember templates.

There are a few things that are possibly in flux here:

  1. The name of the component itself.
  2. The as |State Action Guard dispatch state| API. We'll potentially move this to just a hash. I've also considered using an @id and @for to wire up <State @for="chartId" /> to its <StateChart @id="chartId" /> similar to HTML <input /><label /> combos. This is still under consideration and not likely to be decided until we finish current feature work.
  3. We've tried not to use some of the more advanced features of XState in order to use the smaller 1kb @xstate/fsm library, as opposed to the main 12kb @xstate/xstate library to save ourselves 11kb. This may change, but we have another service that implements the same thing using the main xstate library instead (it requires slightly less wiring to use, not PRed here to keep it out of our build). In the future it would be nice to offer both options, configurable via ember-cli-build options. Again likely to be done following current feature work.

Upcoming stateful components will make use of these above components.

We quibbled over writing some tests here, but there really isn't an awful lot to test, it just wires things in to XState, plus this is still potentially in a little flux. We hope to eventually use XState's model based testing features to help us to test the components that will use XState.

@johncowen johncowen added the theme/ui Anything related to the UI label Apr 30, 2020
@johncowen johncowen requested a review from a team April 30, 2020 14:43
Copy link
Contributor

@kaxcode kaxcode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀 LGTM

@johncowen johncowen merged commit b4e6fcb into ui-staging May 1, 2020
@johncowen johncowen deleted the ui/feature/state-chart-component branch May 1, 2020 08:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme/ui Anything related to the UI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants