Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hidden nodes can cause computation issues #6452

Open
JBBianchi opened this issue Apr 2, 2025 · 0 comments
Open

Hidden nodes can cause computation issues #6452

JBBianchi opened this issue Apr 2, 2025 · 0 comments
Labels
Status: Triage Needs to be verified, categorized, etc Type: Bug / Error Something isn't working or is incorrect

Comments

@JBBianchi
Copy link

JBBianchi commented Apr 2, 2025

Description

Sometime, when building edges from a hidden node (~= width = 0), Mermaid fails and throws an error Could not find a suitable point for the given distance.

Steps to reproduce

Unknown besides the specific sample provided below.

Screenshots

No response

Code Sample

flowchart TD
    root-entry-node(( ))
    root-exit-node((( )))
    /do/0/consumeReading["consumeReading"]
    subgraph /do/1/logReading ["logReading"]
        /do/1/logReading-entry-node:::hidden
        /do/1/logReading-exit-node:::hidden
        /do/1/logReading/for/do/0/callOrderService["callOrderService"]
        /do/1/logReading-entry-node --> /do/1/logReading/for/do/0/callOrderService
        /do/1/logReading/for/do/0/callOrderService --- /do/1/logReading-exit-node
    end
    /do/2/generateReport["generateReport"]
    /do/3/sendReminder["sendReminder"]
    
    root-entry-node --> /do/0/consumeReading
    /do/0/consumeReading --- /do/1/logReading-entry-node

    /do/1/logReading-exit-node --"${ order.proccessed == true }"--> /do/2/generateReport
    /do/1/logReading-exit-node --"${ order.proccessed == false }"--> /do/3/sendReminder
    /do/1/logReading-exit-node ---> root-exit-node

    /do/2/generateReport --> root-exit-node
    /do/3/sendReminder --> root-exit-node

classDef hidden display: none;

See it live

Setup

  • Mermaid version: 11.5.0
  • Browser and Version: Firefox (137.0 (64-bit)) and Chrome (Version 134.0.6998.178 64bits

Suggested Solutions

No response

Additional Context

  • Changing the hidden classDef to provide a width will avoid the bug:
    classDef hidden width: 1px, height: 0px;
    (edit: height also needs to be set at 1px in some cases)
  • Removing the problematic edges labels will avoid the bug (even removing one of the two labels)
  • Removing one of the 3 problematic edges doesn't produce the bug, e.g.:
flowchart TD
    root-entry-node(( ))
    root-exit-node((( )))
    /do/0/consumeReading["consumeReading"]
    subgraph /do/1/logReading ["logReading"]
        /do/1/logReading-entry-node:::hidden
        /do/1/logReading-exit-node:::hidden
        /do/1/logReading/for/do/0/callOrderService["callOrderService"]
        /do/1/logReading-entry-node --> /do/1/logReading/for/do/0/callOrderService
        /do/1/logReading/for/do/0/callOrderService --- /do/1/logReading-exit-node
    end
    /do/2/generateReport["generateReport"]
    /do/3/sendReminder["sendReminder"]
    
    root-entry-node --> /do/0/consumeReading
    /do/0/consumeReading --- /do/1/logReading-entry-node

    /do/1/logReading-exit-node --"${ order.proccessed == true }"--> /do/2/generateReport
    /do/1/logReading-exit-node ---> root-exit-node

    /do/2/generateReport --> root-exit-node
    /do/3/sendReminder --> root-exit-node

classDef hidden display: none;
@JBBianchi JBBianchi added Status: Triage Needs to be verified, categorized, etc Type: Bug / Error Something isn't working or is incorrect labels Apr 2, 2025
JBBianchi added a commit to neuroglia-io/sdk-typescript that referenced this issue Apr 2, 2025
workaround issue mermaid-js/mermaid#6452

Signed-off-by: Jean-Baptiste Bianchi <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Triage Needs to be verified, categorized, etc Type: Bug / Error Something isn't working or is incorrect
Projects
None yet
Development

No branches or pull requests

1 participant