question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow the same state name in different parallel machines

See original GitHub issue

When creating parallel machines, every state must have a unique name.

For example:

parallel {
    bold{
        first.on -> first.off;
        first.off -> first.on;
    },
    underline{
        second.on -> second.off;
        second.off -> second.on;
    };
};

image

I’d like to be able to have the states just be named on and off.

Expected Behavior/Possible Solution

I wonder if when using the json representation of the state machine we could have the idea of states having something like a displayName that when provided is used for rendering the state name.

This would allow me to use the current name field as a unique id, with displayName giving a nice compact output.

Context

I’m working on a library to convert xstate state chart descriptions in svg diagrams using state-machine-cat.

With xstate you can re-use the same state name across each part of a parallel or nested state machine. I’d like to be able to preserve these state names in the diagram output from state-machine-cat.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
sverweijcommented, Jul 8, 2018

Thanks @karl both for requesting this feature and for trying the beta

The PR is merged and released a new major version of state-machine-cat. No worries; the version bump is major because I had to make a small breaking change in the syntax to introduce the label attribute - see the release notes for details).

0reactions
karlcommented, Jul 4, 2018

Just had a chance to have a quick play around and this looks great!

image

Read more comments on GitHub >

github_iconTop Results From Across the Web

Parallel States Merge the output in Step Function
To merge the output of parallel task, you can leverage the "Type": "Pass" state to define transformations to apply to the JSON document....
Read more >
States - AWS Step Functions
States are elements in your state machine. A state is referred to by its name, which can be any string, but which must...
Read more >
State Machine Diagram - UML 2 Tutorial - Sparx Systems
A state may be divided into regions containing sub-states that exist and execute concurrently. The example below shows that within the state "Applying...
Read more >
Jobs in Azure Pipelines and TFS - Microsoft Learn
Understand jobs in Azure Pipelines, Azure DevOps Server, and Team Foundation Server (TFS)
Read more >
Synchronize Parallel States by Broadcasting Events
Events help parallel states to coordinate with one another, allowing one state to trigger an action in another state. To synchronize parallel states...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found