"Lost XXX Edge" error when generating visualisation
See original GitHub issueFirst up, thank you so much for State Machine Cat. It is awesome 🎉
I was able to add auto generated state machine visualisations to our code base in just a few hours thanks to your great work!
Expected Behavior
When using the script:
APP,
PLAYER {
RESTART_STREAM {
PAUSED => PLAYING: play;
PLAYING => PAUSED : pause;
};
LIVE_STREAM => PLAYING : switch to restart;
RESTART_STREAM => LIVE_STREAM: stream finished;
RESTART_STREAM => CONFIRM_SWITCH_TO_LIVE: start to live;
CONFIRM_SWITCH_TO_LIVE => PLAYING: cancel switch to live;
CONFIRM_SWITCH_TO_LIVE => LIVE_STREAM: confirm switch to live;
};
APP => LIVE_STREAM: start playback;
PLAYER => APP: on close;
I would expect it to generate a visualisation.
Current Behavior
The following error occurs:
Error: lost LIVE_STREAM PLAYING edge
When testing using https://state-machine-cat.js.org/ with the default settings.
Steps to Reproduce (for bugs)
Copy the script above into https://state-machine-cat.js.org/
Context
We have started using state machines to model our more complex async UI state management. We use unit tests and State Machine Cat to auto generate up to date visualisations for our state machines.
I’ve been investigating adding support for nested states to our code and wanted to see what our state machine would look like with them. While converting the script to use nested states I spotted the error above.
Your Environment
Using https://state-machine-cat.js.org/ on Chrome on macOS. I also get the same bug when running State Machine Cat from node.
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (4 by maintainers)
Top GitHub Comments
I put the visualisation generation in the unit tests because it was quick and meant that other devs didn’t need to do anything new to update the docs.
But I’m not sure it is the right place to put it. I’m thinking of trying out a pre commit hook, or a separate command. And then running the same step on CI failing the build if the vis is not up to date.
Thanks for releasing the new version. I’ll check it tomorrow!
Ah, so for generating documentation. What’s the reason to do that in the unit test(s)?
(I’m just interested in the concepts. I don’t expect you to open source proprietary code 😃 ).
In other news: Yesterday I’ve published state-machine-cat version 2.6.5 to npm & updated the online interpreter - with which this issue is