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
Is it possible to share context between machines? The parallel states section of comparison with xstate suggests modeling parallel states as separate machines, but I have parallel machines that share a single context. Is there a recommendation for doing that?
The situation I have is a video timeline where you can move the playhead back and forth, and there are ranges of time on the timeline which can be manipulated (moved, deleted etc). Those manipulations are modeled by one machine, and I have another machine for adding new ranges, (because that can be done at any time), however the new ranges are added at the current playhead position, which is stored in the context of the first machine.
The text was updated successfully, but these errors were encountered:
Interesting use case! No, as of now the context is not shared with separate machines. Maybe this is a use case for adding direct parallel states to Robot? 🤔
I'd be interested in parallel states too. My use case is a chat with infinite scroll: scrolling up will trigger an async fetch of old messages, and a websocket subscription can append new messages. I've found it tricky to handle new messages while a fetch is pending.
I found it simpler to model as 2 parallel machines with a shared messages context. Here's a minimal example in the XState visualiser: https://xstate.js.org/viz/?gist=23aa888f7527721be5d138d8446124a7. (If there's another way of achieving this in Robot, then please let me know! I'm new to FSMs 🙂 )
Ah, really nice use case! Yeah you can model this in one machine but it's more elegant in a single one.
Part of me wonders if making machine 2 machine communication easier would solve parallel machines and nested machines at once, without adding a lot of new concepts. Something to continue to ponder on.
Is it possible to share context between machines? The parallel states section of comparison with xstate suggests modeling parallel states as separate machines, but I have parallel machines that share a single context. Is there a recommendation for doing that?
The situation I have is a video timeline where you can move the playhead back and forth, and there are ranges of time on the timeline which can be manipulated (moved, deleted etc). Those manipulations are modeled by one machine, and I have another machine for adding new ranges, (because that can be done at any time), however the new ranges are added at the current playhead position, which is stored in the context of the first machine.
The text was updated successfully, but these errors were encountered: