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
Members
Info

Opt-out of React for performance reasons?

Is anyone opting out of React for performance reason with XState? How does the code change? I just want to have my actors be in charge of when the components are updated. No need to render child components and do expensive reconciliation all the time. @davidkpiano you have been…

thumbsup
0
message-simple
0

Statecharts + cache?

I was looking through the documentation on react-query or the popular useSWR hook, and I think their advantages are pretty cool. Has someone tried any of these libraries + Xstate? Any experiences that you'd like to share on that? Has anyone worked with "stale-while-revalidate"…

thumbsup
2
message-simple
11

Help modeling an application

Hello everyone, I want to model a generic application that lets you edit a file. The application can have either zero or one file opened. In edition mode, you can close the file and return to the initial state or exit the application entirely. The file can either be unmodified…

thumbsup
0
message-simple
0

Persisting state which includes spawned actors

Conceptually I have a route (tour) with an undetermined number of stops. I modeled it the way that I have a parent machine (the route) and a machine for the stop. Stops are loaded in the route machine and are being initialized by spawning and setting the ref in the…

thumbsup
1
message-simple
14

PSA: Just discovered this really bad anti-pattern

regarding {autoForward: true} on spawn or interpret- DO NOT blindly enable this flag. If your interpreted member sends any events to a parent with autoforward enabled, your machine will be trapped in an infinite loop that will be very hard to diagnose. I can't say this is really…

thumbsup
2
message-simple
1

Possible Wish/Idea: XState as Framework Substrate

A Basic Framework Concern I was recently thinking through the experience of routing in js, in the context of a web framework for Deno. Typically, in JS routing approaches, we have to: • declare a big list of repetitive json or json-like objects …

thumbsup
1
message-simple
6

Specifying actions separately from the main machine

Hi. Noob Q about xstate. I'm trying to figure out if actions can be specified more like 'listeners' rather than declaratively in the main machine. …

thumbsup
0
message-simple
7

XState + NgRx. Looking for resources

Hi, I have read this interesting article (https://medium.com/free-code-camp/how-to-model-the-behavior-of-redux-apps-using-statecharts-5e342aad8f66), and I would like to experiment with connecting XState and NgRx. I want to introduce XState into an exiting system that already…

thumbsup
0
message-simple
4

(TypeScript) Cannot use a StateMachine as one with a subset of its events

Hello. If I define I feel like I ought to be able to pass it to a function with signature Because machine does respond to Event1 events. However, TypeScript complains that …

thumbsup
0
message-simple
3