Questions tagged [xstate]

xstate is Javascript library for creating finite state machines and statecharts.

xstate is library for creating finite state machines and statecharts in JavaScript. Code and links to documentation found at https://github.com/davidkpiano/xstate

146 questions
0
votes
2 answers

Store in XSTATE for accessing across components?

I have component A and component B where in after some selection in Component A, Component B should be able to get update state or selection. I have allocated separated machines for MachineA and MachineB respectively. I want to know how to get the…
Pradosh
  • 61
  • 1
  • 7
0
votes
1 answer

ECharts Nested (directed) Graph

When thinking on the visual expression for a workflow, a directed-graph may be one of the first solutions that comes to mind. My app already leverage ECharts so I'd like to use it as well to generate a graph for my workflow. Following is a basic…
Yarden Bar
  • 63
  • 6
0
votes
1 answer

perform action after every other action while in a speicific state

Let's say I have a machine with a single state that provides actions increment or decrement a value. const Machine({ id: 'some_machine', initial: 'initial', context: { value: 0 }, states: { 'initial': { …
matteok
  • 2,189
  • 3
  • 30
  • 54
0
votes
1 answer

Redux and XState for data store and React integration

I've been using Redux for most of my React applications. I think I will start using XState as I don't have to use effects as a plugin all the time. And I think is a more complete pattern. One thing that I want to understand is it's connection with…
Rui d'Orey
  • 982
  • 3
  • 13
  • 31
0
votes
1 answer

Using nested states in xstate

I am working on a home automation project with two bulbs. Please refer to the following state chart I created using xstate. I also have the gist so you can see it in the visualizer…
Neil
  • 7,861
  • 4
  • 53
  • 74
0
votes
1 answer

model input (textfield) statemachine in xState

Would love to read your thoughts on how you would model a input (textfield) with xState. According to an input ux article a textfield could have following states: Input text fields can have one of the following states: default, focused, error,…
user1966723
  • 85
  • 2
  • 8
0
votes
1 answer

I just wrote my first app, powered by xstate, I love the visualizer tool. How can I programmatically generate the diagrams?

I keep having to remove all of my variable references and other bits and pieces when I use the visualizer tool to generate those useful diagrams. I was wondering if there is a way for me to generate them programmatically? Is there a typescript…
0
votes
1 answer

How do I force an observeable to complete?

Kind of a niche question, but I know what the issue is so hopefully someone here can help me out. This is an Observable/RXFire issue, not an xstate issue. I have this machine that invokes an observable: export const tribeMachine = Machine( { …
Iskeraet
  • 731
  • 1
  • 6
  • 12
0
votes
1 answer

Language validation with xstate

I have the following state diagram that is for validating whether a string matches a format. I would like to recreate this language matching fsm in xstate. The machine should return true for ac, abc, abbbbbc etc and otherwise false. It should have…
Ben
  • 3,160
  • 3
  • 17
  • 34
0
votes
1 answer

Puppeteer: Storing and accessing contextual or meta data per page visit

I'm experimenting with auto-generating outcomes using @xstate/test and combining it with puppeteer and jest. Using jest's beforeAll and afterAll hooks I'm calling page.setRequestInterception and registering a callback to intercept network requests…
chautelly
  • 447
  • 3
  • 14
0
votes
1 answer

Reusable form state machine

In trying to wrap my head around xState and state machines in general, I was wondering how you would for example supply an API URL to a form state machine to make it reusable. My current solution is to supply it through withContext, but it feels…
ThomasM
  • 2,647
  • 3
  • 25
  • 30
0
votes
1 answer

Jest - react-automata - undefined is not an object (evaluating 'machine.states')

I'm currently working on testing my react component where I use react-automata. When I run the test it keeps breaking. The goal is to test my Lights component. I'm using the test function from react-automata called "testStateMachine" because I use a…
0
votes
1 answer

type error when trying to use xstate-plantuml to visualise the FSM diagram

I'm trying to create a script to automate the visualisation of a xstate FSM. As there is currently now way to make an http request to the xstate-visualiser. I'm using xstate-plantuml to make a diagram. Because it expects JSON as an input, I've used…
Yury Stanev
  • 419
  • 1
  • 5
  • 16
0
votes
1 answer

Webpack messing up characters order causing Unexpected token error

I know that the title is not very descriptive but couldn't find better words for it. I am playing with the 'xstate' library and the build result is causing an 'Unexpected token' error. This is my webpack.config.js: var WebpackBuildNotifierPlugin =…
Ciamas
  • 41
  • 2
  • 7
0
votes
1 answer

Difference between { actions: "" } and { entry: "" } in xstate?

It seems to me that you can fire an action in one of the following ways: Explicitly { ... states: { foo: { on: { BAR: { actions: "performSomeAction", target: "bar", }, }, }, bar:…
Paul Razvan Berg
  • 16,949
  • 9
  • 76
  • 114
1 2 3
9
10