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

Issue with Self-Referencing Transitions in stateDiagram-v2 Causing TypeError: Cannot read properties of undefined (reading 'node') #5822

Open
abhishek-hopstack opened this issue Sep 6, 2024 · 1 comment
Assignees
Labels
Status: Triage Needs to be verified, categorized, etc Type: Bug / Error Something isn't working or is incorrect

Comments

@abhishek-hopstack
Copy link

abhishek-hopstack commented Sep 6, 2024

Description

Description

When creating a self-referencing transition (e.g., stateA --> stateA) in a stateDiagram-v2, the diagram fails to render and throws a TypeError: Cannot read properties of undefined (reading 'node'). This issue seems to be specific to self-referencing transitions in version 2 of the state diagram.

Expected Behavior

The diagram should render correctly with a self-referencing transition, visually representing the state transition from stateA back to itself.

Actual Behavior

The diagram fails to render and throws the following error in the console:

Steps to reproduce

  1. Create a stateDiagram-v2 with the following content:

    stateDiagram-v2
        [*] --> Draft: Save as Draft
        Draft --> PendingInternalApproval: Submit
        Draft --> Draft: update on draft
    
    Loading
  2. Render this diagram in a Mermaid-compatible environment (such as a browser, markdown editor, or code editor supporting Mermaid.js).

  3. Check the browser console for the error:

    TypeError: Cannot read properties of undefined (reading 'node')
    
  4. Notice that the diagram fails to render, and the self-referencing transition (Draft --> Draft) causes the error.

Screenshots

Screenshot 2024-09-06 at 12 58 44 PM

Code Sample

stateDiagram-v2
    [*] --> Draft: Save as Draft
    Draft --> PendingInternalApproval: Submit
    Draft --> Draft: update on draft

Setup

  • Mermaid version: Web UI
  • Browser and Version: Chrome: Version 127.0.6533.101 (Official Build) (arm64)

Suggested Solutions

No response

Additional Context

It was working about a week or 15 days ago

@abhishek-hopstack abhishek-hopstack added Status: Triage Needs to be verified, categorized, etc Type: Bug / Error Something isn't working or is incorrect labels Sep 6, 2024
@ashishjain0512
Copy link
Collaborator

ashishjain0512 commented Sep 6, 2024

@abhishek-hopstack We can reproduce this and are working on a fix for it in the upcoming release.

Seems to be duplicate issue: #5820

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

3 participants