-
-
Notifications
You must be signed in to change notification settings - Fork 14
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 set properties of undefined (setting 'rank') #47
Comments
For convenience, this is a code sandbox link demonstrating the issue. Start the code with |
For what its worth this also causes an issue in mermaid with the following graph flowchart
subgraph a
subgraph b
subgraph d
e
end
d --> f
end
end
subgraph b
subgraph c
end
end
|
Do you mind testing this https://github.com/tbo47/dagre-es/pull/48/files ? You can do so by following this steps:
|
There is another error
|
Do you mind testing this https://github.com/tbo47/dagre-es/pull/49/files I tried to make it work here https://jsfiddle.net/tbo47/5093quxn/ |
This almost worked, I just needed to add one more check to
|
added #49 |
I'm waiting for @aloisklink opinion and I can release a 7.0.12 if there is not regression in mermaid. |
Sorry for the delay in getting back to you! I've spent a few hours going through the dagre source-code and I'm very uncertain if #49 will fix it. It looks like
I've had a try to fix it, but I've got no idea how. I tried adding dagrejs/dagre#293 and it seems to fix it, but it breaks other tests, so 🤷 Maybe what we could do is just add an exception to make it a bit more obvious? But I'll be honest, I don't really understand the code so I wouldn't know where to put it! diff --git a/src/dagre/util.js b/src/dagre/util.js
index f526e82..9e9ee0d 100644
--- a/src/dagre/util.js
+++ b/src/dagre/util.js
@@ -60,6 +60,11 @@ function asNonCompoundGraph(g) {
}
});
_.forEach(g.edges(), function (e) {
+ [e.v, e.w].forEach(function (v) {
+ if (!simplified.hasNode(v)) {
+ throw new Error('Compound node ' + v + ' has an edge, which is not supported');
+ }
+ });
simplified.setEdge(e, g.edge(e));
});
return simplified; I think #47 (comment) sounds more like a bug in Mermaid than in this library. Mermaid seems to have it's own logic for allowing edges to group/cluster nodes (see https://github.com/mermaid-js/mermaid/blob/6b87fb34189fa0e4ce39dde505339701912f77b0/packages/mermaid/src/dagre-wrapper/mermaid-graphlib.js#L204), and I think @ted-marozzi hit an edge-case in it. |
@aloisklink thanks for taking the time to look at it. |
I am getting this bug
Here is the minimal reproduction steps
The text was updated successfully, but these errors were encountered: