Skip to content
This repository has been archived by the owner on Feb 25, 2024. It is now read-only.

running parent machine with 2 children through invoke duplicates first child displayed and the one invoked by parent is not interactive #326

Open
mogarick opened this issue Dec 10, 2021 · 2 comments · May be fixed by #347

Comments

@mogarick
Copy link

Description
Creating 1 parent machine and 2 children is making the viz create the 3 machines independently (without parent) first and then creating a new instance of the first child called from the parent but with this last one not being interactive. The viz shows the first child instance (without parent) but when viewing the invoked one (via Actors tab) such state chart cannot be interacted with.

Expected Result
When creating a child machine and then invoking it from the parent, the same child machine instance should be used and it should be possible to interact with it.

Actual Result
When creating a child machine and then invoking it from the parent, a new child machine instance is created and it's not possible to interact with it.

Reproduction

Given 2 children machines(authNavigationStateMachine and appNavStateMachine) and one parent appRuntimeStateMachine that invokes authNavigationStateMachine on init, the "Actors" tab shows 4, with the authNavigationStateMachine apparently duplicated:

-> authNavigationStateMachine (x:57)
-> appNavStateMachine (x:58)
-> appRuntimeStateMachine (x:59)
-> appRuntimeStateMachine (x:59) → authNavigationStateMachine (x:61)

the viz shows authNavigationStateMachine (x:57) which is not the one invoked by appRuntimeStateMachine (x:59) so when clicking the event that transitions to the authNavigationStateMachine final state it doesn't get back to the parent.

Going to the "Actors" tab and clicking on "-> appRuntimeStateMachine (x:59) → authNavigationStateMachine (x:61)" shows the authNavigationStateMachine but clicking on any event doesn't work.

Additional context

Link to the viz file.

https://stately.ai/viz/dcd508c8-0915-4c3f-9ad3-d881a1f37d0f#

@mogarick
Copy link
Author

Hello @mattpocock,

would you take a look at this issue or triage it to someone else please?

Thank you in advance. :)

MarianPalkus added a commit to MarianPalkus/xstate-viz that referenced this issue Feb 24, 2022
MarianPalkus added a commit to MarianPalkus/xstate-viz that referenced this issue Feb 24, 2022
@MarianPalkus
Copy link

Hi @mogarick,
I faced the same issue when trying to interact with a child actor: the events are not simulated.

Imho showing multiple instances of child actors (one "general" instance and child instances of other actors) might be useful though.

The issue of events to be not simulated seems to be caused by the underlying simulator to not taking child actors (which might be spawned/invoked dynamically) into account and searching through the "root" actors only.

I create a PR with a potential fix for this issue.

@MarianPalkus MarianPalkus linked a pull request Feb 24, 2022 that will close this issue
MarianPalkus added a commit to MarianPalkus/xstate-viz that referenced this issue Apr 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants