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
[v5] Routable states #4184
base: main
Are you sure you want to change the base?
[v5] Routable states #4184
Conversation
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
I am quite interested in this for binding the route with machine state actors. Now that This would facilitate keeping the route in sync with the active state. Happy to provide more context if needed. |
@christophe-g Glad you're interested in it! Emitting events should be explicit, though, and it may be better to More context would be appreciated. |
@davidkpiano - this is not really more context, but a new lit controller binding xstate actor machine with a router.
I took your advice for this controller ... Any change to have this PR merged ? |
Dear @davidkpiano - just interested to know if this PR has any chance to be merged, or if there are any blocking issues ? I have build a lit-controller around this (see above). This PR allows to de-couple business logic (handled by xstate machine), routing / navigation (natively handled by the browser), and views (provided by the router / also bound to state machine), which is great! |
This PR enables developers to mark states as "routes" by providing a
route
config, which is just a normal transition config without the target:The motivation for this is that there are many use-cases for wanting to transition directly to a state, such as in modeling page routes or steps in a multi-step form. Previously, you needed to manually hard-code transitions for these, which resulted in an unnatural and verbose state machine definition.