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
68.79k stars 6.08k forks source link

Unexpected rendering of message arrows in sequence diagrams #5415

Open Azam-Ra opened 3 months ago

Azam-Ra commented 3 months ago

Description

There is a feature of destroying participant/actor objects, when designing sequence diagrams in mermaid. It's defined in mermaid, that destroy action should associate with a destroying message after its declaration.

However, if you leave the contents of the destroying message empty; then the previous message arrow will point not to the lifeline of the participant/actor object being destroyed, but to the participant/actor object itself: [Picture1] image Furthermore, if the previous message arrow was associated with create action (which is pretty unrealistic, but still...), then it causes even more chaos: [Picture2] image

On the other hand, if you fill contents of the destroying message:

Steps to reproduce

Code to recreate the pictures provided in the description: [Picture1]:

sequenceDiagram
    participant p1

    create participant p2
    p1 ->> p2: Instantiate p2

    p2 -->> p1: Time has passed

    destroy p2
    p1 -x p2: 

[Picture2]:

sequenceDiagram
    participant p1

    create participant p2
    p1 ->> p2: Instantiate p2

    destroy p2
    p1 -x p2: 

[Picture3]:

sequenceDiagram
    participant p1

    create participant p2
    p1 ->> p2: Instantiate p2

    p2 -->> p1: Time has passed

    destroy p2
    p1 -x p2: .

[Picture4]:

sequenceDiagram
    participant p1

    create participant p2
    p1 ->> p2: Instantiate p2

    destroy p2
    p1 -x p2: .

Screenshots

No response

Code Sample

No response

Setup

Suggested Solutions

No response

Additional Context

No response