menu

Statecharts

Statecharts are a precise, visual way of modeling the behaviour of complex reactive systems. They describe how things work, and can help you get your code doing exactly what you want.

Channels
Team
Posts
Chat
Members
Info
Show previous messages

April 29, 2020 at 2:00am
What is the difference between an action that spawn()s a Machine and a state that invokes a Machine? Where do interpreters come into play with these?
  • reply
  • like
2:01am
And why these patterns instead of just using nested complex states?
  • reply
  • like

April 29, 2020 at 3:15pm
I have a Statechart that tries to be an APP wide state management. It has two parallel states one which is an app wide service (runs continually in the back ground) and the second is a nested state designed to show "routes" or sections of the page. Ideally I would want each "route" to be its own machine so it can focus its own context/state and the parent Statechart can just switch them out. But there are complications. Each route would need a way to return to their previous states (not start over) and they also need the ability to interact with that first parallel state (toggle it on off, ask what state it is in). I getting lost designing this in viz
  • reply
  • like
  • reply
  • like
This is all to rewrite an old app into a new clean lean no-framework app: http://sukima.github.io/virtual-dice-ware/
  • reply
  • like

May 1, 2020 at 9:56pm
How do I run the viz package locally? Yarn start gives an error about not finding xstate
  • reply
  • like

May 6, 2020 at 4:56pm
Install XState manually. It's not meant to be publicly consumed (yet) so there will be dragons
  • reply
  • like

May 9, 2020 at 10:04pm
. ... Still thinking about your question ...Will I make my project open source ...I'm thinking yes.. but struggling with the concept of giving away all that thinking away...Will let you know. ... In the mean time how does it feel to have a product wit 500 K + NPM downloads a week? Congratulations. In your words .. that is 'supercool.
  • reply
  • like

May 10, 2020 at 10:04pm
. ... Still thinking about your question ...Will I make my project open source ...I'm thinking yes.. but struggling with the concept of giving away all that thinking away...Will let you know. ... In the mean time how does it feel to have a product wit 500 K + NPM downloads a week? Congratulations. In your words .. that is 'supercool.
I had no idea that it had that many downloads! That's awesome, but I care less about vanity metrics and more about how useful it is to people - working hard on V5 with 's help and working on extra tooling/documentation too (and an upcoming workshop!)
  • reply
  • like

May 11, 2020 at 10:53am
[TS] What about having the State.children actors object typed? It could be defined in the StateSchema.children as an object with State type as value type right away.
  • reply
  • like
[TS] What about having the State.children actors object typed? It could be defined in the StateSchema.children as an object with State type as value type right away.
Not sure about the State type tho, you may also provide the Interpreter as that's what you need for the children typing.
  • reply
  • like
I was wondering if the state.matches result is not memoized using useMemo in the examples for some reason. 🤔
  • reply
  • like
I was wondering if the state.matches result is not memoized using useMemo in the examples for some reason. 🤔
It can be, but it's a cheap calculation. String/object equality (where the objects are typically very shallow/small).
like-fill
2
  • reply
  • like

May 13, 2020 at 7:13am
Hi, May I ask a question about Activities? I was wonder how can I assign context per second with Activities?
  • reply
  • like
Is there an API for validating machines? Or is the only way: interpret(machine).start()
  • reply
  • like
Hi, May I ask a question about Activities? I was wonder how can I assign context per second with Activities?
Activites do not send events back to the machine: https://xstate.js.org/docs/guides/effects.html#:~:text=do%20not%20send try either using Callbacks, Machines or Observables
like-fill
1
  • reply
  • like
Activites do not send events back to the machine: https://xstate.js.org/docs/guides/effects.html#:~:text=do%20not%20send try either using Callbacks, Machines or Observables
OK, I'll try it. It helps me a lot!
thank you.
  • reply
  • like
Yep, try something like this:
someState: {
invoke: {
src: () => (cb) => {
// anytime
cb({ type: 'UPDATE_PARENT' });
},
},
on: {
UPDATE_PARENT: {
actions: assign({ count: (ctx) => ctx.count + 1 })
}
}
});
  • reply
  • like
Hey boys! I started using /test and it is awesome :) I struggle with definition of states. Can you help me with that, that is the best way how to do it? I have this machine -> https://xstate.js.org/viz/?gist=2062fee79fb80dc42c02d74abe3fbe9b (xstate + webdriverIO). It is about commenting feature. So you add comment, you can edit it, you can discard edit and you return back to comment_tab_opened. But it is same as comment_saved_edit, it has different assertion.
It is way, how to "merge" this two states into one and have assertions in on state (by using context)? or should I use it completely differently?
Edited
  • reply
  • like
Hey boys! I started using /test and it is awesome :) I struggle with definition of states. Can you help me with that, that is the best way how to do it? I have this machine -> https://xstate.js.org/viz/?gist=2062fee79fb80dc42c02d74abe3fbe9b (xstate + webdriverIO). It is about commenting feature. So you add comment, you can edit it, you can discard edit and you return back to comment_tab_opened. But it is same as comment_saved_edit, it has different assertion.
It is way, how to "merge" this two states into one and have assertions in on state (by using context)? or should I use it completely differently?
my struggle is for example if I delete comment - I can check, that it is not in list, but what event I should call, if I want to back to comment_tab_opened. So it indicates to me, that I am using it in bad way.
  • reply
  • like

May 14, 2020 at 1:55am
Hey! This would make a great separate topic, can you post it as one?
  • reply
  • like

May 14, 2020 at 8:38am
Hey! This would make a great separate topic, can you post it as one?
Feel free to comment O:)
  • reply
  • like

May 15, 2020 at 7:37am
any public xstate onboarding flows available?
  • reply
  • like

May 20, 2020 at 3:21pm
Hello, guys. I'm very inspired by xState library and final state machines in general. How can I contribute to this library?
  • reply
  • like