Ask questionsservice.children empty when machine starts
Description I was looking for a way to use a "main" machine to handle the whole workflow of my React application (each screen of the app has its own machine, invoked by the main one).
<App /> component just:
Not sure this is the best solution (inputs are welcome!), but I came across something rather unexpected:
service.children should return current actors/invoked services.
service.children returns an empty Map on start, even if a service is invoked and runs properly.
Reproduction Run the following sample and take a look at the console: CodeSandbox
Starting by a transient state doesn't change anything, but delaying the first state seems to work (really ugly though).
You can test this by opening
machines/main.js and changing
initial state from
Additional context XState 4.6.7
Answer questions cybervaldez
Came across this issue myself today, here's a sandbox: https://codesandbox.io/s/optimistic-ride-1izew?file=/src/index.js