Replies: 1 comment
-
|
What you're currently doing is fine. There isn't currently a dedicated "actor system changed" or "children changed" subscription API. The closest thing is system-level inspection via |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I use xstate in angular and have a semi complex system driven by a single root actor - which orchestrates some child actors.
I use Angulars Dependency Injection to share this actor as a service - put also pick some of the nested actors to share as their own service to drive parts of the UI.
Think an Authentification-Actor used to display an Login/Logout Button depending on the users authentification status.
Currently i check on every snapshot change of the ROOT system if the desired CHILD is available and if yes push it into the service.
It's not really a problem and seems to work fine - but of course it's not the most efficient way - as most of the time these Actors are longer lived, but still i have to check if one is added/removed on every state-change.
I could imagine it to be useful being able to subscribe to actor-system changes only - but haven't found a better way to detect it.
Beta Was this translation helpful? Give feedback.
All reactions