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

Empty text in node has mermaid crashing #27

Open
lc-thomas opened this issue Apr 16, 2021 · 0 comments
Open

Empty text in node has mermaid crashing #27

lc-thomas opened this issue Apr 16, 2021 · 0 comments

Comments

@lc-thomas
Copy link

lc-thomas commented Apr 16, 2021

My application allows users to create nodes, links them together, edit them, etc.

But when the text of a node is empty, then mermaid crashes. So to avoid that, I edited the buildNode(item) method as such (see end of the method) :

    buildNode(item) {
      let edge = !item.edgeType
        ? this.edges.find(e => {
            return e.type === "default";
          })
        : this.edges.find(e => {
            return e.type === item.edgeType;
          });
      let text = item.text != '' ? item.text : ' - '
      return `${item.id}${edge.open}${text}${edge.close}`;
    },

Maybe it could be nice to add something like that in your library to prevent crashes ?

@lc-thomas lc-thomas changed the title Empty node text prevents the graph from showing Empty text in node has mermaid crashing Apr 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant