You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Minimal Reproducible Example
I've created a minimal POC demonstrating the issue: CodeSandbox.
Background
I'm working on a larger system where I have multiple state machines managing different responsibilities. Each machine primarily holds states and performs simple calculations, while a coordinator machine orchestrates more complex behaviors like:
Loading from storage
Updating a timestamp using requestAnimationFrame
Other asynchronous or coordinating tasks
So in general the coordinator machine acts as the central controller, managing multiple child state machines. On entry, it spawns the viewportMachine, storing a reference in its context. This allows it to forward events like SET_ZOOM directly to the viewportMachine without handling the logic itself. Each child machine is responsible for its own state updates and calculations, while the coordinator focuses on orchestrating high-level operations such as loading animations, playback control, and saving data.
Issue
The events appear to be sent to the child machine (as per the logs).
However, the child machine's state does not change in response.
Is there something I'm missing in terms of how child machines handle state transitions?
Or is there a better approach to structuring finite state transitions across multiple child machines?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Minimal Reproducible Example
I've created a minimal POC demonstrating the issue: CodeSandbox.
Background
I'm working on a larger system where I have multiple state machines managing different responsibilities. Each machine primarily holds states and performs simple calculations, while a coordinator machine orchestrates more complex behaviors like:
So in general the coordinator machine acts as the central controller, managing multiple child state machines. On entry, it spawns the viewportMachine, storing a reference in its context. This allows it to forward events like SET_ZOOM directly to the viewportMachine without handling the logic itself. Each child machine is responsible for its own state updates and calculations, while the coordinator focuses on orchestrating high-level operations such as loading animations, playback control, and saving data.
Issue
Is there something I'm missing in terms of how child machines handle state transitions?
Or is there a better approach to structuring finite state transitions across multiple child machines?
Any guidance would be much appreciated!
Beta Was this translation helpful? Give feedback.
All reactions