fix(mindmap): correct root edge attachment in tidy-tree layout#7591
fix(mindmap): correct root edge attachment in tidy-tree layout#7591Valley-15 wants to merge 3 commits intomermaid-js:developfrom
Conversation
|
✅ Deploy Preview for mermaid-js ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
@mermaid-js/examples
mermaid
@mermaid-js/layout-elk
@mermaid-js/layout-tidy-tree
@mermaid-js/mermaid-zenuml
@mermaid-js/parser
@mermaid-js/tiny
commit: |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #7591 +/- ##
=======================================
Coverage 3.33% 3.33%
=======================================
Files 536 535 -1
Lines 56249 56240 -9
Branches 820 820
=======================================
Hits 1876 1876
+ Misses 54373 54364 -9
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
The latest updates on your projects. Learn more about Argos notifications ↗︎
|
|
Appreciate this @Valley-15 It looks much better at the right part of the diagram but there are some new visual discepencies on the left part oif the diagram instead. Looking forward to an update! (I will also let my bot do a review)- You can see them here: |
There was a problem hiding this comment.
[sisyphus-bot]
Thanks for tackling this, @Valley-15 — nice first contribution! The root cause analysis in your PR description is clear and the fix is well-targeted.
What's working well
🎉 [praise] Excellent diagnosis of the root cause. The intermediate routing points being added unconditionally for root-connected edges is exactly the problem, and skipping them when targetNode.section === 'root' or sourceNode.section === 'root' is the right fix. The symmetry of the 4 conditions (covering both source→root and root→target for both left and right sections) is clean.
🎉 [praise] Minimal, surgical change — 4 conditions added, zero collateral modifications. This is the ideal scope for a bug fix PR.
Things to address
🔴 [blocking] The issue with added artifacts in the left part of the diagram (See earlier comment).
🟡 [important] Missing e2e visual regression test. Since this is a rendering fix that changes how edges visually appear, it would be great to add a test case to cypress/integration/rendering/mindmap-tidy-tree.spec.js that reproduces the original bug (>5 children causing disconnected edges on the right side). This ensures the fix isn't accidentally regressed. Here's an example you could add:
it('5-tidy-tree: should render root edges correctly with many children', () => {
imgSnapshotTest(
` ---
config:
layout: tidy-tree
---
mindmap
root((Central Idea))
Branch1
Branch2
Branch3
Branch4
Branch5
Branch6
Branch7
`
);
});The existing test file at cypress/integration/rendering/mindmap-tidy-tree.spec.js has 4 tests you can use as reference — they all follow the imgSnapshotTest() pattern. The key is to have enough children (>5) so that nodes appear on both left and right sides, which is the scenario from issue #7572.
🟢 [nit] Consider generating a changeset for this fix: pnpm changeset, select mermaid-layout-tidy-tree, choose patch, and prefix with fix:. Your checklist notes this as optional for small fixes, and it is — but it helps users see the fix in release notes.
Security
No XSS or injection issues identified. This change modifies purely geometric edge routing calculations with no user-input handling or DOM manipulation.
Summary
| Severity | Count |
|---|---|
| 🔴 blocking | 1 |
| 🟡 important | 1 |
| 🟢 nit | 1 |
| 💡 suggestion | 0 |
| 🎉 praise | 2 |
Self-check
- At least one 🎉 praise item
- No duplicate comments
- Severity tally: 0 🔴 / 1 🟡 / 1 🟢 / 0 💡 / 2 🎉
- Verdict matches criteria: COMMENT (1 🟡, no 🔴)
- No inline comments used
- Tone check: collaborative and constructive
|
Happy you are still on this @Valley-15 !! There are some rendering issues still: https://app.argos-ci.com/mermaid/mermaid/builds/6508/291474114 You can always check the argos output after your push, no need to wait for a maintainer. This is part of our CI and will run on each push to your PR.
A red cross does not necessarily mean it is wrong; it simply means the output has changed. For your next update, you can expect it to be red, as your PR is changing the output. Click the link and see that the visual tests align with what you want to achieve! |
|
thanks @knsv sir for guidance I am working on this and will workout asap. |
|
@Valley-15 Tag us in a comment when PR is ready for re-review or the Argos build needs verification. We'll be happy to assist. |


📑 Summary
Fixes an issue where root-to-child edges in mindmap diagrams using
layout: tidy-treeappeared visually disconnected on the right side.Resolves #7572
Related to #7579
📏 Design Decisions
[startPos, endPos]) and attach correctly.📋 Tasks