mermaid-js / mermaid

Generation of diagrams like flowcharts or sequence diagrams from text in a similar manner as markdown
https://mermaid.js.org
MIT License
71.92k stars 6.53k forks source link

State diagram duplicate states #4061

Open luizfbicalho opened 1 year ago

luizfbicalho commented 1 year ago

Description

I created an diagram with this code

stateDiagram-v2

state s4 : Filling
{
p29 : Upload 
}

state s5 : Integration

state s6 : Process
{
p31 : Process internal
}

[*] --> s4 : Inicial
s4 --> s5 : Upload
s5 --> s4 :Not OK
s5--> [*] : End

Steps to reproduce

1) create a state diagram 2) add my code 3) see that there are two drawings for the same state

Screenshots

this is the result

image

Code Sample

stateDiagram-v2

state s4 : Filling
{
p29 : Upload 
}

state s5 : Integration

state s6 : Process
{
p31 : Process internal
}

[*] --> s4 : Inicial
s4 --> s5 : Upload
s5 --> s4 :Not OK
s5--> [*] : End

Setup

Desktop

Smartphone

Additional Context

No response

jgreywolf commented 1 year ago

This looks to be directly related to #4053

Same symptom (overlapping boxes), but in one case it is duplicated(?) boxes, and in the other boxes are being hidden

Pr0dt0s commented 1 year ago

Im not entirely sure this is what you are trying to accomplish @luizfbicalho, but check out the following code:

stateDiagram-v2

s4 : Filling
state s4  {
    p29 : Upload
}
s5 : Integration
s6 : Process
state s6 {
    p31 : Process internal
}

[*] --> s4 : Inicial
s4 --> s5 : Upload
s5 --> s4 : Not OK
s5--> [*] : End

image

With this sintax you need to first declare the state and name and then extend the inner states with the state keyword.

luizfbicalho commented 1 year ago

Thanks @Pr0dt0s

Is this the correct state definition or is this a workaround?

Pr0dt0s commented 1 year ago

I´m not really sure, I have just recently started contributing to this project. But based on the examples, I would say the correct state definition for when you have a label and an Inner State should be like this:

state "Filling" as s4 {
    p29 : Upload
}
luizfbicalho commented 1 year ago

I did this also and got it worse, I'll try your way and see how it goes, thanks again

jgreywolf commented 1 year ago

@luizfbicalho Any update?