Skip to content

Commit

Permalink
Limiting the number of edges that are allowed in the flowchart
Browse files Browse the repository at this point in the history
  • Loading branch information
knsv committed Oct 25, 2023
1 parent 3957575 commit fc28c1d
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 5 deletions.
18 changes: 14 additions & 4 deletions cypress/platform/knsv2.html
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,19 @@
</head>
<body>
<pre id="diagram" class="mermaid">
flowchart-elk LR
subgraph example
node
end
flowchart TB
C & D & E & F & G & H & I & J & K & L & M & N & O & P & Q & R & S & T & U & V & W & X & Y & Z & A1 & A2 & A3 & A4 & A5 & A6 & A7 & A8
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------->
C & D & E & F & G & H & I & J & K & L & M & N & O & P & Q & R & S & T & U & V & W & X & Y & Z & A1 & A2 & A3 & A4 & A5 & A6 & A7 & A8

</pre>
<pre id="diagram" class="mermaid2">
flowchart TB
A & A & A & A & A & A & A & A ---> C & D & E & F & G & H & I & J & K & L & M & N & O & P & Q & R & S & T & U & V & W & X & Y & Z
</pre>
<pre id="diagram" class="mermaid2">
flowchart TB
A1 & A2 & A3 & A4 & A5 & A6 & A7 & A8 --> C & D & E & F & G & H & I & J & K & L & M & N & O & P & Q & R & S & T & U & V & W & X & Y & Z
</pre>
<pre id="diagram" class="mermaid2">
flowchart
Expand Down Expand Up @@ -441,6 +450,7 @@
messageFontFamily: 'courier',
},
fontSize: 16,
logLevel: 0,
});
function callback() {
alert('It worked');
Expand Down
11 changes: 10 additions & 1 deletion packages/mermaid/src/diagrams/flowchart/flowDb.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
setDiagramTitle,
getDiagramTitle,
} from '../common/commonDb.js';
import errorDiagram from '../error/errorDiagram.js';

const MERMAID_DOM_ID_PREFIX = 'flowchart-';
let vertexCounter = 0;
Expand Down Expand Up @@ -156,7 +157,15 @@ export const addSingleLink = function (_start, _end, type) {
edge.stroke = type.stroke;
edge.length = type.length;
}
edges.push(edge);
if (edge?.length > 10) {
edge.length = 10;
}
if (edges.length < 280) {

This comment has been minimized.

Copy link
@lix0x7

lix0x7 Nov 24, 2023

why the limit is fixed to 280 and is not configurable?
I have a graph with ~500 edges and it runs well on my computer with mermaid live editor. But now it throws this error and I have to deploy a local editor with older mermaid package

log.info('abc78 pushing edge...');
edges.push(edge);
} else {
throw new Error('Too many edges');
}
};
export const addLink = function (_start, _end, type) {
log.info('addLink (abc78)', _start, _end, type);
Expand Down

0 comments on commit fc28c1d

Please sign in to comment.