Skip to content

Transform Error when using Empty Html Label for Edges  #6086

Open
@T2brozz

Description

@T2brozz

Description

When you add a empty Html Label you get the Error Error: <g> attribute transform: Expected number, "translate(undefined, NaN)". . It sets the Position after that to 0,0 which is fine.

Steps to reproduce

Enter a HTML Label to an Edge which has no body like <p></p> then you get the Error Error: <g> attribute transform: Expected number, "translate(undefined, NaN)".

Screenshots

No response

Code Sample

https://develop.git.mermaid.live/edit#pako:eNpFjr0KwzAMhF_FaCzx0tGUTH2DbK07iFhNTP0THDlQQt69CqGt0KC7-zi0Qp8dgYGZkenqcSgY9XK2ScncTw-ldas69iEooy5TK3tkh7enQkEDkUpE76Rq3QELPFIkC0ZOh-VlwaZNOKycu3fqwXCp1EDJdRjBPDHMourk_n_83AnTLeev3j7MPzon
stateDiagram-v2
    [*] --> Still : <p></p>
    Still --> [*]



Setup

No response

Suggested Solutions

Im not sure where to fix it, because than i would already open a Pr, but I think error comes from ´positionEdgeLabel´ in mermaid\packages\mermaid\src\dagre-wrapper\edges.js in line 170.
Maybe

 if (x && z ){
    el.attr('transform', `translate(${x}, ${y + subGraphTitleTotalMargin / 2})`);
}else{
    el.attr('transform', `translate(0, 0)`);
}

would be enough

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Status: TriageNeeds to be verified, categorized, etcType: Bug / ErrorSomething isn't working or is incorrect

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions