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

TypeError: Cannot read properties of undefined (reading 'x') #5064

Closed
stefanstranger opened this issue Nov 23, 2023 · 1 comment · Fixed by #5065
Closed

TypeError: Cannot read properties of undefined (reading 'x') #5064

stefanstranger opened this issue Nov 23, 2023 · 1 comment · Fixed by #5065
Labels
Internals: Renderer Status: Approved Is ready to be worked on Type: Bug / Error Something isn't working or is incorrect

Comments

@stefanstranger
Copy link

stefanstranger commented Nov 23, 2023

Description

With Mermaid version 10.6.1. the following Mermaid code shows the error "TypeError: Cannot read properties of undefined (reading 'x')"

That Mermaid code was working in version 10.4.0. See following screenshot.

image

What has changed since version 10.4.0 that breaks the Mermaid diagram creation?

Steps to reproduce

  1. Download following gist
  2. Run Mermaid cli with latest version (e.g. via Docker) like this: docker run --rm -v c:/temp:/data minlag/mermaid-cli -i test.mmd
    This should give an error.
  3. Run Mermaid cli with version 10.4.0 (e.g. via Docker) like this: docker run --rm -v c:/temp:/data minlag/mermaid-cli:10.4.0 -i test.mmd
    This should create an svg file.

Screenshots

image

Code Sample

https://develop.git.mermaid.live/edit?gist=https://gist.github.com/stefanstranger/2ba6b101308c9a18087ad90440a5902e#pako:eNqdWFtv0zAU_itTnunDJvGyB6RR2BigMS2Fp0lHbuy2Fqkd2Q5QEP-dYztNmhFf0j11yfF3vnP3yZ-ikpQV18VWkWZ3sXr7LC7wb6X4dsuU_0e3a_92KQXlhksBC1juWPUd-AY2vGbANQhpgAsoK8Ubo2Eja8rUYqVa5lEoV6yyh3sl9q9kggIRwPaE1wDfruD0nYEfRHGyRg0L-xPe1nJ9iwofidlFBa3QA9mzqJBFGYSQScxeKQzhgim4F9oQUTEoDTEMVkztucBfNGnsO1YzPEGg6sG2SrbNIHGHJGu5RfcpuR8J8k7rtEEhC26lAkaqHVzFeM20M6ns1sXeZkOPFle_b6S2QXHmowptoG1qSSijsCT4yiZZgG9WHg5nP3ONT216wBqTSY9Ydsx1yMKyko3luSQGzVxAVyZrSQ9QIU-ByQRUMs-C_bK68i23yX3C5WqQeyQKpT6WXx460c7DNoFP5QIV02P6Y83JqbCNtxjsuj7E6Htfejfa0rWnvAMnYh_WtFKHPpAbzKEpr8ZojLwTPpzvIOfWyxDtr8Jgq1pgbe4bV8-YdCZd-cQaefkaNMOipnp497JGj32gUegeZThmk9yEmkZP70XYLhaLNxkFmVUNDmtWkWYKd8DnFXOknzvc0GSZr6-DyxhGCaEQ0HhYRQRCAONBFgu7Q5jRA-8F-orU_Dd7qfNm-XRDcSI8Eq1_SkUdsg23ewrHx1CySuFTN9A-sQN8I21tPPiH1erRRkExO2BKIxXZMripKtkK4_mVO6K82S-Eb8oUQRT56lKuA-5wp8GOxZf0XS7nDHZW2MkmCZKT8NwNxR9GDzQ1B50f0pSWUb3NJpNC792TqWJcigkHJvCWXW9PcbR9Q1uO2oeQ-BCKNOOez1C3eeYlcMe9JFN_BmYfiZywZWCOW1akTtq1dt0YO_Y9TYA-MS1bVTEX4gF9otoTQOHqDCCm8aZ6Ucp4PzJn51YkK1Ma__NgQlWIYXCUTY6N04skdlyzY6AkjmI_f-Fkes-5M_ppefaV_ZyTE1el6Vt9XMbB5Fz64zKxi0tkJzjb8MnVYepiOmtxyEmOkfr8fWJ2NmWuGkmxGZE5XUZCq0fgwnv0Orx3jx6k4RteEdtKPV7udS1Ed-6F4ThWHV58jxq2IiccWqAyFqXxKnQ1CX_WF5D0x5oj9chXn5ma-1t2zleikOb_wpmRXdkbaZfuqYE4GuvFq2KPJhJOi-vij8V5LrDOsZyKa_xJ2cYtDcWz-IuipDWyPIiquN6QWrNXRdtQ9M07TnBB33dP__4DE8J05g

Setup

  • Mermaid version: 10.6.1
  • Browser and Version: Edge 119.0.2151.72

Suggested Solutions

No response

Additional Context

No response

@stefanstranger stefanstranger added Status: Triage Needs to be verified, categorized, etc Type: Bug / Error Something isn't working or is incorrect labels Nov 23, 2023
@sidharthv96 sidharthv96 added Status: Approved Is ready to be worked on Internals: Renderer and removed Status: Triage Needs to be verified, categorized, etc labels Nov 24, 2023
@sidharthv96
Copy link
Member

sidharthv96 commented Nov 24, 2023

Thanks for reporting this @stefanstranger.
I've found the newly added issue and patched it. Will raise the PR once I've created a minimal reproduction and tests.
But the root cause is how the arrows between a subgraph, and its child, is handled.
Which would need a deeper inspection.

graph TB
    Out --> In
    subgraph Sub
      In
    end
    Sub --> In
Loading
graph TB
    Out --> In
    subgraph Sub
      In
    end
    Sub --> In

This is the issue, when there are links between an outside node and the subgraph to a node inside subgraph.

github-merge-queue bot pushed a commit that referenced this issue Nov 24, 2023
fix: #5064 Handle case when line has only one point
sidharthv96 added a commit to Zumbala/mermaid that referenced this issue Nov 27, 2023
* develop: (289 commits)
  chore(deps): update all minor dependencies
  chore(deps): update all patch dependencies
  fix: flowchart image without text
  fix Types
  chore: Update pnpm-lock
  chore: Add tests for calculateDeltaAndAngle
  fix: mermaid-js#5064 Handle case when line has only one point
  reset the testTimeout to 5 seconds and change it directly in the test
  update testTimeout from 5 seconds to 10 seconds
  Update all patch dependencies
  fix broken link
  add latest blog post
  Update all minor dependencies
  Update all patch dependencies
  Fix docs
  Update packages/mermaid/src/docs/community/questions-and-suggestions.md
  Update packages/mermaid/src/diagrams/class/classRenderer-v2.ts
  update edge ids
  draw top actors with lines  first followed by messages
  Bump GitHub workflow actions to latest versions
  ...
sidharthv96 added a commit to iwestlin/mermaid that referenced this issue Nov 28, 2023
* develop: (596 commits)
  chore(deps): update all minor dependencies
  chore(deps): update all patch dependencies
  fix: flowchart image without text
  fix Types
  chore: Update pnpm-lock
  chore: Add tests for calculateDeltaAndAngle
  fix: mermaid-js#5064 Handle case when line has only one point
  reset the testTimeout to 5 seconds and change it directly in the test
  update testTimeout from 5 seconds to 10 seconds
  Update all patch dependencies
  fix broken link
  add latest blog post
  Update all minor dependencies
  Update all patch dependencies
  Fix docs
  Update packages/mermaid/src/docs/community/questions-and-suggestions.md
  Update packages/mermaid/src/diagrams/class/classRenderer-v2.ts
  update edge ids
  draw top actors with lines  first followed by messages
  Bump GitHub workflow actions to latest versions
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Internals: Renderer Status: Approved Is ready to be worked on Type: Bug / Error Something isn't working or is incorrect
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants