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
down-caret

Receive an event and update context regardless of state

Hi Everyone! Just found xstate and I'm loving it! It's made a tricky project MUCH cleaner. One big question I find myself having is...Is there a centralized place I can receive events and either update context, or dispatch additional events based on state? Maybe I need to look…

thumbsup
0
message-simple
19

Typescript Error

I keep getting this error: and I don't understand why - I've done the typestates... I've got stuff like this to work before, so it might be something daft I've overlooked!

thumbsup
0
message-simple
17

Introducing xstate-actor-ecosystem library

Hi y'all, I had slapped together a custom solution a little while ago for managing machines as actors in an "ecosystem" of actors, as well as the communication mechanisms I needed. After seeing a few people struggling with this, and after a few requests, I figured I'd publish…

thumbsup
1
message-simple
2

How do we change the initial state, when editing a form

Imagine I have that form, and the nomination status could be different, how do I change the initial state machine? interface FormProps { initialData: Nomination | undefined …

thumbsup
0
message-simple
1

Displaying a spinner if invoked promise takes too long

Hello, I'm trying to model a button that, when pressed, makes an XHR request but displays a spinner if the request takes longer than x ms. So far I've tried doing it with a parallel state but that ends up invoking the promise again and again. …

thumbsup
1
message-simple
1

What about some extra channels?

There are many interesting posts on different topics now, and all goes into the "general" channel, what about some extra channels? Yes/No? Useful channels? (I'm not admin, just thought it might be useful)

thumbsup
1
message-simple
5

Why not just XState + a smiple render function similar to that of hyperapp?

I totally get that XState + React using services are great -- If you are coming from a React background and have a good mental model of it. But otherwise doesn't React add it's own complexities (and kb) to the mix? Would it be feasible to just have a simple render function along…

thumbsup
0
message-simple
22

Sending events periodically

I have a FSM which should receive an event every 5 minutes. I read about delayed transition, https://xstate.js.org/docs/guides/delays.html#delayed-transitions, and I know that I can user "after" to send event after a delay, but it will be sent just once: how about sending an…

thumbsup
0
message-simple
9

updated TodoMVC CodeSandbox

I forked David's CodeSandbox: • improved preset todos (previously only pre-entered the title) • moved persistedTodosMachine into todosMachine.js …

thumbsup
2
message-simple
0

Send event to multiple actors

I'm wondering how can I send one event to multiple actors. Right now I have to add a "to" reference to one specific actor, but I would like to send the same event at the same time to multiple actors. Thanks!

thumbsup
0
message-simple
2