Repository navigation
Fix leaf edges from directed subgraphs - #7993
xianjianlf2 wants to merge 2 commits into
Conversation
✅ Deploy Preview for mermaid-js ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
🦋 Changeset detectedLatest commit: a35154f The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughExplicit-direction cluster extraction now depends on internal or rebased edges, or nested children. Graphlib tests reset shared state and cover leaf cross-boundary edges in direct and nested subgraph scenarios. A patch Changesets entry records the fix. ChangesExplicit-direction cluster extraction
Estimated code review effort: 3 (Moderate) | ~20 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
@mermaid-js/examples
mermaid
@mermaid-js/layout-elk
@mermaid-js/layout-tidy-tree
@mermaid-js/mermaid-zenuml
@mermaid-js/parser
@mermaid-js/tiny
commit: |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@packages/mermaid/src/rendering-util/layout-algorithms/dagre/mermaid-graphlib.js`:
- Around line 230-240: Update shouldExtractExplicitDirCluster so
explicit-direction clusters are still extracted when their direct outgoing or
incoming cluster edges are rebased onto child nodes, including edges marked with
fromCluster or toCluster. Preserve the existing protection for disconnected
leaf-only clusters without rebased direct cluster edges, and ensure the
externalConnections fallback can process this case.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 0f6938cc-56e5-44d5-97ef-eea7926a12ce
📒 Files selected for processing (2)
packages/mermaid/src/rendering-util/layout-algorithms/dagre/mermaid-graphlib.jspackages/mermaid/src/rendering-util/layout-algorithms/dagre/mermaid-graphlib.spec.js
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #7993 +/- ##
===========================================
+ Coverage 70.53% 77.52% +6.98%
===========================================
Files 430 564 +134
Lines 37541 74931 +37390
Branches 6422 12675 +6253
===========================================
+ Hits 26481 58092 +31611
- Misses 8143 15839 +7696
+ Partials 2917 1000 -1917
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 ↗︎
|
Fixes #7954.
Explicit-direction subgraphs are extracted into recursive dagre graphs so their local direction can be honored. For subgraphs that only contain disconnected leaf nodes with edges to sibling nodes, that extraction rebases those edges onto the cluster boundary and loses the leaf-level layout constraints.
This keeps that simple leaf-edge case in the parent graph, while still extracting explicit-direction subgraphs with internal edges or nested child clusters.
Tests:
pnpm exec vitest run packages/mermaid/src/rendering-util/layout-algorithms/dagre/mermaid-graphlib.spec.jspnpm build:mermaidA/OAalign at y=98 andB/OBalign at y=202.Summary
directionclusters).explicitDirclusters are only extracted into isolated subgraphs when they contain internal edges, rebased cluster edges, or non-leaf children—otherwise leaf-level cross-boundary edges remain in the parent graph to preserve alignment.mermaid-graphlib.js(hasInternalEdge,hasRebasedClusterEdge,shouldExtractExplicitDirCluster) and integrated it into the extractor traversal.mermaid-graphlib.spec.js(including new GLB-DIR5 coverage) to ensure:clusterNodes (GLB-DIR5).A/OAandB/OBalignment.#7954.